batch

Upload a batch input file

Upload a JSONL file of chat-completion requests, one BatchInputLine per line, with purpose: batch. Up to 100 MB and 50,000 lines. Files are deleted 30 days after upload unless you set expires_after, or 24 hours on zero-data-retention accounts. Returns the file id to pass as input_file_id.

post/v1/files

Response

The stored file.

idstring required

File identifier, file_ prefixed. Pass it as input_file_id when creating a batch.

objectstring required

Object type, always file.

bytesinteger required

Size of the file in bytes.

created_atinteger required

Unix timestamp (seconds) for when the file was uploaded.

expires_atinteger nullable required

Unix timestamp (seconds) for when the file and its content are deleted. Defaults to 30 days after upload (24 hours on zero-data-retention accounts).

filenamestring required

The filename you uploaded, or the generated name for batch output and error files.

purpose'batch' | 'batch_output' required

batch for files you upload; batch_output for the output and error files a batch produces.

status'uploaded' | 'processed' | 'error' required

Deprecated OpenAI field, kept for SDK compatibility. Always uploaded.

Example response

{
  "id": "file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f",
  "object": "file",
  "bytes": 48211,
  "created_at": 1780000000,
  "expires_at": 1782592000,
  "filename": "requests.jsonl",
  "purpose": "batch",
  "status": "uploaded"
}

Changes