# API endpoints reference

URL: https://lyeve.com/docs/reference/api-endpoints/

This page lists the routes LyEve serves, grouped by what you do with it. Routes that no
feature page covers are listed in full. For a feature's own routes it gives the paths and
links the feature's page, which holds the request and response shapes.

Paths under `/api/admin/` are on the Admin API, port `3001` by default. Paths under `/api/v1/`
are on the Content API, port `3002`. [Core concepts](https://lyeve.com/docs/concepts/) explains the two.

A route of a feature your license does not cover answers `404` with
`The requested endpoint does not exist.`, the same as a path that was never there. A paid
part of a free feature answers `402` and names the feature it needs, as
[Licensing and tiers](https://lyeve.com/docs/concepts/licensing-and-tiers/) shows.

Where one status covers several refusals, the answer carries a `code` beside `error`, such as
`{"error": "a tenant holds at most 500 address entries", "code": "rate_limit.list_full"}`.
Branch on the code, not the message. Each feature page lists its codes.

:::tip[Ask the instance]
`GET /api/admin/openapi/public.json` answers an OpenAPI document of the Content API and every
route outside `/api/admin`, including the URLs your flows answer on. It takes the `admin` or
`super_admin` role. `GET /api/admin/openapi/admin.json` holds the `/api/admin` routes and takes
`super_admin`. `GET /api/admin/openapi.json` answers every signed-in role: the whole document
for a super admin, and for anyone else the routes outside `/api/admin` with the `/api/admin`
operations their role may call. Each describes what this instance runs right now, and LyEve
Console shows them under **API reference**.
:::

## Authenticate

| Credential | Send it as | Use it for |
|---|---|---|
| Session token | `Authorization: Bearer <token>` | A person, or code acting as one. It works on both APIs. The [quickstart](https://lyeve.com/docs/getting-started/quickstart/) shows how to get one |
| Session cookie | `__Host-sys_session` when `SECURE_COOKIE=true`, `sys_session` over plain HTTP | A browser, such as the console. A request that changes data also sends `X-CSRF-Token` with the `csrf_token` from sign-in |
| API key | `X-API-Key: ly_...` | A site, app or service calling the Content API. The Admin API answers a key that holds the `admin` or `super_admin` role with `401`. See [API keys](https://lyeve.com/docs/features/api-keys/) |
| Admin token | `Authorization: Bearer lyat_...` | A script or CI job calling the Admin API. Every other listener answers it with `401`. See [admin tokens](https://lyeve.com/docs/how-to/admin-tokens/) |

A super admin picks a tenant with `X-Tenant-ID: <slug>`. A slug that names no tenant answers
`404` with `tenant not found`. The header has no effect for any other caller, who always acts in
the tenant their credential belongs to. See [Tenants](https://lyeve.com/docs/features/tenants/).

| Method | Path | Who | Does |
|---|---|---|---|
| `POST` | `/api/admin/auth/login` | Anyone, rate limited | Sign in with `email`, `password` and an optional `tenant`. Answers `user`, `token`, `csrf_token` and `refresh_token`, and sets the session cookie |
| `POST` | `/api/admin/auth/mfa-verify` | Anyone, rate limited | Finish a sign-in that answered `{"mfa_required": true, "challenge_token": "..."}`. Send `challenge_token` and `code` |
| `POST` | `/api/admin/auth/refresh` | Anyone, rate limited | Trade `refresh_token` for a new `token`, `refresh_token`, `csrf_token` and `expires_in`. A refresh token lasts `REFRESH_TOKEN_TTL_SECS`, 30 days by default. Trading the same `refresh_token` again within ten seconds answers the same new token once, then `409` with `AUTH_TOKEN_ROTATED`, and the session stays. A token traded again after that ends the session with `401` |
| `POST` | `/api/admin/auth/logout` | Signed in | End the session. An optional `refresh_token` in the body is revoked too |
| `GET` | `/api/admin/auth/me` | Signed in | The caller's `id`, `email` and `roles` |
| `GET` | `/api/admin/auth/memberships` | Signed in | The tenants the caller belongs to |
| `POST` | `/api/v1/auth/token` | Anyone, rate limited | Sign in on the Content API with `email`, `password` and an optional `tenant`. Answers `token` and `expires_in`, in seconds. An account with a second factor gets the `mfa_required` challenge instead, finished at `mfa-verify` |

A token lasts `JWT_EXPIRY_SECS`, 900 seconds by default. Five failed sign-ins for one account
within 15 minutes lock it for the rest of the window, and the lock answers exactly like a wrong
password.

## Read and write content

These are the Content API routes your sites and apps call. Every one takes a credential: a
session token, or an API key whose scopes allow the action (`read` for `GET`, `write` for
`POST` and `PUT`, `delete` for `DELETE`). A write also needs one of the roles in the **Who**
column, on the token or on the key. `{schema}` is the content type's name. Field values
travel under `data`.

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/v1/schemas` | Any credential | List the content types the caller may read, with their fields. The others are left out |
| `GET` | `/api/v1/schemas/{name}` | A caller who may read the type | One content type. Any other caller gets `403` |
| `GET` | `/api/v1/content/{schema}` | Any credential | List entries. Answers a bare array |
| `GET` | `/api/v1/content/{schema}/cursor` | Any credential | List with a cursor, for walking a large set |
| `GET` | `/api/v1/content/{schema}/stream` | Any credential | Follow the content type's changes as Server-Sent Events. See [Follow changes](#follow-changes) |
| `GET` | `/api/v1/content/{schema}/{id}` | Any credential | One entry. An entry that is not published answers `404` unless the caller may read drafts |
| `POST` | `/api/v1/content/{schema}` | `editor`, `admin`, `super_admin` | Create an entry from `{"data": {...}}` |
| `POST` | `/api/v1/content/{schema}/bulk` | `editor`, `admin`, `super_admin` | Create several entries in one call |
| `PUT` | `/api/v1/content/{schema}/{id}` | `editor`, `admin`, `super_admin` | Update the fields the body carries |
| `DELETE` | `/api/v1/content/{schema}/{id}` | `editor`, `admin`, `super_admin` | Delete an entry |
| `PUT` | `/api/v1/content/{schema}/{id}/publish` | `editor`, `admin`, `super_admin` | Publish an entry |
| `PUT` | `/api/v1/content/{schema}/{id}/unpublish` | `editor`, `admin`, `super_admin` | Take an entry back to draft |
| `GET` | `/api/v1/content/{schema}/{id}/relations/{field}` | Any credential | The entries linked through a relation field, as `{"data": [...], "total": n}` |
| `PUT` | `/api/v1/content/{schema}/{id}/relations/{field}` | `editor`, `admin`, `super_admin` | Replace the linked entries |
| `GET` | `/api/v1/content/{schema}/{id}/revisions` | Any credential | An entry's revisions, kept when [content history](https://lyeve.com/docs/features/content-history/) is on for the type. Empty when none are stored |
| `PUT` | `/api/v1/content/{schema}/{id}/revisions/{rev_id}/restore` | `editor`, `admin`, `super_admin` | Restore a revision as a new one |

[Access rules](https://lyeve.com/docs/features/access-rules/) can narrow any of these per role and content type.

On a content type with draft and publish, a caller may read drafts when it holds both the read
and the update permission on that type. An API key with no `admin` or `super_admin` role also
needs the read and the update scope on it, which `content:read` with `content:write`, or
`content.<schema>:read` with `content.<schema>:update`, grant. Every other caller gets
published entries only. A read by id of a draft or an archived entry answers `404`, and
revisions and related entries leave them out. For a caller who may read drafts, the cursor list
holds entries of every status. A response that can carry drafts is served with
`Cache-Control: private, no-store`, so no shared cache keeps it.

```bash
curl -X POST http://localhost:3002/api/v1/content/article \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"data": {"title": "Hello", "body": "First post"}}'
```

### Query parameters

| Parameter | On | Does |
|---|---|---|
| `limit`, `offset` | The list | Page by offset. `limit` runs from 1 to 200 and defaults to 25 |
| `limit`, `cursor` | The cursor list | Page by cursor. `limit` runs from 1 to 1000 and defaults to 20. A value over 1000 gives 20 |
| `filters[<field>]=<value>` | The list | Keep entries whose field equals the value. On a content type with draft and publish, the list holds published entries unless you name `filters[_status]`. A status other than `published` answers `403` unless the caller may read drafts |
| `populate`, `depth` | The list and single reads | Return related entries inline. See [the data model](https://lyeve.com/docs/concepts/data-model/) |
| `fields` | The list, the cursor list and single reads | Return only the named fields in each entry's `data`, such as `fields=title,slug`. A relation field returns both its `<field>_id` and, with `populate`, the related entry. Every entry keeps `id`, `created_at` and `updated_at`. A field you cannot read answers `400`, whether the content type has no such field or an access rule hides it from you |
| `locale` | The list, the cursor list and single reads | Read the entry in a language, such as `fr` or `pt-BR`. Without it, the `Accept-Language` header decides. It takes effect when [localization](https://lyeve.com/docs/features/localization/) runs, which it does on every install unless `LYEVE_PLUGINS` leaves it out |

Use `curl -g` when a URL carries `filters[...]`, so curl does not read the brackets itself.

The cursor list answers `{"data": [...], "next_cursor": "..."}`. Send `next_cursor` back as
`cursor` for the next page. It is empty on the last page, and a page that comes back full
always carries one, so a set whose size is a multiple of `limit` ends on an empty page. Cursor
paging stays fast at depth and never repeats an entry when rows change during the walk. Offset
paging lets you jump to a page number.

### Public delivery

The delivery routes serve the published entries of the content types marked
with `"public_delivery": true` to anyone, with no credential, in answers a CDN
may cache. The tenant comes from the host, and a request that carries a token,
an API key or a session answers `400`. See
[public content delivery](https://lyeve.com/docs/features/content-delivery/).

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/v1/delivery/{schema}` | Anyone, rate limited | List the published entries. Answers a bare array. Takes `limit`, `offset`, `filters[<field>]`, `populate`, `depth` and `fields` |
| `GET` | `/api/v1/delivery/{schema}/{id}` | Anyone, rate limited | One published entry. Takes `populate`, `depth` and `fields`. An entry that is not published, or an id not in lower case with hyphens, answers `404` |

### Follow changes

`GET /api/v1/content/{schema}/stream` keeps the connection open and sends one Server-Sent
Event for each entry created, updated or deleted in the content type, in your tenant. It
replays nothing written before it opened.

```bash
curl -N http://localhost:3002/api/v1/content/article/stream \
  -H "Authorization: Bearer $TOKEN"
```

```text
: connected to article stream

data: {"data":{"id":"0f8fad5b-d9cb-469f-a165-70867728950e","title":"Hello"},"event":"after_create","schema":"article"}

: heartbeat
```

- `event` is `after_create`, `after_update` or `after_delete`. `data` is the entry after the
  change, or as it was before a delete, without the fields a read withholds from the caller.
  Relations are not populated and translations are not applied. A change to a draft reaches
  only a caller who may read drafts.
- A `: heartbeat` comment line arrives every 10 seconds, so a proxy keeps an idle stream open.
- When the token expires, the credential is revoked or the caller can no longer read the
  content type, the stream sends one last event named `error`, such as
  `{"error": "credential expired or revoked"}`, and closes.
- A change carries no event `id`, so a client that reconnects cannot resume where it stopped.
  Reconnect with a valid credential, then read the list once to pick up what changed in
  between. A client that reads more slowly than changes arrive misses some of them.
- One credential holds at most 8 open streams and one tenant at most 128. The next one answers
  `429` `too many open change streams` with `Retry-After: 10`.
- A browser's `EventSource` cannot send an `Authorization` header, so read the stream with
  `fetch` or from your server.

### Updating an entry

`PUT /api/v1/content/{schema}/{id}` writes only the fields the body carries. Every other field
keeps its stored value and no default is filled in. A field that is present gets every rule of
the content type, so a `null` or empty value for a required field answers `422` and a unique
value another entry holds answers `409`. A rule that spans fields is checked against the stored
entry with the update laid over it, whenever the body names one of its fields.

An update, or a restored revision, never changes an entry's `_status`. A `_status` in an update
body is left out, so a client that writes back a body it read earlier cannot publish an entry an
editor has since taken back to draft. Move an entry between draft and published with the
`publish` and `unpublish` routes.

### Serve a content type over some transports only

A content type is served over REST, and over [GraphQL](https://lyeve.com/docs/features/graphql-api/) and
[gRPC](https://lyeve.com/docs/features/grpc-api/) when those features run. An optional `transports` block on the
content type narrows that. Set it when you create or save the content type with
`POST /api/admin/schemas` or `PUT /api/admin/schemas/{name}`:

```json
{
  "name": "article",
  "fields": [{ "name": "title", "field_type": "text" }],
  "transports": { "rest": "rw", "graphql": "r", "grpc": "off" }
}
```

| Mode | Meaning |
|---|---|
| `rw` | Reads and writes. A transport you leave out of the block gets this |
| `r` | Reads only. A write over REST answers `405` with `schema is read-only over this transport` |
| `w` | Writes only. A read answers `405` |
| `off` | Not served. The Content API answers `404`, GraphQL has no type for it, and the gRPC catalog leaves it out |

Over gRPC, the refused direction answers `FAILED_PRECONDITION`. An unknown transport name or mode
answers `422` when you save, so a typo such as `"graphqll": "off"` cannot leave a content type
served where you meant to stop it.

## Admin API routes

Each group below is folded. Open the one you need.

<details>
<summary>First run</summary>

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/admin/setup` | Anyone | `{"setup_required": true}` until the first account exists |
| `POST` | `/api/admin/setup` | The setup token | Create the first `super_admin` from `email`, `password` and `setup_token`. The token can come in the `X-Setup-Token` header instead. Answers `201` with `user`, `token` and `csrf_token` |
| `GET` | `/api/admin/setup/status` | The setup token, in `X-Setup-Token` | In setup mode only: which settings are missing, with the lines to set. See [Installation](https://lyeve.com/docs/getting-started/installation/) |

</details>

<details>
<summary>Content types</summary>

[Schema changes](https://lyeve.com/docs/features/schema-changes/) covers each of these with its body and answer.

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/admin/schemas` | Signed in | List content types |
| `GET` | `/api/admin/schemas/{name}` | Signed in | One content type |
| `GET` | `/api/admin/schemas/{name}/stats` | Signed in | How many entries your tenant holds, and when one last changed |
| `POST` | `/api/admin/schemas` | `admin` | Create or save a content type |
| `PUT` | `/api/admin/schemas/{name}` | `super_admin` | Save a content type |
| `DELETE` | `/api/admin/schemas/{name}` | `admin` | Delete a content type |
| `PUT` | `/api/admin/schemas/{name}/rename` | `admin` | Rename a content type |
| `DELETE` | `/api/admin/schemas/{name}/rename` | `admin` | Abandon a rename that stopped partway, under either name. The content type goes back to its old name |
| `PUT` | `/api/admin/schemas/{name}/fields/{field}/rename` | `admin` | Rename a field to `{"new_name": "..."}` |
| `POST` | `/api/admin/schemas/{name}/preview`, `.../preview-ddl` | `admin` | Show the database statements a save would run, without running them. The body is the content type |
| `GET` | `/api/admin/schemas/{name}/history` | `super_admin` | What each save ran against the table, and what is still queued |
| `POST` | `/api/admin/schemas/{name}/apply-pending` | `super_admin`, signed-in session | Run the queued changes for one content type |
| `GET` | `/api/admin/migrate` | `super_admin` | Every queued change on the instance |
| `POST` | `/api/admin/migrate/apply` | `super_admin`, signed-in session | Run every queued change |
| `POST` | `/api/admin/schemas/migrate` | `super_admin` | Run every queued change |
| `GET` | `/api/admin/schemas/export` | `admin` | Download every content type as a bundle |
| `POST` | `/api/admin/schemas/import` | `super_admin` | Load a bundle. See [Moving content types between projects](https://lyeve.com/docs/reference/content-type-portability/) |
| `GET`, `POST` | `/api/admin/schemas/presets` | `admin` | List presets, or save one of your own. Saving needs the `schema-pro` feature |
| `POST` | `/api/admin/schemas/presets/{id}` | `admin` | Create the content types a preset holds. See [Schema presets](https://lyeve.com/docs/reference/schema-presets/) |
| `DELETE` | `/api/admin/schemas/presets/{id}` | `admin` | Delete a preset you saved |
| `GET`, `PUT` | `/api/admin/schemas/canvas-layout` | `admin` | The schema canvas layout. Saving it needs the `schema-pro` feature |
| `POST` | `/api/admin/config-sync/export`, `/api/admin/config-sync/diff`, `/api/admin/config-sync/apply` | `super_admin`, signed-in session | Export, compare or apply a configuration bundle. Needs the `config-sync` feature. See [Promote configuration](https://lyeve.com/docs/features/promote-configuration/) |

</details>

<details>
<summary>Users, memberships and admin tokens</summary>

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/admin/users` | `super_admin` | List users, as a bare array. `limit` runs from 1 to 200 and defaults to 25 |
| `POST` | `/api/admin/users` | `super_admin` | Create a user from `email`, `password` and `roles` |
| `PUT` | `/api/admin/users/{id}/roles` | `super_admin` | Replace a user's roles |
| `PUT` | `/api/admin/users/{id}/state` | `super_admin` | Disable or enable a user with `disabled` |
| `PUT` | `/api/admin/users/{id}/password` | `super_admin` | Set a password from `{"password": "..."}`. It must meet the password policy, or the answer is `422`. Every session the user held ends |
| `DELETE` | `/api/admin/users/{id}` | `super_admin` | Delete a user |
| `GET` | `/api/admin/users/{id}/memberships` | `super_admin`, signed-in session | The tenants a user belongs to, and the roles held in each |
| `PUT` | `/api/admin/users/{id}/memberships` | `super_admin`, signed-in session | Grant a tenant with `{"tenant_id": "...", "roles": [...]}`. Granting it again replaces the roles |
| `DELETE` | `/api/admin/users/{id}/memberships/{tenant}` | `super_admin`, signed-in session | Remove a membership |
| `GET` | `/api/admin/tenant-members/{tenant}` | `super_admin`, signed-in session | Every member of one tenant |
| `GET`, `POST` | `/api/admin/admin-tokens` | `admin`, signed-in session | List admin tokens, or create one |
| `GET` | `/api/admin/admin-tokens/grants` | `admin`, signed-in session | The grants a token can carry |
| `POST` | `/api/admin/admin-tokens/{id}/rotate` | `admin`, signed-in session | Issue a replacement token |
| `DELETE` | `/api/admin/admin-tokens/{id}` | `admin`, signed-in session | Revoke a token |
| `GET` | `/api/admin/admin-tokens/{id}/requests` | `admin`, signed-in session | The token's request log |

A signed-in session means an API key or an admin token is refused with `403`. Creating and
rotating an admin token also take your `password`, or an `mfa_code` when you have a second
factor. [Users, roles and permissions](https://lyeve.com/docs/guides/user/roles-and-permissions/) explains roles
and memberships.

</details>

<details>
<summary>Sign in a command-line tool</summary>

A tool on a machine without a browser starts a sign-in, shows the person a code, and polls
until the person approves the code in the console.

| Method | Path | Who | Does |
|---|---|---|---|
| `POST` | `/api/admin/auth/device` | Anyone, rate limited | Start a sign-in. Answers `device_code`, `user_code`, `verification_uri`, `verification_uri_complete`, `expires_in` and `interval` |
| `POST` | `/api/admin/auth/device/token` | Anyone, rate limited | Poll with `device_code` until the sign-in is approved |
| `GET` | `/api/admin/auth/device/{user_code}` | `admin`, signed-in session, rate limited | Look up a pending sign-in |
| `POST` | `/api/admin/auth/device/{user_code}/approve` | `admin`, signed-in session, rate limited | Approve it with your `password` or an `mfa_code` |
| `POST` | `/api/admin/auth/device/{user_code}/deny` | `admin`, signed-in session, rate limited | Refuse it |

`verification_uri` is the console page at `LYEVE_CONSOLE_URL` followed by `/admin/device`. A
production instance without `LYEVE_CONSOLE_URL` answers the start with `503` and
`Device sign-in is not configured on this install.`

</details>

<details>
<summary>Features, license and configuration</summary>

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/api/admin/plugins/status` | `admin` | Every feature with `compiled`, `entitled`, `requested` and `active`, its `phase`, a `reason` or `last_error` when it is off, a `manifest` with `label`, `description`, `category` and `maturity`, and the `routes` a running feature serves |
| `GET` | `/api/admin/plugins/running` | Signed in | `plugins`, the features serving your tenant, and `withheld`, the ones that run but are withheld from it |
| `GET` | `/api/admin/plugins/{name}/schema` | `admin` | The JSON Schema of a feature's settings |
| `GET` | `/api/admin/plugins/{name}/config` | `admin` | A feature's saved settings |
| `PUT` | `/api/admin/plugins/{name}/config` | `super_admin` | Save a feature's settings. A key the feature's schema does not list answers `422` with `not a setting of plugin <name>: <keys>`, and nothing is saved |
| `POST` | `/api/admin/plugins/{name}/config/reset` | `super_admin` | Put a feature's settings back to the defaults |
| `GET` | `/api/admin/entitlements` | `admin` | What the license grants. See [Licensing and tiers](https://lyeve.com/docs/concepts/licensing-and-tiers/) |
| `GET` | `/api/admin/license` | Signed in | `links` for managing the license, and `renew`, whether the renew route accepts a key |
| `POST` | `/api/admin/license/renew` | `super_admin`, signed-in session | Apply a license with no restart, from `{"license_key": "..."}` |
| `GET`, `PUT` | `/api/admin/tenant-features/{tenant}` | `super_admin`, signed-in session | The features withheld from one tenant |
| `GET` | `/api/admin/config` | `super_admin` | Every setting and the layer it came from |
| `PUT` | `/api/admin/config` | `super_admin` | Store settings in the admin layer. A setting the environment or the file pins is refused and named. See [Configuration](https://lyeve.com/docs/reference/configuration/) |
| `GET` | `/api/admin/security/controls` | `super_admin` | Which security controls are enforcing. See [Security controls](https://lyeve.com/docs/trust/security-controls/) |
| `GET` | `/api/admin/openapi/public.json` | `admin` | OpenAPI for the Content API and every route outside `/api/admin` |
| `GET` | `/api/admin/openapi/admin.json` | `super_admin` | OpenAPI for the `/api/admin` routes |
| `GET` | `/api/admin/openapi.json` | Signed in | The whole document for a super admin. For any other role, every route outside `/api/admin` and the `/api/admin` operations that role may call |

A build without license support answers `404` on both license routes and reports
`"license_module": false` from the entitlements route.

</details>

<details>
<summary>Privacy requests</summary>

| Method | Path | Who | Does |
|---|---|---|---|
| `POST` | `/api/admin/gdpr/export` | `super_admin`, rate limited | Export everything the instance holds about one person. `503` with `the subject's addresses could not be read; export was not attempted` when nothing was read |
| `POST` | `/api/admin/gdpr/erase` | `super_admin`, rate limited | Erase it. `200` when every part erased, `207` when part of it did not finish and a repeat finishes it, or when rows that cannot be told apart from another account's data were kept, `503` when nothing was erased |
| `GET`, `PUT` | `/api/admin/schemas/form-erasure` | `admin` | What an erasure does with the tenant's form submissions: `auto`, `soft` or `hard` |
| `GET` | `/api/v1/gdpr/export/sections` | Signed-in session | The sections of their own data a person may export |
| `POST` | `/api/v1/gdpr/export` | Signed-in session, once an hour | A person's own data as NDJSON |
| `POST` | `/api/v1/gdpr/export/step-up/email` | Signed-in session | Mail the person a code their export asks for |
| `GET`, `PUT` | `/api/admin/analytics/gdpr/export-sections`, `/api/admin/analytics/gdpr/export-roles` | `admin`, signed-in session | The sections the tenant offers, and the roles that may export |
| `GET`, `PUT` | `/api/admin/analytics/gdpr/export-step-up` | `super_admin`, signed-in session | What every person proves before exporting their own data |

[Data protection](https://lyeve.com/docs/trust/data-protection/) has the bodies and what each one covers, and [Analytics](https://lyeve.com/docs/features/analytics/#let-users-export-or-erase-their-data) has a person's own export.

</details>

<details>
<summary>Health, metrics and debugging</summary>

| Method | Path | Who | Does |
|---|---|---|---|
| `GET` | `/healthz` | Anyone, on both ports | Liveness: the process is up and the database answers a ping. `503` when the ping fails |
| `GET` | `/readyz` | Anyone, on both ports | Readiness: `503` while starting, while shutting down, when the database is unreachable, or when free disk runs low |
| `GET` | `/startup` | Anyone, on both ports | The first start has finished, for platforms with a separate startup probe |
| `GET` | `/.well-known/jwks.json` | Anyone, Content API only | The public keys that verify LyEve tokens. See [Validate tokens with JWKS](https://lyeve.com/docs/integrations/validate-tokens-jwks/) |
| `GET` | `/api/admin/health`, `/api/admin/ready` | Signed in | Ping the database: `{"status": "ok"}`, or `503` with `database unreachable`. A prober without a credential gets `401`, so point probes at the three above |
| `GET` | `/api/v1/health`, `/api/v1/ready` | Signed in | The same on the Content API |
| `GET` | `/api/admin/metrics` | The `METRICS_TOKEN` bearer, or `super_admin` when it is unset | Prometheus metrics. See [Metrics export](https://lyeve.com/docs/features/metrics-export/) |
| `GET` | `/api/admin/pool/health` | `admin` | Database connection pool statistics |
| `GET` | `/api/admin/debug/latency` | `super_admin` | The slowest endpoints by p50, p95 and p99 |
| `GET` | `/api/admin/debug/goroutines` | `super_admin` | How many goroutines run, and which feature started them |
| `GET` | `/api/admin/debug/gc-config` | `admin` | The garbage collector percentage and the memory limit in force |
| `POST` | `/api/admin/debug/gc-config` | `super_admin` | Change the collector percentage with `{"gogc": <n>}`, with no restart. A negative value needs a memory limit |
| `GET` | `/api/admin/debug/pprof/` | `super_admin` | Go's profiler index. `heap`, `goroutine`, `goroutineleak`, `profile`, `allocs`, `block`, `mutex`, `threadcreate`, `trace`, `cmdline` and `symbol` sit under it |

[Request profiling](https://lyeve.com/docs/features/request-profiling/) shows how to read these, and adds its
own routes under `/api/admin/debug/profiler/`.

</details>

## Routes by feature

Each feature serves its routes under the paths below. Its page lists every route with its
body, answer and role.

<details>
<summary>Content, media and search</summary>

| Feature | Paths | Needs |
|---|---|---|
| [Content history](https://lyeve.com/docs/features/content-history/) | `/api/admin/content/history/settings`, `/api/admin/content/history/usage`, `/api/admin/content/history/prune`, `/api/admin/content/history?schema=`, and activity at `/api/admin/content/activity`, across tenants at `/api/admin/content/activity/all` | Free. Reading versions older than 30 days needs `content-pro` |
| [Content lifecycle](https://lyeve.com/docs/features/content-lifecycle/) | `/api/admin/content` and everything under it: revisions, diffs, schedules, relationships, previews | Free, with 30 days of revisions readable. Older revisions, [releases](https://lyeve.com/docs/features/content-releases/) and [comments](https://lyeve.com/docs/features/editorial-comments/) need `content-pro` |
| [Editorial review](https://lyeve.com/docs/features/editorial-review/) | `/api/admin/review/` | Free, with one workflow per tenant. More, and escalation, quorum and conditions on a stage, need `review-pro` |
| [Media](https://lyeve.com/docs/features/media/) | `/api/admin/media`, and `/api/v1/media/{id}/{name}` for a public file | Free, up to 1,000 [image transform](https://lyeve.com/docs/features/image-transforms/) variants per tenant. More need `media-pro` |
| [Object storage](https://lyeve.com/docs/features/object-storage/) | `/api/admin/storage/`, `/api/v1/storage/local/{provider}` | Free |
| [Bulk import](https://lyeve.com/docs/features/bulk-import/) | `/api/admin/imports`, and mapping templates at `/api/admin/imports/templates` | Free. Saving a template, and the date, split and lookup transforms, need `content-pro` |
| [Search](https://lyeve.com/docs/features/search/) | `/api/admin/search`, `/api/v1/search/{schema}` | `search` |
| [Localization](https://lyeve.com/docs/features/localization/) | `/api/admin/localization/locales`, `/api/admin/localization/rich-text-repairs`, `/api/admin/content/{id}/translations`, `/api/admin/translations/`, `/api/v1/localization/resolve` | Free, with two locales per tenant. More need `localization-pro` |
| [Recommendations](https://lyeve.com/docs/features/recommendations/) | `/api/admin/recommendations/`, `/api/v1/recommendations/` | `recommendations` |
| [A/B testing](https://lyeve.com/docs/features/ab-testing/) | `/api/admin/ab/experiments`, `/api/v1/ab/expose`, `/api/v1/ab/convert` | `ab-testing` |
| [AI](https://lyeve.com/docs/features/ai/) | `/api/admin/ai/`, `/api/admin/content/ai-assist`, `/api/admin/content/ai-usage`, and the support desk at `/api/admin/support/` | `ai`, and `support` for the desk |
| [AI assistant](https://lyeve.com/docs/features/ai-assistant/) | `/api/admin/ai/assistant` | `ai` |
| [Builder](https://lyeve.com/docs/features/builder/) | `/api/admin/builder/`, and the builder's own calls under `/api/v1/builder/` | Free, with 2 sites per tenant, 10 pages in each site and 20 in all. More need `builder-pro` |
| [Data export](https://lyeve.com/docs/features/data-export/) | `/api/admin/data-export/` | `data-export` |

</details>

<details>
<summary>Sign-in and access</summary>

| Feature | Paths | Needs |
|---|---|---|
| [Access rules](https://lyeve.com/docs/features/access-rules/) | `/api/admin/permissions` | Free, with rules for three roles. More need `rbac-pro` |
| [API keys](https://lyeve.com/docs/features/api-keys/) | `/api/admin/api-keys` | Free. A [monthly limit](https://lyeve.com/docs/features/api-key-request-limits/) per key needs `apikey-pro` |
| [Password reset](https://lyeve.com/docs/features/password-reset/) | `/api/admin/auth/password-reset/` | Free |
| [Magic link sign-in](https://lyeve.com/docs/features/magic-link-sign-in/) | `/api/admin/auth/magic-link/` | Free |
| [Rate limiting](https://lyeve.com/docs/features/rate-limiting/) | `/api/admin/rate-limits`, with a tenant's own limit at `/api/admin/rate-limits/tenant-global`, address lists at `/api/admin/rate-limits/ip-rules`, and refusals at `/api/admin/rate-limits/history` | Free. Custom rules, tenant limits, address entries and reading refusals need `rate-limit-pro` |
| [Captcha](https://lyeve.com/docs/features/captcha/) | `/api/admin/captcha/settings`, and `/api/admin/captcha/site-key`, which needs no credential | Free. Saving a tenant's own provider needs `multitenant-customization` |
| [Multi-factor authentication](https://lyeve.com/docs/features/multi-factor-auth/) | `/api/admin/mfa/`, and passkey sign-in at `/api/admin/auth/webauthn/` | Free. Enrolling a passkey needs `mfa-pro` |
| [OAuth sign-in](https://lyeve.com/docs/features/oauth-sign-in/) | `/api/admin/auth/oauth/`, `/api/admin/auth/oauth-providers`, `/api/admin/oauth-providers`, `/api/admin/oauth-templates`, `/api/admin/account-links` | Free, with one provider. More need `oauth-pro` |
| [SAML single sign-on](https://lyeve.com/docs/features/saml-sso/) | `/api/admin/auth/saml/`, `/api/admin/auth/saml-providers`, `/api/admin/saml-providers`, `/api/admin/saml-templates` | `saml` |
| [SCIM provisioning](https://lyeve.com/docs/features/scim-provisioning/) | `/api/admin/scim/providers`, and the SCIM 2.0 service at `/api/v1/scim/v2/` | `scim` |
| [Trusted devices](https://lyeve.com/docs/features/trusted-devices/) | `/api/admin/devices`, `/api/admin/session-anomaly/` | `device-fingerprint` |
| [Web application firewall](https://lyeve.com/docs/features/web-application-firewall/) | `/api/admin/waf/` | `waf` |
| [PII masking](https://lyeve.com/docs/features/pii-masking/) | `/api/admin/pii/` | `pii-mask` |

</details>

<details>
<summary>Tenants</summary>

| Feature | Paths | Needs |
|---|---|---|
| [Tenants](https://lyeve.com/docs/features/tenants/) | `/api/admin/tenants`, with cold-storage archives under `/api/admin/tenants/{id}/`, `/api/admin/tenant-domains`, `/api/admin/customization` | Free. Creating a tenant needs `multitenant-provisioning`, and saving customization needs `multitenant-customization` |
| [Tenants](https://lyeve.com/docs/features/tenants/) | `/api/admin/migrate/export`, `/api/admin/migrate/import`, `/api/admin/migrate/sqldump/`, `/api/admin/migrate/validate`, `/api/admin/migrate/schemas` | Free |
| [Back up and restore tenants](https://lyeve.com/docs/how-to/backup-and-restore/) | `/api/admin/tenant-backup/`, `/api/admin/tenant-clone/` | `tenant-backup` |
| [Migrate existing content](https://lyeve.com/docs/how-to/migrate-existing-content/) | `/api/admin/migration/` | `migration-toolkit` |
| [Tenants](https://lyeve.com/docs/features/tenants/) | `/api/admin/cost-monitor/` | Free |
| [Usage and quotas](https://lyeve.com/docs/features/usage-and-quotas/) | `/api/admin/usage/`, `/api/admin/quotas`, `/api/admin/quota-requests`, `/api/v1/quotas/status`, `/api/v1/quota-requests` | Free. Setting [a tenant's limits](https://lyeve.com/docs/features/tenant-quotas/) needs `usage-pro` |
| [Data residency](https://lyeve.com/docs/features/data-residency/) | `/api/admin/regions`, `/api/admin/residency/report`, `/api/admin/tenants/{id}/region`, `/api/admin/tenants/{id}/replication`, `/api/admin/tenants/{id}/migrate`, `/api/admin/tenants/{id}/migrations`, `/api/v1/regions` | `data-residency` |

</details>

<details>
<summary>Automation and delivery</summary>

| Feature | Paths | Needs |
|---|---|---|
| [Flows](https://lyeve.com/docs/features/flows/) | `/api/admin/flows`, and the flows you publish at `/api/v1/flows/` | Free up to its limit. More needs `flow-pro` |
| [Scheduled jobs](https://lyeve.com/docs/features/scheduled-jobs/) | `/api/admin/cron/jobs` (`admin`), `/api/admin/jobs` (`super_admin`) | Free, with email alerts. Slack, Discord, PagerDuty and webhook [alerts](https://lyeve.com/docs/features/alerts/) need `alerts-pro` |
| [Idempotent requests](https://lyeve.com/docs/features/idempotent-requests/) | `/api/admin/idempotency` | Free |
| [Webhooks](https://lyeve.com/docs/features/webhooks/) | `/api/admin/webhooks`, `/api/admin/webhook-dead-letters`, `/api/admin/incoming-webhooks`, and incoming calls at `/api/v1/webhooks/in/{id}` | Free, up to 25 webhooks per tenant. More, and the paid options, need `webhook-pro` |
| [Email](https://lyeve.com/docs/features/email/) | `/api/admin/email/`, `/api/admin/email-templates`, and provider callbacks and tracking under `/api/v1/email/` | Free, with one SMTP provider per tenant. More, and the paid routes, need `email-pro` |
| [Event replay](https://lyeve.com/docs/features/event-replay/) | `/api/admin/events` | `events` |
| [Message broker events](https://lyeve.com/docs/features/message-broker-events/) | `/api/admin/messagebroker/status` | `messagebroker` |
| [Realtime](https://lyeve.com/docs/features/realtime/) | `/api/v1/ws/connect`, `/api/v1/ws/broadcast`, `/api/v1/realtime/`, `/api/admin/realtime/metrics`, `/api/admin/ws/metrics` | `realtime` |
| [GraphQL API](https://lyeve.com/docs/features/graphql-api/) | `/api/v1/graphql`, `/api/v1/graphql/ws`, `/api/admin/graphql/persisted-queries` | `graphql` |
| [gRPC API](https://lyeve.com/docs/features/grpc-api/) | Its own listener, plus `/api/admin/grpc/status` and `/api/admin/grpc/invoke` | `grpc` |

</details>

<details>
<summary>Operations and observability</summary>

| Feature | Paths | Needs |
|---|---|---|
| [Logs](https://lyeve.com/docs/features/logs/) | `/api/admin/logs/`, `/api/admin/logging/`, with volume alert rules at `/api/admin/logging/alerts` and one rule at `/api/admin/logging/alerts/{id}` | Free. Paid [alert](https://lyeve.com/docs/features/alerts/) channels on a rule need `alerts-pro` |
| [Metrics export](https://lyeve.com/docs/features/metrics-export/) | `/api/admin/telemetry/`, with a tenant's own destination at `/api/admin/telemetry/destination` | Free. Saving a tenant destination needs `multitenant-customization` |
| [Error tracking](https://lyeve.com/docs/features/error-tracking/) | `/api/admin/error-tracking/`, with triage at `/api/admin/error-tracking/alerts/{id}/resolve`, `/ignore`, `/reopen` and `/assignee`, and spike alerts at `/api/admin/error-tracking/alert-settings` | Free, with 30 days of events. Paid alert channels, a tenant's own threshold and older events need `alerts-pro` |
| [Analytics](https://lyeve.com/docs/features/analytics/) | `/api/admin/analytics/`, with the delivery queue at `/api/admin/analytics/deliveries` and `/api/admin/analytics/deliveries/{id}/replay`, `/api/v1/analytics`, a person's own data at `/api/v1/gdpr/export`, `/api/v1/gdpr/export/sections`, `/api/v1/gdpr/export/step-up/email` and `/api/v1/gdpr/erase`, the export's settings at `/api/admin/analytics/gdpr/export-sections`, `/api/admin/analytics/gdpr/export-roles` and `/api/admin/analytics/gdpr/export-step-up`, and unfinished erasures at `/api/admin/analytics/gdpr/erasures` and `/api/admin/analytics/gdpr/erasures/{user_id}/rerun` | Free. Retry policies, replay and the PostHog, Amplitude and webhook destinations need `analytics-pro` |
| [Request capture](https://lyeve.com/docs/features/request-capture/) | `/api/admin/request-captures`, with rules at `/api/admin/request-captures/rules` and replay sets at `/api/admin/request-captures/sets` | Free, kept 24 hours. Creating rules and sets needs `request-capture-pro` |
| [Request profiling](https://lyeve.com/docs/features/request-profiling/) | `/api/admin/debug/profiler/` | Free |
| [Concurrency tuning](https://lyeve.com/docs/features/concurrency-tuning/) | `/api/admin/debug/goroutines/status`, `/pool`, `/parallel`, `/async-hooks`, `/tuning` | Free to read. Writes to `/pool`, `/parallel` and `/async-hooks` need `goroutine-engine-pro` |
| [Caching](https://lyeve.com/docs/features/caching/) | `/api/admin/cache/`, with response cache rules at `/api/admin/cache/rules` | Free, with one provider and 10 rules per tenant. `/api/admin/cache/migrate`, `/api/admin/cache/benchmark` and more rules need `cache-pro` |
| [Audit log](https://lyeve.com/docs/features/audit-log/) | `/api/admin/audit-log`, `/api/admin/legal-holds`, `/api/admin/retention-policies`, `/api/admin/retention/` | `audit`. Creating or changing a [stream](https://lyeve.com/docs/features/audit-log-streaming/) at `/api/admin/audit-log/sinks` needs `audit-pro` |
| [API analytics](https://lyeve.com/docs/features/api-analytics/) | `/api/admin/apianalytics/` | `apianalytics` |
| [Slow query analysis](https://lyeve.com/docs/features/slow-query-analysis/) | `/api/admin/query-log` | `query-monitor` |
| [Synthetic monitoring](https://lyeve.com/docs/features/synthetic-monitoring/) | `/api/admin/synthetic-monitoring/`, with each probe's notice channels at `/api/admin/synthetic-monitoring/probes/{id}/alert-channels` | Free, with three probes per tenant. More, or intervals under 300 seconds, need `synthetic-monitoring-pro`, and paid notice channels need `alerts-pro` |
| [Replication](https://lyeve.com/docs/features/replication/) | `/api/admin/cluster/instances` | `cluster` |

</details>

## Paging on admin lists

| Route | Answers | Paged by |
|---|---|---|
| `GET /api/admin/users` | A bare array | `limit` 1 to 200, default 25, and `offset` |
| API keys, tenants, webhooks, media | `total_count`, `limit`, `offset` | `limit` up to 500, and `offset` |
| Flows and flow runs | `total_count`, `limit`, `offset` | `limit` up to 200, default 50, and `offset` |

## Related

- [Developer guide](https://lyeve.com/docs/guides/developer/): the order to learn these routes in.
- [Troubleshooting](https://lyeve.com/docs/guides/developer/troubleshooting/): what an error answer means.
- [SDK overview](https://lyeve.com/docs/sdk/): typed TypeScript functions for many of these routes.
