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

# データセットレコード取得

> データセット内レコードをページング。

**`GET`** `https://api-datahub.octoparse.com/v1/datasets/{dataset_id}/records`

認証：APIキー必須（`Authorization: Bearer <API Key>`）。

データセット内レコードをページング。パラメータは <a href="/docs/jp/datahub/api/reference/runs/get-run-records">実行レコード取得</a>. 可視性ゲートは <a href="/docs/jp/datahub/api/reference/datasets/get-dataset">データセット詳細</a>: 不可視データセットは `404`。

## リクエスト

### パスパラメータ

<ParamField path="dataset_id" type="string" required>
  データセット id。
</ParamField>

### クエリパラメータ

<ParamField query="offset" type="integer">
  オフセット。0 始まり。
</ParamField>

<ParamField query="limit" type="integer">
  ページサイズ。
</ParamField>

<ParamField query="fields" type="string">
  カンマ区切り列プロジェクション。
</ParamField>

<ParamField query="format" type="string" default="json">
  `json` / `jsonl` / `csv`。
</ParamField>

### リクエスト例

```bash theme={null}
curl \
  -H "Authorization: Bearer $OCTOPARSE_API_KEY" \
  "https://api-datahub.octoparse.com/v1/datasets/ds_0bd5345d13d0/records?offset=0&limit=100"
```

## レスポンス

### 200 成功

`format=json` は `data` に `items` と `pagination`。`jsonl`/`csv` はエンベロープなし生テキスト。

### エラー

| HTTP | `code`              | `category`  | Description       |
| ---- | ------------------- | ----------- | ----------------- |
| 401  | `unauthorized`      | `forbidden` | API キー欠落または無効。    |
| 404  | `dataset-not-found` | `not_found` | データセットが存在しないか不可視。 |

エラー応答は `{"error": {code, category, message, retryable}}` です。<a href="/docs/jp/datahub/api/reference/introduction#errors">エラー</a> を参照。

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

<CodeGroup>
  ```python Python theme={null}
  for record in client.iterate_dataset_records("ds_0bd5345d13d0"):
      print(record)
  ```

  ```js JavaScript theme={null}
  for await (const record of client.iterateDatasetRecords("ds_0bd5345d13d0")) {
    console.log(record);
  }
  ```
</CodeGroup>
