Skip to main content

获取 Smart Batch 进度

获取 SmartBatch 的轻量级进度摘要,无需传输整个 rows 数组。响应包含行计数器(totalRows、completedRows、failedRows、partialRows、pendingRows)、执行时间戳、creditsSpent,以及(当由 FeatureRunner 运行驱动时)嵌套的 run 和账本 spend 详情。

当配置了 batchConfiguration.notification.webhookUrl 时,服务端 FeatureRunner 运行在完成后还会发送一个 smart_batch_batch_completed webhook 事件(包含 runId 和 creditsSpent)。轮询此接口不消耗积分。

接口​

GET https://api.verifik.co/v2/smart-batches/{id}/progress

此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/{id}/progress 访问,需使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT>。共享 x402 执行会被拒绝并返回 403 Forbidden。

请求头​

名称值描述
Content-Typeapplication/json请求载荷格式。
AuthorizationBearer <VERIFIK_JWT>客户作用域的 JWT(authUser.clientId)。

参数​

名称类型必填描述
idstring是要轮询进度的 SmartBatch ObjectId。

请求示例​

import axios from "axios";

const run = async () => {
const batchId = "6801a2b3c4d5e6f7a8b9c0d3";

const { data } = await axios.get(`https://api.verifik.co/v2/smart-batches/${batchId}/progress`, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});

console.log(data);
};

run();

响应示例​

{
"data": {
"batchId": "6801a2b3c4d5e6f7a8b9c0d3",
"status": "processing",
"serverSide": true,
"totalRows": 25,
"completedRows": 12,
"failedRows": 1,
"partialRows": 2,
"pendingRows": 10,
"startedAt": "2026-11-24T20:10:00.000Z",
"creditsSpent": 1.6,
"run": {
"id": "6801a2b3c4d5e6f7a8b9c0e1",
"status": "processing",
"mergeStrategy": "sequential",
"totalItems": 25,
"completedItems": 12,
"failedItems": 1,
"partialItems": 2,
"startedAt": "2026-11-24T20:10:00.500Z",
"completedAt": null
},
"spend": {
"credits": 1.6,
"calls": 28,
"billableCalls": 24
}
}
}

注意事项​

  • 当批次关联了 FeatureRunner 运行记录时,响应中会包含 run 和 spend(如果未返回引用的运行记录,则 run 为 null)。
  • 如果设置了 batchConfiguration.notification.webhookUrl,服务端 FeatureRunner 运行会在完成时触发 smart_batch_batch_completed webhook 事件(附带 runId 和 creditsSpent)。请参阅 SmartReports Webhook。
  • 批次进入终态后,请使用查询 Smart Batch查看行级 results 和 errors。

相关文档​