List batches
/v1/batchesList batches.
Compatible with OpenAI's list-batches endpoint, newest first with cursor pagination. With a virtual key, the batches that key created, each read live from the provider (limit 1 to 100); with x-provider and x-api-key, the provider account's own list (after and limit passed through).
Authenticate with a BYOK virtual key or with x-provider and x-api-key; a PLATFORM virtual key is a 400. OpenAI credentials only; any other provider is a 422. Without x-retry-count a failed call is retried up to 3 times on 429 and 5xx.
Authorization
AuthorizationBearer <slug>.<secret>A virtual key's API key (
vk-....<secret>), asAuthorization: Bearer. What the OpenAI SDK sends from itsapi_key. Used by the inference endpoints.- or
x-virtual-keyheaderA virtual key's API key in the
x-virtual-keyheader, for clients that keepAuthorizationfor something else. - or
x-api-keyheaderDirect credentials: the provider's own API key in
x-api-key, with the provider named inx-provider(for exampleopenai). On/v1/messagesa virtual key is accepted inx-api-keytoo, which is what the Claude SDK sends.
Query parameters
afterstringa batch id from a previous page: the list starts after it; omit for the first page
limitinteger<int32>how many batches to return; default 20
Headers
x-providerstringWith direct credentials: the provider
x-api-keybelongs to, for exampleopenaioranthropic(case and dashes are normalised). Not used with a virtual key.x-retry-countinteger<int32>How many times to retry a failed provider call, 0 to 5. Without the header, chat completions, Claude Messages and prompt completions do not retry, and the other endpoints retry up to 3 times. Retries back off exponentially from 1 second and honour a numeric
Retry-After. The number made is in thex-retry-countresponse header.x-retry-status-codesstringComma-separated provider status codes to retry on. Default
429,500,502,503,504,529.
Responses
objectstringAlways
list.dataobject[]The batches on this page.
Child attributes
idstringThe provider's batch id, for example
batch_....objectstringAlways
batch.endpointstringThe endpoint every request in the batch is sent to, for example
/v1/chat/completions.errorsobjectThe errors with the batch as a whole.
Child attributes
objectstringAlways
list.dataobject[]The errors.
Child attributes
codestringThe provider's error code.
messagestringA human-readable description of the error.
paramstringThe parameter the error is about. Absent when it is not about a parameter.
lineinteger<int32>The line of the input file the error is on, from 1. Absent when it is not about a line.
input_file_idstringThe provider's id of the input file.
completion_windowstringThe time the batch has to complete, for example
24h.statusenum<string>The batch's state:
validating(checking the input file),in_progress(running),finalizing(assembling the results),completed(done;output_file_idis set),failed(failed before running; seeerrors),expired(did not finish withincompletion_window),cancellingorcancelled.One of
"validating","in_progress","finalizing","completed","failed","expired","cancelling","cancelled"output_file_idstringThe provider's id of the file with the successful results. Absent until the batch has results.
error_file_idstringThe provider's id of the file with the failed requests' errors. Absent when there are none.
created_atinteger<int64>When the batch was created, as a Unix timestamp in seconds.
in_progress_atinteger<int64>When the batch started running, as a Unix timestamp in seconds. Absent until then.
expires_atinteger<int64>When the batch expires, as a Unix timestamp in seconds.
finalizing_atinteger<int64>When the batch started finalizing, as a Unix timestamp in seconds. Absent until then.
completed_atinteger<int64>When the batch completed, as a Unix timestamp in seconds. Absent until then.
failed_atinteger<int64>When the batch failed, as a Unix timestamp in seconds. Absent unless it failed.
expired_atinteger<int64>When the batch expired, as a Unix timestamp in seconds. Absent unless it expired.
cancelling_atinteger<int64>When cancellation started, as a Unix timestamp in seconds. Absent unless it was cancelled.
cancelled_atinteger<int64>When the batch was cancelled, as a Unix timestamp in seconds. Absent unless it was cancelled.
request_countsobjectHow many of the batch's requests have finished so far.
Child attributes
totalinteger<int32>Requests in the batch.
completedinteger<int32>Requests that completed successfully.
failedinteger<int32>Requests that failed.
metadatamap<string, string>The key/value pairs you attached when creating the batch. Absent when none were.
first_idstringThe id of the first batch on this page.
last_idstringThe id of the last batch on this page: pass it as
afterto get the next page.has_morebooleantruewhen there are more batches after this page.