# Authentication and keys

> How API keys work: keeping them on your server, permissions and presets, site limits, IP allowlists, credit caps, rotation and revoking.

Web page: https://www.gotopeach.com/docs/api-authentication (updated 2026-11-03)

> **In short.** Send your key as `Authorization: Bearer peach_sk_…` from server code. Keys are secret, so the API refuses requests from browsers. Each key has its own permissions, sites and limits, and acts as the person who made it.

## Sending your key

```bash
curl https://app.gotopeach.com/api/v1/me \
  -H "Authorization: Bearer $PEACH_API_KEY"
```

- A key is `peach_sk_` followed by 40 letters and digits.
- Keep it in a private setting on your server, such as an environment variable called `PEACH_API_KEY`. Never put it in browser or mobile app code, logs, web addresses or your code repository.
- A request that carries an `Origin` header, which every browser sends, is refused with `403 browser_not_allowed`. To show Peach data on a web page, call Peach from your server and send the page only what it needs.
- No key, or a malformed one, answers `401 missing_key` or `401 invalid_key`.

## Making a key

Keys are made in the developer console at `app.gotopeach.com/developers`, by the account's owner or an admin. For each key you choose:

- a name, so you can tell keys apart in the logs;
- its permissions, or a preset (below);
- the sites it can see, or every site;
- optionally, a monthly credit cap, an IP allowlist and an expiry date.

The key is shown **once**, with a copy button. Peach keeps only a fingerprint of it, so nobody, including us, can show it to you again. If you lose it, make a new one. An account can have 20 keys at a time unless your plan sets another number.

## Who a key acts as

A key acts as the person who made it, inside your account: the same plan limits, team role and workspace access they have in the app. A key can never do more than its maker could do in the app. If that person leaves the account, their keys stop working with `403 key_owner_left`, and you make new ones.

## Permissions

Every key has a set of permissions: one per area of Peach, plus three that allow changing things, using credits and publishing.

| Permission | In the console | What it allows | In the presets |
|---|---|---|---|
| `sites` | Sites and analyses | Sites, their settings and full analyses | Read only, Read and write (no credits), Everything except publishing |
| `memory` | Company Brain | Brand Memory, brand documents and the site's pages | Read only, Read and write (no credits), Everything except publishing |
| `questions` | Questions, competitors and checks | Tracked questions, competitors, checks, visibility and one-off questions | Read only, Read and write (no credits), Everything except publishing |
| `opportunities` | Opportunities | Opportunities and the searches the engines ran | Read only, Read and write (no credits), Everything except publishing |
| `content` | Content | Topics, outlines, articles and where they are published | Read only, Read and write (no credits), Everything except publishing |
| `results` | Results and reports | Results, AI traffic, Google Analytics and Search Console traffic, and weekly reports | Read only, Read and write (no credits), Everything except publishing |
| `socials` | Socials (Reddit, Quora and posts) | Reddit and Quora threads and communities, drafted replies and posts, and the Google Business Profile check | Read only, Read and write (no credits), Everything except publishing |
| `tools` | Free checks | The free checks | Read only, Read and write (no credits), Everything except publishing |
| `write` | Make changes | Changing things, such as adding a question, editing an article or dismissing an opportunity. Needed as well as the area's permission. | Read and write (no credits), Everything except publishing |
| `spend` | Use credits | Anything that uses credits, such as a check, an analysis or an article. Needed as well as the area's permission. | Everything except publishing |
| `publish` | Approve and publish | Approving articles and publishing them. In no preset: tick it on its own. | None |

- **Reading** needs the area's permission, for example `questions`.
- **Changing something** also needs `write`.
- **Anything paid** also needs `spend`.
- **Publishing** needs `content`, `write` and `publish`, and so does telling Peach your own CMS published an article. Approving an article, or asking for changes to it, needs `publish` too.

A call the key isn't allowed to make answers `403 permission_denied`, and the answer names the missing permission. Each endpoint's permission is in its table, for example on [Questions, competitors and checks](https://www.gotopeach.com/docs/api-questions-and-checks.md).

### Presets

| Preset | Id | Permissions |
|---|---|---|
| Read only | `read_only` | `sites` `memory` `questions` `opportunities` `content` `results` `socials` `tools` |
| Read and write (no credits) | `read_write` | `sites` `memory` `questions` `opportunities` `content` `results` `socials` `tools` `write` |
| Everything except publishing | `all_but_publish` | `sites` `memory` `questions` `opportunities` `content` `results` `socials` `tools` `write` `spend` |

`publish` is in no preset. Tick it on its own, only for a key that should approve and publish articles.

## Keys for some sites only

Leave the sites empty and a key sees every site in the account. Choose sites and it sees only those, so an agency can give each client a key for that client's site.

- Another site's address answers `404 site_not_found`.
- A question, article, check or other item that belongs to another site answers `404 not_found`, as if it didn't exist.
- Starting an analysis of another site answers `403 site_not_allowed`.
- Account-wide endpoints, such as brand documents and publishing destinations, need a key that sees every site: `403 needs_all_sites`.
- Lists only include the key's sites, and the key only sees the [jobs](https://www.gotopeach.com/docs/api-jobs.md) it started itself.

## IP allowlist

A key can be limited to up to 50 IPv4 or IPv6 addresses or ranges, such as `203.0.113.7` or `203.0.113.0/24`. A call from anywhere else answers `403 ip_not_allowed`. Leave it empty to allow any address.

## Monthly credit cap

A cap is the most credits the key may use in a calendar month (UTC), net of refunds. A paid call that would go over it answers `402 key_credit_cap_reached`, with what the key has used and its cap. Raise the cap in the developer console. The account's balance applies as well: see [Credits and pricing](https://www.gotopeach.com/docs/api-credits.md).

## Expiry, rotation and revoking

- **Expiry.** After a key's expiry date it answers `401 key_expired`.
- **Rotate** makes a new key with the same settings. The old one keeps working for 24 hours so live systems can switch over, then answers `401 key_rotated`.
- **Revoke** stops a key at once: `401 key_revoked`. Revoke a key straight away if it may have leaked, then make a new one.

## MCP sign-in

AI tools connecting to the [MCP server](https://www.gotopeach.com/docs/api-mcp.md) sign in through the browser instead, and you choose their sites and access on a consent page. A key is only needed for agents that run without a person.
