Upload a file
Stream a file with content-based type detection, up to 100 MB.
/file/v1/files◐ PartialRequest body
filestring必填File bytes in one multipart file part, not a filename or file ID. The file must be nonempty and at most 104857600 bytes; its content determines the MIME type.
purposestring必填Purpose label stored with the file: user_data, assistants or vision. The vision purpose accepts only PNG, JPEG, GIF and WebP images. Conversation image references require user_data.
expires_afterobject可选Optional expiry relative to created_at. Files without an expiry persist until deleted.
▸ 展开子字段(2)
anchorstring必填Creation timestamp from which expiry is measured. Send created_at as the multipart field expires_after[anchor].
secondsinteger必填Lifetime in seconds after creation, from 3600 through 2592000. Send as expires_after[seconds]; do not combine with praxis[expires_in_seconds].
praxisobject可选Own-face extensions. Use at most one expiry setting.
▸ 展开子字段(1)
expires_in_secondsinteger可选Lifetime in seconds after creation, from 3600 through 7776000. Send as the multipart field praxis[expires_in_seconds]; mutually exclusive with expires_after.
Returns
200 file
Supports PDF; DOCX / XLSX / PPTX; PNG / JPEG / GIF / WebP; MP3 / WAV / FLAC / OGG / M4A; MP4 / WebM; UTF-8 JSON / NDJSON / CSV / Markdown / plain text. Purposes are user_data / assistants / vision. Limit 104857600 bytes. Empty, unsupported, invalid-purpose and oversized uploads return 400. No Uploads chunking. Set expiry with expires_after[anchor] and expires_after[seconds], or with praxis[expires_in_seconds]; the two settings are mutually exclusive.
Errors follow the OpenAI format — see error codes
Response
HTTP 200
OK
application/json
| Name | Type | Description |
|---|---|---|
| id | string | File identifier: file_dp_ followed by a 26-character uppercase Crockford ULID. Use the ID returned by upload or list. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | Upload purpose. Image references in conversations require user_data. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | null | Deprecated; always null or absent. |
| mime_type | string | Content-detected MIME type. |
| downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| scope | object | Present for session output files. |
| scope.type | string | Kind of scope; always `session`. |
| scope.id | string | Id of the session the file belongs to. |
| relative_path | string | Path within the session output directory; present for session outputs. |
| revision | integer | Session output revision; present for session outputs. |