Skip to main content

GET /api/v1/triggers

List all trigger rules sorted by priority descending.

Query Parameters

ParameterTypeDefaultDescription
statusstringFilter by status
eventTypestringFilter by event type
limitinteger50Max results (max 200)
offsetinteger0Pagination offset

Response

{
  "data": [
    {
      "id": "trigger_001",
      "name": "High-Value Purchase Trigger",
      "eventType": "purchase",
      "actionType": "enroll_journey",
      "actionConfig": { "journeyId": "journey_001" },
      "condition": { "field": "amount", "operator": "greater_than", "value": 500 },
      "priority": 80,
      "cooldownMs": 86400000,
      "status": "active",
      "createdAt": "2026-02-20T10:00:00.000Z"
    }
  ],
  "pagination": { "total": 12, "limit": 50, "offset": 0, "hasMore": false }
}

POST /api/v1/triggers

Create a new trigger rule.

Request Body

FieldTypeRequiredDescription
namestringYesTrigger name
eventTypestringYesEvent type to match (e.g., "purchase", "page_view", "login")
actionTypestringYesAction to fire: "enroll_journey", "webhook", "decision_request"
actionConfigobjectNoAction-specific configuration
conditionobjectNoCondition to evaluate against event payload
descriptionstringNoDescription
priorityintegerNoPriority (higher = evaluated first). Default: 50
cooldownMsintegerNoCooldown period in milliseconds before the trigger can fire again for the same customer. Default: 0

Example

curl -X POST https://playground.kaireonai.com/api/v1/triggers \
  -H "Content-Type: application/json" \
  -H "X-Tenant-Id: my-tenant" \
  -d '{
    "name": "High-Value Purchase Trigger",
    "eventType": "purchase",
    "actionType": "enroll_journey",
    "actionConfig": { "journeyId": "journey_001" },
    "condition": { "field": "amount", "operator": "greater_than", "value": 500 },
    "priority": 80,
    "cooldownMs": 86400000
  }'
Response: 201 Created

GET /api/v1/triggers/

Get trigger rule details.

PUT /api/v1/triggers/

Update a trigger rule. Only provided fields are updated.
FieldTypeDescription
namestringUpdated name
descriptionstringUpdated description
eventTypestringUpdated event type
conditionobjectUpdated condition
actionTypestringUpdated action type
actionConfigobjectUpdated action config
cooldownMsintegerUpdated cooldown
priorityintegerUpdated priority
statusstringUpdated status
Response: 200 OK

DELETE /api/v1/triggers/

Delete a trigger rule. Requires admin role. Response: 204 No Content

POST /api/v1/triggers//test

Dry-run a trigger against a sample event payload. Returns whether the trigger would fire without actually executing the action.

Request Body

FieldTypeRequiredDescription
eventPayloadobjectYesSample event data to test against the trigger’s condition

Response

{
  "wouldFire": true,
  "reason": "All conditions matched"
}
{
  "wouldFire": false,
  "reason": "Condition did not match the provided payload"
}

Roles

EndpointAllowed Roles
GET /triggersadmin, editor
POST /triggersadmin, editor
PUT /triggers/{id}admin, editor
DELETE /triggers/{id}admin
POST /triggers/{id}/testadmin, editor
See also: Triggers