---
title: "Get user activity grouped by endpoint"
method: GET
path: "/activity"
tags: ["Analytics"]
---

# Get user activity grouped by endpoint

`GET /activity`

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). [Management key](/docs/guides/overview/auth/management-api-keys) required.

## Query parameters

- `date` string — Filter by a single UTC date in the last 30 days (YYYY-MM-DD format).
- `api_key_hash` string — Filter by API key hash (SHA-256 hex string, as returned by the keys API).
- `user_id` string — Filter by org member user ID. Only applicable for organization accounts.
- `group_by` 'workspace' — Set to 'workspace' to split each row per workspace and include `workspace_id` on every item. Omitted by default, in which case rows are aggregated across workspaces (by date, model, and endpoint) and `workspace_id` is not returned — preserving the historical response shape.
- `workspace_id` string — Filter by workspace ID (UUID). Returns only activity attributed to that workspace. The workspace must belong to the authenticated account.

## Response `200`

Returns user activity data grouped by endpoint

- ActivityResponse
  - `data` ActivityItem[], required — List of activity items
    - `byok_usage_inference` number, double, required — BYOK inference cost in USD (external credits spent)
    - `completion_tokens` integer, required — Total completion tokens generated
    - `date` string, required — Date of the activity (YYYY-MM-DD format)
    - `endpoint_id` string, required — Unique identifier for the endpoint
    - `model` string, required — Model slug (e.g., "openai/gpt-4.1")
    - `model_permaslug` string, required — Model permaslug (e.g., "openai/gpt-4.1-2025-04-14")
    - `prompt_tokens` integer, required — Total prompt tokens used
    - `provider_name` string, required — Name of the provider serving this endpoint
    - `reasoning_tokens` integer, required — Total reasoning tokens used
    - `requests` integer, required — Number of requests made
    - `usage` number, double, required — Total cost in USD (OpenRouter credits spent)
    - `workspace_id` string — ID of the workspace this activity is attributed to. Only present when `group_by=workspace` is passed; the response is then split per workspace. Activity recorded before workspace resolution existed is attributed to the account default workspace.

## Other responses

- `400` — Bad Request - Invalid request parameters or malformed input
- `401` — Unauthorized - Authentication required or invalid credentials
- `403` — Forbidden - Authentication successful but insufficient permissions
- `404` — Not Found - Resource does not exist
- `500` — Internal Server Error - Unexpected server error

---

[API](https://skmtc.net/openrouterteam/apis/openrouter-api.md) · [All operations](https://skmtc.net/openrouterteam/apis/openrouter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openrouterteam/openrouter-api/versions/9d1da2c7d2c3/schema)
