POST
/uploadsCreate an upload
Creates an intermediate upload that accepts parts before producing a usable file. Supply filename, purpose, bytes, and mime_type; the upload remains pending and expires after one hour by default.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
Upload creation details describing the file and its expiration policy.
filenamestringrequired
The name of the file to upload.
purposestringrequired
The intended purpose of the uploaded file.
See the [documentation on File
purposes](https://developers.openai.com/api/reference/resources/files/methods/create#%28resource%29%20files%20%3E%20%28method%29%20create%20%3E%20%28params%29%200%20%3E%20%28param%29%20purpose%20%3E%20%28schema%29).
bytesintegerrequired
The number of bytes in the file you are uploading.
mime_typestringrequired
The MIME type of the file.
This must fall within the supported MIME types for your file purpose. See
the supported MIME types for assistants and vision.
expires_afterobjectoptional
The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.
200Returns the pending upload object with its identifier, filename, intended byte count, purpose, expiration timestamp, and status.
idstringrequired
The Upload unique identifier, which can be referenced in API endpoints.
created_atintegerrequired
The Unix timestamp (in seconds) for when the Upload was created.
filenamestringrequired
The name of the file to be uploaded.
bytesintegerrequired
The intended number of bytes to be uploaded.
purposestringrequired
The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values.
statusstringrequired
The status of the Upload.
expires_atintegerrequired
The Unix timestamp (in seconds) for when the Upload will expire.
objectstringoptional
The object type, which is always "upload".
fileobjectoptional
Error handling
filename, purpose, bytes, and mime_type are required. purpose must be one of assistants, batch, fine-tune, or vision, and expires_after.anchor must be created_at with seconds between 3600 and 2592000 when the expiration policy is supplied.