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

# Audit Trail

> Review who invited, changed, deactivated, or removed users in your Bronto organisation, and who changed teams and organisation access, by searching the audit trail.

Bronto keeps an audit trail of user management in every organisation. It records who invited, changed, deactivated, reactivated, or deleted a user, who changed a team, and who granted or revoked access to an organisation. You search the audit trail like any other log data.

The audit trail is in the `user-management` dataset of the `.audit-trail` collection.

## What the audit trail records

Bronto records one event each time a user or API key successfully makes one of these changes, in the Bronto app or through the [Bronto API](https://docs.bronto.io/api-reference/introduction.md). Requests that fail aren't recorded.

The `event_type` field is the HTTP method of the request followed by `_user`, so several actions share an event type. The `resource.info` field tells them apart.

| Action | `event_type` | `resource.id` | `resource.info` |
| - | - | - | - |
| Invite a user | `post_user` | User ID | `first_name`, `last_name`, `email`, `roles` |
| Change a user's name, roles, or login methods | `patch_user` | User ID | `roles`, plus `first_name` and `last_name` if they changed |
| Delete a user | `delete_user` | User ID | |
| Deactivate a user | `post_user` | User ID | `action`: `deactivate` |
| Reactivate a user | `post_user` | User ID | `action`: `reactivate` |
| Resend a user's invitation | `post_user` | User ID | `action`: `resend_invitation` |
| Create a team | `post_user` | Team ID | `group_name`, `org_id` |
| Rename a team | `patch_user` | Team ID | `group_name`, `org_id` |
| Delete a team | `delete_user` | Team ID | `org_id` |
| Add members to a team | `post_user` | Team ID | `members` (user IDs), `org_id` |
| Remove members from a team | `delete_user` | Team ID | `members` (user IDs), `org_id` |
| Grant access to an organisation | `post_user` | User or team ID | `org_id`, `member_type` |
| Revoke access to an organisation | `delete_user` | User or team ID | `org_id`, `member_type` |
| Set up [multi-organisation](https://docs.bronto.io/Account-Management/Multi-Org.md) | `post_user` | First 8 characters of the organisation ID | `enabled`, `enable_fallback`, `create_new_management_org`, `grant_all` |

The audit trail doesn't record sign-in or sign-out events. If your users sign in through [SSO](https://docs.bronto.io/Account-Management/SSO/SSO-Overview.md), your identity provider's sign-in logs record them.

### Event fields

| Field | Description |
| - | - |
| `time` | When the change was made, in UTC. |
| `event_type` | The HTTP method and resource type, for example `patch_user`. |
| `principal.type` | Who made the change: `user` or `apikey`. |
| `principal.id` | The ID of the user or API key. |
| `principal.info.email` | The email address of the user who made the change. Present when `principal.type` is `user`. |
| `principal.roles` | The roles held by the user or API key. |
| `resource.type` | Always `user`. |
| `resource.id` | The ID of the user, team, or organisation that was changed (see the table above). |
| `resource.info` | Details of the change (see the table above). |
| `context.request_method`, `context.request_uri` | The HTTP method and path of the request. |
| `context.query_params` | The query string of the request, if it had one. |
| `context.response_status` | The HTTP status code returned. |
| `context.source_ip` | The IP address the request came from. |
| `context.agent` | The user agent of the client that sent the request. |

### Example event

An administrator changes a user's last name in the Bronto app:

```json theme={"dark"}
{
  "time": "2026-11-25T15:44:47.852560209Z",
  "event_type": "patch_user",
  "principal": {
    "type": "user",
    "id": "41386710-0000-0000-0000-000000000000",
    "roles": ["Admin"],
    "info": { "email": "jane.doe@example.com" }
  },
  "resource": {
    "type": "user",
    "id": "c9975fcc-0000-0000-0000-000000000000",
    "info": {
      "first_name": "Alex",
      "last_name": "Smith",
      "roles": "[Standard]"
    }
  },
  "context": {
    "request_uri": "/users/c9975fcc-0000-0000-0000-000000000000",
    "request_method": "PATCH",
    "response_status": "200",
    "source_ip": "203.0.113.10",
    "agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ..."
  }
}
```

> [!TIP]
>
> Changes made with an API key identify the key, not a person. Keep a record of who owns each API key so you can trace these changes to an individual. See [API Keys](https://docs.bronto.io/Account-Management/API-Keys.md).

## Search the audit trail

### In the Bronto app

1. Go to **Logs**.
2. Under **Select**, open **Datasets**, expand the `.audit-trail` collection, and select the `user-management` dataset.
3. Choose a time range.
4. In **Filter**, enter a query. See the [sample queries](#sample-queries) below and [Search Syntax](https://docs.bronto.io/query-syntax/search-syntax.md).

Click an event to see all its fields. See [Log Search](https://docs.bronto.io/Search-and-Visualize/Log-Search.md).

### With the Search API

Use the [Search API](https://docs.bronto.io/api-reference/introduction.md) with `from_expr` set to `"collection" IN ('.audit-trail') AND "dataset" IN ('user-management')`. Use the API host for your region: `api.eu.bronto.io` or `api.us.bronto.io`.

This request returns the users deleted in the last 7 days:

```bash theme={"dark"}
curl -G "https://api.eu.bronto.io/search" \
  -H "X-BRONTO-API-KEY: $BRONTO_API_KEY" \
  --data-urlencode "from_expr=\"collection\" IN ('.audit-trail') AND \"dataset\" IN ('user-management')" \
  --data-urlencode "where=event_type = 'delete_user' AND \"context.request_uri\" LIKE '/users/%'" \
  --data-urlencode "time_range=Last 7 days" \
  --data-urlencode "limit=100"
```

To search an exact time window, use `from_ts` and `to_ts` (Unix epoch milliseconds) instead of `time_range`.

### Sample queries

Use these filters in the **Filter** box or as the `where` parameter of the Search API. Leave the filter empty to see every change in the time range.

**Users invited:**

```sql theme={"dark"}
event_type = 'post_user' AND "resource.info.email" IS NOT NULL
```

**Changes to one user:**

```sql theme={"dark"}
"resource.id" = '<user-id>'
```

To find a user's ID, open the user in **Settings** > **Users**. The ID is the last part of the page URL.

**Users deactivated or reactivated:**

```sql theme={"dark"}
"resource.info.action" IN ('deactivate', 'reactivate')
```

**Users deleted:**

```sql theme={"dark"}
event_type = 'delete_user' AND "context.request_uri" LIKE '/users/%'
```

**Everything one person changed:**

```sql theme={"dark"}
"principal.info.email" = 'jane.doe@example.com'
```

**Changes made with an API key:**

```sql theme={"dark"}
"principal.type" = 'apikey'
```

## Retention and access

The audit trail is kept for the retention period in your Bronto contract, which is 12 months by default.

Any role that can search log data can search the audit trail. To limit who can read it, use dataset restrictions: for example, deny the `.audit-trail` collection to every role except an administrator or auditor role. See [Access Control](https://docs.bronto.io/Account-Management/Access-Control.md#fine-grained-access-with-dataset-restrictions).

## Related links

* [User Management](https://docs.bronto.io/Account-Management/User-Management.md)
* [Access Control](https://docs.bronto.io/Account-Management/Access-Control.md)
* [Multi-Organisation](https://docs.bronto.io/Account-Management/Multi-Org.md)
* [SSO Overview](https://docs.bronto.io/Account-Management/SSO/SSO-Overview.md)
* [API Keys](https://docs.bronto.io/Account-Management/API-Keys.md)
* [Data Retention](https://docs.bronto.io/Account-Management/Retention.md)
* [Security](https://docs.bronto.io/Account-Management/Security.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.