文件与批处理

列出 Message Batch

列出您的组织创建的 Message Batch。

GET
/v1/messages/batches

概述

返回您的组织通过此 API 创建的 Message Batch,最新的在前。列表显示 TokenLab 最近记录的各批次状态。要查看某个批次的当前状态,请单独获取它。

说明

  • limit 取值 1 到 1000,默认 20。
  • 翻页时,把列表中的批次 ID 传给 after_id(更早的批次)或 before_id(更新的批次),不要同时发送。ID 不存在或出现其他查询参数时,TokenLab 返回 400。
  • 已删除的批次不会列出。
  • 还有更多批次时 has_more 为 true。

示例

请求

cURL
curl -X GET "https://api.tokenlab.sh/v1/messages/batches?limit=20" \
  -H "x-api-key: sk-your-api-key" \
  -H "anthropic-version: 2023-06-01"

响应示例

响应

200 OK
{
  "data": [
    {
      "id": "msgbatch_01ABC123",
      "type": "message_batch",
      "processing_status": "ended",
      "request_counts": { "processing": 0, "succeeded": 2, "errored": 0, "canceled": 0, "expired": 0 },
      "ended_at": "2026-11-01T10:20:00Z",
      "created_at": "2026-11-01T10:00:00Z",
      "expires_at": "2026-11-02T10:00:00Z",
      "cancel_initiated_at": null,
      "archived_at": null,
      "results_url": "https://api.tokenlab.sh/v1/messages/batches/msgbatch_01ABC123/results"
    }
  ],
  "first_id": "msgbatch_01ABC123",
  "last_id": "msgbatch_01ABC123",
  "has_more": false
}

重要字段

dataarray
Message Batch 列表,最新的在前。
first_idstring|null
data 中第一个批次的 ID。
last_idstring|null
data 中最后一个批次的 ID。
has_moreboolean
has_more 为 true 时还有更多批次。

授权

BearerAuth
AuthorizationBearer <token>

API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。

位置: header

查询参数

before_id?string

返回此批处理 ID 之前的批处理。不能与 after_id 组合使用。

after_id?string

返回此批处理 ID 之后的批处理。不能与 before_id 组合使用。

limit?integer

返回批处理的最大数量

范围1 <= value <= 1000
默认值20

响应

application/json

application/json

application/json

application/json

application/json

application/json

application/json