Query an audience without saving it

Runs a rule list now and answers with the counts GET /segments/{id}/preview gives plus the first limit matching contacts.

POST/v1/segments/preview

Body Parameters

  • matchall, any

    Default "all".

  • rulesarray of SegmentRule

    At most 10 items.

  • topic_idstring

    Topic id or name: eligible also removes contacts unsubscribed from it

  • limitinteger

    How many matching contacts to return Default 25. Maximum 100. Minimum 0.

Details

Use it to ask cohort questions (who replied in the last 7 days, who got a batch and did not reply, who did one event and not another) before saving the rules as a segment to page through or send to. eligible + opted_out + topic_unsubscribed = matched.

Responses

  • 200JSON object

    Counts and the first contacts

  • 400Error

    Invalid rules

  • 401Error

    Missing, malformed, or revoked API key

  • 402Error

    Billable live calls only: the prepaid credit balance cannot cover the call (insufficient_credits); nothing was done or charged

  • 429Error

    Rate limit or quota exceeded

Response Fields

  • objectsegment_preview
  • segment_idstring

    Nullable.

  • topic_idstring

    Nullable.

  • contacts_totalinteger
  • matchedinteger
  • opted_outinteger
  • topic_unsubscribedinteger
  • eligibleinteger
  • contactsarray of Contact

Errors

Every error has the same JSON shape, and request_id matches the X-Request-Id response header. Errors lists every code and what to do about it.

  • 400

    Invalid rules

  • 401

    Missing, malformed, or revoked API key

  • 402

    Billable live calls only: the prepaid credit balance cannot cover the call (insufficient_credits); nothing was done or charged

  • 429

    Rate limit or quota exceeded