Crear un Smart Batch
Crea un SmartBatch vinculado a una BatchConfiguration existente. Debes proporcionar un name visible y al menos una fila de entrada en rows. Crear el lote persiste las filas de entrada con status: "draft" y no ejecuta pasos del catálogo ni consume créditos hasta que inicie la ejecución.
Cada entrada en rows acepta un objeto envuelto ({ rowIndex?, inputData }) o un objeto plano ({ rowIndex?, ...inputFields }), que la capa de validación normaliza en { rowIndex, inputData }. No incluyas status, results ni errors al crear.
Endpoint
POST https://api.verifik.co/v2/smart-batches
Este endpoint también es accesible a través del proxy de Smart-Agent en https://ai.verifik.co/v2/smart-batches usando tu propio encabezado Authorization: Bearer <VERIFIK_JWT> por cliente. La ejecución compartida x402 está bloqueada con 403 Forbidden.
Encabezados
| Nombre | Valor | Descripción |
|---|---|---|
Content-Type | application/json | Formato de carga útil de la solicitud. |
Authorization | Bearer <VERIFIK_JWT> | JWT delimitado al cliente (authUser.clientId). |
Cuerpo
| Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|
batchConfiguration | string | Sí | ObjectId de BatchConfiguration que define los pasos del flujo. |
name | string | Sí | Nombre visible del lote. Máximo 150 caracteres. |
executor | string | No | Modo de ejecución: "queue", "featureRunner" o "browser". Cuando se deriva de batchConfiguration, se normaliza a "queue" o "browser". |
source | string | No | Identificador del producto de origen: "smart_batch" (predeterminado) o "smart_fleet". |
rows | object[] | Sí | Arreglo de al menos 1 fila (min 1). Acepta { rowIndex?, inputData } envuelto o { rowIndex?, ...inputFields } plano. No envíes status, results ni errors al crear. |
Las claves desconocidas y las propiedades de fila no permitidas (status, results, errors) son rechazadas por la validación Joi con 409 MissingParameter.
Solicitud
- Node.js
- PHP
- Python
- Go
- cURL
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();
<?php
$payload = [
"batchConfiguration" => "6801a2b3c4d5e6f7a8b9c0d4",
"name" => "Colombia Onboarding — November",
"source" => "smart_batch",
"rows" => [
[
"rowIndex" => 0,
"inputData" => [
"documentType" => "CC",
"documentNumber" => "1032386359",
],
],
[
"documentType" => "CC",
"documentNumber" => "1007463534",
],
],
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches");
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
url = "https://api.verifik.co/v2/smart-batches"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"name": "Colombia Onboarding — November",
"source": "smart_batch",
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359",
},
},
{
"documentType": "CC",
"documentNumber": "1007463534",
},
],
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"name": "Colombia Onboarding — November",
"source": "smart_batch",
"rows": []map[string]interface{}{
{
"rowIndex": 0,
"inputData": map[string]string{
"documentType": "CC",
"documentNumber": "1032386359",
},
},
{
"documentType": "CC",
"documentNumber": "1007463534",
},
},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-batches", 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" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"name": "Colombia Onboarding — November",
"source": "smart_batch",
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
}
},
{
"documentType": "CC",
"documentNumber": "1007463534"
}
]
}'
Respuesta
- 200 OK
- 401
- 403
- 409
- 422
{
"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"
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "\"rows[0].status\" is not allowed",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
Notas
- Nunca pases
status,resultsnierrorsdentro derowsal crear un lote; las filas recién creadas siempre comienzan en estadopending. - Si se omite
executor, se resuelve desdebatchConfiguration.executory se normaliza a"queue"o"browser". - Después de crearlo, llama a Estimar costo de Smart Batch para previsualizar los cargos de créditos y a Iniciar un Smart Batch para comenzar el procesamiento.
- Para importaciones masivas en CSV, XLSX o JSONL con validación de dependencias y ejecución inmediata opcional, usa Crear un Smart Batch desde un archivo.