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

# Get Activity Logs

> Retrieve the activity log history for a task, including comments, approvals, and other actions

## Endpoint

```
GET /tasks/{task_id}/activity-logs
```

## Authentication

This endpoint requires authentication via API key. Include your API key in the `X-API-Key` header:

```bash theme={null}
X-API-Key: ca_your_api_key_here
```

## Path Parameters

| Parameter | Type    | Required | Description                    |
| --------- | ------- | -------- | ------------------------------ |
| `task_id` | integer | Yes      | Unique identifier for the task |

## Query Parameters

| Parameter            | Type    | Default | Description                                   |
| -------------------- | ------- | ------- | --------------------------------------------- |
| `limit`              | integer | 50      | Maximum number of logs to return (1–200)      |
| `offset`             | integer | 0       | Pagination offset                             |
| `only_user_comments` | boolean | false   | When `true`, only return user comment entries |

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://platform.chamelio.ai/tasks/12345/activity-logs?limit=20&offset=0&only_user_comments=true" \
    -H "X-API-Key: ca_your_api_key_here"
  ```

  ```python Python theme={null}
  import requests

  task_id = 12345

  url = f"https://platform.chamelio.ai/tasks/{task_id}/activity-logs"
  headers = {
      "X-API-Key": "ca_your_api_key_here"
  }
  params = {
      "limit": 20,
      "offset": 0,
      "only_user_comments": True
  }

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const taskId = 12345;

  const params = new URLSearchParams({
    limit: 20,
    offset: 0,
    only_user_comments: true
  });

  const response = await fetch(
    `https://platform.chamelio.ai/tasks/${taskId}/activity-logs?${params}`,
    {
      headers: {
        'X-API-Key': 'ca_your_api_key_here'
      }
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

## Response

### Success Response

**Status Code:** `200 OK`

```json theme={null}
{
  "activity_logs": [
    {
      "activity_log_id": 98765,
      "action_type": "general.comment",
      "message": "The contract has been reviewed and looks good.",
      "user_id": 42,
      "user_email": "reviewer@example.com",
      "created_at": "2025-03-15T14:30:00Z",
      "reply_to": null,
      "mention_emails": ["manager@example.com"],
      "attachment_ids": [501, 502]
    },
    {
      "activity_log_id": 98770,
      "action_type": "approval.user_approved",
      "message": "Task approved by manager@example.com",
      "user_id": 57,
      "user_email": "manager@example.com",
      "created_at": "2025-03-15T15:00:00Z",
      "reply_to": null,
      "mention_emails": [],
      "attachment_ids": []
    }
  ],
  "total_count": 2
}
```

### Response Fields

| Field           | Type    | Description                                    |
| --------------- | ------- | ---------------------------------------------- |
| `activity_logs` | array   | List of activity log entries                   |
| `total_count`   | integer | Total number of matching logs (for pagination) |

### Activity Log Entry Fields

| Field             | Type            | Description                                                            |
| ----------------- | --------------- | ---------------------------------------------------------------------- |
| `activity_log_id` | integer         | Unique ID of the activity log entry                                    |
| `action_type`     | string          | Type of action (e.g., `"general.comment"`, `"approval.user_approved"`) |
| `message`         | string          | Description of the action or comment text                              |
| `user_id`         | integer \| null | ID of the user who performed the action                                |
| `user_email`      | string \| null  | Email of the user who performed the action                             |
| `created_at`      | string          | ISO 8601 timestamp of when the action occurred                         |
| `reply_to`        | integer \| null | Activity log ID of the parent comment (if this is a reply)             |
| `mention_emails`  | array\[string]  | Emails mentioned in this entry                                         |
| `attachment_ids`  | array\[integer] | IDs of attachments associated with this entry                          |

## Error Responses

### 401 Unauthorized

Returned when authentication fails. See the [authentication errors](/api-reference/introduction#authentication-errors) section for details.

```json theme={null}
{
  "detail": "Invalid API key"
}
```

### 422 Validation Error

Returned when query parameters are invalid (e.g., `limit` outside the 1–200 range).

```json theme={null}
{
  "detail": [
    {
      "loc": ["query", "limit"],
      "msg": "ensure this value is less than or equal to 200",
      "type": "value_error.number.not_le"
    }
  ]
}
```

### 500 Internal Server Error

Returned when the request fails due to a server error.

```json theme={null}
{
  "detail": "Failed to get activity logs"
}
```

## Notes

<Info>
  Use the `activity_log_id` from these results as the `reply_to` value when [adding a comment](/api-reference/endpoint/tasks/add-comment) to create threaded conversations.
</Info>

<Tip>
  Set `only_user_comments` to `true` to filter out system-generated entries and see only comments posted by users.
</Tip>

<Tip>
  Use `limit` and `offset` together to paginate through large activity histories. The `total_count` field tells you how many entries exist in total.
</Tip>

## Use Cases

This endpoint is useful for:

* **Audit trails** - Review the full history of actions taken on a task
* **Comment syncing** - Pull task comments into external systems like Slack or a CRM
* **Threaded replies** - Fetch existing comments to display conversation threads and reply to specific entries
* **Activity dashboards** - Build custom views showing task progress and team interactions
