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

# Replace workflow triggers

> Atomically replace the full set of triggers for a workflow. All existing triggers are deleted and the supplied set is created in a single transaction — if any trigger in the request is invalid, no changes are applied.

Use this when syncing trigger configuration from an external source of truth. For per-trigger CRUD, use POST/PATCH/DELETE instead.




## OpenAPI

````yaml /api/platform/v1/openapi-workflows.yaml put /workflows/{workflow_id}/triggers
openapi: 3.1.0
info:
  title: Kapso Platform API – Advanced Resources
  version: 0.1.0
  description: >
    Build WhatsApp automation workflows and serverless functions. Create
    multi-step conversation flows, inspect executions, and deploy custom logic.
servers:
  - url: https://api.kapso.ai/platform/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Workflows
    description: Create and manage conversation workflows and executions
  - name: Workflow Triggers
    description: Configure workflow triggers to automate execution
  - name: Functions
    description: Manage serverless functions, deployments, and secrets
  - name: WhatsApp Conversations
    description: Query WhatsApp conversation data and related resources
paths:
  /workflows/{workflow_id}/triggers:
    parameters:
      - name: workflow_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: Workflow identifier
    put:
      tags:
        - Workflow Triggers
      summary: Replace workflow triggers
      description: >
        Atomically replace the full set of triggers for a workflow. All existing
        triggers are deleted and the supplied set is created in a single
        transaction — if any trigger in the request is invalid, no changes are
        applied.


        Use this when syncing trigger configuration from an external source of
        truth. For per-trigger CRUD, use POST/PATCH/DELETE instead.
      operationId: replaceWorkflowTriggers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowTriggerBulkReplaceRequest'
      responses:
        '200':
          description: Triggers replaced successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowTriggerListResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    WorkflowTriggerBulkReplaceRequest:
      type: object
      required:
        - triggers
      properties:
        triggers:
          type: array
          description: >
            Complete desired set of triggers. Existing triggers not in this list
            are deleted. An empty array removes all triggers.
          items:
            type: object
            required:
              - trigger_type
            properties:
              trigger_type:
                type: string
                enum:
                  - inbound_message
                  - api_call
                  - whatsapp_event
                  - project_event
              active:
                type: boolean
                default: true
              phone_number_id:
                type: string
                description: >-
                  Required for `inbound_message`. Optional scope for
                  `whatsapp_event`. Not used for `api_call`.
              event:
                type: string
                enum:
                  - whatsapp.message.received
                  - whatsapp.message.sent
                  - whatsapp.message.failed
                  - whatsapp.conversation.created
                  - whatsapp.conversation.ended
                description: Required for `whatsapp_event` triggers.
              event_name:
                type: string
                description: Required for `project_event` triggers.
                example: conversation.csat_scored
              property_key:
                type: string
                description: Optional Project Event property key to filter on.
              operator:
                type: string
                enum:
                  - eq
                  - lt
                  - lte
                  - gt
                  - gte
                description: Optional Project Event property comparison operator.
              property_value:
                description: Optional non-null Project Event property comparison value.
      description: >
        Atomic bulk-replace request body. Use with `PUT
        /workflows/{workflow_id}/triggers` to declaratively sync trigger
        configuration.
    WorkflowTriggerListResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowTrigger'
      description: List of workflow triggers
    WorkflowTrigger:
      type: object
      required:
        - id
        - workflow_id
        - trigger_type
        - active
      properties:
        id:
          type: string
          format: uuid
          description: Unique trigger identifier
        workflow_id:
          type: string
          format: uuid
          description: ID of the workflow this trigger belongs to
        trigger_type:
          type: string
          enum:
            - inbound_message
            - api_call
            - whatsapp_event
            - project_event
          description: >
            Trigger activation mechanism:

            - `inbound_message`: Triggered by incoming WhatsApp messages to a
            specific phone number

            - `api_call`: Triggered by POST /workflows/{id}/executions API calls

            - `whatsapp_event`: Triggered by WhatsApp events (message and
            conversation lifecycle)

            - `project_event`: Triggered by an emitted Project Event
        active:
          type: boolean
          description: >
            Whether this trigger is enabled. Inactive triggers will not start
            workflow executions even when their conditions are met. Use this to
            temporarily disable a trigger without deleting it.
        display_name:
          type:
            - string
            - 'null'
          description: |
            Human-readable trigger name. Format varies by type:
            - Inbound message: "WhatsApp: [phone number display name]"
            - API call: "API Call Trigger"
            - Project event: "Event: [event name]"
        created_at:
          type: string
          format: date-time
          description: Trigger creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last modification timestamp
        triggerable:
          type: object
          description: >
            Type-specific trigger configuration. Structure varies by
            trigger_type:

            - For `inbound_message`: Contains phone_number_id

            - For `api_call`: Empty object

            - For `whatsapp_event`: Contains event and optional phone_number_id

            - For `project_event`: Contains event_name and optional property
            filter fields
          oneOf:
            - type: object
              description: Inbound message trigger configuration
              required:
                - phone_number_id
              properties:
                phone_number_id:
                  type: string
                  description: >-
                    WhatsApp Business phone number ID that will trigger the
                    workflow
            - type: object
              description: API call trigger configuration (no additional fields)
              additionalProperties: false
            - type: object
              description: WhatsApp event trigger configuration
              required:
                - event
              properties:
                event:
                  type: string
                  enum:
                    - whatsapp.message.received
                    - whatsapp.message.sent
                    - whatsapp.message.failed
                    - whatsapp.conversation.created
                    - whatsapp.conversation.ended
                  description: WhatsApp event type that will trigger the workflow
                phone_number_id:
                  type: string
                  description: >-
                    Optional WhatsApp Business phone number ID to scope trigger
                    to specific number
            - type: object
              description: Project Event trigger configuration
              required:
                - event_name
              properties:
                event_name:
                  type: string
                  description: >-
                    Lowercase dotted snake_case Project Event name that starts
                    the workflow.
                  example: conversation.csat_scored
                property_key:
                  type:
                    - string
                    - 'null'
                  description: Optional Project Event property key to filter on.
                  example: score
                operator:
                  type:
                    - string
                    - 'null'
                  enum:
                    - eq
                    - lt
                    - lte
                    - gt
                    - gte
                    - null
                  description: Optional property comparison operator.
                property_value:
                  description: >-
                    Optional non-null comparison value when `property_key` and
                    `operator` are provided.
      description: Workflow trigger defining when and how a workflow execution should start
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
  responses:
    UnauthorizedError:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Request validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````