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

# Create a new flow execution

> Triggers a new execution of a flow via API. The flow must have an active API trigger configured.



## OpenAPI

````yaml api/legacy/openapi-agents.yaml post /flows/{flow_id}/executions
openapi: 3.0.3
info:
  title: Kapso External API - Agents & Flows API
  description: >-
    API for programmatically interacting with Kapso agents, executions, and
    WhatsApp conversations. This specification includes only Agents & Flows API
    endpoints.
  version: 1.0.0
  contact:
    name: Kapso Support
servers:
  - url: https://app.kapso.ai/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /flows/{flow_id}/executions:
    post:
      tags:
        - Flow Executions
      summary: Create a new flow execution
      description: >-
        Triggers a new execution of a flow via API. The flow must have an active
        API trigger configured.
      operationId: createFlowExecution
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - phone_number
              properties:
                phone_number:
                  type: string
                  description: >-
                    Phone number to associate with this flow execution (required
                    for conversation tracking)
                  pattern: ^\+[1-9]\d{1,14}$
                  example: '+1234567890'
                whatsapp_config_id:
                  type: string
                  format: uuid
                  description: >-
                    Optional WhatsApp configuration to use for this execution.
                    Must belong to the project (direct or via customer). When
                    omitted, uses project's default WhatsApp config.
                  example: config-123abc
                variables:
                  type: object
                  description: Variables to pass to the flow execution
                  additionalProperties: true
                  example:
                    user_id: '123'
                    name: John Doe
                    email: john@example.com
                context:
                  type: object
                  description: Additional context for the execution
                  additionalProperties: true
                  example:
                    source: mobile_app
                    version: 1.2.3
                initial_data:
                  type: object
                  description: Initial data to pass to the flow
                  additionalProperties: true
      responses:
        '202':
          description: Flow execution accepted and queued
          content:
            application/json:
              schema:
                type: object
                properties:
                  flow_id:
                    type: string
                    format: uuid
                    description: ID of the flow being executed
                  tracking_id:
                    type: string
                    format: uuid
                    description: Unique tracking ID for this execution request
                  message:
                    type: string
                    example: Flow execution queued
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Flow not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Flow cannot be executed or validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Flow is not active
                  details:
                    type: string
                    example: >-
                      Flow must be in active status and have an active API
                      trigger, or whatsapp_config_id does not belong to this
                      project
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          example: Resource not found
        status:
          type: integer
          example: 404
        message:
          type: string
          example: The requested resource could not be found
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key required for all endpoints

````