Create Batch

Create a batch job from a previously uploaded JSONL input file.

Create a batch job. Returns a Batch object with status: 'validating'.

POST /v1/batches

Headers

AuthorizationBearerrequired

API key. See Authentication.

Content-Typestringrequired

Must be application/json.

Body

input_file_idstringrequired

The id of an uploaded input file with purpose: 'batch'. See Upload file.

endpointstringrequired

Must match the url used by every line in the input file, or the request is rejected with 400.

Allowed values:/v1/chat/completions/v1/responses
completion_windowstringoptionalDefault 24h

Only 24h is supported.

metadataobjectoptional

Arbitrary string key/value pairs, echoed back on every subsequent read of this batch.

Response

idstringoptional

Unique batch identifier, prefixed with avn-batch_.

object'batch'optional

Always batch.

endpointstringoptional
input_file_idstringoptional
completion_windowstringoptional
status'validating'optional

Initial status is always validating.

request_countsobjectoptional

{ total, completed, failed }.

created_atintegeroptional
expires_atinteger | nulloptional

Errors

StatusReason
400Missing/invalid field, unsupported model, or endpoint doesn't match the file's detected endpoint.
401Missing or invalid API key.
402Not enough credit, an unpaid balance, a spend limit was reached, or the batch's estimated cost is more than your balance plus the perks that cover the model. The estimate prices the input file and, for requests that set max tokens, their maximum output, at batch pricing.
404input_file_id does not exist or belongs to another workspace.
502The batch could not be submitted. Try again later.

See Errors for the error.type of each status.