Update a segment
Partially update a segment: rename it, change its channel or replace its rules.
Endpoint
PATCH/campaign-segments/:id
Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | No | Segment name. |
channel | string | No | whatsapp, instagram, messenger, email, automation, sms or ai_calling. |
builder_type | string | No | manual or ai. |
query | object | null | Manual rules. Replaces the stored rules; see the query object. | |
ai_sql_query | string | null | AI selector. Validated and test-run before saving; an empty string clears it. | |
ai_explanation | string | null | Explanation of the AI selector. | |
ai_prompt | string | null | Request the AI selector was generated from. |
Request
Replace the rules:
Rename:
Response
The updated segment object (without total_persons).
query rules are not validated on save: an invalid field or operator is stored as is (its total_persons then reads 0). Check the result with Preview the contacts of a segment.
Errors
| Status | When |
|---|---|
400 | Invalid channel or builder_type, or an ai_sql_query that is not a valid read-only selector or fails when run. |
404 | The segment does not exist, is deleted or belongs to another organization. |
Report an issue with this documentation
Please log in to report issues with our documentation.