Create Upload
Create an intermediate upload object to which you can add parts.The total number of bytes in the file you are uploading.
The name of the file to upload.
The MIME type of the file. Must match the purpose requirements.
The intended purpose of the uploaded file. Options:
assistants, batch, fine-tune, vision.Number of seconds after which the upload expires (default: 1 hour).
Add Parts
Upload file data in chunks using the parts subresource:Complete Upload
Finalize the upload by providing the ordered list of part IDs:The ID of the upload to complete.
Ordered list of part IDs to assemble into the final file.
Optional MD5 checksum for verification.
Cancel Upload
Cancel an upload before completion:The ID of the upload to cancel.
Complete Example
Best Practices
When to use multipart uploads
When to use multipart uploads
Use the Uploads API for files larger than 50 MB or when you need to:
- Upload files from multiple sources
- Resume interrupted uploads
- Verify data integrity with MD5 checksums
Optimal chunk size
Optimal chunk size
Use chunk sizes between 5 MB and 100 MB for optimal performance. Smaller chunks increase overhead; larger chunks may fail on slow connections.
Handling expiration
Handling expiration
Uploads expire after 1 hour by default. For long uploads:
- Monitor upload progress
- Implement retry logic
- Consider increasing
expires_afterif needed
Response Fields
The upload identifier.
Current status:
pending, completed, or cancelled.Total number of bytes for the upload.
The created File object (only present after completion).
Related Resources
Files API
Manage uploaded files
Fine-tuning
Use uploaded files for fine-tuning
File Uploads Guide
File upload patterns and examples
Batch API
Process batch requests