重试 Smart Batch 行步骤
仅清除并重新入队 SmartBatch 单行(rowIndex)上的指定 sequences,同时保持该行所有其他步骤的已存储输出以及所有其他行完全不变。rowIndex 和 sequences 均为必填项。
如果批次、目标行、底层 FeatureRunner 运行记录或运行项当前正在处理中,服务器将拒绝该请求并返回 409 Conflict(batch_is_processing、row_is_processing、run_is_processing、item_is_processing)。
接口
POST https://api.verifik.co/v2/smart-batches/{id}/retry-steps
此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/{id}/retry-steps 访问,需使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT>。共享 x402 执行会被拒绝并返回 403 Forbidden。
请求头
| 名称 | 值 | 描述 |
|---|---|---|
Content-Type | application/json | 请求载荷格式。 |
Authorization | Bearer <VERIFIK_JWT> | 客户作用域的 JWT(authUser.clientId)。 |
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
id | string | 是 | SmartBatch ObjectId。 |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
rowIndex | integer | 是 | 要部分重试的行在批次中从 0 开始的索引(>= 0)。 |
sequences | integer[] | 是 | 要在该行上清除并重新执行的步骤序号数组(>= 0,最少 1 项,最多 200 项)。 |
未知请求体键或缺少必填字段将被 Joi 校验拒绝,并返回 409 MissingParameter。
请求示例
- Node.js
- PHP
- Python
- Go
- cURL
import axios from "axios";
const run = async () => {
const batchId = "6801a2b3c4d5e6f7a8b9c0d3";
const { data } = await axios.post(
`https://api.verifik.co/v2/smart-batches/${batchId}/retry-steps`,
{
rowIndex: 2,
sequences: [2, 3],
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);
console.log(data);
};
run();
<?php
$batchId = "6801a2b3c4d5e6f7a8b9c0d3";
$payload = [
"rowIndex" => 2,
"sequences" => [2, 3],
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches/" . $batchId . "/retry-steps");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import os
import requests
batch_id = "6801a2b3c4d5e6f7a8b9c0d3"
url = f"https://api.verifik.co/v2/smart-batches/{batch_id}/retry-steps"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"rowIndex": 2,
"sequences": [2, 3],
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
batchID := "6801a2b3c4d5e6f7a8b9c0d3"
body, _ := json.Marshal(map[string]interface{}{
"rowIndex": 2,
"sequences": []int{2, 3},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-batches/"+batchID+"/retry-steps", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERIFIK_JWT"))
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var out map[string]interface{}
json.NewDecoder(resp.Body).Decode(&out)
fmt.Println(out)
}
curl -X POST "https://api.verifik.co/v2/smart-batches/6801a2b3c4d5e6f7a8b9c0d3/retry-steps" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"rowIndex": 2,
"sequences": [2, 3]
}'
响应示例
- 200 OK
- 400
- 401
- 403
- 404(批次不存在)
- 404(行不存在)
- 409(处理中)
- 409(MissingParameter)
- 422
{
"data": {
"batch": {
"_id": "6801a2b3c4d5e6f7a8b9c0d3",
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"client": "507f1f77bcf86cd799439013",
"name": "Colombia Onboarding — November",
"status": "processing",
"executor": "featureRunner",
"source": "smart_batch",
"headlessRun": true,
"creditsSpent": 0.4,
"totalRows": 10,
"completedRows": 9,
"failedRows": 0,
"partialRows": 0,
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:22:00.000Z"
},
"retried": 2
}
}
{
"message": "retry_steps_invalid",
"code": "BadRequest"
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "batch_not_found",
"code": "NotFound"
}
{
"message": "row_not_found",
"code": "NotFound"
}
{
"message": "batch_is_processing",
"code": "Conflict"
}
{
"message": "\"sequences\" must contain at least 1 items",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
注意事项
- 仅清除
rowIndex上指定sequences已存储的results和errors;其他所有步骤序号的结果将保持不变。 - 可能的
409 Conflict原因包括batch_is_processing、row_is_processing、run_is_processing和item_is_processing。 - 传入无效或空的步骤序号引用将返回
400 BadRequest(retry_steps_invalid)。 - 若要重试整个批次中所有失败或部分完成的行,请使用重试失败的 Smart Batch 行。