Batch Inference
List your batch jobs, ordered by creation time (most recent first).
GET /v1/batches HTTP/1.1
Host:
Accept: */*
{
"data": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"object": "text",
"first_id": "text",
"last_id": "text",
"has_more": true
}
Create and execute a batch job from an uploaded JSONL file.
The ID of an uploaded file that contains requests for the new batch job. Your input file must be formatted as a JSONL file and must be uploaded with purpose 'batch'.
POST /v1/batches HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 24
{
"input_file_id": "text"
}
{
"id": "text",
"object": "text",
"endpoint": "text",
"errors": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"input_file_id": "text",
"completion_window": "text",
"status": "text",
"output_file_id": "text",
"error_file_id": "text",
"created_at": 1,
"in_progress_at": 1,
"expires_at": 1,
"completed_at": 1,
"failed_at": 1,
"expired_at": 1,
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"request_counts": {
"total": 1,
"completed": 1,
"failed": 1
}
}
List your files, ordered by creation time (most recent first).
A limit on the number of objects to be returned. Limit can range between 1 and 10,000; the default is 1000.
1000
A cursor for use in pagination. 'after' is an object ID that defines your place in the list.
Sort order by the created_at timestamp of the objects. 'asc' for ascending order and 'desc' for descending order.
^(asc|desc)$
GET /v1/files HTTP/1.1
Host:
Accept: */*
{
"data": [
{
"id": "text",
"object": "text",
"bytes": 1,
"created_at": 1,
"filename": "text",
"purpose": "text"
}
],
"object": "text"
}
Upload a file that can be used with batch jobs. Accepts JSONL files.
The file object (not filename) to be uploaded. Currently, only JSONL files are supported for batch jobs.
POST /v1/files HTTP/1.1
Host:
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17
{
"file": "binary"
}
{
"id": "text",
"filename": "text",
"bytes": 1,
"created_at": "2025-08-05T03:04:46.569Z"
}
Retrieve a batch job by its ID.
The ID of the batch job to retrieve.
GET /v1/batches/{job_id} HTTP/1.1
Host:
Accept: */*
{
"id": "text",
"object": "text",
"endpoint": "text",
"errors": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"input_file_id": "text",
"completion_window": "text",
"status": "text",
"output_file_id": "text",
"error_file_id": "text",
"created_at": 1,
"in_progress_at": 1,
"expires_at": 1,
"completed_at": 1,
"failed_at": 1,
"expired_at": 1,
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"request_counts": {
"total": 1,
"completed": 1,
"failed": 1
}
}
Attempt to cancel an in-progress batch job.
The ID of the batch job to delete.
DELETE /v1/batches/{job_id} HTTP/1.1
Host:
Accept: */*
{
"message": "text"
}
Attempt to cancel an in-progress batch job.
The ID of the batch job to cancel.
POST /v1/batches/{job_id}/cancel HTTP/1.1
Host:
Accept: */*
{
"id": "text",
"object": "text",
"endpoint": "text",
"errors": [
{
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"input_file_id": "text",
"completion_window": "text",
"status": "text",
"output_file_id": "text",
"error_file_id": "text",
"created_at": 1,
"in_progress_at": 1,
"expires_at": 1,
"completed_at": 1,
"failed_at": 1,
"expired_at": 1,
"metadata": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"request_counts": {
"total": 1,
"completed": 1,
"failed": 1
}
}
Retrieve the contents of the specified file.
The ID of the file to retrieve.
GET /v1/files/{file_id}/content HTTP/1.1
Host:
Accept: */*
No content