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

# Initialize assets and get links to upload them to

> Registers assets against the data source and returns one signed upload link per entry key. At most 100 assets per call. An entry key that already has an asset fails the whole call with `409` — use `PUT` to create or replace.

`PUT` the file bytes to the link. They go straight to Azure Blob Storage and never pass through Occtoo, so no Occtoo request-size ceiling applies to the upload. Call `/complete` once the `PUT` returns.

An entry key that couldn't be initialized comes back under `failed` with the reason; the rest of the batch still succeeds. Links expire — use `/uploadLinks` to sign an entry key that was already initialized.

`folderId` places the new assets in that folder of the data source; omit it to use the data source's root folder. List the folders with `GET /v1/sources/{sourceId}/folders` on the Configuration API; the `id` it returns is the value `folderId` takes.

## Properties

An asset can carry `properties`, the same rows typed source ingest takes: one `{ "id", "value" }` per property, and for a localized property one per language with `"language"` set. Each value is plain JSON, read as the type the property is configured with:

| Property type | JSON value |
|---|---|
| Text, or no type | string |
| Integer | whole number in the 64-bit range |
| Decimal | number |
| Boolean | `true` or `false` |
| Timestamp | ISO-8601 string with an offset, or an RFC 1123 string, stored as sent |
| List | array of strings |
| LocalizedText | string, with `language` |
| LocalizedList | array of strings, with `language` |

`null` clears the value, for a localized property in that row's language. Initialize always creates the entry, so a `null` leaves it empty.

- Each property must already exist on the data source. Create it before initializing an asset that uses it. List elements can't contain the property's delimiter.
- Property ids are matched case-insensitively and can't start with the reserved `occtoosys` prefix. A property can appear once per language.
- Language codes are 2–10 characters.

A property that breaks these rules fails the whole call before anything is written. The `400` lists every failure under `assets[<index>].properties[<index>]`.



## OpenAPI

````yaml /api-reference/openapi/assets.json post /v1/assets/{dataSourceId}
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}:
    post:
      tags:
        - Assets
      summary: Initialize assets and get links to upload them to
      description: >-
        Registers assets against the data source and returns one signed upload
        link per entry key. At most 100 assets per call. An entry key that
        already has an asset fails the whole call with `409` — use `PUT` to
        create or replace.


        `PUT` the file bytes to the link. They go straight to Azure Blob Storage
        and never pass through Occtoo, so no Occtoo request-size ceiling applies
        to the upload. Call `/complete` once the `PUT` returns.


        An entry key that couldn't be initialized comes back under `failed` with
        the reason; the rest of the batch still succeeds. Links expire — use
        `/uploadLinks` to sign an entry key that was already initialized.


        `folderId` places the new assets in that folder of the data source; omit
        it to use the data source's root folder. List the folders with `GET
        /v1/sources/{sourceId}/folders` on the Configuration API; the `id` it
        returns is the value `folderId` takes.


        ## Properties


        An asset can carry `properties`, the same rows typed source ingest
        takes: one `{ "id", "value" }` per property, and for a localized
        property one per language with `"language"` set. Each value is plain
        JSON, read as the type the property is configured with:


        | Property type | JSON value |

        |---|---|

        | Text, or no type | string |

        | Integer | whole number in the 64-bit range |

        | Decimal | number |

        | Boolean | `true` or `false` |

        | Timestamp | ISO-8601 string with an offset, or an RFC 1123 string,
        stored as sent |

        | List | array of strings |

        | LocalizedText | string, with `language` |

        | LocalizedList | array of strings, with `language` |


        `null` clears the value, for a localized property in that row's
        language. Initialize always creates the entry, so a `null` leaves it
        empty.


        - Each property must already exist on the data source. Create it before
        initializing an asset that uses it. List elements can't contain the
        property's delimiter.

        - Property ids are matched case-insensitively and can't start with the
        reserved `occtoosys` prefix. A property can appear once per language.

        - Language codes are 2–10 characters.


        A property that breaks these rules fails the whole call before anything
        is written. The `400` lists every failure under
        `assets[<index>].properties[<index>]`.
      operationId: initializeAssets
      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/InitializeAssetsRequest'
            examples:
              example:
                summary: Initialize two assets, one with properties
                value:
                  assets:
                    - entryKey: sku-1
                      filename: front.jpg
                      properties:
                        - id: title
                          language: en
                          value: Blue chair
                        - id: title
                          language: sv
                          value: Blå stol
                        - id: sku
                          value: CH-001
                        - id: tags
                          value:
                            - summer
                            - outdoor
                        - id: width
                          value: 640
                        - id: price
                          value: 1299.5
                        - id: published
                          value: true
                        - id: shotAt
                          value: '2026-09-30T10:00:00Z'
                        - id: features
                          language: en
                          value:
                            - stackable
                    - entryKey: sku-2
                      filename: back.jpg
        required: true
      responses:
        '200':
          description: An upload link per entry key that could be initialized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitializedAssets'
              examples:
                example:
                  summary: One link per entry key
                  value:
                    initialized:
                      sku-1:
                        uploadUrl: >-
                          https://occtoomedia.blob.core.windows.net/6b1f0b3c/9c2a7d18/front.jpg?sv=2024-11-04&se=...&sig=...
                        expiresAt: '2026-09-25T13:30:00+00:00'
                      sku-2:
                        uploadUrl: >-
                          https://occtoomedia.blob.core.windows.net/6b1f0b3c/1e77a904/back.jpg?sv=2024-11-04&se=...&sig=...
                        expiresAt: '2026-09-25T13:30:00+00:00'
                    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:
    InitializeAssetsRequest:
      required:
        - folderId
        - assets
      type: object
      properties:
        folderId:
          type:
            - 'null'
            - string
          format: uuid
        assets:
          type: array
          items:
            $ref: '#/components/schemas/NewAsset'
    InitializedAssets:
      required:
        - initialized
        - failed
      type: object
      properties:
        initialized:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/AssetInitialization'
        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
    NewAsset:
      required:
        - entryKey
        - filename
      type: object
      properties:
        entryKey:
          type: string
        filename:
          type: string
        properties:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/TypedPropertyImport'
    AssetInitialization:
      required:
        - uploadUrl
        - expiresAt
      type: object
      properties:
        uploadUrl:
          type: string
        expiresAt:
          type: string
          format: date-time
    TypedPropertyImport:
      required:
        - id
        - value
      type: object
      properties:
        id:
          type:
            - 'null'
            - string
        value:
          $ref: '#/components/schemas/JsonElement'
        language:
          type:
            - 'null'
            - string
    JsonElement: {}
  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.