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

# Run a flow now

> Immediately enqueue one live execution on every device bound to the flow, regardless of whether its trigger is event-based, custom, or scheduled.

Supports an optional `Idempotency-Key` header (1-255 printable ASCII characters). The run identity is derived from the key, so a retry never starts a second run. Replays with the same key and an identical body return the original status and the original `executionIds`; a changed body under the same key returns 422 `idempotency_key_reused`.



## OpenAPI

````yaml /api-reference/workflows.yaml post /flows/{flowId}/run
openapi: 3.1.0
info:
  title: Workflows
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /flows/{flowId}/run:
    post:
      tags:
        - Flows
      summary: Run a flow now
      description: >-
        Immediately enqueue one live execution on every device bound to the
        flow, regardless of whether its trigger is event-based, custom, or
        scheduled.


        Supports an optional `Idempotency-Key` header (1-255 printable ASCII
        characters). The run identity is derived from the key, so a retry never
        starts a second run. Replays with the same key and an identical body
        return the original status and the original `executionIds`; a changed
        body under the same key returns 422 `idempotency_key_reused`.
      operationId: runFlow
      parameters:
        - in: path
          name: flowId
          required: true
          schema:
            format: uuid
            type: string
        - description: >-
            Idempotency-Key: 1-255 printable ASCII characters. Same key with a
            different request body is a 422 idempotency_key_reused. A retryable
            in-flight duplicate is a 409 with Retry-After and x-should-retry:
            true; a terminal duplicate is a 409 with x-should-retry: false. A
            replay returns the current resource state with Idempotent-Replayed:
            true.
          in: header
          name: idempotency-key
          required: false
          schema:
            description: >-
              Idempotency-Key: 1-255 printable ASCII characters. Same key with a
              different request body is a 422 idempotency_key_reused. A
              retryable in-flight duplicate is a 409 with Retry-After and
              x-should-retry: true; a terminal duplicate is a 409 with
              x-should-retry: false. A replay returns the current resource state
              with Idempotent-Replayed: true.
            example: b3f6a9f0-6f1a-4e9a-9e7a-9c9b6b6a5a3f
            maxLength: 255
            minLength: 1
            pattern: ^[\x21-\x7E]{1,255}$
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunFlowBody'
      responses:
        '202':
          content:
            application/json:
              schema:
                properties:
                  data:
                    properties:
                      enqueuedCount:
                        minimum: 0
                        type: integer
                      executionIds:
                        description: >-
                          Ids of the executions this run created. An idempotent
                          replay returns the ids of the original run.
                        items:
                          format: uuid
                          type: string
                        type: array
                    required:
                      - enqueuedCount
                      - executionIds
                    type: object
                required:
                  - data
                type: object
          description: Flow executions enqueued
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowNotFoundError'
          description: Flow not found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowBlockedError'
          description: Flow is blocked
        '422':
          content:
            application/json:
              schema:
                properties:
                  details:
                    items:
                      properties:
                        field:
                          type: string
                        message:
                          type: string
                      required:
                        - field
                        - message
                      type: object
                    type: array
                  error:
                    type: string
                required:
                  - error
                  - details
                type: object
          description: Validation Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Mobilerun from '@mobilerun/sdk';


            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.workflows.flows.run('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');


            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.workflows.flows.run(
                flow_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(response.data)
components:
  schemas:
    RunFlowBody:
      additionalProperties: false
      properties:
        captureScreenshots:
          description: >-
            Record and keep this run's scripts.run screenshots
            (device.screenshot(save=True)) even without flow delivery. Used for
            a one-off proof run.
          type: boolean
        payload:
          additionalProperties: {}
          default: {}
          type: object
      type: object
    FlowNotFoundError:
      properties:
        code:
          enum:
            - flow_not_found
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
    FlowBlockedError:
      properties:
        code:
          enum:
            - flow_blocked
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

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