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

# Finalize an admitted managed MCAP upload

> Send every admitted file UID with its retained generation UID. Repeating the same file-to-generation mapping returns the current finalization record. A retry can restart a recoverable failed job. Poll the managed upload status endpoint to check completion.



## OpenAPI

````yaml /api-reference/openapi.json post /fleet/recordings/{uid}/managed-upload/finalize/
openapi: 3.0.0
info:
  title: Avala API
  description: >

    # Authentication


    ## Generating an API Key


    The Avala SDK uses API keys to authenticate requests. You can create and
    manage your API keys from the

    Settings page of Mission Control.


    Follow these steps to generate a new API key:


    1. Open your settings page by clicking on your user avatar located at the
    top right-hand corner of any
        Mission Control screen, and select `Settings`.
    2. From the left-hand sub-menu, select `Security & Identity`.

    3. Click on `New API Key`, enter a name for the key, and then click `Create
    key`.


    The new key will be automatically copied to your clipboard. Please note, for
    security reasons, the key

    will not be accessible once you close the window. Ensure you store it in a
    safe location before closing

    the pop-up modal.


    ### Video walkthrough of API key generation


    <iframe class="embedly-embed"
    src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2F
        www.youtube.com%2Fembed%2FTYdLhkAAbLA%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2F
        www.youtube.com%2Fwatch%3Fv%3DTYdLhkAAbLA&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTYdLhkAAbLA%2F
        hqdefault.jpg&key=7788cb384c9f4d5dbbdbeffd9fe4b92f&type=text%2Fhtml&schema=youtube" width="854"
        height="480" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay;
        fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"></iframe>


    ## Authenticating with an API Key


    This is the easiest part! Just add a header named `X-Avala-Api-Key` to your
    requests and set the

    previously generated API Key as the value.
  termsOfService: https://avala.ai/legal/terms
  contact:
    email: support@avala.ai
  version: v1
servers:
  - url: https://api.avala.ai/api/v1
security:
  - API_Key: []
  - JWT: []
tags:
  - name: datasets
    description: To be completed...
  - name: projects
    description: To be completed...
  - name: tasks
    description: List and retrieve annotation tasks.
  - name: exports
    description: To be completed...
paths:
  /fleet/recordings/{uid}/managed-upload/finalize/:
    parameters:
      - name: uid
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - fleet
      summary: Finalize an admitted managed MCAP upload
      description: >-
        Send every admitted file UID with its retained generation UID. Repeating
        the same file-to-generation mapping returns the current finalization
        record. A retry can restart a recoverable failed job. Poll the managed
        upload status endpoint to check completion.
      operationId: fleet_recordings_managed-upload_finalize
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagedFinalizeRequest'
            example:
              protocol: fleet-managed-mcap-v1
              session_uid: e60b40be-a090-4a41-8360-76cceca25e39
              files:
                - file_uid: 28608b23-d75c-4287-84ab-2a8608971c37
                  generation_uid: ea4380a4-17e4-4799-9639-7e0221be37f8
        required: true
      responses:
        '202':
          description: >-
            The server accepted the finalization request. The response reports
            its current state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedFinalizeResponse'
        '409':
          $ref: '#/components/responses/ManagedFleetConflict'
        '503':
          $ref: '#/components/responses/ManagedFleetUnavailable'
components:
  schemas:
    ManagedFinalizeRequest:
      required:
        - protocol
        - session_uid
        - files
      type: object
      properties:
        protocol:
          title: Protocol
          type: string
          enum:
            - fleet-managed-mcap-v1
        session_uid:
          title: Session uid
          type: string
          format: uuid
        files:
          type: array
          items:
            $ref: '#/components/schemas/ManagedFinalizationFile'
    ManagedFinalizeResponse:
      required:
        - protocol
        - session_uid
        - finalization
      type: object
      properties:
        protocol:
          title: Protocol
          type: string
          enum:
            - fleet-managed-mcap-v1
        session_uid:
          title: Session uid
          type: string
          format: uuid
        finalization:
          $ref: '#/components/schemas/ManagedFinalizationResponse'
    ManagedFinalizationFile:
      required:
        - file_uid
        - generation_uid
      type: object
      properties:
        file_uid:
          title: File uid
          type: string
          format: uuid
        generation_uid:
          title: Generation uid
          type: string
          format: uuid
    ManagedFinalizationResponse:
      required:
        - uid
        - state
        - stage
        - attempts
        - failures
        - code
        - available_at
        - publication_uid
        - dataset_uid
      type: object
      properties:
        uid:
          title: Uid
          type: string
          format: uuid
        state:
          title: State
          type: string
          minLength: 1
        stage:
          title: Stage
          type: string
          minLength: 1
        attempts:
          title: Attempts
          type: integer
        failures:
          title: Failures
          type: integer
        code:
          title: Code
          type: string
        available_at:
          title: Available at
          type: string
          format: date-time
        publication_uid:
          title: Publication uid
          type: string
          format: uuid
          nullable: true
        dataset_uid:
          title: Dataset uid
          type: string
          format: uuid
          nullable: true
      nullable: true
    ManagedFleetError:
      type: object
      required:
        - code
        - detail
      properties:
        code:
          type: string
          description: Machine-readable reason for this response.
        detail:
          type: string
          description: Human-readable explanation.
  responses:
    ManagedFleetConflict:
      description: >-
        Check the original manifest, session and file generations before
        retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagedFleetError'
          example:
            code: managed_fleet_conflict
            detail: Retain the exact upload session and original manifest.
    ManagedFleetUnavailable:
      description: >-
        Retain the session and local files. Check the server's retry delay
        before attempting again.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
            example: 60
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ManagedFleetError'
          example:
            code: managed_fleet_unavailable
            detail: >-
              Upload is temporarily unavailable. Retain the session and local
              files.
  securitySchemes:
    API_Key:
      type: apiKey
      name: X-Avala-Api-Key
      in: header
      description: >-
        API key for authentication. Generate one in Mission Control Settings >
        Security & Identity.
    JWT:
      type: apiKey
      name: Authorization
      in: header
      description: JWT token with 'JWT' prefix, e.g., 'JWT eyJhbGciOiJIUzI1NiIsInR...'

````