Upload file
Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.
The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.
The Fine-tuning API only supports .jsonl
files. The input also has certain required formats for fine-tuning chat or completions models.
The Batch API only supports .jsonl
files up to 200 MB in size. The input also has a specific required format.
Please contact us if you need to increase these storage limits.
Request body
file
string
Required
The File object (not file name) to be uploaded.purpose
string
Required
The intended purpose of the uploaded file. One of: -
assistants
: Used in the Assistants API -batch
: Used in the Batch API -fine-tune
: Used for fine-tuning -vision
: Images used for vision fine-tuning -user_data
: Flexible file type for any purpose -evals
: Used for eval data setsassistants
string
batch
string
fine-tune
string
vision
string
user_data
string
evals
string
Response
The uploaded File object.
1 curl https://api.openai.com/v1/files \2 -H "Authorization: Bearer $OPENAI_API_KEY" \3 -F purpose="fine-tune" \4 -F file="@mydata.jsonl"
1 {2 "id": "file-abc123",3 "object": "file",4 "bytes": 120000,5 "created_at": 1677610602,6 "filename": "mydata.jsonl",7 "purpose": "fine-tune",8 }