Skip to main content

Create a Smart Batch from a file

Ingest a CSV, XLSX, or JSONL payload into a new SmartBatch. The server decodes raw text or base64 data URLs, enforces MAX_ROWS (20000 by default), resolves column headers and camelCase aliases against your BatchConfiguration step dependencies, and computes a credit cost estimate.

Accepted rows are saved onto the batch in pending status while malformed rows are returned in rejectedRows. Pass autoStart: true to verify account endpoint grants and begin processing immediately; otherwise no checks execute and no credits are spent.

Endpoint​

POST https://api.verifik.co/v2/smart-batches/from-file

This endpoint is also reachable through the Smart-Agent proxy at https://ai.verifik.co/v2/smart-batches/from-file using your own per-client Authorization: Bearer <VERIFIK_JWT>. Shared x402 execution is blocked with 403 Forbidden.

Headers​

NameValueDescription
Content-Typeapplication/jsonRequest payload format.
AuthorizationBearer <VERIFIK_JWT>Client-scoped JWT (authUser.clientId).

Body​

NameTypeRequiredDescription
batchConfigurationstringYesBatchConfiguration ObjectId owned by the authenticated client.
namestringYesBatch display name. Maximum 150 characters.
contentstringYesRaw CSV/JSONL text or a base64 data URL (data:<mime>;base64,<payload>).
formatstringNoInput format: "csv", "xlsx", or "jsonl". Defaults to batchConfiguration.inputFormat or "csv".
autoStartbooleanNoSet true to start the created batch immediately after ingest.

Unknown body keys are rejected by Joi validation with 409 MissingParameter.

Request​

import axios from "axios";

const run = async () => {
const { data } = await axios.post(
"https://api.verifik.co/v2/smart-batches/from-file",
{
batchConfiguration: "6801a2b3c4d5e6f7a8b9c0d4",
name: "November CSV Import",
format: "csv",
content: "Document Type,Document Number\nCC,1032386359\nCC,1007463534\n",
autoStart: false,
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);

console.log(data);
};

run();

Response​

{
"data": {
"batch": {
"_id": "6801a2b3c4d5e6f7a8b9c0d3",
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"client": "507f1f77bcf86cd799439013",
"name": "November CSV Import",
"status": "pending",
"executor": "browser",
"source": "smart_batch",
"headlessRun": false,
"creditsSpent": 0,
"rows": [
{
"rowIndex": 0,
"inputData": {
"Document Type": "CC",
"documentType": "CC",
"Document Number": "1032386359",
"documentNumber": "1032386359"
},
"status": "pending",
"results": {},
"errors": []
},
{
"rowIndex": 1,
"inputData": {
"Document Type": "CC",
"documentType": "CC",
"Document Number": "1007463534",
"documentNumber": "1007463534"
},
"status": "pending",
"results": {},
"errors": []
}
],
"totalRows": 2,
"completedRows": 0,
"failedRows": 0,
"partialRows": 0,
"createdAt": "2026-11-24T20:05:00.000Z",
"updatedAt": "2026-11-24T20:05:00.000Z"
},
"columns": [
"Document Type",
"documentType",
"Document Number",
"documentNumber"
],
"accepted": 2,
"rejected": 0,
"rejectedRows": [],
"estimate": {
"itemCount": 2,
"creditsPerItem": 0.04,
"totalCredits": 0.08,
"breakdown": [
{
"sequence": 1,
"featureCode": "co-cedula",
"price": 0.04,
"total": 0.08
}
]
}
}
}

Notes​

  • File parsing enforces MAX_ROWS (20000 default) and generates camelCase header aliases automatically so columns like Document Number resolve to documentNumber.
  • For .xlsx workbooks, pass a base64 data URL (data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,<payload>) with format: "xlsx".
  • 409 Conflict errors include batch_file_has_no_sheets, batch_file_is_empty, batch_file_has_no_rows, batch_file_has_no_usable_rows, batch_jsonl_parse_failed_on_line_<N>, batch_configuration_has_no_steps, and endpoints_not_in_account.
  • Invalid row validation (0 valid rows), unsupported format errors, and MAX_ROWS threshold errors return HTTP 500.