---
title: "Preview conditions"
method: POST
path: "/v1/segments/preview"
tags: ["Segments"]
---

# Preview conditions

`POST /v1/segments/preview`

## Request

- Base URL: `https://api.volanea.com`
- URL: `https://api.volanea.com/v1/segments/preview`
- Auth: HTTP bearer

Live member-count preview for a condition tree (used while building a segment). Returns the count and a small sample of matching contacts.

## Request body

- object
  - `conditions` SegmentConditions, required: Nested condition tree evaluated against contacts, their custom `data`, and their activity.
    - `logic` 'and' | 'or', required
    - `groups` object[], required
      - `filters` object[], required
        - `field` string, required: `email`, `subscribed`, `locale`, `createdAt`, `data.<key>`, `event.<name>`, `email.opened`, …
        - `operator` string, required: `equals`, `notEquals`, `contains`, `notContains`, `greaterThan`, `lessThan`, `exists`, `notExists`, `within`, `notWithin`, `triggered`, `notTriggered`, …
        - `value` union
          - string
          - number
          - boolean
        - `days` integer: Time window (days) for activity operators.

## Response `200`

Match count and sample.

- object
  - `count` integer, required
  - `sample` Contact[], required
    - `contactId` string, required
    - `projectId` string
    - `email` string, email, required
    - `firstName` string, nullable
    - `lastName` string, nullable
    - `subscribed` boolean, required
    - `data` object, nullable: Arbitrary custom fields.
    - `locale` string, nullable
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required

## Other responses

- `401`: Missing or invalid API key.
- `422`: Request validation failed (code `validation_error`, 422).

---

[API](https://skmtc.dev/volanea/apis/volanea-api.md) · [All operations](https://skmtc.dev/volanea/apis/volanea-api/llms.txt) · [OpenAPI document](https://skmtc.dev/volanea/apis/volanea-api/revisions/9e187ae84fda?raw)
