Update a segment

Partially update a segment: rename it, change its channel or replace its rules.

Endpoint

PATCH
/campaign-segments/:id

Body

NameTypeRequiredDescription
namestringNoSegment name.
channelstringNowhatsapp, instagram, messenger, email, automation, sms or ai_calling.
builder_typestringNomanual or ai.
queryobject | nullManual rules. Replaces the stored rules; see the query object.
ai_sql_querystring | nullAI selector. Validated and test-run before saving; an empty string clears it.
ai_explanationstring | nullExplanation of the AI selector.
ai_promptstring | nullRequest 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

StatusWhen
400Invalid channel or builder_type, or an ai_sql_query that is not a valid read-only selector or fails when run.
404The 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.