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.

POST /files
multipart/form-data

Body Required

  • file string(binary) 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 sets

    Values are assistants, batch, fine-tune, vision, user_data, or evals.

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.

    • expires_at integer

      The Unix timestamp (in seconds) for when the file will expire.

    • 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 \
 --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"
}