Skip to main content
POST
/
v1
/
batches
Create Openai Batch
curl --request POST \
  --url https://api.example.com/v1/batches \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "input_file_id": "<string>",
  "endpoint": "/v1/chat/completions",
  "completion_window": "<string>",
  "metadata": {}
}
'
{
  "id": "<string>",
  "object": "<string>",
  "endpoint": "<string>",
  "input_file_id": "<string>",
  "completion_window": "<string>",
  "status": "<string>",
  "created_at": 123,
  "expires_at": 123,
  "errors": {},
  "output_file_id": "<string>",
  "error_file_id": "<string>",
  "in_progress_at": 123,
  "completed_at": 123,
  "failed_at": 123,
  "finalizing_at": 123,
  "expired_at": 123,
  "cancelled_at": 123,
  "cancelling_at": 123,
  "request_counts": {},
  "metadata": {}
}

Authorizations

Authorization
string
header
required

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

Headers

xi-api-key
string | null

Body

application/json
input_file_id
string
required

The ID of an uploaded file that contains requests for the new batch.

endpoint
enum<string>
required

The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported.

Available options:
/v1/chat/completions,
/v1/completions
completion_window
string
required

The time frame within which the batch should be processed. Currently only 24h is supported.

Allowed value: "24h"
metadata
Metadata · object
required

Optional metadata to be stored with the batch.

Response

Successful Response

id
string
required
object
string
required
endpoint
string
required
input_file_id
string
required
completion_window
string
required
status
string
required
created_at
integer
required
expires_at
integer
required
errors
Errors · object
output_file_id
string | null
error_file_id
string | null
in_progress_at
integer | null
completed_at
integer | null
failed_at
integer | null
finalizing_at
integer | null
expired_at
integer | null
cancelled_at
integer | null
cancelling_at
integer | null
request_counts
Request Counts · object
metadata
Metadata · object