batch_too_large
The vat_numbers array contains more than 50 items.
HTTP 400 · Bad Request
Example response
{
"error": {
"code": "batch_too_large",
"message": "Batch size 73 exceeds the maximum of 50 items per request."
},
"meta": {
"request_id": "a1b2c3d4-...",
"latency_ms": 0
}
}What happened
POST /v1/validate/batch accepts a maximum of 50 VAT numbers per request. Sending more than 50 items in vat_numbers is rejected immediately before any validation is attempted.
How to fix
- Split your input into chunks of at most 50 items.
- Make multiple batch requests, one per chunk.
- Cache results on your side to avoid re-validating the same numbers.
// Example: chunk an array into batches of 50
const BATCH_SIZE = 50;
const chunks = [];
for (let i = 0; i < vatNumbers.length; i += BATCH_SIZE) {
chunks.push(vatNumbers.slice(i, i + BATCH_SIZE));
}
const results = await Promise.all(
chunks.map(chunk => client.validateBatch({ vat_numbers: chunk }))
);Common mistakes
- Assuming the API truncates to 50: it rejects, it doesn't truncate. The whole request fails.
- Not chunking before sending: always pre-split large arrays client-side.
- Ignoring cache hits: cache hits don't count against quota. Filtering out recently-validated numbers before batching can significantly reduce costs.
Related errors
rate_limited: batch was a valid size but quota was exhaustedplan_required: batch endpoint requires Pro or Business plan