Create Rule

View as Markdown
Create a new automation rule for opportunities. **Payload fields:** - `name` (required): Rule name - max 191 chars - `description` (optional): Free text - max 1000 chars - `entity_type` (required): "opportunity" for this endpoint - `trigger_type` (required): Valid TriggerType enum (e.g. OPPORTUNITY_STAGE_CHANGED, OPPORTUNITY_WON, OPPORTUNITY_LOST) - `priority` (optional): Integer 0-100 - lower fires first - default 50 - `is_active` (optional): Boolean - default true - `stop_subsequent_rules` (optional): Boolean - if true, halts rule chain on match - `cooldown_hours` (optional): Integer hours - dedupe within window - null = no cooldown - `conditions[]` (required, min 1): Array of condition rows (see Leads/Create Rule for sub-keys) - `actions[]` (required, min 1): Array of action rows (see Leads/Create Rule for sub-keys) **Payload fields:** - `name` (required): Rule name - max 191 chars - `description` (optional): Free text - max 1000 chars - `entity_type` (required): "lead" or "opportunity" matching the route - `trigger_type` (required): Valid TriggerType enum case - `priority` (optional): Integer 0-100 - lower fires first - default 50 - `is_active` (optional): Boolean - default true - `stop_subsequent_rules` (optional): Boolean - halts chain when true - `cooldown_hours` (optional): Integer hours - dedupe within window - blank = no cooldown - `conditions[i][...]` (required, min 1): condition rows. Each row has `field_path`, `operator`, one of `value_int|value_string|value_array|value_bool|value_datetime` (polymorphic by operator), and optional `sort_order`. - `actions[i][...]` (required, min 1): action rows. Each row has `action_type`, `sort_order`, and action_type-specific keys (e.g. `assign_pool_id` for `ASSIGN_USER`).

Headers

{{tenant_key_name}}stringOptional

Request

This endpoint expects a multipart form.
namestringRequired

Required: Rule name - max 191 chars

prioritystringRequired

Optional: Integer 0-100 - lower fires first - default 50

is_activestringRequired

Optional: bool - default true

descriptionstringRequired

Optional: Free text - max 1000 chars

entity_typestringRequired

Required: “opportunity” for this endpoint

trigger_typestringRequired

Required: Valid TriggerType enum case

stop_subsequent_rulesstringRequired

Optional: bool - halts chain on match

actions[0][sort_order]stringRequired

Optional: Integer - default 0

actions[0][action_type]stringRequired

Required: ASSIGN_USER|CHANGE_STAGE|TAG|NOTIFY|…

conditions[0][operator]stringRequired

Required: EQUALS|NOT_EQUALS|IN|NOT_IN|GT|GTE|LT|LTE|CONTAINS|EXISTS|…

conditions[0][field_path]stringRequired

Required: Dotted accessor (e.g. opportunity.opportunity_stage_id)

conditions[0][sort_order]stringRequired

Optional: Integer - default 0

actions[0][assign_pool_id]stringRequired

Conditional: required when action_type=ASSIGN_USER. User pool UUID.

Response

Successful response