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

# Get Activity Logs

Use this API to retrieve activity log records for a document or organization.

# Endpoint

`POST https://api.velt.dev/v2/activities/get`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string">
      Document ID. Filter activities to a specific document.
    </ParamField>

    <ParamField body="targetEntityId" type="string">
      Target entity ID. Filter activities to a specific entity (e.g., annotation ID).
    </ParamField>

    <ParamField body="featureTypes" type="string[]">
      Filter by feature type. Must be one or more of: `"comment"`, `"reaction"`, `"recorder"`, `"crdt"`, `"custom"`.
    </ParamField>

    <ParamField body="actionTypes" type="string[]">
      Filter by action type (e.g., `["comment.add"]`).
    </ParamField>

    <ParamField body="userId" type="string">
      Filter activities by the acting user's ID.
    </ParamField>

    <ParamField body="activityIds" type="string[]">
      Fetch specific activities by ID.
    </ParamField>

    <ParamField body="order" type="string">
      Order results by timestamp. Must be `asc` or `desc`. Default: `desc`.
    </ParamField>

    <ParamField body="pageSize" type="number">
      Number of items to retrieve per page. Default: 1000. Minimum: 1.
    </ParamField>

    <ParamField body="pageToken" type="string">
      Encrypted pagination token retrieved from a previous API response.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Get by organizationId and documentId

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "documentId": "doc-456",
    "order": "desc",
    "pageSize": 50
  }
}
```

#### 2. Get by organizationId, documentId and featureTypes

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "documentId": "doc-456",
    "featureTypes": ["comment"],
    "order": "desc",
    "pageSize": 50
  }
}
```

#### 3. Get specific activity logs by activityIds

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "activityIds": ["activity-001", "activity-002"]
  }
}
```

#### 4. Get by targetEntityId with pagination

```JSON theme={null}
{
  "data": {
    "organizationId": "org-123",
    "documentId": "doc-456",
    "targetEntityId": "annotation-789",
    "pageSize": 20,
    "pageToken": "encryptedPageToken"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Activity(s) retrieved successfully.",
    "data": [
      {
        "id": "activity-001",
        "featureType": "comment",
        "actionType": "comment.add",
        "actionUser": {
          "userId": "user-1",
          "email": "user@example.com",
          "name": "User Name"
        },
        "targetEntityId": "annotation-789",
        "displayMessageTemplate": "{{user}} added a comment",
        "displayMessageTemplateData": {
          "user": {
            "userId": "user-1",
            "name": "User Name"
          }
        },
        "metadata": {
          "apiKey": "yourApiKey",
          "documentId": "doc-456",
          "organizationId": "org-123"
        },
        "timestamp": 1722409519944
      }
    ],
    "pageToken": "nextPageToken"
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Activity(s) retrieved successfully.",
      "data": [
        {
          "id": "activity-001",
          "featureType": "comment",
          "actionType": "comment.add",
          "actionUser": {
            "userId": "user-1",
            "email": "user@example.com",
            "name": "User Name"
          },
          "targetEntityId": "annotation-789",
          "displayMessageTemplate": "{{user}} added a comment",
          "displayMessageTemplateData": {
            "user": {
              "userId": "user-1",
              "name": "User Name"
            }
          },
          "metadata": {
            "apiKey": "yourApiKey",
            "documentId": "doc-456",
            "organizationId": "org-123"
          },
          "timestamp": 1722409519944
        }
      ],
      "pageToken": "nextPageToken"
    }
  }
  ```
</ResponseExample>
