文件与批处理

获取批处理任务

获取批处理任务的状态、请求数量和结果文件。

GET
/v1/batches/{batch_id}

返回批处理任务的状态、成功和失败数量,以及任务结束后的结果文件 ID。

示例

请求

cURL
curl -X GET "https://api.tokenlab.sh/v1/batches/batch_abc123" \
  -H "Authorization: Bearer sk-your-api-key"

响应示例

响应

200 OK
{
  "id": "batch_abc123",
  "object": "batch",
  "status": "completed",
  "input_file_id": "file_abc123",
  "output_file_id": "file_out123",
  "error_file_id": "file_err123",
  "request_counts": { "total": 100, "completed": 98, "failed": 2 }
}

重要字段

request_countsobject
总请求数、成功数、失败数和取消数。
output_file_idstring|null
成功结果文件 ID。
error_file_idstring|null
失败结果文件 ID。

授权

BearerAuth
AuthorizationBearer <token>

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

位置: header

路径参数

batch_id*string

响应

application/json

application/json