---
title: "Report document activity"
method: POST
path: "/rest/api/v1/activity"
tags: ["Activity"]
---

# Report document activity

`POST /rest/api/v1/activity`

Report user activity that occurs on indexed documents such as viewing or editing. This signal improves search quality.

## Request body

- Activity
  - `events` ActivityEvent[], required
    - `id` string — Universally unique identifier of the event. To allow for reliable retransmission, only the earliest received event of a given UUID is considered valid by the server and subsequent are ignored.
    - `action` 'VIEW' | 'EDIT' | 'SEARCH' | 'COMMENT' | 'CRAWL' | 'HISTORICAL_SEARCH' | 'HISTORICAL_VIEW', required — The type of activity this represents.
    - `params` ActivityEventParams
      - `bodyContent` string — The HTML content of the page body.
      - `datasourceInstance` string — The full datasource instance name inferred from the URL of the event
      - `datasource` string — The datasource without the instance inferred from the URL of the event
      - `instanceOnlyName` string — The instance only name of the datasource instance, e.g. 1 for jira_1, inferred from the URL of the event
      - `duration` integer — Length in seconds of the activity. For VIEWS, this represents the amount the page was visible in the foreground.
      - `query` string — The user's search query associated with a SEARCH.
      - `referrer` string — The referring URL of the VIEW or SEARCH.
      - `title` string — The page title associated with the URL of the event
      - `truncated` boolean — Indicates that the parameters are incomplete and more parameters may be sent with the same action+timestamp+URL in the future. This is used for sending the duration when a `VIEW` is finished.
    - `timestamp` string, date-time, required — The ISO 8601 timestamp when the activity began.
    - `url` string, required — The URL of the activity.

## Response `200`

OK

## Other responses

- `400` — Invalid request
- `401` — Not Authorized
- `429` — Too Many Requests

---

[API](https://skmtc.net/gleanwork/apis/glean-client-api.md) · [All operations](https://skmtc.net/gleanwork/apis/glean-client-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gleanwork/glean-client-api/versions/98678e54a6c5/schema)
