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

# Validate a flow



## OpenAPI

````yaml /api-reference/workflows.yaml post /flows/validate
openapi: 3.1.0
info:
  title: Workflows
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /flows/validate:
    post:
      tags:
        - Flows
      summary: Validate a flow
      operationId: validateFlow
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                actions:
                  items:
                    anyOf:
                      - $ref: '#/components/schemas/FlowActionInput'
                      - $ref: '#/components/schemas/FlowDraftActionInput'
                  minItems: 1
                  type: array
                cooldownScope:
                  default: flow
                  enum:
                    - flow
                    - device
                  type: string
                cooldownSeconds:
                  minimum: 0
                  type:
                    - integer
                    - 'null'
                delivery:
                  additionalProperties: false
                  properties:
                    destination:
                      enum:
                        - mobilerun
                        - one_drive
                        - google_drive
                      type: string
                    folder:
                      description: not allowed when destination is mobilerun
                      maxLength: 1024
                      minLength: 1
                      type: string
                    recording:
                      additionalProperties: false
                      properties:
                        filename:
                          maxLength: 255
                          minLength: 1
                          type: string
                      required:
                        - filename
                      type: object
                    screenshots:
                      additionalProperties: false
                      properties: {}
                      type: object
                  required:
                    - destination
                  type: object
                description:
                  maxLength: 2048
                  type: string
                deviceIds:
                  default: []
                  items:
                    format: uuid
                    type: string
                  maxItems: 256
                  type: array
                enabled:
                  default: true
                  type: boolean
                healthMonitoringEnabled:
                  default: true
                  type: boolean
                name:
                  maxLength: 256
                  minLength: 1
                  type: string
                notifyOnFailure:
                  default: false
                  type: boolean
                notifyOnSuccess:
                  default: false
                  type: boolean
                notifyWebhookId:
                  format: uuid
                  type:
                    - string
                    - 'null'
                recordingEnabled:
                  type: boolean
                recordingPolicy:
                  additionalProperties: false
                  properties:
                    mode:
                      $ref: '#/components/schemas/RecordingPolicyMode'
                  required:
                    - mode
                  type: object
                selfHealingEnabled:
                  type: boolean
                selfHealingMaxAttempts:
                  default: 2
                  maximum: 5
                  minimum: 1
                  type: integer
                triggerId:
                  format: uuid
                  type: string
              required:
                - name
                - actions
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/FlowValidateResponse'
                required:
                  - data
                type: object
          description: Flow validation result
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Unauthorized
        '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.validate({
              actions: [{ actionId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', position: 0 }],
              name: 'x',
            });

            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.validate(
                actions=[{
                    "action_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                    "position": 0,
                }],
                name="x",
            )
            print(response.data)
components:
  schemas:
    FlowActionInput:
      additionalProperties: false
      properties:
        actionId:
          format: uuid
          type: string
        children:
          items:
            $ref: '#/components/schemas/FlowChildActionInput'
          type: array
        continueOnError:
          default: false
          type: boolean
        key:
          description: >-
            Stable identifier used by template resolution v2+ to address this
            step as {{key.field}}. Omitted keys are derived from the step name
            whenever a flow is created. For template resolution v3, replacing an
            existing flow's full action tree requires every step to carry an
            explicit key — a missing key is rejected there, not derived, so a
            name change can never silently move a step's key.
          pattern: ^[a-z_][a-z0-9_-]{0,63}$
          type: string
        nameOverride:
          maxLength: 256
          minLength: 1
          type: string
        overrides:
          $ref: '#/components/schemas/FlowActionOverrides'
        position:
          minimum: 0
          type: integer
        recordingEnabled:
          default: false
          type: boolean
      required:
        - actionId
        - position
      type: object
    FlowDraftActionInput:
      additionalProperties: false
      properties:
        continueOnError:
          default: false
          type: boolean
        draft:
          additionalProperties: false
          properties:
            method:
              minLength: 1
              type: string
            name:
              maxLength: 256
              minLength: 1
              type: string
            params:
              additionalProperties: {}
              default: {}
              type: object
            service:
              minLength: 1
              type: string
          required:
            - name
            - service
            - method
          type: object
        key:
          description: >-
            Stable identifier used by template resolution v2+ to address this
            step as {{key.field}}. Omitted keys are derived from the step name
            whenever a flow is created. For template resolution v3, replacing an
            existing flow's full action tree requires every step to carry an
            explicit key — a missing key is rejected there, not derived, so a
            name change can never silently move a step's key.
          pattern: ^[a-z_][a-z0-9_-]{0,63}$
          type: string
        nameOverride:
          maxLength: 256
          minLength: 1
          type: string
        overrides:
          $ref: '#/components/schemas/FlowActionOverrides'
        position:
          minimum: 0
          type: integer
        recordingEnabled:
          default: false
          type: boolean
      required:
        - draft
        - position
      type: object
    RecordingPolicyMode:
      enum:
        - 'off'
        - flow
        - selected_steps
      type: string
    FlowValidateResponse:
      properties:
        errors:
          items:
            properties:
              code:
                type: string
              field:
                type: string
              knownSteps:
                items:
                  type: string
                type: array
              message:
                type: string
              reference:
                type: string
            required:
              - code
              - field
              - message
            type: object
          type: array
        valid:
          type: boolean
        warnings:
          items:
            properties:
              code:
                type: string
              connectKey:
                type: string
              destination:
                type: string
              message:
                type: string
            required:
              - code
              - message
            type: object
          type: array
      required:
        - valid
        - errors
        - warnings
      type: object
    ApiErrorEnvelope:
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
        retryAfterSeconds:
          type: number
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    FlowChildActionInput:
      additionalProperties: false
      properties:
        actionId:
          format: uuid
          type: string
        continueOnError:
          default: false
          type: boolean
        key:
          description: >-
            Stable identifier used by template resolution v2+ to address this
            step as {{key.field}}. Omitted keys are derived from the step name
            whenever a flow is created. For template resolution v3, replacing an
            existing flow's full action tree requires every step to carry an
            explicit key — a missing key is rejected there, not derived, so a
            name change can never silently move a step's key.
          pattern: ^[a-z_][a-z0-9_-]{0,63}$
          type: string
        nameOverride:
          maxLength: 256
          minLength: 1
          type: string
        overrides:
          $ref: '#/components/schemas/FlowActionOverrides'
        position:
          minimum: 0
          type: integer
        recordingEnabled:
          default: false
          type: boolean
      required:
        - actionId
        - position
      type: object
    FlowActionOverrides:
      additionalProperties: false
      properties:
        params:
          additionalProperties: {}
          type: object
      type:
        - object
        - 'null'
  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.