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

# Run Workflow by ID

> Enqueues or starts a run of the given workflow ID under the specified team and run ID. The `origin` field determines the calling context (e.g. '2' for Unity).



## OpenAPI

````yaml post /run_workflow/{team_id}/{run_id}
openapi: 3.1.0
info:
  title: Playbook API Documentation
  description: >-
    This is the documentation for the Playbook API. You can use this API to use
    our service programmatically, this is done by using your API key. <br/> You
    can view your API key using the 'User' tab on https://beta.playbook3d.com/.
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /run_workflow/{team_id}/{run_id}:
    post:
      tags:
        - run-workflow
      summary: Run a Specified Workflow
      description: >-
        Enqueues or starts a run of the given workflow ID under the specified
        team and run ID. The `origin` field determines the calling context (e.g.
        '2' for Unity).
      operationId: run_workflow
      parameters:
        - name: team_id
          in: path
          description: The team UUID to which this run will be associated.
          required: true
          schema:
            type: string
            format: uuid
        - name: run_id
          in: path
          description: >-
            A unique run UUID for identifying this workflow execution. Generated
            automatically if not supplied by user.
          required: true
          schema:
            type: string
            format: uuid
        - name: x-api-key
          in: header
          description: >-
            Your API key. This is required by most endpoints for programmatic
            access. You can view your x-api-key in the 'Profile' tab.
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer token for authentication (JWT).
          required: true
          schema:
            type: string
      requestBody:
        description: The workflow ID and optional origin and inputs for the run.
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: The workflow's unique UUID.
                origin:
                  type: string
                  description: Indicates the caller context (e.g., '2' for Unity SDK).
                inputs:
                  type: object
                  description: Any JSON data you want to pass into the workflow.
              example:
                id: b8ba9786-75aa-471d-baf2-7d0446b3f4b4
                origin: '2'
                inputs: {}
        required: true
      responses:
        '200':
          description: >-
            Workflow queued successfully. The response body typically includes
            run status info.
          content:
            application/json:
              schema:
                type: object
                properties:
                  run_id:
                    type: string
                    format: uuid
                    description: The unique run ID.
                  status:
                    type: string
                    description: Status of the newly queued workflow.
                  message:
                    type: string
                    description: Optional success/failure message.
                example:
                  run_id: eb49c4e2-e9c5-4202-aea2-86dd31493621
                  status: queued
                  message: Workflow queued successfully.
        '401':
          description: Unauthorized. The bearer token or API key is invalid.
        '403':
          description: Forbidden. User does not have permission to perform this operation.
        '404':
          description: Not Found. The resource (team, run, or workflow) does not exist.
        '422':
          description: Validation Error. The request body or parameters are malformed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                example:
                  detail:
                    - loc:
                        - body
                        - id
                      msg: field required
                      type: value_error
        '500':
          description: Internal Server Error. Something unexpected happened.
      x-codeSamples:
        - lang: cURL
          source: |-
            curl -X POST \
              -H 'x-api-key: <YOUR_API_KEY>' \
              -H 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
              -H 'Content-Type: application/json' \
              -d '{ "id": "<WORKFLOW_ID>", "origin": "2", "inputs": {} }' \
              'https://api.playbook3d.com/run_workflow/<TEAM_ID>/<RUN_ID>'
        - lang: Python
          source: |-
            import requests
            import uuid

            TEAM_ID = "<TEAM_ID>"
            WORKFLOW_ID = "<WORKFLOW_ID>"
            RUN_ID = str(uuid.uuid4())

            payload = {
                "id": WORKFLOW_ID,
                "origin": "2",
                "inputs": {}
            }

            headers = {
                "x-api-key": "<YOUR_API_KEY>",
                "Authorization": "Bearer <YOUR_JWT_TOKEN>",
                "Content-Type": "application/json"
            }

            url = f"https://api.playbook3d.com/run_workflow/{TEAM_ID}/{RUN_ID}"
            resp = requests.post(url, json=payload, headers=headers)
            print(resp.status_code, resp.json())
        - lang: JavaScript
          source: >-
            const TEAM_ID = '<TEAM_ID>';

            const WORKFLOW_ID = '<WORKFLOW_ID>';

            const RUN_ID = 'some-uuid';


            fetch(`https://api.playbook3d.com/run_workflow/${TEAM_ID}/${RUN_ID}`,
            {
              method: 'POST',
              headers: {
                'x-api-key': '<YOUR_API_KEY>',
                'Authorization': 'Bearer <YOUR_JWT_TOKEN>',
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                id: WORKFLOW_ID,
                origin: '2',
                inputs: {}
              })
            })
              .then(res => res.json())
              .then(data => {
                console.log('Status:', data.status);
                console.log('Run ID:', data.run_id);
              })
              .catch(err => console.error(err));

````