Features
Segments
Create dynamic audience segments
Overview
Dynamic segments filter your contacts based on a set of rules. Segments are evaluated in real time, so the list of matching contacts always reflects the current state of your data. Use segments to target specific audiences for campaigns, A/B tests, or one-off sends.
List Segments
Retrieve all segments along with their rule definitions.
/api/segmentsReturns all segments with their rule definitions and contact counts.
Response
[
{
"id": 1,
"name": "Active Enterprise",
"rules": [
{ "field": "status", "operator": "equals", "value": "active" },
{ "field": "company", "operator": "contains", "value": "Inc" }
],
"contacts_count": 142
},
{
"id": 2,
"name": "Recent Signups",
"rules": [
{ "field": "created_at", "operator": "after", "value": "2026-01-01" }
],
"contacts_count": 58
}
]Create Segment
Create a new segment by providing a name and an array of filter rules. Rules are combined with AND logic, meaning contacts must match all conditions to be included.
/api/segmentsCreate a new dynamic segment with filter rules.
Parameters
| Name | Type | Description |
|---|---|---|
name* | string | Display name for the segment |
rules* | array | JSON array of filter conditions |
Request
{
"name": "Active Enterprise",
"rules": [
{ "field": "status", "operator": "equals", "value": "active" },
{ "field": "company", "operator": "contains", "value": "Inc" }
]
}Response
{
"id": 3,
"name": "Active Enterprise",
"rules": [
{ "field": "status", "operator": "equals", "value": "active" },
{ "field": "company", "operator": "contains", "value": "Inc" }
],
"contacts_count": 142
}Get Segment Contacts
Retrieve the list of contacts that currently match a segment's rules.
/api/segments/contacts?segment_id=1Returns all contacts that match the segment's filter rules.
Parameters
| Name | Type | Description |
|---|---|---|
segment_id* | number | ID of the segment to query |
Response
[
{
"id": 12,
"email": "alice@acme-inc.com",
"name": "Alice Chen",
"company": "Acme Inc",
"status": "active"
},
{
"id": 34,
"email": "bob@globex-inc.com",
"name": "Bob Martin",
"company": "Globex Inc",
"status": "active"
}
]Rule Format
Each rule is a JSON object with three fields: field, operator, and value. Multiple rules are combined with AND logic.
[
{
"field": "status",
"operator": "equals",
"value": "active"
},
{
"field": "company",
"operator": "contains",
"value": "Inc"
}
]Supported operators include equals, not_equals,contains, not_contains,starts_with, before, and after. The available fields correspond to contact properties such as status, company,email, name, and created_at.