Creates an intermediate [Upload](/docs/api-reference/uploads/object) object that you can add [Parts](/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it. Once you complete the Upload, we will create a [File](/docs/api-reference/files/object) object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object. For certain `purpose` values, the correct `mime_type` must be specified. Please refer to documentation for the [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files). For guidance on the proper filename extensions for each purpose, please follow the documentation on [creating a File](/docs/api-reference/files/create).

POST /uploads
application/json

Body Required

  • filename string Required

    The name of the file to upload.

  • purpose string Required

    The intended purpose of the uploaded file.

    See the documentation on File purposes.

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

  • bytes integer Required

    The number of bytes in the file you are uploading.

  • mime_type string Required

    The MIME type of the file.

    This must fall within the supported MIME types for your file purpose. See the supported MIME types for assistants and vision.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • id string Required

      The Upload unique identifier, which can be referenced in API endpoints.

    • created_at integer Required

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

    • filename string Required

      The name of the file to be uploaded.

    • bytes integer Required

      The intended number of bytes to be uploaded.

    • purpose string Required

      The intended purpose of the file. Please refer here for acceptable values.

    • status string Required

      The status of the Upload.

      Values are pending, completed, cancelled, or expired.

    • expires_at integer Required

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

    • object string

      The object type, which is always "upload".

      Value is upload.

    • file object

      The File object represents a document that has been uploaded to OpenAI.

      Hide file attributes Show file 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 /uploads
curl \
 --request POST 'https://api.openai.com/v1/uploads' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"filename":"string","purpose":"assistants","bytes":42,"mime_type":"string"}'
Request examples
{
  "filename": "string",
  "purpose": "assistants",
  "bytes": 42,
  "mime_type": "string"
}
Response examples (200)
{
  "id": "string",
  "created_at": 42,
  "filename": "string",
  "bytes": 42,
  "purpose": "string",
  "status": "pending",
  "expires_at": 42,
  "object": "upload",
  "file": {
    "id": "string",
    "bytes": 42,
    "created_at": 42,
    "expires_at": 42,
    "filename": "string",
    "object": "file",
    "purpose": "assistants",
    "status": "uploaded",
    "status_details": "string"
  }
}