ファイルから Smart Batch を作成する
CSV、XLSX、または JSONL ペイロードを新しい SmartBatch に取り込みます。サーバーは生テキストまたは Base64 データ URL をデコードし、MAX_ROWS(既定は 20000)を適用し、BatchConfiguration のステップ依存関係に対して列ヘッダーおよびキャメルケースエイリアスを解決した上で、クレジットコスト見積もりを算出します。
受理された行は pending ステータスでバッチに保存され、不正な行は rejectedRows で返されます。アカウントのエンドポイント権限を検証してすぐに処理を開始するには autoStart: true を渡してください。それ以外の場合はチェックは実行されず、クレジットも消費されません。
エンドポイント
POST https://api.verifik.co/v2/smart-batches/from-file
このエンドポイントは、クライアント単位の Authorization: Bearer <VERIFIK_JWT> を使用することで Smart-Agent プロキシ(https://ai.verifik.co/v2/smart-batches/from-file)経由でもアクセスできます。共有 x402 実行は 403 Forbidden でブロックされます。
ヘッダー
| 名前 | 値 | 説明 |
|---|---|---|
Content-Type | application/json | リクエストペイロード形式。 |
Authorization | Bearer <VERIFIK_JWT> | クライアントスコープの JWT(authUser.clientId)。 |
リクエストボディ
| 名前 | 型 | 必須 | 説明 |
|---|---|---|---|
batchConfiguration | string | はい | 認証済みクライアントが所有する BatchConfiguration の ObjectId。 |
name | string | はい | バッチの表示名。最大 150 文字。 |
content | string | はい | 生の CSV/JSONL テキスト、または Base64 データ URL(data:<mime>;base64,<payload>)。 |
format | string | いいえ | 入力形式: "csv"、"xlsx"、または "jsonl"。既定値は batchConfiguration.inputFormat または "csv"。 |
autoStart | boolean | いいえ | 取り込み後に作成されたバッチを即座に開始する場合は true を指定します。 |
不明なボディキーは Joi バリデーションにより 409 MissingParameter で拒否されます。
リクエスト
- 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/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();
<?php
$payload = [
"batchConfiguration" => "6801a2b3c4d5e6f7a8b9c0d4",
"name" => "November CSV Import",
"format" => "csv",
"content" => "Document Type,Document Number\nCC,1032386359\nCC,1007463534\n",
"autoStart" => false,
];
$ch = curl_init("https://api.verifik.co/v2/smart-batches/from-file");
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/from-file"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"name": "November CSV Import",
"format": "csv",
"content": "Document Type,Document Number\nCC,1032386359\nCC,1007463534\n",
"autoStart": False,
}
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": "November CSV Import",
"format": "csv",
"content": "Document Type,Document Number\nCC,1032386359\nCC,1007463534\n",
"autoStart": false,
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-batches/from-file", 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/from-file" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"batchConfiguration": "6801a2b3c4d5e6f7a8b9c0d4",
"name": "November CSV Import",
"format": "csv",
"content": "Document Type,Document Number\nCC,1032386359\nCC,1007463534\n",
"autoStart": false
}'
レスポンス
- 200 OK
- 401
- 403
- 404
- 409 (取り込み / 設定)
- 409 (MissingParameter)
- 422
- 500 (上限 / 形式エラー)
{
"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
}
]
}
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "batch_configuration_not_found",
"code": "NotFound"
}
{
"message": "batch_file_is_empty",
"code": "Conflict"
}
{
"message": "\"content\" is required",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
{
"message": "409:batch_file_exceeds_max_rows:20000",
"code": "InternalServerError"
}
補足
- ファイル解析では
MAX_ROWS(既定20000)が適用され、Document Numberのような列がdocumentNumberに解決されるようキャメルケースのヘッダーエイリアスが自動生成されます。 .xlsxワークブックの場合は、format: "xlsx"とともに Base64 データ URL(data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,<payload>)を渡してください。409 Conflictエラーには、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、およびendpoints_not_in_accountが含まれます。- 無効な行バリデーション(有効行が
0件)、未対応の形式エラー、およびMAX_ROWS上限エラーは HTTP500を返します。