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

# Replace a conversion preset

> Replaces the preset's `displayName` and `parameters`. Send both, even when only one changes.

A change to `parameters` raises `version` by one. A `displayName`-only change keeps it.



## OpenAPI

````yaml /api-reference/openapi/media.json put /v1/conversion-presets/{id}
openapi: 3.2.0
info:
  title: Media API
  description: >-
    Convert images on demand and manage the tenant's conversion presets. The
    tenant comes from the credential, never from the route or request body.


    ## The conversion flow


    1. `POST /v1/image-conversions` with the original's `filename` returns an
    `id` and a signed `uploadUrl`.

    2. `PUT` the original to `uploadUrl` with the header `x-ms-blob-type:
    BlockBlob`. The bytes go straight to Azure Blob Storage and never pass
    through Occtoo.

    3. `POST /v1/image-conversions/<id>/convert` with the conversion
    `parameters`, or with a `preset` (see [Conversion
    presets](#conversion-presets)), queues the conversion and returns a job. The
    `Location` header holds its URL.

    4. `GET /v1/image-conversions/jobs/<jobId>` every 1–2 seconds until `status`
    is `Completed`, with a signed `result.url` to download the converted image,
    or `Failed`, with an `error` that says why. A queued job waits behind other
    conversions, so how long that takes depends on how much is queued.


    The upload link is valid for 1 hour. Each read of a completed job signs a
    download link valid for 1 hour from that read. Originals and converted
    images are deleted after a day. Converting after that answers `404`, and so
    does reading the completed job.


    ## Parameters


    | Field | Rule |

    |---|---|

    | `mode` | `Fit` scales the image to fit inside the canvas, keeping its
    proportions, so one side can come out shorter. `FillBackground` fits it
    inside the canvas minus the padding and fills the rest with `background`.
    `Crop` fills the canvas and crops from the centre. `Auto` crops when the
    image and canvas share an orientation and fits otherwise. |

    | `targetSize` | The canvas's longer side in pixels, from 1 to 8000. |

    | `aspectRatio` | The canvas as `width:height`, each side a whole number
    from 1 to 100, for example `1:1` or `4:3`. |

    | `paddingPercent` | Padding on each side as a percentage of `targetSize`,
    from 0 to 49. Required with `FillBackground` and not allowed with any other
    mode. The canvas minus the padding on both sides must be at least 1 px. |

    | `background` | Optional. The colour behind transparent areas and padding,
    as six hex digits without `#`, for example `FFFFFF`. |

    | `outputFormat` | `Jpg`, `Png` or `Webp`. |

    | `quality` | From 1 to 100. |


    `mode` and `outputFormat` are case-insensitive strings; numbers aren't
    accepted.


    ## Conversion presets


    A preset stores `parameters` under an `id` so you can reuse them by name.
    `/v1/conversion-presets` lists, gets, creates, replaces and deletes presets.
    To convert with a preset, send its `id` as `preset` to the convert endpoint
    in place of `parameters`. The conversion uses the preset's current
    `parameters`.


    - `id`: a lower-case letter, then lower-case letters, digits, `_` or `-`, at
    most 64 characters. It can't be changed.

    - `displayName`: 2–50 printable ASCII characters, with no leading or
    trailing space.

    - `parameters`: the same fields and rules as above. An unset
    `paddingPercent` or `background` is returned as `null`.

    - `version`: 1 when created. Goes up by one when `parameters` change or a
    deleted preset is created again. Changing only `displayName` keeps it.


    The list is ordered by `id` and comes back one page at a time as `items`,
    `after` and `totalCount`. `limit` sets the page size, from 1 to 200, default
    50. Pass a page's `after` as the `after` parameter to get the next page.
    It's `null` on the last page. `totalCount` is `null` unless you set
    `includeTotalCount=true`.


    ## 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`. Listing and getting presets need the `read:media` permission.
    Creating, replacing and deleting presets, and the conversion endpoints, need
    `write:media`.


    ## Responses


    Successful responses return the resource directly. Requesting a conversion
    and creating a preset answer `201`, converting answers `202`, deleting a
    preset answers `204`, and everything else answers `200`. A conversion that
    fails isn't an error response: reading its job answers `200` with `status`
    `Failed` and an `error`.


    | Status | When |

    |---|---|

    | `400` | An invalid `filename`; neither or both of `preset` and
    `parameters`, or invalid `parameters`; an original of `maxFileSize` bytes or
    more; an invalid preset `id`, `displayName` or `parameters`; a list `limit`
    out of range, an `after` the list didn't return, or a `before` or `offset`
    parameter. |

    | `401` | No credential, or an invalid one. |

    | `403` | A credential without the operation's permission. |

    | `404` | An unknown `id`, another tenant's `id`, nothing uploaded yet, or
    an original that was already deleted; an unknown or deleted preset; an
    unknown job, or a completed job whose result is no longer kept. |

    | `409` | Creating a preset whose `id` is in use; deleting a preset whose
    conversion property a card definition binds on a source. |

    | `500` | Anything else. |


    Errors use ProblemDetails (RFC 9457) with the `application/problem+json`
    content type. A validation `400` lists each invalid field under `errors`,
    for example `Parameters.TargetSize`, or `Preset` when a convert sends
    neither or both of `preset` and `parameters`. A body that isn't valid JSON,
    misses a required field, or has a value of the wrong type, an unknown enum
    name, or an `aspectRatio` or `background` in the wrong format, answers `400`
    without `errors`. Retry `500` with bounded exponential backoff. A convert
    that answered `500` may have queued the conversion anyway, so a retry can
    queue a second one.


    Machine-readable contract:
    [OpenAPI](https://api.occtoo.com/openapi/media.json)
  version: 1.0.0
  summary: >-
    Convert images on demand and manage conversion presets (named, reusable
    conversion parameters).
servers:
  - url: https://api.occtoo.com
    description: Occtoo public API
security: []
tags:
  - name: Conversion presets
  - name: Image conversions
paths:
  /v1/conversion-presets/{id}:
    put:
      tags:
        - Conversion presets
      summary: Replace a conversion preset
      description: >-
        Replaces the preset's `displayName` and `parameters`. Send both, even
        when only one changes.


        A change to `parameters` raises `version` by one. A `displayName`-only
        change keeps it.
      operationId: updateConversionPreset
      parameters:
        - name: id
          in: path
          description: The preset's `id`.
          required: true
          schema:
            type: string
          example: thumb
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConversionPresetRequest'
            examples:
              example:
                summary: Make the thumbnail 600 px
                value:
                  displayName: Thumbnail
                  parameters:
                    mode: Fit
                    targetSize: 600
                    aspectRatio: '1:1'
                    outputFormat: Webp
                    quality: 80
        required: true
      responses:
        '200':
          description: The updated preset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversionPresetResponse'
              examples:
                example:
                  summary: The preset at its next version
                  value:
                    id: thumb
                    displayName: Thumbnail
                    version: 2
                    parameters:
                      mode: Fit
                      targetSize: 600
                      aspectRatio: '1:1'
                      paddingPercent: null
                      background: null
                      outputFormat: Webp
                      quality: 80
                    createdAt: '2026-11-13T10:00:00+00:00'
                    updatedAt: '2026-11-13T11:00:00+00:00'
        '400':
          description: An invalid `id`, `displayName` or `parameters`.
          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: Unknown id, or a deleted preset.
          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:
    UpdateConversionPresetRequest:
      required:
        - displayName
        - parameters
      type: object
      properties:
        displayName:
          type: string
          description: >-
            The preset's name: 2–50 printable ASCII characters, with no leading
            or trailing space.
        parameters:
          $ref: '#/components/schemas/ConversionParametersRequest'
          description: >-
            The conversion parameters the preset applies. Same fields and rules
            as the convert endpoint's `parameters`.
    ConversionPresetResponse:
      required:
        - id
        - displayName
        - version
        - parameters
        - createdAt
        - updatedAt
      type: object
      properties:
        id:
          type: string
          description: The preset's id.
        displayName:
          type: string
          description: The preset's name.
        version:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: >-
            Starts at 1. Goes up by one when `parameters` change or a deleted
            preset is created again.
          format: int32
        parameters:
          $ref: '#/components/schemas/ConversionParameters'
          description: >-
            The conversion parameters the preset applies. An unset
            `paddingPercent` or `background` is `null`.
        createdAt:
          type: string
          description: When the preset was created.
          format: date-time
        updatedAt:
          type: string
          description: When the preset was last changed.
          format: date-time
      description: A named set of conversion parameters stored for a tenant.
    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
    ConversionParametersRequest:
      required:
        - mode
        - targetSize
        - aspectRatio
        - outputFormat
        - quality
      type: object
      properties:
        mode:
          $ref: '#/components/schemas/ConversionMode'
          description: How the image is placed on the canvas.
        targetSize:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: The canvas's longer side in pixels, from 1 to 8000.
          format: int32
        aspectRatio:
          $ref: '#/components/schemas/AspectRatio'
          description: >-
            The canvas as `width:height`, each side a whole number from 1 to
            100.
        paddingPercent:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: >-
            Padding on each side as a percentage of `TargetSize`, from 0 to 49.
            Required with `FillBackground` and not allowed with any other mode.
          format: int32
        background:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Background'
              description: >-
                The colour behind transparent areas and padding, as six hex
                digits without `#`.
        outputFormat:
          $ref: '#/components/schemas/ConversionOutputFormat'
          description: The file format of the converted image.
        quality:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: The output quality, from 1 to 100.
          format: int32
      description: >-
        Conversion parameters. A missing `required` member, or a malformed
        AspectRatio ConversionParametersRequest.AspectRatio or

        Background? ConversionParametersRequest.Background, fails the body read
        with a plain `400`. The rules are checked by

        ConversionParametersValidator.
    ConversionParameters:
      required:
        - mode
        - targetSize
        - aspectRatio
        - paddingPercent
        - background
        - outputFormat
        - quality
      type: object
      properties:
        mode:
          $ref: '#/components/schemas/ConversionMode'
          description: How the original is placed on the canvas.
        targetSize:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: The canvas's longer side in pixels, from 1 to 8000.
          format: int32
        aspectRatio:
          $ref: '#/components/schemas/AspectRatio'
          description: >-
            The canvas's shape as `width:height`, each side a whole number from
            1 to 100 (e.g. `4:3`).
        paddingPercent:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: >-
            Padding on each side as a percentage of `targetSize`, from 0 to 49.
            Set only with the mode that fills the background, null with the
            others.
          format: int32
        background:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Background'
              description: >-
                The colour behind transparent areas and padding, as six
                upper-case hex digits without `#` (e.g. `FFFFFF`). Null when
                none is set.
        outputFormat:
          $ref: '#/components/schemas/ConversionOutputFormat'
          description: The file format of the converted image.
        quality:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - integer
            - string
          description: The output quality, from 1 to 100.
          format: int32
      description: >-
        How an image is converted: the canvas, how the original is placed on it,
        and the output file's format and quality.
    ConversionMode:
      enum:
        - Fit
        - FillBackground
        - Crop
        - Auto
      description: >-
        How a conversion places the original on the canvas. Every mode scales a
        smaller original up.
    AspectRatio:
      type: string
      description: >-
        The canvas as `width:height`, each side a whole number from 1 to 100,
        for example `1:1`.
    Background:
      type: string
      description: Six hex digits without `#`, for example `FFFFFF`.
    ConversionOutputFormat:
      enum:
        - Jpg
        - Png
        - Webp
      description: The file format the converted image is written in.
  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.