Count events

Count the events for a pixel, a project or a DelivrDSP campaign over a time window, optionally narrowed by a filter or reduced to the distinct values of one field. Use it to size a window before you pull rows with the tier routes.

Counts only, and not billed. The response is a number, never event rows.

Scope. Name one of pixel_id or project_id (source=pixel, the default), or campaign_id with source=dsp. A project counts across all its pixels.

Window. start_ms and end_ms are required, and the maximum window depends on the query:

  • A plain count: 168 hours.
  • A count with filter or distinct: 75 hours.
  • With include_cold=true: 92 days, for either kind.

A wider window returns 400.

Example. Count the page views on one pixel over one day:

GET /api/v2/event_counts?pixel_id=px_123&start_ms=1792022400000&end_ms=1792108800000&filter=event_type:eq:page_view
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
enum
Defaults to pixel

Event source type: pixel or dsp. Defaults to pixel if omitted.

Allowed:
string

Pixel identifier. Use with source=pixel.

string

Project identifier. Queries all pixels in the project (source=pixel). Also required alongside campaign_id for Bearer token auth (source=dsp).

string

Campaign identifier. Use with source=dsp. Bearer token auth requires project_id alongside campaign_id.

int64
required

Start of the window, in milliseconds since the epoch.

int64
required

End of the window, in milliseconds since the epoch. At most 168 hours after start_ms (75 hours with filter or distinct, 92 days with include_cold=true).

string

Filter expression using <field>:<op>:<value> syntax, the same grammar as the tier routes. Limits the window to 75 hours.

string

A single field. Count its distinct values instead of the events. Limits the window to 75 hours. An unknown field returns 400.

boolean
Defaults to false

When true, also read date partitions older than the event store's local retention window from cold storage (S3), and allow a longer time window of up to 92 days instead of 25 hours. Works for any source (pixel or dsp). Off by default.

Responses

400

Invalid query. A missing or invalid start_ms or end_ms, a window wider than allowed, no pixel, project or campaign, or an unknown distinct field.

401

Missing or invalid API key.

429

Rate limit exceeded.

500

Query failed.

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json