API reference

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

Path and query parameters
FieldTypeWhat it is
id (path)requiredstringThe batch id.

Answer 200

The batch, normally cancelling.

Fields of the 200 answer
FieldTypeWhat it is
idstring
object"batch"
endpointstringOne of "/v1/chat/completions", "/v1/embeddings".
modelstringPresent when every line names the same model.
errorsobject or nullWhy validation failed the batch: {object: list, data: [{code, message, param, line}]}.
input_file_idstring
completion_window"24h"
statusstringOne of "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled".
output_file_idstring or null
error_file_idstring or null
created_atinteger
in_progress_atinteger or null
expires_atinteger
finalizing_atinteger or null
completed_atinteger or null
failed_atinteger or null
expired_atinteger or null
cancelling_atinteger or null
cancelled_atinteger or null
request_countsobject
request_counts.totalinteger
request_counts.completedinteger
request_counts.failedinteger
usageobject
metadataobject 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.

Antimatter