Skip to main content

Overview

Analytics and usage endpoints

Available Operations

getUserActivity

Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass workspace_id to scope the response to a single workspace. Pass group_by=workspace to split each row per workspace and include workspace_id on every item; by default rows are aggregated across workspaces and workspace_id is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). A workspace-scoped management key needs activity:view_all on its own workspace and reads only that workspace: an omitted workspace_id defaults to it, a workspace_id naming any other workspace returns 403, api_key_hash and user_id resolve only keys and members of that workspace, and legacy activity with no workspace is excluded (including for the default workspace). Management key required.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<models.ActivityResponse>

Errors

getAnalyticsMeta

Returns the available metrics, dimensions, filter operators, and granularities for the analytics query endpoint. Workspace-scoped management keys are accepted. Management key required.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.GetAnalyticsMetaResponse>

Errors

queryAnalytics

Execute an analytics query with specified metrics, dimensions, filters, and time range. A workspace-scoped management key needs activity:view_all on its own workspace and reads only that workspace: it is refused a workspace filter naming another workspace, it excludes legacy rows with no workspace (including for the default workspace), and possible-cache metrics such as possible_cached_tokens return 400. Management key required.

Example Usage

Standalone function

The standalone function version of this method:

Parameters

Response

Promise<operations.QueryAnalyticsResponse>

Errors