Ajouter des lignes à un Smart Batch
Ajoutez de nouvelles lignes d'entrée à un SmartBatch existant sans écraser les lignes existantes ni les résultats enregistrés. Les lignes encapsulées ({ rowIndex?, inputData }) comme les lignes plates ({ rowIndex?, ...inputFields }) sont acceptées, et le serveur attribue des index de ligne séquentiels à partir de maxExisting + 1.
L'ajout de lignes est interdit pendant que le lot est en "processing" (400 batch_append_not_allowed_while_processing). Si le lot était précédemment au statut "completed" ou "failed", l'ajout de lignes réinitialise status à "pending" et efface completedAt afin que les nouvelles lignes puissent être exécutées.
Point de terminaison
POST https://api.verifik.co/v2/smart-batches/{id}/rows/append
Ce point de terminaison est également accessible via le proxy Smart-Agent à l'adresse https://ai.verifik.co/v2/smart-batches/{id}/rows/append 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). |
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
id | string | Oui | ObjectId SmartBatch auquel ajouter des lignes. |
Corps de la requête
| Nom | Type | Requis | Description |
|---|---|---|---|
rows | object[] | Oui | Tableau non vide (min 1) de lignes d'entrée encapsulées ({ rowIndex?, inputData }) ou plates ({ rowIndex?, ...inputFields }). Le serveur attribue séquentiellement rowIndex = maxExisting + 1. |
Les clés de corps inconnues ou les tableaux rows vides sont rejetés par la validation Joi avec 409 MissingParameter.
Requête
- 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}/rows/append`,
{
rows: [
{
inputData: {
documentType: "CC",
documentNumber: "1020304050",
},
},
{
documentType: "CC",
documentNumber: "1098765432",
},
],
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);
console.log(data);
};
run();
<?php
$batchId = "6801a2b3c4d5e6f7a8b9c0d3";
$payload = [
"rows" => [
[
"inputData" => [
"documentType" => "CC",
"documentNumber" => "1020304050",
],
],
[
"documentType" => "CC",
"documentNumber" => "1098765432",
],
],
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches/" . $batchId . "/rows/append");
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}/rows/append"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"rows": [
{
"inputData": {
"documentType": "CC",
"documentNumber": "1020304050",
}
},
{
"documentType": "CC",
"documentNumber": "1098765432",
},
]
}
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{}{
"rows": []map[string]interface{}{
{
"inputData": map[string]string{
"documentType": "CC",
"documentNumber": "1020304050",
},
},
{
"documentType": "CC",
"documentNumber": "1098765432",
},
},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-batches/"+batchID+"/rows/append", 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/rows/append" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"rows": [
{
"inputData": {
"documentType": "CC",
"documentNumber": "1020304050"
}
},
{
"documentType": "CC",
"documentNumber": "1098765432"
}
]
}'
Réponse
- 200 OK
- 400
- 401
- 403
- 404
- 409
- 422
{
"data": {
"_id": "6801a2b3c4d5e6f7a8b9c0d3",
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"client": "507f1f77bcf86cd799439013",
"name": "Colombia Onboarding — November",
"status": "pending",
"executor": "browser",
"source": "smart_batch",
"headlessRun": false,
"creditsSpent": 0.04,
"rows": [
{
"rowIndex": 0,
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"status": "completed",
"results": {
"1": {
"fullName": "JANE DOE"
}
},
"errors": []
},
{
"rowIndex": 1,
"inputData": {
"documentType": "CC",
"documentNumber": "1020304050"
},
"status": "pending",
"results": {},
"errors": []
},
{
"rowIndex": 2,
"inputData": {
"documentType": "CC",
"documentNumber": "1098765432"
},
"status": "pending",
"results": {},
"errors": []
}
],
"totalRows": 3,
"completedRows": 1,
"failedRows": 0,
"partialRows": 0,
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:28:00.000Z"
}
}
{
"message": "batch_append_not_allowed_while_processing",
"code": "BadRequest"
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "batch_not_found",
"code": "NotFound"
}
{
"message": "\"rows\" must contain at least 1 items",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
Notes
- L'ajout de lignes n'exécute aucune vérification et ne consomme pas de crédits ; démarrez ensuite le lot avec Démarrer un Smart Batch.
- Tout
rowIndexfourni par le client est ignoré au profit d'une numérotation séquentielle attribuée par le serveur à partir demaxExisting + 1. - Si le lot était au statut
"completed"ou"failed", sonstatusest réinitialisé à"pending"etcompletedAtest effacé.