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

# バッチの一覧取得

> 現在のユーザーのバッチをページング付きで一覧します。

`GET /api/v1/forward/batches`

現在の PAT ユーザーが作成したバッチを、作成時刻の降順で返します。

## Headers

| Header          | Required | Description    |
| --------------- | -------- | -------------- |
| `Authorization` | Yes      | `Bearer <PAT>` |

## Query parameters

| Parameter   | Type    | Required | Default | Description    |
| ----------- | ------- | -------- | ------- | -------------- |
| `status`    | string  | No       | -       | ステータスでフィルタします。 |
| `limit`     | integer | No       | 20      | ページサイズ。最大 100。 |
| `after_id`  | string  | No       | -       | 次ページへのカーソル。    |
| `before_id` | string  | No       | -       | 前ページへのカーソル。    |

## Example request

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/batches?limit=10' \
  -H "Authorization: Bearer $QODER_PAT"
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "id": "batch_completed001",
      "object": "batch",
      "status": "completed",
      "input_file_id": "file_input001",
      "output_file_id": "file_output001",
      "completion_window": "24h",
      "created_at": "2026-07-07T07:25:01Z",
      "expires_at": "2026-07-08T07:25:01Z",
      "request_counts": {
        "total": 30,
        "pending": 0,
        "running": 0,
        "completed": 30,
        "failed": 0,
        "cancelled": 0,
        "expired": 0
      },
      "usage": null
    },
    {
      "id": "batch_processing001",
      "object": "batch",
      "status": "processing",
      "input_file_id": "file_input002",
      "completion_window": "24h",
      "created_at": "2026-07-06T11:59:02Z",
      "expires_at": "2026-07-07T11:59:02Z",
      "request_counts": {
        "total": 50,
        "pending": 20,
        "running": 5,
        "completed": 25,
        "failed": 0,
        "cancelled": 0,
        "expired": 0
      },
      "usage": null
    }
  ],
  "has_more": true,
  "first_id": "batch_completed001",
  "last_id": "batch_processing001"
}
```

## Response fields

| Field      | Type    | Description      |
| ---------- | ------- | ---------------- |
| `object`   | string  | 常に `list`。       |
| `data`     | array   | 現在ページのバッチオブジェクト。 |
| `first_id` | string  | 現在ページの先頭レコード ID。 |
| `last_id`  | string  | 現在ページの末尾レコード ID。 |
| `has_more` | boolean | 追加レコードがあるかどうか。   |

## Error codes

| HTTP | Type                    | Code                      | Trigger           |
| ---- | ----------------------- | ------------------------- | ----------------- |
| 400  | `invalid_request_error` | `invalid_pagination`      | ページングパラメータが不正です。  |
| 401  | `authentication_error`  | `authentication_required` | PAT が無効または期限切れです。 |

## Notes

* `has_more=true` の場合は `last_id` を `after_id` に渡して次ページを取得します。
* `output_file_id` / `error_file_id` は終端状態到達後にのみ返されます。
* `error_message` は `failed` の場合のみ返されます。
* 現在の PAT ユーザーが作成したバッチのみ返されます。

## Related

<CardGroup cols={2}>
  <Card title="バッチを作成" icon="plus" href="/ja/cloud-agents/api/forward/batches/create" />

  <Card title="バッチを取得" icon="file-text" href="/ja/cloud-agents/api/forward/batches/get" />
</CardGroup>
