> ## Documentation Index
> Fetch the complete documentation index at: https://www.octoparse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Elenca chiamate upstream (run di debug)

> Ispeziona la timeline di ogni interazione HTTP upstream in un run di debug dell’autore per il troubleshooting.

**`GET`** `https://api-datahub.octoparse.com/v1/runs/{run_id}/upstream-calls`

Autenticazione: API key obbligatoria; solo l’autore (publisher) può chiamarlo. Tutti gli altri ricevono `404`.

Timeline delle chiamate upstream per run di debug (`run_kind=test`). Per run api-type ogni interazione HTTP upstream (`submit` / `status` / `fetch`) è una entry. `summary` aggrega l’intero trail per (attempt, stage), indipendente dalla paginazione, così vedi a colpo d’occhio quale stage è bloccata. `items` porta solo metadati; body di request e response si caricano on demand dall’endpoint di dettaglio singola chiamata.

Puoi leggere solo i tuoi run di debug. I run di un altro account, i run inesistenti e i **run di produzione** restituiscono tutti `404`. I valori delle credenziali e dell'ambiente vengono oscurati in scrittura; i valori contrassegnati come `sensitive` nel contratto di input vengono oscurati di nuovo in lettura. I run di tipo codice non hanno un trail HTTP e restituiscono una lista vuota.

## Richiesta

### Parametri di percorso

<ParamField path="run_id" type="string" required>
  ID run di debug.
</ParamField>

### Parametri di query

<ParamField query="offset" type="integer" default="0">
  Offset di paginazione.

  Intervallo ≥ 0.
</ParamField>

<ParamField query="limit" type="integer" default="50">
  Dimensione pagina.

  Intervallo da 1 a 500.
</ParamField>

<ParamField query="stage" type="string">
  Filtra per una fase. `submit` invia il lavoro, `status` interroga lo stato, `fetch` recupera i dati.

  Valori: `submit` / `status` / `fetch`.
</ParamField>

### Esempio di richiesta

```bash theme={null}
curl \
  -H "Authorization: Bearer $OCTOPARSE_API_KEY" \
  "https://api-datahub.octoparse.com/v1/runs/run_c62bc0fb8df2/upstream-calls"
```

## Risposta

### 200 successo

```json theme={null}
{
  "data": {
    "run_id": "string",
    "summary": [
      {
        "attempt": 0,
        "stage": "string",
        "calls": 0,
        "last_status_code": 0,
        "last_error": "string",
        "duration_ms_sum": 0,
        "first_at": "string",
        "last_at": "string"
      }
    ],
    "items": [
      {
        "call_id": 0,
        "attempt": 0,
        "seq": 0,
        "stage": "string",
        "method": "string",
        "url": "string",
        "status_code": 0,
        "error": "string",
        "duration_ms": 0,
        "response_truncated": false,
        "created_at": "string"
      }
    ],
    "pagination": {
      "offset": 0,
      "limit": 0,
      "count": 0,
      "total": 0,
      "has_more": false
    }
  }
}
```

Il payload è wrappato in `data`. Campi:

<ResponseField name="run_id" type="string" required>
  —
</ResponseField>

<ResponseField name="summary" type="object[]" required>
  Statistiche aggregate per (tentativo, fase).

  <Expandable title="fields">
    <ResponseField name="attempt" type="integer" required>
      —
    </ResponseField>

    <ResponseField name="stage" type="string" required>
      —
    </ResponseField>

    <ResponseField name="calls" type="integer" required>
      —
    </ResponseField>

    <ResponseField name="last_status_code" type="integer">
      —
    </ResponseField>

    <ResponseField name="last_error" type="string">
      —
    </ResponseField>

    <ResponseField name="duration_ms_sum" type="integer">
      —
    </ResponseField>

    <ResponseField name="first_at" type="string">
      —
    </ResponseField>

    <ResponseField name="last_at" type="string">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="items" type="object[]" required>
  Voci di metadati delle chiamate.

  <Expandable title="fields">
    <ResponseField name="call_id" type="integer" required>
      ID della voce. Usalo per caricare il dettaglio.
    </ResponseField>

    <ResponseField name="attempt" type="integer" required>
      Numero tentativo.
    </ResponseField>

    <ResponseField name="seq" type="integer" required>
      —
    </ResponseField>

    <ResponseField name="stage" type="string" required>
      Fase.
    </ResponseField>

    <ResponseField name="method" type="string" required>
      Metodo HTTP.
    </ResponseField>

    <ResponseField name="url" type="string" required>
      URL della request (credenziali redacted).
    </ResponseField>

    <ResponseField name="status_code" type="integer">
      Codice di stato della risposta upstream.
    </ResponseField>

    <ResponseField name="error" type="string">
      —
    </ResponseField>

    <ResponseField name="duration_ms" type="integer">
      Durata in millisecondi.
    </ResponseField>

    <ResponseField name="response_truncated" type="boolean">
      —
    </ResponseField>

    <ResponseField name="created_at" type="string" required>
      —
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object" required>
  Oggetto di paginazione.

  <Expandable title="fields">
    <ResponseField name="offset" type="integer">
      —
    </ResponseField>

    <ResponseField name="limit" type="integer">
      —
    </ResponseField>

    <ResponseField name="count" type="integer">
      —
    </ResponseField>

    <ResponseField name="total" type="integer">
      —
    </ResponseField>

    <ResponseField name="has_more" type="boolean">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

### Errori

| HTTP | `code`                     | `category`  | Descrizione                                                                                                                                                                           |
| ---- | -------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 401  | `unauthorized`             | `forbidden` | API key mancante o non valida.                                                                                                                                                        |
| 404  | `upstream-calls-not-found` | `not_found` | Solo i run di debug (`run_kind=test`) conservano un trail delle chiamate upstream. I run di produzione, i run di altre persone e i run inesistenti restituiscono tutti questo errore. |

Le risposte di errore usano `{"error": {code, category, message, retryable}}`. Vedi <a href="/docs/it/datahub/api/reference/introduction#errors">Errori</a>.

## Librerie client

Gli SDK Python e JavaScript non wrappano ancora questo endpoint. Chiama REST direttamente.
