Event catalog
GET /catalog lists one project’s events for a bounded window: the name, the exact count, and when the event was first and last seen. Each event includes its property keys, with a type, how often the key is present in the sample, and a few example values. Read it before POST /query or POST /sql so the filter names a key the project actually sends.
Discover your schema before querying
Section titled “Discover your schema before querying”Call catalog when the next query needs a real event name, a property type, and an example value. Property types, presence, and examples come from a sample of the newest 40 rows of that event. Counts, first_seen, and last_seen are exact for the window. Example values are email-redacted.
Call properties (GET /properties, MCP tool properties, CLI properties) when you only need exact event counts, unique users, and one flat list of recent property keys. That list has no types, no presence, no examples, and no per-event pages. The MCP tool properties accepts days from 1 to 365. GET /properties/received (MCP properties_received, CLI properties-received) lists distinct key and event pairs from a recent sample, without counts or types.
Call sql (POST /sql) when POST /query cannot say the question. sql runs one SELECT on the events and sessions columns. It does not list custom property keys. Read the catalog, then write the statement. query stays the supported read for a count, a breakdown, or one properties.<key> group.
GET /catalog
Auth is an API key, a project key, or an agent session. An agent session or a project key needs analytics:read.
Pro only. A free account receives 403 PRO_REQUIRED. That response is not metered. One successful call counts as one metered read.
A project with saved context also receives project_context, the same optional field as the other project analytics reads. The field is omitted when the project has no stored context.
This page describes the hosted route.
Parameters
Section titled “Parameters”| Name | Required | Default | Rule |
|---|---|---|---|
project |
yes | Project name or id. The response project field is the stored name. |
|
days |
no | 7 | Integer from 1 through 90. |
date_from, date_to |
no | YYYY-MM-DD. Send both. Inclusive span at most 90 days. Do not combine with days. |
|
limit |
no | 10 | Events per page. Integer from 1 through 18. |
property_limit |
no | 25 | Property keys per event. Integer from 1 through 40. |
cursor |
no | Opaque cursor from next_cursor. |
|
properties_cursor |
no | Opaque cursor from properties_next_cursor. Pass cursor or properties_cursor, not both. |
A missing project is 400 MISSING_FIELDS with message project is required. An unknown project, or a project outside the session, is 404 PROJECT_NOT_FOUND with message project not found or unauthorized. That body does not include the requested name.
A bad window is 400 INVALID_WINDOW. A bad limit, a bad cursor, a cursor issued for another window, or both cursors is 400 VALIDATION_ERROR. Send the same window the cursor was issued for. Cursors are opaque and do not contain the project name.
Response
Section titled “Response”Events are ordered by name. count is exact in the window. first_seen and last_seen are ISO-8601 timestamps from MIN and MAX(timestamp). Stored values are milliseconds. A value under 1e12 is treated as seconds.
Property keys are alphabetical. A key longer than 128 characters is omitted. type is string, number, boolean, object, array, null, or mixed. JSON integers and reals are number. true and false are boolean. A numeric string stays string. types counts the sample. presence is present / sample_size, rounded to 4 decimal places. queryable is true when the key matches ^[A-Za-z0-9_]{1,128}$. groupable is true for that same charset when the length is at most 64. examples has up to 3 values, each at most 80 characters after redaction. Objects and arrays contribute no examples.
sampling.properties is newest_dates. sampling.per_event is 40. properties_exact is true when count is at most 40 and sample_size includes every counted row. Invalid JSON and a null properties value still count in sample_size. The sample is the newest dates, not a uniform sample across the window. Rows that share a date are not ordered by timestamp.
Example values are always returned, so a filter can match a real shape. Email-shaped text is replaced with [redacted-email]. A key whose name contains email replaces the whole example. An email nested in an object or array is omitted with that value. There is no parameter that returns the raw example. To look a person up by email, use the email field on POST /query.
next_cursor continues the event list. properties_next_cursor continues one event’s keys. Either value is null when that page is complete.
The route does not take the /sql lease. The server does not cache the body, so an event that just started arriving shows up on the next call.
Errors
Section titled “Errors”| Status | Code | When |
|---|---|---|
| 400 | MISSING_FIELDS |
project is missing. Message: project is required. |
| 400 | INVALID_WINDOW |
days or the date pair is outside the window rules. |
| 400 | VALIDATION_ERROR |
Bad limit or property_limit, a bad cursor, a cursor from another window, or both cursors. |
| 403 | PRO_REQUIRED |
Free account. Not metered. |
| 403 | FORBIDDEN |
Agent session is missing analytics:read. Message: agent session missing required scope: analytics:read. |
| 404 | PROJECT_NOT_FOUND |
Unknown project, or a project outside the session. The body does not include the requested name. Message: project not found or unauthorized. |
| 429 | The D1 read budget is exhausted, or the upstream database returned 429. | |
| 500 | DATABASE_NOT_PROVISIONED |
The account has no customer database. |
| 500 | QUERY_FAILED |
The database read failed for another reason. |
Example
Section titled “Example”{ "project": "my-site", "window": { "date_from": "2026-11-14", "date_to": "2026-11-20" }, "order": "event", "counts": "exact", "sampling": { "properties": "newest_dates", "per_event": 40, "exact_when": "count is at most per_event and the sample includes every counted row" }, "redaction": { "examples": "email", "raw_examples": false }, "events": [ { "event": "page_view", "count": 1280, "first_seen": "2026-11-14T00:12:03.000Z", "last_seen": "2026-11-20T15:04:05.000Z", "sample_size": 40, "properties_exact": false, "properties": [ { "key": "path", "type": "string", "types": { "string": 40 }, "queryable": true, "groupable": true, "present": 40, "presence": 1, "examples": ["/", "/pricing"] }, { "key": "email", "type": "string", "types": { "string": 12 }, "queryable": true, "groupable": true, "present": 12, "presence": 0.3, "examples": ["[redacted-email]"] } ], "properties_next_cursor": null } ], "next_cursor": null}The MCP tool catalog is planned. It will call GET /catalog with the query fields above.
The current schema tool is properties. It calls GET /properties. properties_received calls GET /properties/received.
The command catalog is planned. It will call GET /catalog.
The current schema commands are:
agent-analytics properties my-siteagent-analytics properties-received my-site