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

# Flows - Run a flow

> Triggers the execution of a flow. Provide values for all required inputs
defined in the flow's definition (see the GET endpoint).

The `inputs` object maps each input's `api_key` (recommended) or its `id` (UUID, legacy) to its value:

| Input Type | Accepted Values |
|------------|----------------|
| `creation` | Image URL (`https://...`), base64-encoded image string, or existing creation identifier |
| `text` | Plain text string |
| `number` | Numeric value |
| `select` | Value from allowed options |

**This endpoint is asynchronous.** It returns immediately with `status: "running"` and a
`workflow_run_identifier`. Provide a `webhook` URL to receive notifications when the execution
completes. The webhook receives two events: `initialized` (run started) and `finished`/`failed` (run completed).

The webhook payload for a completed run includes a `result` object containing `images`, `videos`,
and `audios` arrays with download URLs for the generated assets.




## OpenAPI

````yaml post /v1/ai/flows/{flow-id}/run
openapi: 3.0.0
info:
  description: >-
    The Magnific API is your gateway to a vast collection of high-quality
    digital resources for your applications and projects. As a leading platform,
    it offers a wide range of graphics, including vectors, photos,
    illustrations, icons, PSD templates, and more, all curated by talented
    designers from around the world.
  title: Magnific API
  version: 1.0.0
servers:
  - description: B2B API Production V1
    url: https://api.magnific.com
security:
  - magnificApiKey: []
paths:
  /v1/ai/flows/{flow-id}/run:
    post:
      tags:
        - flows
      summary: Flows - Run a flow
      description: >
        Triggers the execution of a flow. Provide values for all required inputs

        defined in the flow's definition (see the GET endpoint).


        The `inputs` object maps each input's `api_key` (recommended) or its
        `id` (UUID, legacy) to its value:


        | Input Type | Accepted Values |

        |------------|----------------|

        | `creation` | Image URL (`https://...`), base64-encoded image string,
        or existing creation identifier |

        | `text` | Plain text string |

        | `number` | Numeric value |

        | `select` | Value from allowed options |


        **This endpoint is asynchronous.** It returns immediately with `status:
        "running"` and a

        `workflow_run_identifier`. Provide a `webhook` URL to receive
        notifications when the execution

        completes. The webhook receives two events: `initialized` (run started)
        and `finished`/`failed` (run completed).


        The webhook payload for a completed run includes a `result` object
        containing `images`, `videos`,

        and `audios` arrays with download URLs for the generated assets.
      operationId: run_flow
      parameters:
        - description: >-
            Short unique identifier (sqid) of the flow to execute. Discover flow
            identifiers via GET /v1/ai/flows.
          in: path
          name: flow-id
          required: true
          schema:
            example: uqzQLDr2Aw
            type: string
      requestBody:
        content:
          application/json:
            example:
              inputs:
                image: car in the forest
              webhook: https://www.example.com/webhook
            schema:
              $ref: '#/components/schemas/run-request'
        required: true
      responses:
        '202':
          content:
            application/json:
              example:
                status: running
                workflow_run_identifier: vCrK3Aa47y
              schema:
                $ref: '#/components/schemas/run_flow_202_response'
          description: >-
            Accepted - Flow execution started. Use the webhook to receive
            results.
        '400':
          content:
            application/json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Parameter 'page' must be greater than 0
                invalid_query:
                  summary: Parameter 'query' is not valid
                  value:
                    message: Parameter 'query' must not be empty
                invalid_filter:
                  summary: Parameter 'filter' is not valid
                  value:
                    message: Parameter 'filter' is not valid
                generic_bad_request:
                  summary: Bad Request
                  value:
                    message: Parameter ':attribute' is not valid
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
            application/problem+json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Validation error
                    invalid_params:
                      - field: page
                        reason: Parameter 'page' must be greater than 0
                      - field: per_page
                        reason: Parameter 'per_page' must be greater than 0
              schema:
                $ref: >-
                  #/components/schemas/get_all_style_transfer_tasks_400_response_1
          description: >-
            Bad Request - The server could not understand the request due to
            invalid syntax.
        '401':
          content:
            application/json:
              examples:
                invalid_api_key:
                  summary: API key is not valid
                  value:
                    message: Invalid API key
                missing_api_key:
                  summary: API key is not provided
                  value:
                    message: Missing API key
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: >-
            Unauthorized - The client must authenticate itself to get the
            requested response.
        '404':
          description: Flow not found.
        '422':
          description: Validation error on input values.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_500_response'
          description: >-
            Internal Server Error - The server has encountered a situation it
            doesn't know how to handle.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_503_response'
          description: Service Unavailable
components:
  schemas:
    run-request:
      properties:
        inputs:
          additionalProperties:
            $ref: '#/components/schemas/run_request_inputs_value'
          description: >
            Map of input identifier to value. Use each input's `api_key`
            (recommended) or its `id` (UUID, legacy) as the key — both are
            accepted.


            Value types by input type:

            - `creation` (image/media): URL string, base64-encoded string, or
            existing creation sqid

            - `text`: Plain text string

            - `number`: Numeric value

            - `select`: Value from allowed options
          type: object
        webhook:
          description: >
            Optional callback URL that receives status notifications during
            execution.

            The webhook receives POST requests with the event payload (see
            webhook event schema).

            Events are sent when the run starts (`initialized`) and when it
            finishes (`finished` or `failed`).
          example: https://www.example.com/webhook
          format: uri
          type: string
      required:
        - inputs
      type: object
    run_flow_202_response:
      example:
        workflow_run_identifier: vCrK3Aa47y
        status: running
      properties:
        status:
          description: Current execution status.
          enum:
            - running
          example: running
          type: string
        workflow_run_identifier:
          description: >-
            Unique identifier for this flow execution run. Matches the `run_id`
            in webhook events.
          example: vCrK3Aa47y
          type: string
      required:
        - status
        - workflow_run_identifier
      type: object
    get_all_style_transfer_tasks_400_response:
      example:
        message: message
      properties:
        message:
          type: string
      type: object
    get_all_style_transfer_tasks_400_response_1:
      properties:
        problem:
          $ref: >-
            #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem
      type: object
    get_all_style_transfer_tasks_500_response:
      example:
        message: Internal Server Error
      properties:
        message:
          example: Internal Server Error
          type: string
      type: object
    get_all_style_transfer_tasks_503_response:
      example:
        message: Service Unavailable. Please try again later.
      properties:
        message:
          example: Service Unavailable. Please try again later.
          type: string
      type: object
    run_request_inputs_value:
      oneOf:
        - type: string
        - type: number
    get_all_style_transfer_tasks_400_response_1_problem:
      properties:
        message:
          example: Validation error
          type: string
        invalid_params:
          items:
            $ref: >-
              #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner
          type: array
      required:
        - invalid_params
        - message
      type: object
    get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner:
      properties:
        name:
          description: Name of the invalid parameter.
          example: page
          type: string
        field:
          description: Field of the invalid parameter. Mirrors `name`.
          example: page
          type: string
        reason:
          example: Parameter 'page' must be greater than 0
          type: string
      required:
        - field
        - name
        - reason
      type: object
  securitySchemes:
    magnificApiKey:
      description: >
        Your Magnific API key. Required for authentication. [Learn how to obtain
        an API key](https://docs.magnific.com/quickstart)
      in: header
      name: x-magnific-api-key
      type: apiKey

````