> ## Documentation Index
> Fetch the complete documentation index at: https://openai-hd4n6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete an upload

> 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.




## OpenAPI

````yaml api-definition.yaml post /uploads/{upload_id}/complete
openapi: 3.0.0
info:
  title: OpenAI API
  description: >-
    The OpenAI REST API. Please see
    https://platform.openai.com/docs/api-reference for more details.
  version: 2.3.0
  termsOfService: https://openai.com/policies/terms-of-use
  contact:
    name: OpenAI Support
    url: https://help.openai.com/
  license:
    name: MIT
    url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
  - url: https://api.openai.com/v1
security:
  - ApiKeyAuth: []
tags:
  - name: Assistants
    description: Build Assistants that can call models and use tools.
  - name: Audio
    description: Turn audio into text or text into audio.
  - name: Chat
    description: >-
      Given a list of messages comprising a conversation, the model will return
      a response.
  - name: Completions
    description: >-
      Given a prompt, the model will return one or more predicted completions,
      and can also return the probabilities of alternative tokens at each
      position.
  - name: Embeddings
    description: >-
      Get a vector representation of a given input that can be easily consumed
      by machine learning models and algorithms.
  - name: Evals
    description: Manage and run evals in the OpenAI platform.
  - name: Fine-tuning
    description: Manage fine-tuning jobs to tailor a model to your specific training data.
  - name: Batch
    description: Create large batches of API requests to run asynchronously.
  - name: Files
    description: >-
      Files are used to upload documents that can be used with features like
      Assistants and Fine-tuning.
  - name: Uploads
    description: Use Uploads to upload large files in multiple parts.
  - name: Images
    description: Given a prompt and/or an input image, the model will generate a new image.
  - name: Models
    description: List and describe the various models available in the API.
  - name: Moderations
    description: >-
      Given text and/or image inputs, classifies if those inputs are potentially
      harmful.
  - name: Audit Logs
    description: List user actions and configuration changes within this organization.
paths:
  /uploads/{upload_id}/complete:
    post:
      tags:
        - Uploads
      summary: Complete an upload
      description: >
        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.
      operationId: completeUpload
      parameters:
        - in: path
          name: upload_id
          required: true
          schema:
            type: string
            example: upload_abc123
          description: |
            The ID of the Upload.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteUploadRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Upload'
components:
  schemas:
    CompleteUploadRequest:
      type: object
      additionalProperties: false
      properties:
        part_ids:
          type: array
          description: |
            The ordered list of Part IDs.
          items:
            type: string
        md5:
          description: >
            The optional md5 checksum for the file contents to verify if the
            bytes uploaded matches what you expect.
          type: string
      required:
        - part_ids
    Upload:
      type: object
      title: Upload
      description: |
        The Upload object can accept byte chunks in the form of Parts.
      properties:
        id:
          type: string
          description: >-
            The Upload unique identifier, which can be referenced in API
            endpoints.
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the Upload was created.
        filename:
          type: string
          description: The name of the file to be uploaded.
        bytes:
          type: integer
          description: The intended number of bytes to be uploaded.
        purpose:
          type: string
          description: >-
            The intended purpose of the file. [Please refer
            here](/docs/api-reference/files/object#files/object-purpose) for
            acceptable values.
        status:
          type: string
          description: The status of the Upload.
          enum:
            - pending
            - completed
            - cancelled
            - expired
        expires_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the Upload will expire.
        object:
          type: string
          description: The object type, which is always "upload".
          enum:
            - upload
          x-stainless-const: true
        file:
          allOf:
            - $ref: '#/components/schemas/OpenAIFile'
            - nullable: true
              description: The ready File object after the Upload is completed.
      required:
        - bytes
        - created_at
        - expires_at
        - filename
        - id
        - purpose
        - status
      x-oaiMeta:
        name: The upload object
        example: |
          {
            "id": "upload_abc123",
            "object": "upload",
            "bytes": 2147483648,
            "created_at": 1719184911,
            "filename": "training_examples.jsonl",
            "purpose": "fine-tune",
            "status": "completed",
            "expires_at": 1719127296,
            "file": {
              "id": "file-xyz321",
              "object": "file",
              "bytes": 2147483648,
              "created_at": 1719186911,
              "filename": "training_examples.jsonl",
              "purpose": "fine-tune",
            }
          }
    OpenAIFile:
      title: OpenAIFile
      description: >-
        The `File` object represents a document that has been uploaded to
        OpenAI.
      properties:
        id:
          type: string
          description: The file identifier, which can be referenced in the API endpoints.
        bytes:
          type: integer
          description: The size of the file, in bytes.
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the file was created.
        expires_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the file will expire.
        filename:
          type: string
          description: The name of the file.
        object:
          type: string
          description: The object type, which is always `file`.
          enum:
            - file
          x-stainless-const: true
        purpose:
          type: string
          description: >-
            The intended purpose of the file. Supported values are `assistants`,
            `assistants_output`, `batch`, `batch_output`, `fine-tune`,
            `fine-tune-results` and `vision`.
          enum:
            - assistants
            - assistants_output
            - batch
            - batch_output
            - fine-tune
            - fine-tune-results
            - vision
        status:
          type: string
          deprecated: true
          description: >-
            Deprecated. The current status of the file, which can be either
            `uploaded`, `processed`, or `error`.
          enum:
            - uploaded
            - processed
            - error
        status_details:
          type: string
          deprecated: true
          description: >-
            Deprecated. For details on why a fine-tuning training file failed
            validation, see the `error` field on `fine_tuning.job`.
      required:
        - id
        - object
        - bytes
        - created_at
        - filename
        - purpose
        - status
      x-oaiMeta:
        name: The file object
        example: |
          {
            "id": "file-abc123",
            "object": "file",
            "bytes": 120000,
            "created_at": 1677610602,
            "expires_at": 1680202602,
            "filename": "salesOverview.pdf",
            "purpose": "assistants",
          }
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````