Files
OpenAI's Files API for the files of a batch: the input file you upload and the output and error files a batch writes. A file streams through the gateway into the workspace's storage location and is never held whole or logged. The content of a file follows the plan's request-data policy like a live request.
Note
Files and batches are built and not offered in production yet: every route on this page answers 404 route_not_available until they are switched on.
/v1/filesnot offeredOpenAI's Files API for batch input files. Not offered in production yet: 404 route_not_available.
/v1/filesnot offeredThe files the credential reaches, OpenAI's list. Not offered in production yet.
/v1/files/{file_id}not offeredThe File object. Not offered in production yet.
/v1/files/{file_id}/contentnot offeredThe file's bytes, streamed. Not offered in production yet.
/v1/files/{file_id}not offeredDeletes the file from storage at once. Not offered in production yet.
File object
{ "id": "file_...", "object": "file", "bytes": 120000, "created_at": 1792576800, "expires_at": 1795168800, "filename": "requests.jsonl", "purpose": "batch", "status": "processed", "status_details": null}Parts list: Routes and fields
POST /v1/filesmultipart/form-datawithfileandpurposebatch; any other purpose is a 400invalid_value. The optionalexpires_after[anchor](created_at) andexpires_after[seconds](3,600 to 2,592,000: one hour to 30 days) come together or not at all. The file is checked as it arrives: at most 200 MB (file_too_large); UTF-8 JSON Lines, one object per line, not empty, at most 50,000 lines, every line naming the same model and the sameurl, and no line naming a router (invalid_file_format, the message naming the first line at fault). Takesidempotency-key.GET /v1/filesOpenAI's list (
data,first_id,last_id,has_more) withafter,limit,orderandpurpose(batchorbatch_output).GET /v1/files/{file_id}/contentThe bytes, streamed from storage through the gateway,
application/jsonlfor an input, output or error file.DELETE /v1/files/{file_id}{"id": "file_...", "object": "file", "deleted": true}; the object is deleted from storage at once. Deleting the input file of a batch that has not ended cancels that batch.purposebatchfor an uploaded input;batch_outputfor a batch's output and error files, which HIPS writes. Once Knowledge is switched on, alsouser_datafor a knowledge base's document (assistantstaken as its alias): uploaded by afullkey or a person whose role writes, kept until it is deleted or itsexpires_afterpasses, a stored object at the storage price while kept, at most a number of such files a workspace Not decided yet (past it, 400limit_reached), and named in a knowledge base alone.expires_at30 days after
created_atby default, sooner byexpires_afteror a batch'soutput_expires_after. An expired or deleted file answers 404file_not_found.Who reads a fileA
fullkey reads every file of its workspace; aninference_onlykey and a person's token the files they created; a retrieval key only the workspace's batch output and error files.
| Status | Type | Code | Situation | Retry |
|---|---|---|---|---|
| 400 | invalid_request_error | invalid_value | A value is out of range or malformed: stop with more than 16 entries, a prompt_cache_key over 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, both max_tokens names with different values | No |
| 400 | invalid_request_error | invalid_idempotency_key, idempotency_key_reused, idempotency_in_progress | The idempotency rules | The last one, later |
| 400 | invalid_request_error | file_too_large, invalid_file_format, batch_not_offered | A batch input file over 200 MB; one that is not UTF-8 JSON Lines of objects, is empty, holds more than 50,000 lines, or names more than one model, one url or a router (the message names the first line at fault); a batch of a model sold without batch. Batches and files are not offered in production yet | No |
| 403 | permission_error | key_scope_denied | The key's kind excludes the route: a retrieval key on any route but its batch and file reads; a key other than full writing a knowledge base's documents | No |
| 404 | not_found_error | upload_not_found, file_not_found, batch_not_found | An id in the path, or input_file_id, that is unknown, deleted, expired, another workspace's, or out of the credential's reach. Batches and files are not offered in production yet | No |
| 404 | not_found_error | route_not_available | A route that is built and not offered on this gateway: uploads, files and batches in production, and POST /v1/messages/count_tokens | No |
- Status
- 400
- Type
invalid_request_error- Code
invalid_value- Situation
- A value is out of range or malformed:
stopwith more than 16 entries, aprompt_cache_keyover 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, bothmax_tokensnames with different values - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
invalid_idempotency_key,idempotency_key_reused,idempotency_in_progress- Situation
- The idempotency rules
- Retry
- The last one, later
- Status
- 400
- Type
invalid_request_error- Code
file_too_large,invalid_file_format,batch_not_offered- Situation
- A batch input file over 200 MB; one that is not UTF-8 JSON Lines of objects, is empty, holds more than 50,000 lines, or names more than one model, one
urlor a router (the message names the first line at fault); a batch of a model sold without batch. Batches and files are not offered in production yet - Retry
- No
- Status
- 403
- Type
permission_error- Code
key_scope_denied- Situation
- The key's kind excludes the route: a retrieval key on any route but its batch and file reads; a key other than
fullwriting a knowledge base's documents - Retry
- No
- Status
- 404
- Type
not_found_error- Code
upload_not_found,file_not_found,batch_not_found- Situation
- An id in the path, or
input_file_id, that is unknown, deleted, expired, another workspace's, or out of the credential's reach. Batches and files are not offered in production yet - Retry
- No
- Status
- 404
- Type
not_found_error- Code
route_not_available- Situation
- A route that is built and not offered on this gateway: uploads, files and batches in production, and
POST /v1/messages/count_tokens - Retry
- No
Related sheets
- Sheet
- 17 of 19
- Detail
- K
- Updated
- 2026-11-11