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](/docs/assistants/tools) for details. The Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) models. The Batch API only supports `.jsonl` files up to 200 MB in size. The input also has a specific required [format](/docs/api-reference/batch/request-input). Please [contact us](https://help.openai.com/) if you need to increase these storage limits.
Body
Required
-
The File object (not file name) to be uploaded.
-
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 setsValues are
assistants
,batch
,fine-tune
,vision
,user_data
, orevals
.
POST
/files
curl \
--request POST 'https://api.openai.com/v1/files' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: multipart/form-data" \
--form "file=@file" \
--form "purpose=assistants"
Response examples (200)
{
"id": "string",
"bytes": 42,
"created_at": 42,
"expires_at": 42,
"filename": "string",
"object": "file",
"purpose": "assistants",
"status": "uploaded",
"status_details": "string"
}