# Audit & Reports API

> Every endpoint of Audit & Reports on your realm's host, by area, with what each does and the page that covers it.

Every endpoint Audit & Reports serves on your realm's host. Realm-wide search and reports are planned and have no
endpoint yet: see [What's next for audit and reports](/audit-reports/audit-trail/whats-next/). Each call is made with a
session as a cookie;
[Call the API](/develop/api/) shows how to get `$CVYUH_SESSION`, and the paging and error rules every call shares. For
example:

```sh
curl https://foobar.cvyuh.com/api/v0/am/audit/v1/trail/me \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
```

## The trail of a user or agent

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/audit/v1/trail?person=<user's id>` | Everything that involved one user, newest first: `events`, and an empty `changes`. The user themselves, or `READ` on the realm | [Read a user's or agent's trail](/audit-reports/audit-trail/read-a-trail/) |
| `GET` | `https://foobar.cvyuh.com/api/v0/am/audit/v1/trail?agent=<agent's id>` | Everything that involved one agent, newest first: `events`, and `changes` (empty today; read the agent's change history). `READ` on the realm | [Read a user's or agent's trail](/audit-reports/audit-trail/read-a-trail/) |
| `GET` | `https://foobar.cvyuh.com/api/v0/am/audit/v1/trail/me` | The signed-in user's own trail | [Read a user's or agent's trail](/audit-reports/audit-trail/read-a-trail/#your-own-trail) |

Each takes `page` (from 1) and `pageSize` (20 by default, 100 at most), or `cursor` on a realm set to cursor paging.
`events` and `changes` are paged separately. Naming neither `agent` nor `person`, or both, answers `400`; someone
else's trail without `READ` on the realm answers `403`. Every field of a record is in
[Record fields and examples](/audit-reports/audit-trail/record-fields/).

## Change history

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/<type>/<id>/history` | Every change to one object, newest first; `page`, and `pageSize` (50 by default, 500 at most). `READ` on the object, which `RealmViewer` gives | [Change history](/audit-reports/audit-trail/change-history/) |

## What is recorded

| Method | Endpoint | What it does | Page |
|---|---|---|---|
| `GET` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/authorizationSettings/authorizationSettings` | The realm's authorization settings, `auditDecisions` among them | [What is recorded](/audit-reports/audit-trail/what-is-recorded/#policy-decisions) |
| `PATCH` | `https://foobar.cvyuh.com/api/v0/am/objects/v1/authorizationSettings/authorizationSettings` | Sets `auditDecisions` to `agents` or `all`. `MODIFY` on the realm, which `RealmOwner` gives | [Record every policy decision](/audit-reports/guides/record-every-policy-decision/) |
