Preview a segment
GET/api/v1/segments/{id}/preview
GET /segments/{id}/preview
curl -X GET 'https://www.unitpost.com/api/v1/segments/seg_123/preview' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'User-Agent: my-app/1.0'Response · 200
{
"object": "segment_preview",
"segment_id": "segment_123",
"archived": false,
"member_count": 1,
"subscribed_count": 1,
"sample": [
{
"id": "id_123",
"email": "customer@example.com",
"first_name": "string",
"last_name": "string"
}
]
}How many contacts a saved segment reaches: its members, the subscribed set a campaign would mail (0 means a campaign would send nothing), and a sample (which also needs contacts:read). Requires the segments:read capability.
Parameters1 field
| Field | Type | Description |
|---|---|---|
idrequired | string · path | — |
Response · 200 fields6 fields
| Field | Type | Description |
|---|---|---|
objectrequired | string | — |
segment_idrequired | string | null | The saved segment, or null for an unsaved filter. |
archivedrequired | boolean | null | Whether the saved segment is archived (a campaign can't target it); null for an unsaved filter. |
member_countrequired | integer | Contacts that match (or are members). |
subscribed_countrequired | integer | Of those, the ones a campaign would mail: not unsubscribed. 0 means an empty send. |
samplerequired | object[] | Up to 3 of the subscribed set. Empty without `contacts:read`. |
200401403404422