文件与批处理
获取 Message Batch
获取 Message Batch 的状态和请求数量。
概述
返回您的组织创建的某个 Message Batch 的状态、请求数量和时间戳。请轮询该接口,直到 processing_status 变为 ended,再获取结果。
说明
processing_status为in_progress、canceling或ended。- 批次结束前,
results_url为null。 - 批次不存在或已删除时返回
404。批次尚未就绪时可能返回409,请稍后重试。
请求
curl -X GET "https://api.tokenlab.sh/v1/messages/batches/msgbatch_01ABC123" \
-H "x-api-key: sk-your-api-key" \
-H "anthropic-version: 2023-06-01"响应
{
"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"
}重要字段
processing_statusstring
in_progress、canceling 或 ended。request_countsobject
处于
processing、succeeded、errored、canceled 或 expired 状态的请求数量。ended_atstring|null
处理结束的时间,未结束时为
null。cancel_initiated_atstring|null
取消请求被受理的时间,没有则为
null。results_urlstring|null
结果的 URL,没有则为
null。授权
BearerAuth AuthorizationBearer <token>
API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。
位置: header
路径参数
message_batch_id*string
消息批处理标识符
响应
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json