Atualizar um Smart Batch
Atualize campos de um SmartBatch existente pertencente ao cliente autenticado. Você pode atualizar name, status, executor ou substituir rows. Quando rows é fornecido, o servidor recalcula totalRows, completedRows, failedRows e partialRows e sincroniza os snapshots externos de linhas.
Use o endpoint dedicado Pausar um Smart Batch para fazer a transição de um lote para "paused". Alterar executor só tem efeito quando o lote está atualmente no status "draft", "pending" ou "cancelled".
Endpoint
PUT https://api.verifik.co/v2/smart-batches/{id}
Este endpoint também é acessível pelo proxy do Smart-Agent em https://ai.verifik.co/v2/smart-batches/{id} usando seu próprio Authorization: Bearer <VERIFIK_JWT> por cliente. A execução compartilhada via x402 é bloqueada com 403 Forbidden.
Cabeçalhos
| Nome | Valor | Descrição |
|---|---|---|
Content-Type | application/json | Formato do payload da requisição. |
Authorization | Bearer <VERIFIK_JWT> | JWT com escopo de cliente (authUser.clientId). |
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
id | string | Sim | ObjectId do SmartBatch a atualizar. |
Corpo
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
name | string | Não | Nome de exibição atualizado do lote. Máximo de 150 caracteres. |
status | string | Não | Valores permitidos: "draft", "pending", "processing", "completed", "failed" ou "cancelled". Use POST /v2/smart-batches/{id}/pause para "paused". |
executor | string | Não | Valores permitidos: "queue", "featureRunner" ou "browser". Só tem efeito quando o status atual do lote é "draft", "pending" ou "cancelled". |
rows | object[] | Não | Lista de linhas de substituição. O formato encapsulado exige rowIndex e inputData e aceita opcionalmente status, results, errors e processedAt; linhas planas são normalizadas automaticamente. |
Chaves desconhecidas no corpo são rejeitadas pela validação Joi com 409 MissingParameter.
Requisição
- Node.js
- PHP
- Python
- Go
- cURL
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();
<?php
$batchId = "6801a2b3c4d5e6f7a8b9c0d3";
$payload = [
"name" => "Colombia Onboarding — Updated",
"executor" => "queue",
"rows" => [
[
"rowIndex" => 0,
"inputData" => [
"documentType" => "CC",
"documentNumber" => "1032386359",
],
"status" => "pending",
],
],
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches/" . $batchId);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
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}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"name": "Colombia Onboarding — Updated",
"executor": "queue",
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359",
},
"status": "pending",
}
],
}
response = requests.put(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{}{
"name": "Colombia Onboarding — Updated",
"executor": "queue",
"rows": []map[string]interface{}{
{
"rowIndex": 0,
"inputData": map[string]string{
"documentType": "CC",
"documentNumber": "1032386359",
},
"status": "pending",
},
},
})
req, _ := http.NewRequest("PUT", "https://api.verifik.co/v2/smart-batches/"+batchID, 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 PUT "https://api.verifik.co/v2/smart-batches/6801a2b3c4d5e6f7a8b9c0d3" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"name": "Colombia Onboarding — Updated",
"executor": "queue",
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"status": "pending"
}
]
}'
Resposta
- 200 OK
- 401
- 403
- 404
- 409
- 422
{
"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"
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "not_found",
"code": "NotFound"
}
{
"message": "\"status\" must be one of [draft, pending, processing, completed, failed, cancelled]",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
Notas
"paused"não é aceito emPUT /v2/smart-batches/{id}; chame Pausar um Smart Batch em vez disso.- A atualização de
executoré ignorada, a menos que o lote esteja atualmente no status"draft","pending"ou"cancelled". - Para adicionar novas linhas a um lote existente sem substituir as existentes, use Adicionar linhas a um Smart Batch.