ReferenceCampaigns API
Preview automatic segment rules
POST
Evaluates automatic Inbox dialog rules live without writing segment members.
- Returns matching
totaland up to 20samples(name,phone,bsuid). - When
segmentIdis provided, also returnsadded,removed, andunchangedcounts compared against the segment's current members. - Evaluates pure Inbox audience predicates only; stoplist (
excludeStoplist) and blocked-dialog (excludeBlocked) exclusions are configured per campaign. - Invalid filter payloads return
400with{ "code": "invalid_filter" }.
bearerheader
AuthorizationBearer <API key>Key issued in Settings → Developer → API key. Inbox methods need the Inbox scope. Campaigns methods need the Campaigns scope.
application/json- body
rules*Rules to evaluate live against Inbox dialogs.
segmentId?stringExisting segment id. When set, response includes added/removed/unchanged vs current members (materialized list).
application/json- response
total*numberHow many contacts match the rules right now.
samples*array<>Up to 20 sample contacts from the live evaluate.
added?numberContacts that would be added vs current members (when segmentId was provided).
removed?numberContacts that would leave vs current members (when segmentId was provided).
unchanged?numberContacts unchanged vs current members (when segmentId was provided).
curl -X POST 'https://api.1msg.io/api/v1/campaigns/segments/preview' \ -H 'Content-Type: application/json' \ -d '{ "rules": { "channelId": "cm3channel01", "predicates": [ { "field": "lastCustomerMessageAt", "op": "gte" } ] }}'Example Response
{ "total": 42, "samples": [ { "name": "Ada Lovelace", "phone": "+5511999990001", "bsuid": null } ], "added": 3, "removed": 1, "unchanged": 38}