---
title: "Update Trigger Rule"
method: PATCH
path: "/trigger-rules/{trigger_rule_id}"
tags: ["trigger-rules"]
---

# Update Trigger Rule

`PATCH /trigger-rules/{trigger_rule_id}`

## Path parameters

- `trigger_rule_id` string, required

## Request body

- UpdateTriggerRuleRequest — Partial patch. Only the fields supplied are written. ``conditions`` replaces the whole set when supplied — a condition has no stable client-facing identity, so a merge would be ambiguous. Omit to leave them alone. Changing ``trigger_condition_type`` keeps the rule's id, and fire-time state is keyed on that id: the rate-limit window, alert dedup, and channel-join cooldown all live per rule. A rule switched between types therefore inherits the old type's windows and its first fire under the new type can be suppressed by them. Condition fields are also type-specific, so a type change usually wants new ``conditions`` in the same request.
  - `trigger_condition_type` 'MESSAGE_DATA' | 'CHANNEL_JOIN' — The type of condition for a self-serve trigger.
  - `context_source` 'CHANNEL_TOPIC' | 'CHANNEL_PURPOSE' | 'MESSAGE_CONTENT' | 'MESSAGE_THREAD_CONTENT' | 'ALL'
  - `channel_id` string, nullable — Omit to leave unchanged.
  - `conditions` TriggerConditionPayload[], nullable — Replaces every condition on the rule. Omit (null) to leave unchanged.
    - `field` 'sender_email' | 'sender_name' | 'message_text' | 'channel_name' | 'sender_id' | 'channel_topic' | 'channel_purpose', required
    - `operator` 'contains' | 'starts_with' | 'ends_with' | 'equals' | 'not_equals' | 'does_not_contain', required
    - `value` string, required
  - `resident_agent_template_id` string, nullable — Template to point this rule at. Omit to leave unchanged. Detach by managing the attachment set on the template instead.

## Response `200`

Successful Response

- TriggerRuleResponse
  - `id` string, required
  - `organization_id` string, nullable, required
  - `integration_id` string, nullable, required
  - `trigger_condition_type` string, required
  - `context_source` string, required
  - `channel_id` string, required
  - `conditions` TriggerConditionResponse[], required
    - `id` string, required
    - `field` string, required
    - `operator` string, required
    - `value` string, required
  - `resident_agent_template_id` string, nullable, required
  - `created_at` string, date-time, required
  - `created_by_user_uuid` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/traversal/apis/fastapi.md) · [All operations](https://skmtc.net/traversal/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/traversal/fastapi/revisions/2134ebffd1ef/schema)
