# API keys and scopes

Create a secret API key, choose its scopes and expiration, use it safely and revoke it.

The REST API, the [CLI](https://docs.feedzzie.com/cli/cli/) and the [MCP server](https://docs.feedzzie.com/cli/mcp/) use a **secret API key**. Only the organization's **owners** and **admins** can see and create keys.

## Secret and public keys

| | Secret key | Public key |
|---|---|---|
| Starts with | `fz_live_` | `fz_pub_` |
| For | Your servers, scripts, the CLI and the MCP server | The FeedzzieKit SDK inside a mobile app |
| Reaches | Every project of the organization | One project |
| REST API | Yes | No: it answers `403` with `WRONG_KEY_TYPE` |

These guides use secret keys. A secret key can read and change your whole organization's ideas: keep it on your server or in your terminal, never in a web page or an app.

## Create a key

1. In the dashboard, open **Settings › API Keys**.
2. Click **Create API Key** and fill in:
   - **Key Name**: something that tells you where it is used, such as `support-sync`.
   - **Key Type**: **Secret (server)**.
   - **Scopes**: what the key can do (below). The default is **Read**.
   - **Expiration**: 30 days, 90 days (the default), 1 year or never.
3. Copy the key. It is shown **only once**: Feedzzie keeps only a hash of it.

## Scopes

| Scope | Allows |
|---|---|
| `read` | Read ideas, comments and topics, and `GET /me` |
| `write` | Everything in `read`, plus create and edit ideas, vote and post comments |
| `admin` | Everything in `write`, plus change an idea's status, delete ideas and comments, post official comments, edit the comments the same key posted, and see ideas awaiting moderation |

`admin` includes `write`, and `write` includes `read`. A request that needs a wider scope answers `403` with `INSUFFICIENT_SCOPE`, and `error.details[0].expected` names the scope it needs.

## Use the key

Send it in the `Authorization` header of every request:

```bash
curl https://feedzzie.com/api/v1/me \
  -H "Authorization: Bearer $FEEDZZIE_API_KEY"
```

`GET /me` answers with the key's name, scopes, organization, plan and rate limit, never with the key itself. It is a quick way to check a key: see [first steps with curl](https://docs.feedzzie.com/api/quickstart/).

## Revoke a key

In **Settings › API Keys**, click **Revoke** on the key and confirm. From then on, requests with that key answer `401`, and the key leaves the list.

A secret key also stops working when the person who created it is suspended or becomes a **member**: create keys with an owner or admin who will stay one.

## See the usage

The **Usage Analytics** tab in **Settings › API Keys** shows the requests of your keys.
