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

# Authentication

> Create, scope and revoke API keys

Every request sends an API key in the `Authorization` header:

```bash theme={null}
curl https://on.relyant.app/api/v1/me -H "Authorization: Bearer rly_live_…"
```

Production keys start with `rly_live_`. Keys made on a test environment start with `rly_test_` and only work there.

> [!WARNING]
>
> Treat a key like a password. Keep it on a server, never in a website or a mobile app, and never commit it to a code repository. The API doesn't accept requests from browsers.

## Create a key

1. Go to **Admin console → AI & API**.
2. In **API keys**, click **Create key**.
3. Name the key after the system that will use it, for example **Power BI nightly sync**. One key per system means you can revoke one without breaking the others.
4. Choose when it expires: never, or in 30 days, 90 days or 1 year.
5. Pick **What it can read**. You can only pick data you can see yourself.
6. Click **Create key**, copy the key and store it somewhere safe. Relyant only keeps a fingerprint of it, so it can't show it again.

Only school **owners and admins** can create, rename and revoke keys. Other people with admin console access can see the list.

## Scopes

A key reads only the data you picked. Calling an endpoint outside its scopes returns `403 insufficient_scope`.

Education scopes (students, classes and attendance) cover the whole school, and are marked **Student data** when you pick them. Every request that reads students or attendance is recorded in the audit log. Student contact details, addresses, health information, guardians, notes and wellbeing records are never available through the API.

## When a key stops working

A key reads with the current access of the person who created it. It stops working when:

| Reason | Response |
| - | - |
| Someone revokes it | `401 api_key_revoked` |
| It reaches its expiry date | `401 api_key_expired` |
| An admin turns off API access for the school | `403 api_disabled` |
| Its creator is no longer an owner or admin of the school | `403 key_owner_lacks_permission` |
| Its creator loses access to that kind of data | `403 key_owner_lacks_permission` |
| The school's plan no longer includes API keys or that app | `403 feature_not_entitled` or `app_not_entitled` |

The **API keys** list in the admin console flags keys whose creator has lost access. Create a new key under a current admin to replace one.

## Revoke a key or turn off API access

* **Revoke**: open the key's **⋯** menu and click **Revoke**. Anything using the key stops working at once, and this can't be undone.
* **Pause everything**: switch **API keys** off. Every key stops working until you switch it back on. Nothing is revoked.

Creating, renaming and revoking keys, and turning API access on or off, are recorded in the [audit log](https://docs.relyant.app/organization/audit-logs.md). Requests made with a key show as **API key** next to the name of the person who created it.


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