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

# Confirm asset uploads and create the files

> Confirms the uploads and creates the files. At most 50 assets per call.

Occtoo reads each blob back, creates the media file and updates the data source entry behind the entry key. Each asset must carry the same filename it was initialized under — a different name points at a blob that doesn't exist, and that entry key comes back under `failed`.



## OpenAPI

````yaml /api-reference/openapi/assets.json post /v1/assets/{dataSourceId}/complete
openapi: 3.2.0
info:
  title: Assets API
  description: >-
    Upload files into an Occtoo data source. Tenant identity comes from the
    credential, never from the route or request body.


    ## The upload flow


    1. `POST /v1/assets/<dataSourceId>` registers the assets and returns a
    signed upload link per entry key.

    2. `PUT` each file to its link. The bytes go straight to Azure Blob Storage
    and never pass through Occtoo.

    3. `POST /v1/assets/<dataSourceId>/complete` confirms the uploads and
    creates the files.


    Everything is keyed by entry key. `GET` reads asset state, `DELETE` removes
    assets and the files behind them, `PUT` creates assets or replaces their
    files, and `/uploadLinks` re-signs a link that expired before the `PUT`
    happened.


    ## Authentication and access


    Select **Authorize** to reuse the existing Occtoo browser session, provide a
    tenant-scoped bearer token, or send an organization API key through
    `x-api-key`. Every operation accepts any one of `write:media`,
    `write:sources` or the established `import-datasource` permission.


    ## Batch ceilings


    - 100 assets per initialize call.

    - 25 assets per `PUT` call.

    - 50 assets per `/uploadLinks`, `/complete`, `GET` and `DELETE` call.

    - Entry keys must be unique within a request, compared case-insensitively,
    and allow letters, digits, `_` and `-`.


    ## Responses


    Successful responses return resource data directly. `DELETE` answers `204`
    with no body. The batch operations answer `200` with the keys that succeeded
    and a `failed` map of entry key to reason, so one bad asset doesn't sink the
    call.


    Errors use ProblemDetails (RFC 9457) with the `application/problem+json`
    content type. A `400` carries per-property failures under `errors`. Retry
    `429` and transient `5xx` responses with bounded exponential backoff,
    honouring `Retry-After` where present.


    Machine-readable contract:
    [OpenAPI](https://api.occtoo.com/openapi/assets.json)
  version: 1.0.0
  summary: Upload files into a data source and read the state of what was uploaded.
servers:
  - url: https://api.occtoo.com
    description: Occtoo public API
security: []
tags:
  - name: Assets
paths:
  /v1/assets/{dataSourceId}/complete:
    post:
      tags:
        - Assets
      summary: Confirm asset uploads and create the files
      description: >-
        Confirms the uploads and creates the files. At most 50 assets per call.


        Occtoo reads each blob back, creates the media file and updates the data
        source entry behind the entry key. Each asset must carry the same
        filename it was initialized under — a different name points at a blob
        that doesn't exist, and that entry key comes back under `failed`.
      operationId: completeAssets
      parameters:
        - name: dataSourceId
          in: path
          description: Stable customer-facing source id within the authenticated tenant.
          required: true
          schema:
            minLength: 1
            type: string
            example: product-images
          example: product-images
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteAssetsRequest'
            examples:
              example:
                summary: Complete one upload
                value:
                  assets:
                    - entryKey: sku-1
                      filename: front.jpg
        required: true
      responses:
        '200':
          description: The file created for each entry key that could be completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompletedAssets'
              examples:
                example:
                  summary: The file Occtoo read back off the blob
                  value:
                    completed:
                      sku-1:
                        filename: front.jpg
                        mimeType: image/jpeg
                        size: 120432
                        publicUrl: >-
                          https://cdn.occtoo-media.com/6b1f0b3c-6f2e-4a52-9a1e-7c6f0c2f9a10/9c2a7d18-4f6b-4f0b-9a2a-2f2e6c7d8e90/front.jpg
                        width: 1200
                        height: 800
                    failed: {}
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/HttpValidationProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Optional number of seconds to wait before retrying.
              schema:
                minimum: 1
                type: integer
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      security:
        - kindeOAuth: []
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    CompleteAssetsRequest:
      required:
        - assets
      type: object
      properties:
        assets:
          type: array
          items:
            $ref: '#/components/schemas/AssetToInitialize'
    CompletedAssets:
      required:
        - completed
        - failed
      type: object
      properties:
        completed:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CompletedAsset'
        failed:
          type: object
          additionalProperties:
            type: string
    HttpValidationProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    AssetToInitialize:
      required:
        - entryKey
        - filename
      type: object
      properties:
        entryKey:
          type: string
        filename:
          type: string
    CompletedAsset:
      required:
        - filename
        - mimeType
        - size
        - publicUrl
        - width
        - height
      type: object
      properties:
        filename:
          type: string
        mimeType:
          type: string
        size:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          format: int64
        publicUrl:
          type: string
        width:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        height:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
  securitySchemes:
    kindeOAuth:
      type: oauth2
      description: >-
        Sign in with the existing Occtoo Studio identity and selected
        organization.
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://auth.occtoo.com/oauth2/auth?audience=https%3A%2F%2Fapi-weu.occtoo.com
          tokenUrl: https://auth.occtoo.com/oauth2/token
          scopes:
            openid: Authenticate the user with OpenID Connect.
            profile: Read the user's basic profile.
            email: Read the user's email address.
            offline: Refresh the access token without another interactive sign-in.
          x-usePkce: SHA-256
          x-scalar-redirect-uri: https://api.occtoo.com/docs/
    bearerAuth:
      type: http
      description: >-
        Tenant-scoped Occtoo access token, including Kinde machine-to-machine
        application tokens.
      scheme: bearer
      bearerFormat: JWT
    apiKey:
      type: apiKey
      description: Occtoo organization API key.
      name: x-api-key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.