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

# Magic resize from an image



## OpenAPI

````yaml /api/openapi.json post /api/v1/canvases/{canvasId}/magic-resize
openapi: 3.0.2
info:
  title: Melius API
  version: '1'
  description: >-
    The Melius REST API. Authenticate with an API key as a bearer token
    (`Authorization: Bearer mel_...`) and select the team to act on with the
    `x-team-id` header. Generations run through the same node + run pipeline as
    the app: create a node on a canvas, start a run, poll the run, then read the
    resulting version asset.
servers:
  - url: https://api.melius.com
security:
  - apiKey: []
    teamId: []
paths:
  /api/v1/canvases/{canvasId}/magic-resize:
    post:
      tags:
        - run
      summary: Magic resize from an image
      operationId: run.magicResize
      parameters:
        - name: canvasId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              type: object
              properties:
                sourceNodeId:
                  type: string
                  format: uuid
                ratios:
                  type: array
                  items:
                    oneOf:
                      - type: string
                        enum:
                          - '21:9'
                          - '16:9'
                          - '4:3'
                          - '1:1'
                          - '3:4'
                          - '9:16'
                          - '9:21'
                      - type: string
                  minItems: 1
                  maxItems: 5
              required:
                - sourceNodeId
                - ratios
      responses:
        '201':
          description: '201'
          content:
            application/json:
              schema:
                type: object
                properties:
                  nodeId:
                    type: string
                    format: uuid
                  nodeRunId:
                    type: string
                    format: uuid
                  creditCost:
                    type: integer
                required:
                  - nodeId
                  - nodeRunId
                  - creditCost
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - statusCode
                  - message
        '403':
          description: The API key's user is not a member of the requested team.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - statusCode
                  - message
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '429':
          description: Rate limit reached — retry after the `Retry-After` header.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    type: integer
                  error:
                    type: string
                  message:
                    type: string
                  retryAfterSeconds:
                    type: integer
                required:
                  - statusCode
                  - message
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'A Melius API key (`mel_...`), sent as `Authorization: Bearer <key>`.'
    teamId:
      type: apiKey
      in: header
      name: x-team-id
      description: The team (workspace) to act on. Defaults to the key's team when omitted.

````