Skip to main content

更新 Smart Batch

更新由已认证客户拥有的现有 SmartBatch 字段。你可以更新 name、status、executor,或替换 rows。当请求中提供 rows 时,服务器会重新计算 totalRows、completedRows、failedRows 和 partialRows,并同步外部行快照。

若要将批次切换为 "paused" 状态,请使用专用的暂停 Smart Batch 接口。仅当批次当前处于 "draft"、"pending" 或 "cancelled" 状态时,修改 executor 才会生效。

接口​

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

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

请求头​

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

参数​

名称类型必填描述
idstring是要更新的 SmartBatch ObjectId。

请求体​

名称类型必填描述
namestring否更新后的批次显示名称。最多 150 个字符。
statusstring否允许的值:"draft"、"pending"、"processing"、"completed"、"failed" 或 "cancelled"。如需设为 "paused",请使用 POST /v2/smart-batches/{id}/pause。
executorstring否允许的值:"queue"、"featureRunner" 或 "browser"。仅当当前批次状态为 "draft"、"pending" 或 "cancelled" 时生效。
rowsobject[]否用于替换的行列表。包装格式需包含 rowIndex 和 inputData,并可选传入 status、results、errors 和 processedAt;扁平格式行会自动标准化。

未知请求体键将被 Joi 校验拒绝,并返回 409 MissingParameter。

请求示例​

import axios from "axios";

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

const { data } = await axios.put(
`https://api.verifik.co/v2/smart-batches/${batchId}`,
{
name: "Colombia Onboarding — Updated",
executor: "queue",
rows: [
{
rowIndex: 0,
inputData: {
documentType: "CC",
documentNumber: "1032386359",
},
status: "pending",
},
],
},
{
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 — Updated",
"status": "draft",
"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,
"createdAt": "2026-11-24T19:58:00.000Z",
"updatedAt": "2026-11-24T20:06:00.000Z"
}
}

注意事项​

  • PUT /v2/smart-batches/{id} 不接受 "paused" 状态;请改用暂停 Smart Batch。
  • 除非批次当前处于 "draft"、"pending" 或 "cancelled" 状态,否则对 executor 的更新将被忽略。
  • 若要在不替换现有行的前提下向现有批次追加新行,请使用向 Smart Batch 追加行。

相关文档​