API reference

API reference · API

Upload a batch input file (OpenAI wire format)

POST/v1/filesAPI key

Multipart with purpose=batch and a JSONL file: one {custom_id, method: POST, url, body} per line, every line targeting the same url, one of /v1/chat/completions or /v1/embeddings. The file is validated whole before it is stored: not JSON, a repeated custom_id, another url, or a file over ANTIMATTER_BATCH_MAX_FILE_BYTES (4 MiB) or ANTIMATTER_BATCH_MAX_LINES (1000) is refused. The file belongs to the key's account and nobody else can read it. Where vector stores are on (ANTIMATTER_VECTOR_STORES=1), purpose assistants (or user_data) stores a document for file search instead, under its own caps (ANTIMATTER_VECTOR_MAX_FILE_BYTES, 4 MiB; ANTIMATTER_VECTOR_MAX_FILES; ANTIMATTER_VECTOR_MAX_ACCOUNT_BYTES), read when a vector store takes it.

Request body

multipart/form-data, required

Request body fields
FieldTypeWhat it is
filerequiredstring
purposerequiredstringOne of "batch", "assistants", "user_data".

Answer 200

The stored file.

Fields of the 200 answer
FieldTypeWhat it is
idstring
object"file"
bytesinteger
created_atinteger
expires_atnull
filenamestring
purposestringassistants and user_data are documents for file search (scripts/openapi-vector.ts). One of "batch", "batch_output", "assistants", "user_data".
status"processed"
status_detailsnull

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 403OpenAI shaped error.
  • 413OpenAI shaped error.
  • 429OpenAI 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