> ## 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.

# 실행 조회

> 실행 상태·진행·과금 조회. long-poll 지원.

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

인증: API 키 필요(`Authorization: Bearer <API Key>`).

상태, 진행, 오류 객체, 업스트림 참조, 사용량, 과금. `wait`가 0보다 크면 종료 도달 또는 wait 경과까지 연결 유지(long-poll).

본인이 시작한 실행만 읽기 가능. 다른 계정 `run_id`와 없는 `run_id`는 모두 `404`. 입력의 `sensitive` 필드는 에코에서 마스킹.

## 요청

### 경로 파라미터

<ParamField path="run_id" type="string" required>
  실행 id.
</ParamField>

### 쿼리 파라미터

<ParamField query="wait" type="number" default="0">
  long-poll 초. `0–60`. 기본 `0`은 즉시.

  범위 0\~60.
</ParamField>

### 요청 예시

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

## 응답

### 200 성공

```json theme={null}
{
  "data": {
    "run_id": "run_c62bc0fb8df2",
    "namespace": "carol",
    "app_name": "probe-b",
    "app_version": "0.1.0",
    "build_id": null,
    "run_kind": "production",
    "state": "SUCCEEDED",
    "input": {
      "product": "p-now"
    },
    "progress": {
      "done": 20,
      "total": null,
      "status_text": null
    },
    "dataset_id": "ds_0bd5345d13d0",
    "partial": false,
    "cancel_requested": false,
    "triggered_by": "api",
    "upstream_ref": null,
    "created_at": "2026-09-15T07:45:40.411993+00:00",
    "started_at": "2026-09-15T07:45:40.419610+00:00",
    "first_started_at": "2026-09-15T07:45:40.419610+00:00",
    "finished_at": "2026-09-15T07:45:40.822250+00:00",
    "usage": {
      "metrics": {
        "records_collected": 20
      },
      "duration_ms": 402
    },
    "billing": {
      "events": [
        {
          "event": "record",
          "label": "One record",
          "qty": 20.0,
          "unit_price": 0.001,
          "amount": 0.02,
          "unit_size": null,
          "raw_qty": null
        }
      ],
      "total": 0.02,
      "currency": "USD",
      "charged": true
    },
    "error": null,
    "sample_records": null,
    "warnings": []
  }
}
```

필드는 <a href="/docs/ko/datahub/api/reference/runs/start-run">실행 시작</a> 응답과 같음.

페이로드는 `data`로 감쌉니다. 필드:

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

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

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

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

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

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

<ResponseField name="state" type="enum" required>
  값: `PENDING` / `QUEUED` / `RUNNING` / `SUCCEEDED` / `PARTIALLY_SUCCEEDED` / `FAILED` / `CANCELLED` / `EXPIRED`.
</ResponseField>

<ResponseField name="input" type="object">
  —
</ResponseField>

<ResponseField name="progress" type="object">
  —

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

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

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

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

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

<ResponseField name="cancel_requested" type="boolean">
  취소 요청 후 정리 중이면 `true`(협조 중지/부분 결과 회수). 종료 시 항상 `false`(서버 정규화). `state`에서 유도 불필요.
</ResponseField>

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

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

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

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

<ResponseField name="first_started_at" type="string">
  워커가 처음 실행을 가져온 시각. `started_at`과 달리 재시도에 덮어쓰지 않아 벽시계 기준: queued = `first_started_at - created_at`, 총 벽시간 = `finished_at - first_started_at`. `started_at`으로 queued를 구하면 이전 시도를 대기로 오산. 미할당만 `null`.
</ResponseField>

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

<ResponseField name="usage" type="object">
  객관 사용량: 실행이 한 일. 과금과 분리. 평가 비교 기준.

  <Expandable title="fields">
    <ResponseField name="metrics" type="object">
      —
    </ResponseField>

    <ResponseField name="duration_ms" type="integer">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="billing" type="object">
  과금 원장 = 사용량 × 요금 × 과금 규칙.

  <Expandable title="fields">
    <ResponseField name="events" type="object[]">
      —

      <Expandable title="fields">
        <ResponseField name="event" type="string" required>
          —
        </ResponseField>

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

        <ResponseField name="qty" type="number" required>
          —
        </ResponseField>

        <ResponseField name="unit_price" type="number" required>
          —
        </ResponseField>

        <ResponseField name="amount" type="number" required>
          —
        </ResponseField>

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

        <ResponseField name="raw_qty" type="number">
          —
        </ResponseField>
      </Expandable>
    </ResponseField>

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

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

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

<ResponseField name="error" type="object">
  —

  <Expandable title="fields">
    <ResponseField name="code" type="string" required>
      —
    </ResponseField>

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

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

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

    <ResponseField name="retry_after" type="number">
      —
    </ResponseField>

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

    <ResponseField name="details" type="object[]">
      —
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="sample_records" type="object[]">
  —
</ResponseField>

<ResponseField name="warnings" type="object[]">
  —

  <Expandable title="fields">
    <ResponseField name="code" type="string" required>
      —
    </ResponseField>

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

    <ResponseField name="detail" type="object">
      —
    </ResponseField>

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

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

### 오류

| HTTP | `code`          | `category`  | 설명                  |
| ---- | --------------- | ----------- | ------------------- |
| 401  | `unauthorized`  | `forbidden` | API 키 누락 또는 무효.     |
| 404  | `run-not-found` | `not_found` | 실행 없거나 현재 계정 시작 아님. |

오류 응답은 `{"error": {code, category, message, retryable}}`입니다. <a href="/docs/ko/datahub/api/reference/introduction#errors">오류</a> 참고.

## 클라이언트 라이브러리

<CodeGroup>
  ```python Python theme={null}
  run = client.get_run("run_c62bc0fb8df2", wait=60)
  print(run["state"], run["progress"], run["billing"]["total"])
  ```

  ```js JavaScript theme={null}
  const run = await client.getRun("run_c62bc0fb8df2", { wait: 60 });
  console.log(run.state, run.progress, run.billing.total);
  ```
</CodeGroup>
