API Reference
Pathway Rules

Pathway Rules

Pathway rules provide conditional overrides on top of base pathway configs. Rules let you customise episode routing based on event properties — for example, routing VIP appointment bookings to a specific team, or silencing billing episodes for certain invoice types.

Endpoints

MethodEndpointDescription
GET/pathway-rulesList rules
GET/pathway-rules/{id}Retrieve a rule
POST/pathway-rulesCreate a rule
PATCH/pathway-rules/{id}Update a rule
DELETE/pathway-rules/{id}Delete a rule

The Rule Object

{
  "id": "rule_123e4567-e89b-12d3-a456-426614174000",
  "trigger_type": "appointment.booked",
  "rule_name": "VIP bookings → urgent priority",
  "priority": 0,
  "conditions": {
    "appointment_type_ids": ["type_vip_consultation"]
  },
  "creation_mode": null,
  "inbox_visibility": null,
  "journey_type": null,
  "suggested_assignment": "usr_team_lead",
  "suggested_priority": "urgent",
  "expected_next_actor": null,
  "enabled": true,
  "created_at": "2025-01-01T00:00:00Z",
  "updated_at": "2025-01-01T00:00:00Z"
}

Override fields set to null inherit from the base pathway config. Only non-null fields take effect.

How Rules are Evaluated

Rules are evaluated in priority order (lowest number first). The first matching rule wins — its non-null fields override the base config. If no rules match, the base config applies.


List Rules

GET /pathway-rules

Sorted by trigger_type ascending, then priority ascending (evaluation order).

Query Parameters

ParameterTypeDescription
limit / offsetintegerPagination (default 20)
trigger_typestringFilter by trigger type
enabledstringFilter enabled/disabled
creation_modestringFilter by creation mode override
suggested_prioritystringFilter by suggested priority

Create a Rule

POST /pathway-rules

Supports idempotency via Idempotency-Key header.

Required Fields

FieldTypeDescription
trigger_typestringWhich trigger this rule applies to
rule_namestringHuman-readable name
priorityintegerEvaluation order (0 = first, must be non-negative)

Optional Override Fields

All override fields are nullable — set to null to inherit from the base config:

FieldTypeDescription
conditionsobjectCondition matching (JSON object)
creation_modestringOverride creation mode
inbox_visibilitystringOverride inbox visibility
journey_typestringOverride journey type
suggested_assignmentstringSuggested assignee
suggested_prioritystringlow, medium, high, urgent
expected_next_actorstringpractice or patient
enabledbooleanEnable/disable this rule
⚠️

Each (trigger_type, priority) combination must be unique within your organisation. Attempting to create or update a rule with a duplicate priority returns 409 CONFLICT.


Update a Rule

PATCH /pathway-rules/{id}

All fields from the create endpoint are updatable except trigger_type (changing trigger type requires delete + create).


Delete a Rule

DELETE /pathway-rules/{id}

Permanently deletes the rule. The base config will apply to events that would have matched this rule.

Response

{
  "data": null,
  "meta": {
    "request_id": "req_abc123"
  }
}

Gaps in the priority sequence after deletion are fine — rules are evaluated by priority order, not contiguous numbering.


Related Resources