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

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message` from the Node SDK (`@trycourier/courier` v7 and later, where the client is the default import). Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> To translate a template, write one locale at a time with `PUT /notifications/{id}/locales/{localeId}`, which merges into the existing translations. `PUT /notifications/{id}/content` and `PUT /notifications/{id}/elements/{elementId}` overwrite translations along with the content, so send each element's `id` and `locales` back, and first remove every `checksum` and any `locales` key that starts with an underscore.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# Audit trail

> A log of API key rotations, role changes, publishes, and integration edits, with who and when. Review it in the console or through the Audit Events API.

Courier records every API key rotation, role change, publish, and integration edit.

Use it for compliance and security review, in the console or through the Audit Events API.

## How it works

### What it records

The audit trail captures configuration and access changes across the workspace:

* **API keys**: created, deleted, rotated.
* **Users**: invited, role changed, deleted, logged in, logged out.
* **Workspace settings**: name, discoverability, accessibility, SSO-required, open and click tracking toggles, send limits.
* **Custom domains**: added, removed, verified, claim expired, added to or removed from an environment.
* **Templates**: published, deleted, duplicated, draft created, rolled back, subscription topic changed, linked to or unlinked from a routing strategy.
* **Partials**: created, updated, published, archived, deleted.
* **Brands**: created, updated, published, deleted, default changed.
* **Automations**: template published or deleted.
* **Preferences**: hosted preferences page published, topic or section created or deleted, channel added to or removed from a section, topic default status changed, template linked to or unlinked from a topic.
* **Outbound integrations**: Segment, RudderStack, Datadog, and New Relic source changes.

Each event records the actor, the target that changed, the source, a timestamp, and the event type. It records workspace changes, not message delivery. For delivery history see [logs](https://www.courier.com/docs/monitor/overview.md).

### Reading the audit trail

Review events in the console under **Settings → Audit Trail**, or pull them over the API. [`GET /audit-events`](https://www.courier.com/docs/api-reference/audit-events/list-audit-events) is cursor-paginated, and [`GET /audit-events/{audit-event-id}`](https://www.courier.com/docs/api-reference/audit-events/get-an-audit-event) reads one. Use the API to forward events to a SIEM, an external log store, or a compliance dashboard.

```javascript Node.js theme={null}
const auditEvents = await client.auditEvents.list();

for (const event of auditEvents.results) {
  console.log(event.type, event.actor.email, event.timestamp);
}
```

```python Python theme={null}
audit_events = client.audit_events.list()

for event in audit_events.results:
    print(event.type, event.actor.email, event.timestamp)
```

```bash cURL theme={null}
curl https://api.courier.com/audit-events \
  -H "Authorization: Bearer $COURIER_API_KEY"
```

```ruby Ruby theme={null}
audit_events = courier.audit_events.list

audit_events.results.each do |event|
  puts "#{event.type} #{event.actor.email} #{event.timestamp}"
end
```

```go Go theme={null}
auditEvents, err := client.AuditEvents.List(context.TODO(), courier.AuditEventListParams{})
if err != nil {
	panic(err)
}

for _, event := range auditEvents.Results {
	fmt.Println(event.Type, event.Timestamp)
}
```

```java Java theme={null}
AuditEventListResponse auditEvents =
    client.auditEvents().list(AuditEventListParams.builder().build());

auditEvents.results().forEach(event ->
    System.out.println(event.type() + " " + event.timestamp()));
```

```php PHP theme={null}
$auditEvents = $client->auditEvents->list();

foreach ($auditEvents->results as $event) {
  echo $event->type . ' ' . $event->timestamp . PHP_EOL;
}
```

```csharp C# theme={null}
var auditEvents = await client.AuditEvents.List(new());

foreach (var auditEvent in auditEvents.Results)
{
    Console.WriteLine($"{auditEvent.Type} {auditEvent.Timestamp}");
}
```

```bash CLI theme={null}
courier audit-events list \
  --api-key "$COURIER_API_KEY"
```

```text MCP theme={null}
With Courier MCP, list this workspace's audit events.
```

The audit trail requires the **Enterprise** plan. [Contact Courier](https://www.courier.com/request-demo) to enable it for your workspace.

## FAQ

> [accordion] Can I pull audit events into my own system?
>
> Use [`GET /audit-events`](https://www.courier.com/docs/api-reference/audit-events/list-audit-events) to page through events and forward them to a SIEM, log store, or dashboard. Each event includes the actor, target, source, type, and timestamp.

> [accordion] Does the audit trail show message deliveries?
>
> The audit trail records workspace and access changes. For delivery history, use [message logs](https://www.courier.com/docs/monitor/overview.md).
