Upload file

POST /files

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.

multipart/form-data

Body Required

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string Required

      The file identifier, which can be referenced in the API endpoints.

    • bytes integer Required

      The size of the file, in bytes.

    • created_at integer Required

      The Unix timestamp (in seconds) for when the file was created.

    • filename string Required

      The name of the file.

    • object string Required

      The object type, which is always file.

      Value is file.

    • purpose string Required

      The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results and vision.

      Values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, or vision.

    • status string Required Deprecated

      Deprecated. The current status of the file, which can be either uploaded, processed, or error.

      Values are uploaded, processed, or error.

    • status_details string Deprecated

      Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.

POST /files
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"
Response examples (200)
{
  "id": "string",
  "bytes": 42,
  "created_at": 42,
  "filename": "string",
  "object": "file",
  "purpose": "assistants",
  "status": "uploaded",
  "status_details": "string"
}