# Authentication

Every API request is authenticated with a bearer key:

```http
Authorization: Bearer ck_your_key_here
```

Requests to a supported API endpoint without a valid key return **`401 Unauthorized`**. See
[Errors](/errors). If a key check cannot complete, the API returns retryable
`503 authentication_unavailable`. Follow [the retry guidance](/errors#503).

## Keys

Keys belong to an activated workspace. A workspace that has not been activated
holds no keys and cannot create any; the Console points you at Billing instead.
When the workspace is activated, every member of it, including anyone invited
before activation, gets a private key named **Default**. Open **API keys**
in the [Customer Console](https://console.celeris.ai) to reveal yours or create
additional keys.

- **Keys start with `ck_`.** Add this prefix to your secret-scanning rules.
- **The full key is shown when created** and can be revealed later by its
  owner. Treat the key as a secret.
- **Keys authenticate the workspace, but each key has an owner.** A key you
  create is **private to you** by default; teammates don't see it, so your
  organization can tell who is using the API. Workspace admins and organization
  owners/admins can create a **workspace-shared** key that every member sees
  and can use, and only they can rename, rotate, or revoke it. Prefer private
  keys: use a shared key only when a service genuinely needs a workspace-owned
  credential, since sharing loses per-person visibility and a departure forces
  a rotation that disrupts everyone. Either way, all usage draws on the
  workspace's shared credit balance and there are no per-key limits.
- **Label your keys.** One key per app or environment (`prod-backend`,
  `staging`, `cli-tools`) simplifies rotation and incident response.

Each member can hold up to five private API keys in a workspace, including their
automatic Default key, and a workspace can have up to five shared API keys.
Creating a key beyond either limit returns `429` with code `key_limit_reached`.
Revoke a key you no longer use, or contact support. Rotation still works at
either limit.

## Rotating and revoking

From the Console you can:

- **Rotate** a key. The Console mints a replacement and revokes the old key in
  one step. Update your deployment with the new value.
- **Revoke** a key. It stops working and cannot be recovered.

Creating, rotating, and revoking keys usually takes effect within a minute.
Until then, an old key may still work and a new key may not work yet.

For a planned, zero-downtime change, create a second key, verify it, update the
deployment, and then revoke the old key. If a key may be compromised, rotate
or revoke it immediately.

## Handling keys well

- **Keep keys server-side where you can.** Load them from environment
  variables or your secret manager, never from source control.
- **Calling from a browser is supported.** A key embedded in a public web page
  can be read and reused by anyone. For public applications, proxy Celeris
  calls through your backend. See
  [Making requests](/making-requests#calling-from-the-browser).
- **Prefer private keys.** Give each person and each app its own unshared
  key so usage stays attributable. Use a workspace-shared key only when the
  application requires a credential shared by the workspace.
- **Rotate on departure.** Rotate shared keys when someone with production
  access leaves your team, and revoke or rotate any keys the departing
  person created.
