> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a workflow

> Executes a workflow with the specified trigger data



## OpenAPI

````yaml /api-reference/endpoint/hub-flows/openapi.json post /hub/workflows/{collection_topic}/{flow_topic}/run
openapi: 3.0.0
info:
  title: quiva.ai Gateway
  description: API for managing collections, nodes, and workflows in quiva.ai Hub
  version: 0.1.0
  contact:
    name: quiva.ai Support
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Collections
    description: Operations related to collections
  - name: Nodes
    description: Operations related to nodes
  - name: Workflows
    description: Operations related to workflows
  - name: Oauth
    description: Oauth configurations and connections
paths:
  /hub/workflows/{collection_topic}/{flow_topic}/run:
    parameters:
      - $ref: '#/components/parameters/collectionTopic'
      - $ref: '#/components/parameters/flowTopic'
      - $ref: '#/components/parameters/queryDraftFlag'
    post:
      tags:
        - Workflows
      summary: Run a workflow
      description: Executes a workflow with the specified trigger data
      operationId: runWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunWorkflowRequest'
            examples:
              singleTriggerSync:
                summary: Single trigger with synchronous execution
                value:
                  trigger:
                    user_id: user_123
                    action: process_order
                    data:
                      order_id: ORD-456
                      items:
                        - sku: PROD-001
                          quantity: 2
                        - sku: PROD-002
                          quantity: 1
                      total: 149.99
                  enable_log: true
                  await: true
              singleTriggerAsync:
                summary: Single trigger with asynchronous execution
                value:
                  trigger:
                    event_type: webhook
                    payload:
                      source: external_system
                      data:
                        key: value
                  enable_log: false
                  await: false
              multipleTriggers:
                summary: Multiple triggers for batch processing
                value:
                  triggers:
                    - user_id: user_001
                      email: user1@example.com
                      notification_type: welcome
                    - user_id: user_002
                      email: user2@example.com
                      notification_type: welcome
                    - user_id: user_003
                      email: user3@example.com
                      notification_type: welcome
                  enable_log: true
                  await: false
              minimalTrigger:
                summary: Minimal trigger with just data
                value:
                  trigger:
                    message: Hello, World!
              complexTrigger:
                summary: Complex trigger with nested data
                value:
                  trigger:
                    timestamp: 1651395678
                    source: api
                    customer:
                      id: cust_789
                      name: John Doe
                      email: john@example.com
                      tier: premium
                    order:
                      id: ORD-12345
                      items:
                        - product_id: P001
                          name: Widget
                          quantity: 5
                          unit_price: 19.99
                        - product_id: P002
                          name: Gadget
                          quantity: 2
                          unit_price: 49.99
                      shipping:
                        method: express
                        address:
                          street: 123 Main St
                          city: Springfield
                          country: US
                    metadata:
                      utm_source: google
                      campaign_id: summer_sale
                  enable_log: true
                  await: true
      responses:
        '200':
          description: Workflow executed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunWorkflowResponse'
              examples:
                awaitedSuccess:
                  summary: Synchronous execution completed
                  value:
                    trackingId: >-
                      ms.hub.run.abcdef-1234-5678-90ab-cdef12345678.ms.hub.config.workflow.1234567890.98765432
                    result:
                      status: completed
                      order_id: ORD-456
                      processed_at: '2024-01-15T10:30:00Z'
                      confirmation_number: CONF-789012
                notAwaitedSuccess:
                  summary: Asynchronous execution started
                  value:
                    trackingId: >-
                      ms.hub.run.fedcba-9876-5432-10ab-cdef98765432.ms.hub.config.workflow.1234567890.98765432
                debouncedRun:
                  summary: Debounced execution
                  value:
                    body: 'debounced run: user_123-notifications'
                orderedRun:
                  summary: Ordered execution queued
                  value: 'ordered run: order_queue-ORD-456'
                complexResult:
                  summary: Complex workflow result
                  value:
                    trackingId: >-
                      ms.hub.run.12345678-abcd-efgh-ijkl-mnopqrstuvwx.ms.hub.config.workflow.9876543210.11111111
                    result:
                      validation:
                        status: passed
                        checks:
                          - inventory
                          - payment
                          - fraud
                      processing:
                        order_id: ORD-12345
                        payment_id: PAY-67890
                        fulfillment_id: FUL-11111
                      notifications_sent:
                        - type: email
                          status: sent
                        - type: sms
                          status: sent
                      metadata:
                        duration_ms: 1523
                        nodes_executed: 7
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NoTrigger:
                  value:
                    error: no trigger specified
                ArchivedFlow:
                  value:
                    error: cannot run an archived flow
                MissingConfig:
                  value:
                    error: missing configuration
                NodesRequired:
                  value:
                    error: nodes are required
                DebounceError:
                  value:
                    error: failed to resolve debounceOn
                OrderOnError:
                  value:
                    error: failed to resolve orderOn
components:
  parameters:
    collectionTopic:
      name: collection_topic
      in: path
      description: >-
        The topic is a hash of the name that was used when a collection was
        created
      required: true
      schema:
        type: string
      example: '1234567890'
    flowTopic:
      name: flow_topic
      in: path
      description: Flow topic - hash of the names the node was created with
      required: true
      schema:
        type: string
      example: '21312322'
    queryDraftFlag:
      name: draft
      in: query
      description: Draft flag
      required: false
      schema:
        type: boolean
      example: true
  schemas:
    RunWorkflowRequest:
      type: object
      properties:
        trigger:
          type: object
          description: Trigger data for workflow execution (use either trigger or triggers)
        triggers:
          type: array
          items:
            type: object
          description: Multiple trigger data sets for parallel workflow execution
        enable_log:
          type: boolean
          description: Whether to enable logging of workflow execution
          default: false
        await:
          type: boolean
          description: Whether to wait for workflow completion
          default: false
    RunWorkflowResponse:
      oneOf:
        - type: object
          properties:
            trackingId:
              type: string
              description: ID for tracking the workflow execution
            result:
              type: object
              description: Result of the workflow execution
        - type: string
          description: Status message for debounced or ordered executions
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Authorization header using the Bearer scheme
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````