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

# Run Workflow

> Start a run of the current version, or of version_id. With wait, the response comes when the run finishes or after 60 seconds, whichever is first.

```bash cURL theme={null}
curl --request POST \
  --url "https://api.roe-ai.com/v1/workflows/YOUR_WORKFLOW_ID/runs/" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "inputs": {"customer_id": "c_123"},
    "wait": true
  }'
```


## OpenAPI

````yaml POST /v1/workflows/{workflow_id}/runs/
openapi: 3.1.0
info:
  title: Roe API
  version: 1.0.0
  description: Complete API documentation for Roe platform
servers:
  - url: https://api.roe-ai.com
    description: Production API
security: []
paths:
  /v1/workflows/{workflow_id}/runs/:
    post:
      tags:
        - v1
      summary: Run a workflow
      description: >-
        Start a run of the current version, or of version_id. With wait, the
        response comes when the run finishes or after 60 seconds, whichever is
        first.
      operationId: v1_workflows_runs_create
      parameters:
        - in: path
          name: workflow_id
          schema:
            type: string
            format: uuid
          required: true
        - name: organization_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Organization ID. This is required for access control. It can be
            provided via query or request body depending on the endpoint.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowRunCreateRequest'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowRunDetail'
          description: ''
        '400':
          content:
            application/json:
              schema:
                oneOf:
                  - type: array
                    items:
                      type: string
                    description: >-
                      DRF ValidationError raised with a message string: the body
                      is a bare JSON array of error messages.
                  - type: object
                    additionalProperties:
                      oneOf:
                        - type: array
                          items:
                            type: string
                        - type: string
                    description: >-
                      Validation failure: a map of field name to a list of error
                      messages (DRF serializers) or a single message (e.g.
                      organization_id validation).
                  - type: object
                    properties:
                      error:
                        type: string
                    required:
                      - error
                    description: Hand-built application error body.
                description: >-
                  Bad request. The body is a bare array of messages, a
                  field-error map, or an {error} object depending on which
                  validation failed.
          description: ''
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetailResponse'
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetailResponse'
          description: ''
      security:
        - apiKeyAuth: []
components:
  schemas:
    WorkflowRunCreateRequest:
      type: object
      properties:
        inputs:
          type: object
          additionalProperties: true
          description: >-
            Values for the workflow's inputs, keyed by input. A file input takes
            a file id or URL, or the file itself in a multipart request.
        version_id:
          type: string
          format: uuid
          description: The version to run. Defaults to the current one.
        metadata:
          additionalProperties: true
          type: object
        wait:
          type: boolean
          default: false
          description: >-
            Wait up to 60 seconds for the run to finish, then return it as it
            stands.
    WorkflowRunDetail:
      type: object
      properties:
        id:
          type: string
          format: uuid
        workflow_id:
          type: string
          format: uuid
        version_id:
          type:
            - string
            - 'null'
          format: uuid
        status:
          $ref: '#/components/schemas/WorkflowRunStatusEnum'
        error_message:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        inputs: {}
        outputs:
          type:
            - array
            - 'null'
          items: {}
          description: The result step's output, once the run has finished.
        steps:
          type: array
          items:
            $ref: '#/components/schemas/StepRun'
      required:
        - created_at
        - error_message
        - id
        - inputs
        - outputs
        - status
        - steps
        - version_id
        - workflow_id
    ErrorDetailResponse:
      type: object
      description: 'DRF default error body: NotFound, PermissionDenied, Http404, etc.'
      properties:
        detail:
          type: string
          description: Human-readable error detail
      required:
        - detail
    WorkflowRunStatusEnum:
      enum:
        - pending
        - running
        - succeeded
        - failed
        - cancelled
      type: string
      description: |-
        * `pending` - pending
        * `running` - running
        * `succeeded` - succeeded
        * `failed` - failed
        * `cancelled` - cancelled
    StepRun:
      type: object
      properties:
        step_id:
          type: string
          maxLength: 200
        execution_path: {}
        status:
          $ref: '#/components/schemas/StepRunStatusEnum'
        cached:
          type: boolean
        input:
          oneOf:
            - {}
            - type: 'null'
        output:
          oneOf:
            - {}
            - type: 'null'
        error:
          type:
            - string
            - 'null'
        child_job_id:
          type:
            - string
            - 'null'
          format: uuid
          readOnly: true
        delivery:
          description: >-
            For a step that sends: sending, sent, or unknown when Roe couldn't
            tell whether the send went through.


            * `sending` - Sending

            * `sent` - Sent

            * `unknown` - Unknown
          oneOf:
            - $ref: '#/components/schemas/StepRunDeliveryEnum'
            - type: 'null'
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - child_job_id
        - execution_path
        - status
        - step_id
    StepRunStatusEnum:
      enum:
        - succeeded
        - failed
        - skipped
        - cancelled
      type: string
      description: |-
        * `succeeded` - succeeded
        * `failed` - failed
        * `skipped` - skipped
        * `cancelled` - cancelled
    StepRunDeliveryEnum:
      enum:
        - sending
        - sent
        - unknown
      type: string
      description: |-
        * `sending` - Sending
        * `sent` - Sent
        * `unknown` - Unknown
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key passed as a Bearer token. This is the scheme used
        by the public SDK surface.

````

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