> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datalinks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Finish file upload

> Finish a single file upload



## OpenAPI

````yaml /api-reference/openapi.yml post /file-upload/{sessionId}/files/{fileId}/finish
openapi: 3.0.3
info:
  title: DataLinks
  version: 2.2.3
servers:
  - url: https://api.datalinks.com/api/v1
    description: production server
security:
  - bearerAuth: []
  - openId:
      - implicit
paths:
  /file-upload/{sessionId}/files/{fileId}/finish:
    post:
      tags:
        - fileUpload
      summary: Finish file upload
      description: Finish a single file upload
      operationId: finishFileUpload
      parameters:
        - name: sessionId
          in: path
          description: The unique identifier of the file upload session.
          required: true
          schema:
            $ref: '#/components/schemas/UploadSessionId'
        - name: fileId
          in: path
          description: The unique identifier of the file.
          required: true
          schema:
            $ref: '#/components/schemas/UploadFileId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FinishFileUploadRequest'
        required: true
      responses:
        '200':
          description: Returns the session status and finished file status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinishFileUploadResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableContent'
components:
  schemas:
    UploadSessionId:
      type: string
      description: Unique identifier for the upload session.
      format: uuid
      example: 24b49ba0-6b5c-4950-94c1-1622939cc481
    UploadFileId:
      type: string
      description: Unique identifier for a file
      format: uuid
      example: 311fe2cb-1c85-46a4-a8d9-f63a88da44fd
    FinishFileUploadRequest:
      required:
        - key
        - parts
        - uploadId
      type: object
      properties:
        uploadId:
          type: string
        key:
          type: string
        parts:
          type: array
          items:
            $ref: '#/components/schemas/FinishFileUploadRequestParts'
      description: A request contaning list of pairs of file names and their sizes.
    FinishFileUploadResponse:
      required:
        - fileId
        - fileStatus
        - sessionId
        - sessionStatus
      type: object
      properties:
        sessionId:
          $ref: '#/components/schemas/UploadSessionId'
        sessionStatus:
          type: string
          description: Status of the upload session.
          example: preparing
          enum:
            - preparing
            - completed
            - aborted
        fileId:
          $ref: '#/components/schemas/UploadFileId'
        fileStatus:
          type: string
          description: Status of the file upload.
          example: completed
          enum:
            - preparing
            - completed
            - aborted
      description: A response contaning session and file status information
    FinishFileUploadRequestParts:
      required:
        - etag
        - partNumber
      type: object
      properties:
        partNumber:
          type: integer
        etag:
          type: string
      description: A request contaning list of pairs of file names and their sizes.
    ErrorResponse:
      required:
        - error_code
        - message
      type: object
      properties:
        error_code:
          type: string
          example: UNAUTHORIZED
        error_message:
          type: string
          example: ''
        message:
          type: string
          example: Missing authentication token
        sub_errors:
          type: array
          items:
            required:
              - code
              - message
            type: object
            properties:
              code:
                type: string
              message:
                type: string
  responses:
    Unauthorized:
      description: >-
        Unauthorized. This error occurs if the authentication token is missing
        or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Forbidden. The user does not have access to this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnprocessableContent:
      description: The request could not be processed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      description: >
        Use a Bearer token for authentication. Submit the token using the
        `Authorization`

        header: `Authorization: Bearer <token>`.
      scheme: bearer
    openId:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: >-
            https://login.datalinks.com/realms/datalinks-realm/protocol/openid-connect/auth
          scopes:
            openid: openid

````