API reference · API
Cancel a batch
POST/v1/batches/{id}/cancelAPI key
No line starts after this; a line already running settles, and the batch ends in cancelled with what finished in its output file.
Parameters
| Field | Type | What it is |
|---|---|---|
| id (path)required | string | The batch id. |
Answer 200
The batch, normally cancelling.
| Field | Type | What it is |
|---|---|---|
| id | string | |
| object | "batch" | |
| endpoint | string | One of "/v1/chat/completions", "/v1/embeddings". |
| model | string | Present when every line names the same model. |
| errors | object or null | Why validation failed the batch: {object: list, data: [{code, message, param, line}]}. |
| input_file_id | string | |
| completion_window | "24h" | |
| status | string | One of "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled". |
| output_file_id | string or null | |
| error_file_id | string or null | |
| created_at | integer | |
| in_progress_at | integer or null | |
| expires_at | integer | |
| finalizing_at | integer or null | |
| completed_at | integer or null | |
| failed_at | integer or null | |
| expired_at | integer or null | |
| cancelling_at | integer or null | |
| cancelled_at | integer or null | |
| request_counts | object | |
| request_counts. | integer | |
| request_counts. | integer | |
| request_counts. | integer | |
| usage | object | |
| metadata | object or null |
Errors
- 404OpenAI shaped error.
- 409OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.