> ## 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` フィールドはエコーで伏字。

## リクエスト

### パスパラメータ

**run\_id** `string` *required*

実行 id。

### クエリパラメータ

**wait** `number` (default: 0)

long-poll 秒。`0–60`。既定 `0` は即時。

範囲 0〜60。

### リクエスト例

```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": []
  }
}
```

フィールドは [実行を開始](https://www.octoparse.com/docs/jp/datahub/api/reference/runs/start-run.md) の応答と同じ。

ペイロードは `data` に包まれます。フィールド:

**run\_id** `string` *required*

—

**namespace** `string`

—

**app\_name** `string`

—

**app\_version** `string`

—

**build\_id** `string`

—

**run\_kind** `string`

—

**state** `enum` *required*

値: `PENDING` / `QUEUED` / `RUNNING` / `SUCCEEDED` / `PARTIALLY_SUCCEEDED` / `FAILED` / `CANCELLED` / `EXPIRED`。

**input** `object`

—

**progress** `object`

—

**fields**

**done** `integer`

—

**total** `integer`

—

**status\_text** `string`

—

**dataset\_id** `string`

—

**partial** `boolean`

—

**cancel\_requested** `boolean`

取消要求済みで収束中なら `true`（協調停止／部分結果回収）。終端では常に `false`（サーバ正規化）。`state` から導出不要。

**triggered\_by** `string`

—

**upstream\_ref** `string`

—

**created\_at** `string`

—

**started\_at** `string`

—

**first\_started\_at** `string`

ワーカーが初めて実行を引き受けた時刻。`started_at` と違いリトライで上書きされないため壁時計の基準: queued = `first_started_at - created_at`、総壁時間 = `finished_at - first_started_at`。`started_at` から queued を取ると以前の試行を待ちと誤算。未割当のみ `null`。

**finished\_at** `string`

—

**usage** `object`

客観使用量: 実行が何をしたか。課金と分離。評価比較の基準。

**fields**

**metrics** `object`

—

**duration\_ms** `integer`

—

**billing** `object`

課金台帳 = 使用量 × 料金 × 課金ルール。

**fields**

**events** `object[]`

—

**fields**

**event** `string` *required*

—

**label** `string`

—

**qty** `number` *required*

—

**unit\_price** `number` *required*

—

**amount** `number` *required*

—

**unit\_size** `integer`

—

**raw\_qty** `number`

—

**total** `number`

—

**currency** `string`

—

**charged** `boolean`

—

**error** `object`

—

**fields**

**code** `string` *required*

—

**category** `string`

—

**message** `string` *required*

—

**retryable** `boolean`

—

**retry\_after** `number`

—

**item\_index** `integer`

—

**details** `object[]`

—

**sample\_records** `object[]`

—

**warnings** `object[]`

—

**fields**

**code** `string` *required*

—

**event** `string`

—

**detail** `object`

—

**count** `integer`

—

**updated\_at** `string`

—

### エラー

| HTTP | `code` | `category` | 説明 |
| - | - | - | - |
| 401 | `unauthorized` | `forbidden` | API キー欠落または無効。 |
| 404 | `run-not-found` | `not_found` | 実行が存在しないか、現在のアカウント開始ではない。 |

エラー応答は `{"error": {code, category, message, retryable}}` です。[エラー](https://www.octoparse.com/docs/jp/datahub/api/reference/introduction.md#errors) を参照。

## クライアントライブラリ

```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);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.