Preview a segment

The live count for a segment definition without saving it: how many contacts match now, how many of those are subscribed (who a campaign would reach),…

POSThttps://app.usenotix.dev/api/v1/contactBooks/{contactBookId}/segments/preview

Needs a full access key. Sending access keys cannot call this. Key permissions lists the extra rules some calls have.

The live count for a segment definition without saving it: how many contacts match now, how many of those are subscribed (who a campaign would reach), any problems that make it match nothing, and up to 5 matching contacts. Use it to show the audience before a campaign binds to a segment. Nothing is written.

Path parameters

contactBookIdstringrequired

Body parameters

definitionobjectrequired
definition.versionnumberrequired

One of 1.

definition.matchstringrequired

One of all, any.

definition.conditionsobject[]required

Headers

Authorizationstringrequired

Bearer followed by your API key.

Errors

400

The definition is not valid, or names a campaign or journey the team does not have.

404

No contact book with this id for the calling team.

422

The definition took longer than 10 seconds to evaluate.

Every error has the same shape. See all error codes.

curl -X POST "https://app.usenotix.dev/api/v1/contactBooks/<contactBookId>/segments/preview" \
  -H "Authorization: Bearer $NOTIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "definition": {
    "version": 1,
    "match": "all",
    "conditions": [
      {
        "type": null,
        "match": null,
        "conditions": null
      }
    ]
  }
}'
Response200
{
  "contactBookId": "cm1x8f3k20001qz7v5b9d2e4a",
  "count": 1,
  "subscribedCount": 1,
  "problems": [
    "string"
  ],
  "sample": [
    {
      "id": "cm1x8f3k20001qz7v5b9d2e4a",
      "email": "customer@example.com",
      "firstName": "Acme",
      "lastName": "Acme",
      "subscribed": true
    }
  ]
}
Open in ClaudeOpen in ChatGPT