Skip to Content
Docs

Preview an ad-hoc filter without saving it

POST
/v1/segments/preview

Compiles filter and returns its live count plus a first page of matching contacts — powers a live segment builder while the user is still editing.

Authorization

bearerAuth
headerAuthorizationBearer <token>

API key sent as Authorization: Bearer <key>. Looked up by SHA-256 hash (email_core::sha256_hex) against api_keys.hash; revoked keys and keys belonging to a suspended tenant are rejected. See the top-level Authentication section for permission levels.

Request Body

application/json
  1. body
filter*

email_core::segment::SegmentFilter, validated by parse_filter and compiled to a parameterized SQL predicate by compile_filter. At most 25 conditions; all conditions are ANDed (there is no OR).

limit?integer
Range1 <= value <= 100
Default25

Response Body

Live count + page of matches.

application/json
  1. response
count?integer
data?array<>
Example Request
curl -X POST 'https://api.emitd.com/v1/segments/preview' \  -H 'Content-Type: application/json' \  -d '{  "filter": {    "conditions": [      {        "field": "string",        "op": "eq"      }    ]  }}'
Example Response
{  "count": 0,  "data": [    {      "id": "string",      "email": "user@example.com",      "status": "subscribed",      "attributes": {},      "source": "string",      "created_at": 0,      "updated_at": 0    }  ]}