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 100 MB in size. The input also has a specific required format.
Please contact us 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.
Use "assistants" for Assistants and Message files, "vision" for Assistants image file inputs, "batch" for Batch API, and "fine-tune" for Fine-tuning.
Values are
assistants
,batch
,fine-tune
, orvision
.
curl \
-X POST https://api.openai.com/v1/files \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "file=@file" \
-F "purpose=assistants"
{
"id": "string",
"bytes": 42,
"created_at": 42,
"filename": "string",
"object": "file",
"purpose": "assistants",
"status": "uploaded",
"status_details": "string"
}