Skip to main content
POST
cURL
Related guide: Batches guide. See the Batches guide for the input file format, supported endpoints, and result files.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
completion_window
enum<string>
required

Time window the batch runs in. Only 24h is supported.

Available options:
24h
endpoint
enum<string>
required

Endpoint each line is sent to. The batch model must support it.

Available options:
/v1/responses,
/v1/chat/completions,
/v1/embeddings,
/v1/completions,
/v1/moderations,
/v3/router/decisions
input_file_id
string
required

ID of an uploaded JSONL file whose purpose is batch.

metadata
object

Up to 16 key/value pairs, keys up to 64 characters and values up to 512.

output_expires_after
object

Expiration applied to the output and error files.

Response

Batch created. Poll or list it until it reaches a terminal status.

completion_window
string
required

Time window the batch runs in, always 24h.

created_at
integer<int64>
required

Creation time, in Unix seconds.

endpoint
string
required

Endpoint each line of the input file is sent to.

id
string
required

Batch identifier.

input_file_id
string
required

ID of the uploaded JSONL input file.

object
string
required

Object type, always batch.

request_counts
object
required

Per-line progress counters.

status
enum<string>
required

Current batch status.

Available options:
validating,
in_progress,
finalizing,
completed,
failed,
expired,
cancelling,
cancelled
cancelled_at
integer<int64>

Time the batch finished cancelling, in Unix seconds.

cancelling_at
integer<int64>

Time cancellation was requested, in Unix seconds.

completed_at
integer<int64>

Time the batch completed, in Unix seconds.

error_file_id
string

ID of the JSONL file holding per-line errors, when any line failed.

errors
object

Errors that prevented the batch from running, when the status is failed.

expired_at
integer<int64>

Time the batch expired, in Unix seconds.

expires_at
integer<int64>

Time the batch expires, in Unix seconds.

failed_at
integer<int64>

Time the batch failed, in Unix seconds.

finalizing_at
integer<int64>

Time the batch began assembling its result files, in Unix seconds.

in_progress_at
integer<int64>

Time the batch started running, in Unix seconds.

metadata
object

Metadata supplied at creation.

model
string

Model resolved for the batch.

output_file_id
string

ID of the JSONL file holding successful responses, set once the batch completes.

usage
object

Token usage summed over the successful lines.