Skip to main content

Search Analytics API

Every in-app search your team runs (the ?q= filter on messages, contacts, calls, campaigns, and the inbox) is recorded per tenant. This resource reads those records back as four aggregations for an operator dashboard — the most-run queries, the queries that returned nothing, the click-through rate per query, and the queries your search syntax could not parse — plus one endpoint to attribute a click back to the search that produced it. Use it to find the searches people rely on, the ones that come up empty (a sign of missing data or a confusing filter), and the inputs your search grammar rejects (a sign the help text or grammar needs work). Base path: /api/v1/search-analytics Authentication: API key (X-API-Key) or session JWT. All data is scoped to the calling tenant — the schema is resolved server-side and is never read from the request, so cross-tenant reads and writes are not possible. Validation failures return 422 with a VALIDATION_ERROR body; see Error codes.

Endpoints

Shared range filters

The four GET aggregation endpoints take the same query parameters, so a dashboard can share one filter state across every panel. The window is capped at 90 days. If from reaches further back than that, it is silently pinned to 90 days before to. Searches run while impersonating a tenant (support exploration) are excluded so they never skew a customer’s own numbers. Every aggregation responds with the standard envelope: the rows plus the resolved range.
Response shape

Top queries

GET /api/v1/search-analytics/top-queries returns the most-run searches over the window, ordered by count. Only successfully-parsed searches are counted. Each row:

Zero-result queries

GET /api/v1/search-analytics/zero-result returns the searches that returned no results, ordered by count — the most actionable panel, since each one is a query your team expected to match something and it did not. Each row:

Click-through rate

GET /api/v1/search-analytics/click-through returns the click-through rate per query — the share of runs where someone opened a result from the list. Only searches that returned at least one result are included. Record clicks with POST /click (below) for this panel to be meaningful. Each row:

Parse failures

GET /api/v1/search-analytics/parse-failures returns the searches that failed to parse against the search grammar, ordered by count. These point at inputs your team keeps typing that the search syntax rejects — useful for tuning the grammar or the help text. Each row:

Record a click

POST /api/v1/search-analytics/click attributes a click to the search that produced the result list, feeding the click-through panel. Call it when a user opens a result.
Record a click
The call is idempotent and safe to fire-and-forget: re-clicking the same result just refreshes the click. The response reports whether a record was stamped.
Response
recorded is false when the searchAnalyticsId does not match a search in your tenant or it has aged out of retention. This is reported as a 200, not a 404, so a client can stay fire-and-forget and so the response never reveals whether an id exists in another tenant.

See also