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

# Authentication

> Authenticate your server to Aiveth's APIs with an API key: format, powers, address allowlist and rotation.

Aiveth's server APIs (the admin API, consent API, events API and Shared Signals streams) authenticate with an **API key**. Your server sends it in the `Authorization` header:

```bash theme={null}
curl https://accounts.aiveth.com/v1/admin/people \
  -H "Authorization: Bearer aiveth_sk_live_..."
```

Never send an API key from a browser or a phone app. It belongs on your server.

The OpenID Connect endpoints don't use API keys. Apps authenticate there with their client ID and secret; see [OpenID Connect endpoints](https://docs.aiveth.com/api-reference/oidc-endpoints.md).

> [!NOTE]
>
> API keys and the admin API need the Pro plan or above. If your organization moves to a plan without them, its keys are kept but refused until it moves back.

## Key format

```text theme={null}
aiveth_sk_live_<32 random characters><6-character checksum>
aiveth_sk_test_<32 random characters><6-character checksum>
```

* `aiveth_sk_` marks it as an Aiveth secret key, so secret scanners can find a leaked one.
* `live_` is a key of your Production organization. `test_` is a key of your [Development environment](https://docs.aiveth.com/environments.md). A key works only in the environment that made it.
* The random part is base62 (digits and letters). The checksum lets Aiveth refuse a made-up or mistyped key without a database lookup.

Aiveth stores only a SHA-256 fingerprint of the key. It shows the full key once, when you make it, and after that only its last four characters.

## Make a key

**1. Open API keys**

In the console, open **API keys** and select **Make key**. You need the `apps:manage` power to see this page.

**2. Name it**

Enter a **Name**, such as "HR sync". The name appears in the activity log for every change the key makes.

**3. Choose its powers**

Under **What it may do**, tick only the powers this server needs.

**4. Choose when it ends**

Under **Ends after**, choose 30, 90 or 365 days, or never. Your Owners get an email a week before it ends.

**5. Limit where it may come from (optional)**

Under **Only from these addresses**, add IP addresses or ranges, one per line, such as `203.0.113.10` or `203.0.113.0/24`. Leave empty to allow any address.

**6. Copy the key**

Select **Make key**, copy the key, then select **I've saved it**. This is the only time it is shown.

## Powers

Each power needs a matching permission held by the person who makes the key. You can't give a key a power you don't have yourself.

| Power | Maker needs | Lets the key |
| - | - | - |
| `people:read` | `users:read` | See people and invitations. |
| `people:manage` | `users:manage` | Invite, suspend, reactivate and sign people out. |
| `people:roles` | `roles:manage` | Change people's roles (never Owner). |
| `roles:read` | `users:read` | See the organization's roles. |
| `events:read` | `audit:read` | Read the organization's events. |
| `organization:fields` | `security:manage` | Read and change the organization's custom fields. |
| `agents:actions` | `apps:manage` | Report what AI agents did on your MCP servers. |
| `resources:write` | `roles:manage` | Register, rename, move and remove parts of the organization. |
| `authorization:read` | `users:read` | Check who may do what on a part, and list who reaches what. |
| `authorization:write` | `roles:manage` | Give and take roles on parts (never to the key's maker). |
| `signals:manage` | `security:manage` | Set up security signal streams (Shared Signals). |
| `consent:read` | `security:manage` | Check whether a person agreed to a purpose. |
| `consent:write` | `security:manage` | Record and withdraw people's consent from your own app's screens. |
| `erasure:write` | `users:manage` | See the data your apps must erase and mark it erased. |

## Who a key acts as

* **The key belongs to the organization**, not to a person. It keeps working when the person who made it leaves. Who made it is recorded.
* **A key never does more than its maker could when they made it.** It keeps the maker's reach as it was at that moment: it can't give a role its maker couldn't give.
* **A key never acts as an Owner.** It can't give, take or edit the Owner role.
* **Every change is in the activity log** as done by the key, for example `API key "HR sync"`.

## Address allowlist

If a key has addresses, Aiveth accepts it only from a caller whose IP address is in one of them. Up to 20 addresses or ranges, IPv4 or IPv6. A call from anywhere else is refused with `401`, exactly as if the key were wrong.

## Rotate a key with overlap

To replace a key without downtime:

1. In **API keys**, select **New secret** next to the key.
2. Copy the new key. It has the same name, powers, addresses and lifetime.
3. Put the new key where the old one is.

The old key keeps working for 24 hours, then stops. If it was due to end sooner, it still ends then.

Only someone who holds every power of the key, and all of its reach, can make a new secret for it. A key that has already ended can't be renewed; make a new one.

## End a key

Select **End**, then **End now**. The key stops working at once.

## Limits

* At most 25 live keys per organization.
* Each key shows when it was last used, to the minute.
* Rate limits are per key or per organization; see [Errors and limits](https://docs.aiveth.com/api-reference/errors-and-limits.md).

## Errors

| Status | Body `detail` | Why |
| - | - | - |
| `401` | `Send your organization's API key as Authorization: Bearer aiveth_sk_…` | No key, a malformed or unknown key, an ended or expired key, a call from an address not on the list, a suspended organization, or a plan without API keys. The answer carries `WWW-Authenticate: Bearer`. |
| `403` | Names the missing power | The key is valid but lacks the power this call needs. |

## Related

* [API keys](https://docs.aiveth.com/account/api-keys.md)
* [API introduction](https://docs.aiveth.com/api-reference/introduction.md)
* [Errors and limits](https://docs.aiveth.com/api-reference/errors-and-limits.md)


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