Skip to main content

创建 Smart Batch

创建一个关联到现有 BatchConfiguration 的 SmartBatch。你需要提供显示名称 name 以及至少一行位于 rows 中的输入数据。创建批次会将输入行持久化保存为 status: "draft" 状态,并且在执行开始前不会运行目录步骤或消耗积分。

rows 中的每一项既支持包装对象({ rowIndex?, inputData }),也支持扁平对象({ rowIndex?, ...inputFields }),校验层会自动将其标准化为 { rowIndex, inputData }。创建时请勿包含 status、results 或 errors。

接口​

POST https://api.verifik.co/v2/smart-batches

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

请求头​

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

请求体​

名称类型必填描述
batchConfigurationstring是定义工作流步骤的 BatchConfiguration ObjectId。
namestring是批次显示名称。最多 150 个字符。
executorstring否执行模式:"queue"、"featureRunner" 或 "browser"。从 batchConfiguration 派生时,会被标准化为 "queue" 或 "browser"。
sourcestring否来源产品标识:"smart_batch"(默认值)或 "smart_fleet"。
rowsobject[]是至少包含 1 行数据的数组(min 1)。接受包装格式 { rowIndex?, inputData } 或扁平格式 { rowIndex?, ...inputFields }。创建时请勿发送 status、results 或 errors。

未知键以及不允许的行属性(status、results、errors)将被 Joi 校验拒绝,并返回 409 MissingParameter。

请求示例​

import axios from "axios";

const run = async () => {
const { data } = await axios.post(
"https://api.verifik.co/v2/smart-batches",
{
batchConfiguration: "6801a2b3c4d5e6f7a8b9c0d4",
name: "Colombia Onboarding — November",
source: "smart_batch",
rows: [
{
rowIndex: 0,
inputData: {
documentType: "CC",
documentNumber: "1032386359",
},
},
{
documentType: "CC",
documentNumber: "1007463534",
},
],
},
{
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": "draft",
"executor": "browser",
"source": "smart_batch",
"headlessRun": false,
"creditsSpent": 0,
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"status": "pending",
"results": {},
"errors": [],
"creditsSpent": 0,
"attemptCount": 0,
"attempts": []
},
{
"rowIndex": 1,
"inputData": {
"documentType": "CC",
"documentNumber": "1007463534"
},
"status": "pending",
"results": {},
"errors": [],
"creditsSpent": 0,
"attemptCount": 0,
"attempts": []
}
],
"totalRows": 2,
"completedRows": 0,
"failedRows": 0,
"partialRows": 0,
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:00:00.000Z"
}
}

注意事项​

  • 创建批次时切勿在 rows 内传入 status、results 或 errors;新创建的行始终以 pending 状态开始。
  • 若省略 executor,将从 batchConfiguration.executor 解析并标准化为 "queue" 或 "browser"。
  • 创建完成后,可调用估算 Smart Batch 费用预览积分扣费,并调用启动 Smart Batch开始处理。
  • 如需批量导入 CSV、XLSX 或 JSONL 并享受依赖校验及可选的立即执行功能,请使用从文件创建 Smart Batch。

相关文档​