# Activity log

`crm.activity` — `/v1/channels/:channelId/logs`

What happened to a channel, and who did it — the owner, the agency, or the
platform itself.

**Read-only**, and written by the services as they work. Wallet movements share
the feed with ordinary activity, so `type: 'activity'` is the filter for
"everything except money"; for the money itself with its running balance, read
the [wallet ledger](wallet.md) instead.

| Action | Route | Scope |
| --- | --- | --- |
| [`list`](#list) | `GET /v1/channels/:channelId/logs` | `channels:read` |

**Permissions** — `CRM.CHANNEL.LOG.LIST`. Its own feature rather than part of
reading the channel, because the log exposes message traffic.

## The activity log object

```ts
interface ActivityLog {
  id: string;
  source: {
    type?: 'user' | 'agency' | 'system';
    id?: string;
  };
  log: {
    type?: 'wallet' | 'activity';
    event: string;     // machine name, e.g. 'template.approved'
    message: string;   // human-readable line for the feed
  };
  createdAt: string;
  updatedAt: string;
}
```

---

## list

```ts
crm.activity.list(channelId: string, query?: Partial<ListActivityLogsQuery>): Promise<Paginated<ActivityLog>>
```

`GET /v1/channels/:channelId/logs` · `channels:read` · **200**

Newest first.

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `page` | number | `1` | 1-based. |
| `rows` | number | `25` | 1–100. |
| `search` | string | — | 1–120 chars. Matches the **event name and the message**. |
| `type` | `'wallet' \| 'activity'` | — | Quick filter. |
| `source` | `'user' \| 'agency' \| 'system'` | — | Quick filter: who caused the entry. |
| `event` | string | — | Quick filter: one exact event name, 1–120 chars. |
| `range` | `{ start, end }` | — | Unix seconds. `0` on either end means no bound. Serialised to JSON by the SDK. |

```ts
// Everything the platform did to this channel this week
const feed = await crm.activity.list(channelId, {
  source: 'system',
  type: 'activity',
  range: { start: weekStart, end: 0 },
});

// One event's history
const approvals = await crm.activity.list(channelId, { event: 'template.approved' });
```
