Completes the [Upload](/docs/api-reference/uploads/object). Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform. You can specify the order of the Parts by passing in an ordered list of the Part IDs. The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.

POST /uploads/{upload_id}/complete

Path parameters

  • upload_id string Required

    The ID of the Upload.

application/json

Body Required

  • part_ids array[string] Required

    The ordered list of Part IDs.

  • md5 string

    The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.

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/{upload_id}/complete
curl \
 --request POST 'https://api.openai.com/v1/uploads/upload_abc123/complete' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"part_ids":["string"],"md5":"string"}'
Request examples
{
  "part_ids": [
    "string"
  ],
  "md5": "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"
  }
}