重试失败的 Smart Batch 行
将 SmartBatch 上处于 "failed" 或 "partial" 状态的行重新入队执行,且不会影响已经完成的行。你可以可选地传入 rowIndexes,仅重试特定子集的行;若省略 rowIndexes,则会重试该批次中所有处于 "failed" 和 "partial" 状态的行。
如果批次当前正处于 "processing" 状态,请求将失败并返回 409 Conflict(batch_is_processing)。响应中返回 retried: 0 表示没有符合条件的失败或部分完成行匹配。
接口
POST https://api.verifik.co/v2/smart-batches/{id}/retry-failed
此接口也可通过 Smart-Agent 代理 https://ai.verifik.co/v2/smart-batches/{id}/retry-failed 访问,需使用你自己的客户专属 Authorization: Bearer <VERIFIK_JWT>。共享 x402 执行会被拒绝并返回 403 Forbidden。
请求头
| 名称 | 值 | 描述 |
|---|---|---|
Content-Type | application/json | 请求载荷格式。 |
Authorization | Bearer <VERIFIK_JWT> | 客户作用域的 JWT(authUser.clientId)。 |
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
id | string | 是 | SmartBatch ObjectId。 |
请求体
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
rowIndexes | integer[] | 否 | 要重试的从 0 开始的行索引数组(>= 0,最多 10000 项)。若省略,则重试所有 "failed" 和 "partial" 行。 |
未知请求体键将被 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-failed`,
{
rowIndexes: [2, 5],
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);
console.log(data);
};
run();
<?php
$batchId = "6801a2b3c4d5e6f7a8b9c0d3";
$payload = [
"rowIndexes" => [2, 5],
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches/" . $batchId . "/retry-failed");
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-failed"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"rowIndexes": [2, 5],
}
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{}{
"rowIndexes": []int{2, 5},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-batches/"+batchID+"/retry-failed", 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-failed" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"rowIndexes": [2, 5]
}'
响应示例
- 200 OK
- 401
- 403
- 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": 8,
"failedRows": 0,
"partialRows": 0,
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:20:00.000Z"
},
"retried": 2
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "batch_not_found",
"code": "NotFound"
}
{
"message": "batch_is_processing",
"code": "Conflict"
}
{
"message": "\"rowIndexes[0]\" must be greater than or equal to 0",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
注意事项
- 发送
{}(或省略rowIndexes)可一次性重试所有"failed"和"partial"行。 - 传入
rowIndexes时,即使索引包含处于"completed"或"pending"状态的行,这些行也会被忽略。 - 若需仅重新运行单行中的特定步骤序号同时保留其他步骤结果,请使用重试 Smart Batch 行步骤。