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

# 列出 Batches

> 分页列出当前用户的 Batch 列表。

`GET /api/v1/forward/batches`

返回当前 PAT 用户创建的 Batch 列表，按创建时间倒序排列。

## 请求头

| Header        | 是否必填 | 说明             |
| ------------- | ---- | -------------- |
| Authorization | 是    | `Bearer <PAT>` |

## 查询参数

| 参数         | 类型      | 是否必填 | 默认值 | 说明           |
| ---------- | ------- | ---- | --- | ------------ |
| status     | string  | 否    | -   | 按状态过滤。       |
| limit      | integer | 否    | 20  | 分页大小，最大 100。 |
| after\_id  | string  | 否    | -   | 向后翻页游标。      |
| before\_id | string  | 否    | -   | 向前翻页游标。      |

## 示例请求

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

## 示例响应

**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"
}
```

## 响应字段

| 字段        | 类型      | 说明             |
| --------- | ------- | -------------- |
| object    | string  | 固定为 `list`。    |
| data      | array   | 当前页的 Batch 对象。 |
| first\_id | string  | 当前页第一条记录 ID。   |
| last\_id  | string  | 当前页最后一条记录 ID。  |
| has\_more | boolean | 是否还有更多记录。      |

## 错误码

| HTTP | Type                    | Code                      | 触发条件        |
| ---- | ----------------------- | ------------------------- | ----------- |
| 400  | `invalid_request_error` | `invalid_pagination`      | 分页参数不合法。    |
| 401  | `authentication_error`  | `authentication_required` | PAT 无效或已过期。 |

## 注意事项

* `has_more=true` 时用 `last_id` 作为 `after_id` 继续翻页。
* `output_file_id` / `error_file_id` 在终态生成后才出现。
* `error_message` 仅 `failed` 状态出现。
* 只返回当前 PAT 用户创建的 Batch。

## 相关

<CardGroup cols={2}>
  <Card title="创建 Batch" icon="plus" href="/zh/cloud-agents/api/forward/batches/create" />

  <Card title="查询 Batch 详情" icon="file-text" href="/zh/cloud-agents/api/forward/batches/get" />
</CardGroup>
