Skip to main content

启动 Smart Batch

启动现有 SmartBatch 的执行。批次当前必须处于 "draft"、"pending" 或 "cancelled" 状态;其他任何状态都将失败并返回 400 BadRequest(batch_not_in_startable_state)。

启动前,服务器会校验关联的 BatchConfiguration 中每个已启用的步骤是否均已授权给你的客户账户(若缺少任何功能,将返回 409 endpoints_not_in_account),随后设置 status: "processing" 和 startedAt,并返回更新后的 SmartBatch。

接口​

POST https://api.verifik.co/v2/smart-batches/{id}/start

此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/{id}/start 访问,需使用你自己的客户专属 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.post(
`https://api.verifik.co/v2/smart-batches/${batchId}/start`,
{},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);

console.log(data);
};

run();

响应示例​

{
"data": {
"_id": "6801a2b3c4d5e6f7a8b9c0d3",
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"client": "507f1f77bcf86cd799439013",
"name": "Colombia Onboarding — November",
"status": "processing",
"executor": "queue",
"source": "smart_batch",
"headlessRun": false,
"creditsSpent": 0,
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"status": "pending",
"results": {},
"errors": []
}
],
"totalRows": 1,
"completedRows": 0,
"failedRows": 0,
"partialRows": 0,
"startedAt": "2026-11-24T20:10:00.000Z",
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:10:00.000Z"
}
}

注意事项​

  • 只有处于 "draft"、"pending" 或 "cancelled" 状态的批次才能启动;已暂停的批次必须使用恢复 Smart Batch。
  • 重新启动 "cancelled" 状态的批次会清除 completedAt,并将所有 "processing" 状态的行重置为 "pending"。
  • 建议事先通过估算 Smart Batch 费用核对预计积分扣费,并通过获取 Smart Batch 进度监控执行状态。

相关文档​