# Keys

> Make an API key in Settings, pick which workspace pays, revoke a key, and use the free test key.

Make a key in **Settings → API** and send it on every call as `Authorization: Bearer <key>`.
For building and testing, use the free test key `eden_test_demo`.

## Make a key

1. **Open Settings → API**. In Eden, open **Settings** and pick **API**. Under **API keys**, give the key a name you'll recognize, like the app it's for.
2. **Pick what it can do**. **Full access** can do anything you can. **Read-only** can read but not change anything. **Custom** lets you pick a level for each part of Eden. The social data calls only read.
3. **Generate and copy it**. Click **Generate key**, then **Copy**. Eden shows the key once and can't show it again.

You can have up to 20 keys. Keys don't expire. Each key in the list shows its calls, errors, and
credits for the last 7 days.

## Which workspace pays

Each key names the workspace whose credits it spends. In more than one workspace? Pick it in the
**Workspace** menu when you make the key. A key that names none spends your default workspace's
credits. For store calls, the same workspace is the store the key works on.

Building an app for a company or a client? Make a workspace for that app and pick it for the key.
Teammates in that workspace share its credits, and the app's spending stays apart from yours.

## Revoke a key

Click **Revoke** next to the key in **Settings → API**. It stops working at once and answers `401`.
You can't change a key's access later: make a new key, switch your app to it, then revoke the old
one.

> **Keep your key private**
>
> Anyone with a key can spend your credits. Keep it in an environment variable on your server. Never
> put it in a web page, a public repo, or an app people download. If one leaks, revoke it and make a
> new one.

## The test key

Any key that starts with `eden_test_` is a test key. The docs use `eden_test_demo`.

- It works with no account and costs nothing.
- Every route returns fixed sample data, with the same fields as a real answer.
- Answers carry `"test": true` and the header `Eden-Test-Mode: true`.
- Bad input still fails the same way, so you can test your error handling.
- The [rate limit](https://eden.so/developers/limits/) of 120 calls a minute counts per key, and `eden_test_demo`
  is shared by everyone. If it answers `429`, use your own test key name, like `eden_test_myapp`.

```bash
curl "https://api.eden.so/v1/creators/youtube/noravale" \
  -H "Authorization: Bearer eden_test_demo"
```

Switch to your real key when your app works. Nothing else changes.
