Créer un Smart Batch
Créez un SmartBatch lié à une BatchConfiguration existante. Vous fournissez un nom affiché name et au moins une ligne d'entrée dans rows. La création du lot enregistre les lignes d'entrée avec status: "draft" et n'exécute aucune étape du catalogue ni ne consomme de crédits tant que l'exécution n'a pas démarré.
Chaque entrée de rows accepte soit un objet encapsulé ({ rowIndex?, inputData }), soit un objet plat ({ rowIndex?, ...inputFields }), que la couche de validation normalise en { rowIndex, inputData }. N'incluez pas status, results ou errors lors de la création.
Point de terminaison
POST https://api.verifik.co/v2/smart-batches
Ce point de terminaison est également accessible via le proxy Smart-Agent à l'adresse https://ai.verifik.co/v2/smart-batches avec votre propre en-tête Authorization: Bearer <VERIFIK_JWT>. L'exécution partagée x402 est bloquée avec 403 Forbidden.
En-têtes
| Nom | Valeur | Description |
|---|---|---|
Content-Type | application/json | Format de la charge utile de la requête. |
Authorization | Bearer <VERIFIK_JWT> | JWT lié au client (authUser.clientId). |
Corps de la requête
| Nom | Type | Requis | Description |
|---|---|---|---|
batchConfiguration | string | Oui | ObjectId BatchConfiguration définissant les étapes du workflow. |
name | string | Oui | Nom affiché du lot. 150 caractères maximum. |
executor | string | Non | Mode d'exécution : "queue", "featureRunner" ou "browser". Lorsqu'il est dérivé de batchConfiguration, il est normalisé en "queue" ou "browser". |
source | string | Non | Identifiant du produit d'origine : "smart_batch" (par défaut) ou "smart_fleet". |
rows | object[] | Oui | Tableau d'au moins 1 ligne (min 1). Accepte le format encapsulé { rowIndex?, inputData } ou plat { rowIndex?, ...inputFields }. N'envoyez pas status, results ou errors lors de la création. |
Les clés inconnues et les propriétés de ligne interdites (status, results, errors) sont rejetées par la validation Joi avec 409 MissingParameter.
Requête
- 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"
}
]
}'
Réponse
- 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"
}
Notes
- Ne transmettez jamais
status,resultsouerrorsdansrowslors de la création d'un lot ; les lignes nouvellement créées démarrent toujours au statutpending. - Si
executorest omis, il est résolu à partir debatchConfiguration.executoret normalisé en"queue"ou"browser". - Après la création, appelez Estimer le coût d'un Smart Batch pour prévisualiser les frais en crédits et Démarrer un Smart Batch pour lancer le traitement.
- Pour les imports en masse CSV, XLSX ou JSONL avec validation des dépendances et exécution immédiate facultative, utilisez Créer un Smart Batch à partir d'un fichier.