> ## 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 flow trigger

> Creates a new trigger for a flow (inbound_message or api_call)



## OpenAPI

````yaml api/legacy/openapi-agents.yaml post /flows/{flow_id}/triggers
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}/triggers:
    post:
      tags:
        - Flow Triggers
      summary: Create a flow trigger
      description: Creates a new trigger for a flow (inbound_message or api_call)
      operationId: createFlowTrigger
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - trigger
              properties:
                trigger:
                  type: object
                  required:
                    - trigger_type
                  properties:
                    trigger_type:
                      type: string
                      enum:
                        - inbound_message
                        - api_call
                      description: Type of trigger to create
                      example: inbound_message
                    active:
                      type: boolean
                      description: Whether the trigger should be active
                      default: true
                      example: true
                    whatsapp_config_id:
                      type: string
                      format: uuid
                      description: >-
                        Required for inbound_message triggers, not used for
                        api_call triggers
                      example: config-123abc
            examples:
              inbound_message_trigger:
                summary: Create an inbound message trigger
                description: >-
                  Creates a trigger that fires when a WhatsApp message is
                  received
                value:
                  trigger:
                    trigger_type: inbound_message
                    active: true
                    whatsapp_config_id: config-789ghi
              api_call_trigger:
                summary: Create an API call trigger
                description: Creates a trigger that can be invoked via API
                value:
                  trigger:
                    trigger_type: api_call
                    active: true
      responses:
        '201':
          description: Flow trigger created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/FlowTrigger'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Flow or WhatsApp config not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid trigger type or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    FlowTrigger:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: trigger-123abc
        flow_id:
          type: string
          format: uuid
          example: flow-456def
        trigger_type:
          type: string
          enum:
            - inbound_message
            - api_call
          example: inbound_message
          description: Type of trigger (inbound_message or api_call)
        active:
          type: boolean
          example: true
          description: Whether the trigger is active
        display_name:
          type: string
          example: Customer Support Trigger
          description: Display name for the trigger
        triggerable:
          type: object
          description: Details specific to the trigger type
          oneOf:
            - type: object
              description: InboundMessageTrigger details
              properties:
                id:
                  type: string
                  format: uuid
                  example: inbound-trigger-123
                whatsapp_config_id:
                  type: string
                  format: uuid
                  example: config-789ghi
            - type: object
              description: ApiCallTrigger details
              properties:
                id:
                  type: string
                  format: uuid
                  example: api-trigger-456
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    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

````