Skip to Content
1MSG
ReferenceCampaigns API

Preview automatic segment rules

POST
/api/v1/campaigns/segments/preview

Evaluates automatic Inbox dialog rules live without writing segment members.

  • Returns matching total and up to 20 samples (name, phone, bsuid).
  • When segmentId is provided, also returns added, removed, and unchanged counts 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 400 with { "code": "invalid_filter" }.

Authorization

bearer
headerAuthorizationBearer <API key>

Key issued in Settings → Developer → API key. Inbox methods need the Inbox scope. Campaigns methods need the Campaigns scope.

Request Body

application/json
  1. body
rules*

Rules to evaluate live against Inbox dialogs.

segmentId?string

Existing segment id. When set, response includes added/removed/unchanged vs current members (materialized list).

Response Body

application/json
  1. response
total*number

How many contacts match the rules right now.

samples*array<>

Up to 20 sample contacts from the live evaluate.

added?number

Contacts that would be added vs current members (when segmentId was provided).

removed?number

Contacts that would leave vs current members (when segmentId was provided).

unchanged?number

Contacts unchanged vs current members (when segmentId was provided).

Example Request
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}