v2

latestOpenAPI 3.1.12026-07-2613060964.2 KB

Dry-run a segment query (count only)

Return the total number of users a Segment List SQL query would match, without returning the rows. Use this when you only need to size the audience.

post/v1/subscriber_list/~/dry_run/count/

Request body

query_textstring required

The SQL query to count. Must return a distinct_id column and reference only the users and events tables.

Example request

{
  "query_text": "SELECT distinct_id FROM users WHERE user_properties ->> 'plan' = 'enterprise'"
}

Response

200

countinteger

Number of distinct users matched by the query.

Example response

{
  "count": 4812
}