> ## Documentation Index
> Fetch the complete documentation index at: https://developers.dock.us/llms.txt
> Use this file to discover all available pages before exploring further.

# Workspace analytics

> Pull the numbers behind every workspace Activity tab in bulk.

Every tab of a workspace's **Activity** page has an endpoint. Each returns the same numbers you see in the app, for one workspace or for every workspace in your company.

| Activity tab | Endpoint | One row per |
| - | - | - |
| Summary (and the AI summary) | [`GET /v1/workspaces/analytics`](https://developers.dock.us/api-reference/endpoint/workspace-analytics/retrieve-workspace-analytics) | workspace |
| People | [`GET /v1/workspaces/analytics/people`](https://developers.dock.us/api-reference/endpoint/workspace-analytics/retrieve-workspace-people-analytics) | workspace member |
| Pages | [`GET /v1/workspaces/analytics/pages`](https://developers.dock.us/api-reference/endpoint/workspace-analytics/retrieve-workspace-page-analytics) | workspace page |
| Assets (library assets and files) | [`GET /v1/workspaces/analytics/assets`](https://developers.dock.us/api-reference/endpoint/workspace-analytics/retrieve-workspace-asset-analytics) | library asset or file (`kind`) |
| Feed | [`GET /v1/workspaces/events`](https://developers.dock.us/api-reference/endpoint/workspace-analytics/retrieve-workspace-events) | event |

## Choosing workspaces

All five endpoints take the same filters:

* `filters[workspaceId]`: one or more workspace IDs, comma-separated (up to 100).
* `filters[accountId]` and `filters[templateId]`: the same filters as [`GET /v1/workspaces`](https://developers.dock.us/api-reference/endpoint/workspaces/retrieve-a-list-of-workspaces).

Leave out `filters[workspaceId]` to report on every workspace. Archived workspaces and playbooks are never included. The four analytics endpoints order rows by workspace creation date, so paging with `page` and `limit` is stable. The assets endpoint pages by workspace instead of by row: each page holds every row of up to `limit` workspaces. The events feed pages differently, by `cursor` in order of change (see [Syncing events](#syncing-events)).

## Choosing fields

Rows have no ID of their own. Each row is numbers about things that already exist in Dock, and it always includes them as nested objects: `workspace` on every endpoint, plus `user` on people, `workspacePage` on pages, and `asset` or `file` on assets. Each has its `object`, `id` and `url`, except `file`, which has only `object` and `id` (request `file.url` for its link). Use those IDs as the row's key, for example workspace ID + user ID for a People row. Everything else is opt-in with `properties[]`:

```bash theme={null}
curl -G https://api.dock.us/v1/workspaces/analytics \
  -H "Authorization: Bearer $DOCK_API_KEY" \
  --data-urlencode "filters[workspaceId]=RiHO4e0Ju3DS" \
  --data-urlencode "properties[]=viewsCount" \
  --data-urlencode "properties[]=timeSpentSeconds" \
  --data-urlencode "properties[]=workspace.name"
```

Fields of nested objects use a prefix: `workspace.*` on every endpoint, `user.*` on people, `workspacePage.*` and `viewers.*` on pages, and `asset.*`, `file.*` and `creator.*` on assets. Only the numbers you request are calculated, so asking for fewer fields makes requests faster.

## What the numbers count

The numbers match the Activity tab, including who each tab counts:

* **Summary**
  * **Views** and **time spent** are totals across the workspace's visible pages, the same sums the Summary tab shows.
  * **Visitors** counts distinct people who viewed the workspace, internal users included and the workspace creator excluded.
* **People** lists every workspace member, internal and external. `viewsCount` counts workspace visits.
* **Pages**
  * **Views** count page views by people whose activity is tracked.
  * **Time spent** counts external contacts.
  * Hidden pages are left out unless you pass `filters[includeHidden]=true`.
* **Assets**
  * Asset counts include everyone who opened the asset in the workspace.
  * Only files uploaded to the workspace itself (`file.source: Project`) have counts.

> [!NOTE]
>
> These numbers can differ from **Views** and **Actions** on the Workspaces list
> and from the legacy `totalViews` and `totalActions` properties on `GET
>     /v1/workspaces`. Those count workspace sessions by external contacts, not page
> views.

Numbers are all-time totals and are calculated when you call the endpoint. The AI activity summary is returned as it was last generated, and reading it never starts a new generation.

## Syncing events

`GET /v1/workspaces/events` returns the Feed tab's events, oldest change first, with the same type names as [webhook events](https://developers.dock.us/webhooks/event-types.md). Use it to backfill a warehouse and keep it current, alongside or instead of webhooks.

1. **First request:** call it without `cursor`. Add `filters[updatedAfter]` to skip older history.
2. **Keep paging:** pass the response's `nextCursor` as `cursor` while `hasMore` is `true`. Send the same `filters` every time; a cursor only works with the filters it was issued for.
3. **Stay current:** store the last `nextCursor` and call again later (for example every few minutes) to get what changed since.
4. **Upsert by `id`:** an event can come back with the same `id` when it changes, for example when more time is spent on a page view. Replace your stored copy.
5. **Roll up time from page views:** only page views carry `timeSpentSeconds`. To get a visit's time, add up the page views whose `parentEventId` is that `workspace.viewed` event.

Things to know:

* Events appear about two minutes after they happen, so changes still being saved aren't skipped. A save that takes longer than two minutes to finish, which is rare, can be missed.
* A page can hold fewer than `limit` events, even none, while `hasMore` is `true`, because events with no public type and events outside `filters[type]` are skipped. Follow `hasMore`, not the count.
* Like the Feed tab, events from contacts whose activity tracking is turned off are left out, except comments, messages, completed tasks, signed order forms and course events.
* Events carry IDs and names only. Fetch comment, message and form content from their own endpoints.
* Deleted events are not reported. When an account or workspace is deleted or archived, or a contact's activity tracking is turned off, their earlier events stop appearing; the feed does not send a removal.

## Rate limits

The analytics and events endpoints share their own bucket of **60 requests per minute** per company, separate from the rest of the API, so a bulk export doesn't slow down your other integrations. Every request still counts toward your company's combined limit of 210 requests per minute. See [Rate limits](https://developers.dock.us/api-reference/rate-limits.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.