sendsend.email

Preview a segment

POST/v1/segments/preview

Try rules out before you save them: how many contacts match, and up to five of their addresses. Nothing is stored.

Required scope: contacts:manage

Request body

FieldType
audience_idrequiredstring
matchoptional"all" | "any"
rulesrequiredany[]

Unknown fields are rejected, so a typo never silently does nothing.

Example

curl -X POST 'https://api.sendsend.email/v1/segments/preview' \
  -H "Authorization: Bearer $SENDSEND_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "audience_id": "aud_7Qe2…",
  "match": "all",
  "rules": [
    {
      "field": "property",
      "key": "plan",
      "op": "equals",
      "value": "pro"
    },
    {
      "field": "status",
      "op": "is",
      "value": "subscribed"
    }
  ]
}'

Response 200

{
  "object": "segment_preview",
  "count": 184,
  "sample": [
    "maria@example.com",
    "li@example.com"
  ]
}

Errors

StatusCodeWhen
400validation_errorThe request body or parameters are invalid. The message says which field.
404not_foundNo such resource in this project.
401unauthorizedThe API key is missing, invalid or revoked.
403forbiddenThe key does not have the scope this endpoint needs.

Every error has the same shape. See Errors.