# Audit log

An append-only record of every change. See ADR 0006.

Part of the [Celerbeam API and MCP reference](https://celerbeam.com/docs/api/index.md). HTML version: https://celerbeam.com/docs/api/audit-log/

## List the platform's audit events

`GET /v1/audit-events`

Every audit event on the platform, newest first: each Organisation's, and the platform-level ones that belong to no Organisation, such as sign-ins and device registrations. Each event's `org` says which. The Platform admin only. `organisation` narrows it to one Organisation, `route` and `action` to a route and an action, `q` to events a text appears in, and `from` (inclusive) and `to` (exclusive) to a range of times. An `action` without a dot, e.g. `viewer`, matches every `viewer.*` action. `actors` gives the email of each User who acted in the page. A page can hold fewer items than `limit`, even none, and still have a `next_cursor`.

- MCP tool: `list_platform_audit_events` (read-only)
- Auth: Bearer token (`bearerAuth`)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `cursor` | query | `string` | no | The `next_cursor` from the previous page. Omit it for the first page. At least 1 character. |
| `limit` | query | `integer` | no | The most items to return. 1 to 100. Default `50`. |
| `route` | query | `AuditRoute` | no | Only events that came through this route. |
| `action` | query | `AuditActionFilter` | no | Only this action, e.g. `viewer.deactivated`, or, without a dot, every action on that entity, e.g. `viewer`. |
| `from` | query | `Timestamp` | no | Only events at or after this time. |
| `to` | query | `Timestamp` | no | Only events before this time. |
| `organisation` | query | `OrganisationId` | no | Only this Organisation's events. |
| `q` | query | `string` | no | Only events this text appears in, ignoring case: the acting User's email, an API key's ID, an ID the event acted on or any field that identified it (an email, a name, a Watermark code), or the event's own ID. 1 to 100 characters. |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | One page of audit events, and who acted in them. | `PlatformAuditEventPage` (`application/json`) |
| 400 | The request is malformed or fails validation (`invalid_request`), or an ID has the wrong prefix for its field (`invalid_id`). `errors` names each invalid field. | `Problem` (`application/problem+json`) |
| 401 | No valid bearer token (`unauthenticated`). Header `WWW-Authenticate`: The bearer challenge, per RFC 6750. | `Problem` (`application/problem+json`) |
| 403 | The caller can see the resource, but their Role doesn't allow this operation (`forbidden`). The attempt is audited with `result=denied`. | `Problem` (`application/problem+json`) |

## List an Organisation's audit events

`GET /v1/organisations/{organisation_id}/audit-events`

One Organisation's audit events, newest first. Admins of that Organisation and the Platform admin only.

- MCP tool: `list_audit_events` (read-only)
- Auth: Bearer token (`bearerAuth`)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `organisation_id` | path | `OrganisationId` | yes | Organisation ID. |
| `cursor` | query | `string` | no | The `next_cursor` from the previous page. Omit it for the first page. At least 1 character. |
| `limit` | query | `integer` | no | The most items to return. 1 to 100. Default `50`. |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | One page of audit events. | `AuditEventPage` (`application/json`) |
| 400 | The request is malformed or fails validation (`invalid_request`), or an ID has the wrong prefix for its field (`invalid_id`). `errors` names each invalid field. | `Problem` (`application/problem+json`) |
| 401 | No valid bearer token (`unauthenticated`). Header `WWW-Authenticate`: The bearer challenge, per RFC 6750. | `Problem` (`application/problem+json`) |
| 403 | The caller can see the resource, but their Role doesn't allow this operation (`forbidden`). The attempt is audited with `result=denied`. | `Problem` (`application/problem+json`) |
| 404 | The resource doesn't exist, or the caller can't see it (`not_found`). The two are never told apart. | `Problem` (`application/problem+json`) |

## Schemas

### AuditRoute

How a change reached the Backend (ADR 0006 `route`).

Type: `string`. One of `app`, `api`, `mcp`, `website`, `system`.

### AuditActionFilter

An action, `<entity>.<past_tense_verb>`, or an entity on its own.

Type: `string`. At most 100 characters. Pattern `^[a-z][a-z0-9]*(_[a-z0-9]+)*(\.[a-z][a-z0-9]*(_[a-z0-9]+)*)?$`. Examples: `viewer.deactivated`, `viewer`.

### Timestamp

UTC, with milliseconds and a `Z` suffix.

Type: `string (date-time)`. Pattern `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$`. Example: `2026-11-28T14:27:03.412Z`.

### OrganisationId

Organisation ID.

Type: `string`. Exactly 18 characters. Pattern `^ORG[a-z0-9]{15}$`. Example: `ORG8hfaw8hfpwhjf94`.

### PlatformAuditEventPage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | `array of AuditEvent` | yes |  |
| `next_cursor` | `string \| null` | yes | An opaque cursor for the next page, or `null` on the last page. |
| `actors` | `array of AuditActor` | yes | Each User named as an `actor` in `items`, once. API keys and `system` aren't Users, so they aren't listed. |

### CursorPage

One page of a list. A list response combines this with its own `items` through `allOf`. Pass `next_cursor` back as `cursor` to get the next page; it is `null` on the last page.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | `array of any` | yes |  |
| `next_cursor` | `string \| null` | yes | An opaque cursor for the next page, or `null` on the last page. |

### AuditEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `AuditEventId` | yes | Audit event ID. |
| `at` | `Timestamp` | yes | UTC, with milliseconds and a `Z` suffix. |
| `org` | `OrganisationId \| null` | yes | The Organisation the event belongs to, or `null` for a platform-level event. |
| `actor` | `UserId \| ApiKeyId \| string` | yes | Who made the change. `system` for the Backend's own actions. |
| `actor_role` | `string \| null` | yes | The actor's Role when they acted. `null` when the actor is `system`, or on a platform-level event by a User who isn't the Platform admin, e.g. a sign-in. One of `viewer`, `member`, `admin`, `platform_admin`, `null`. |
| `route` | `AuditRoute` | yes | How a change reached the Backend (ADR 0006 `route`). |
| `source` | `AuditSource` | yes | Where the change came from. Fields that don't apply are `null`. |
| `action` | `string` | yes | `<entity>.<past_tense_verb>`, in snake_case. Pattern `^[a-z][a-z0-9]*(_[a-z0-9]+)*\.[a-z][a-z0-9]*(_[a-z0-9]+)*$`. Examples: `organisation.created`, `viewer.deactivated`. |
| `target` | `array of AuditTarget` | yes | The IDs acted on, each with the fields that identified it at that moment. |
| `change` | `object \| null` | yes | Before and after values of the fields that changed, keyed by field name, or `null` when nothing changed. Never holds secrets. |
| `result` | `string` | yes | One of `ok`, `denied`. |
| `reason` | `string \| null` | yes | Why the attempt was denied, as a Problem `code`. `null` when `result` is `ok`. |
| `request_id` | `string \| null` | yes | Links the event to the API request logs. `null` for system actions. |

### AuditEventId

Audit event ID.

Type: `string`. Exactly 18 characters. Pattern `^EVT[a-z0-9]{15}$`. Example: `EVT8hfaw8hfpwhjf94`.

### UserId

User ID.

Type: `string`. Exactly 18 characters. Pattern `^USR[a-z0-9]{15}$`. Example: `USR8hfaw8hfpwhjf94`.

### ApiKeyId

API key ID.

Type: `string`. Exactly 18 characters. Pattern `^KEY[a-z0-9]{15}$`. Example: `KEY8hfaw8hfpwhjf94`.

### AuditSource

Where the change came from. Fields that don't apply are `null`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | `string \| null` | yes |  |
| `country` | `string \| null` | yes | ISO 3166-1 alpha-2. Pattern `^[A-Z]{2}$`. |
| `device_id` | `DeviceId \| null` | yes |  |
| `app_version` | `string \| null` | yes |  |
| `user_agent` | `string \| null` | yes |  |

### DeviceId

Device ID.

Type: `string`. Exactly 18 characters. Pattern `^DEV[a-z0-9]{15}$`. Example: `DEV8hfaw8hfpwhjf94`.

### AuditTarget

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `AnyId` | yes | An ID of any registered type. |
| `snapshot` | `object` | yes | The fields that identified the target at that moment, e.g. a Viewer's `email` and `watermark_code`. |

### AnyId

An ID of any registered type.

Type: `string`. Exactly 18 characters. Pattern `^(USR|ORG|MEM|CHN|BRD|SSN|DEV|PLN|KEY|WHK|EVT|ALR|RLY|RCT|REL|CRS|INV|EML|UPL|SEG|PRD|LDG|IVC|DLV|EVN|SGN|ERR|LOG|APS)[a-z0-9]{15}$`. Example: `ORG8hfaw8hfpwhjf94`.

### AuditFieldChange

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `before` | `any` | yes | The value before the change, or `null` when the field was new. |
| `after` | `any` | yes | The value after the change, or `null` when the field was removed. |

### AuditActor

A User who acted in the page.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `UserId` | yes | User ID. |
| `email` | `Email` | yes | An email address. Compared case-insensitively, and returned in lower case. |

### Email

An email address. Compared case-insensitively, and returned in lower case.

Type: `string (email)`. At most 254 characters. Example: `jason@northgate.example`.

### Problem

An RFC 9457 problem details object, sent as `application/problem+json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `string (uri-reference)` | yes | A URI identifying the problem type. `about:blank` when `code` says enough. Example: `about:blank`. |
| `title` | `string` | yes | A short, human-readable summary of the problem type. Example: `Not found`. |
| `status` | `integer` | yes | The HTTP status code. 400 to 599. Example: `404`. |
| `code` | `string` | yes | A stable, snake_case machine code. Clients branch on this, never on `title`. Pattern `^[a-z][a-z0-9]*(_[a-z0-9]+)*$`. Examples: `not_found`, `invalid_id`. |
| `detail` | `string` | no | A human-readable explanation of this occurrence. |
| `instance` | `string (uri-reference)` | no | The request path that produced the problem. |
| `request_id` | `string` | yes | Links the problem to the request logs and any audit event. |
| `started_by` | `UplinkSessionStarter` | no | `channel_in_use` only: who started the Channel's active Uplink session. |
| `reason` | `string` | no | `session_ended` only: `idle` (unused past its window) or `signed_out` (by another session, e.g. after a password change). One of `idle`, `signed_out`. |
| `errors` | `array of ProblemFieldError` | no | One entry per invalid field, for `invalid_request` and `invalid_id`. |
| `retry_after_seconds` | `integer` | no | `rate_limited` only: how long to wait before trying again, in seconds. At least 0. |

### UplinkSessionStarter

Who pressed Start.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | `UserId` | yes | User ID. |
| `name` | `string` | yes | How to show them. Their email, until Users have names. Example: `mike@northgate.example`. |

### ProblemFieldError

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `pointer` | `string` | no | A JSON Pointer into the request body, e.g. `/first_admin_email`. |
| `parameter` | `string` | no | The name of the path, query or header parameter, e.g. `organisation_id`. |
| `detail` | `string` | yes | What is wrong with the field. |

### AuditEventPage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | `array of AuditEvent` | yes |  |
| `next_cursor` | `string \| null` | yes | An opaque cursor for the next page, or `null` on the last page. |
