# Authentication

> How API keys work, how to send them, and how to keep them safe.

Every request needs **your API key**. The key tells us which account is calling, so your templates and credits are used. You never send a user ID.

## Sending the key

Put it in the `Authorization` header:

```http
Authorization: Bearer plx_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

The header `x-api-key: plx_live_…` works too.

A missing, wrong or revoked key gets `401`:

```json
{ "error": "unauthorized", "message": "send your API key: Authorization: Bearer plx_live_…" }
```

## Creating and revoking keys

| | |
|---|---|
| **Where** | [platinux.net/dashboard/score](https://platinux.net/dashboard/score) |
| **Format** | `plx_live_` followed by 32 letters and numbers |
| **Shown** | **Once**, when you create it. We store only a fingerprint, so a lost key can't be recovered; create a new one |
| **How many** | Up to **5 active keys** per account |
| **Revoking** | Click **Revoke**. The key stops working on the very next request |
| **Last used** | The keys page shows when each key was last used |

Give each system its own key (for example "CRM sync" and "Zapier"), so you can revoke one without touching the others.

## Keeping keys safe

- **Use keys only on your server.** Never put a key in a web page, a mobile app or anything others can download: anyone with the key can spend your credits.
- **Keep keys out of code.** Load them from environment variables or a secrets manager, not from files in your repository.
- **Revoke a leaked key at once,** then create a new one.

## CORS

The API sends CORS headers and answers browser preflight requests. That is for the Platinux app itself, which calls the API with the signed-in user's session. **Your own integrations should call the API from a server**, with a key.
