# Errors and limits

> The shape of every error, what each code means and what to do, rate limits, pagination and request ids.

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

> **In short.** Every error is `{ "error": { "code", "message", "request_id" } }` with a matching HTTP status. Act on the `code`, show people the `message`, and quote the `request_id` if you contact us. Each key can make 60 requests a minute unless your plan says otherwise.

## The error shape

```json
{
  "error": {
    "code": "permission_denied",
    "message": "This key doesn't have the \"Use credits\" permission.",
    "request_id": "req_6b1f0c2d9e8a7f3b4c5d6e7f",
    "permission": "spend"
  }
}
```

- `code` is stable and meant for your code. The `message` is a plain sentence that may be reworded.
- Some errors add fields, such as `permission` above, `required` and `balance` on `insufficient_credits`, or `field` on a bad input.
- `request_id` is also in the `X-Request-Id` header of every answer.

## Codes

### Your key

| Status | Code | What it means |
|---|---|---|
| 401 | `missing_key` | No `Authorization` header. Send `Authorization: Bearer peach_sk_…`. |
| 401 | `invalid_key` | The key isn't a Peach key, or doesn't exist. |
| 401 | `key_revoked` | The key was revoked. Make a new one. |
| 401 | `key_expired` | The key passed its expiry date. |
| 401 | `key_rotated` | The key was replaced by a new one and its 24 hours of overlap have ended. |
| 403 | `browser_not_allowed` | The request came from a browser. Call the API from your server. |
| 403 | `ip_not_allowed` | The key's IP allowlist doesn't include this address. |
| 403 | `key_owner_left` | The person who made the key is no longer in the account. Make a new key. |

### Access to the API

| Status | Code | What it means |
|---|---|---|
| 403 | `api_access_not_approved` | The account has no approved API access. See [Request API access](https://www.gotopeach.com/docs/api-request-access.md). |
| 403 | `api_access_pending_payment` | Approved, but the Enterprise plan isn't paid yet, or its payment has stopped. Pay from the developer console. |
| 403 | `pilot_ended` | The pilot has ended. Pay for the plan to carry on. |
| 403 | `api_access_paused` | Access is paused. Email hello@gotopeach.com. |
| 403 | `mcp_not_included` | The plan doesn't include the MCP server. |
| 403 | `mcp_needs_growth` | Connecting an AI tool by signing in comes with the Growth plan and above; this account is on Free or Starter. |

### Permissions and sites

| Status | Code | What it means |
|---|---|---|
| 403 | `permission_denied` | The key lacks a permission. `permission` names it. |
| 404 | `site_not_found` | The account has no such site, or the key can't see it. |
| 404 | `not_found` | Nothing with that id, or it belongs to a site the key can't see. |
| 403 | `site_not_allowed` | The key is limited to other sites. |
| 403 | `needs_all_sites` | Account-wide data needs a key that can see every site. |

### Credits

| Status | Code | What it means |
|---|---|---|
| 402 | `insufficient_credits` | The balance is lower than the price. Nothing ran. `required`, `balance` and `buy_url` say more. |
| 402 | `key_credit_cap_reached` | The call would take the key past its monthly credit cap. `keyUsed` and `keyCap` say more. |

### Requests

| Status | Code | What it means |
|---|---|---|
| 400 | `bad_request`, or a code naming the problem | Something in the request is wrong. `field` often names it. |
| 400 | `invalid_idempotency_key` | An `Idempotency-Key` must be 1 to 200 visible characters. |
| 404 | `not_found` | No such endpoint. Check the method and path. |
| 405 | `method_not_allowed` | The path exists with a different method. |
| 409 | `conflict`, or a code naming it | The request clashes with the current state, for example `check_running`, `edited_elsewhere`, `not_approved` or `no_analysis`. |
| 409 | `idempotency_in_progress` | A request with this `Idempotency-Key` is still running. Wait a moment and try again. |
| 413 | `too_large` | The upload is over its size limit. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was used for a different request. |
| 429 | `rate_limited` | Too many requests. Wait for `Retry-After` seconds. |

### Peach's side

| Status | Code | What it means |
|---|---|---|
| 500 | `internal_error` | Something went wrong in Peach. Any credits taken are refunded. Try again in a minute. |
| 503 | `unavailable`, `queue_unavailable` or `credits_unavailable` | Peach couldn't do it just now. Any credits taken are refunded. Try again in a minute. |

A paid call that fails with a `4xx` or `5xx` is refunded in full, except where the [credits page](https://www.gotopeach.com/docs/api-credits.md#when-you-are-charged) says otherwise.

## Rate limits

- Each key can make **60 requests a minute**, unless your plan sets another number. An MCP connection has the same limit.
- Every accepted answer carries `X-RateLimit-Limit` and `X-RateLimit-Remaining`.
- Over the limit, the answer is `429 rate_limited` with a `Retry-After` header and `retryAfterSec`. Wait that long, then try again.
- Some endpoints have limits of their own: [one-off questions](https://www.gotopeach.com/docs/api-questions-and-checks.md#one-off-questions) 20 an hour per account, the [free checks](https://www.gotopeach.com/docs/api-free-checks.md#limits) 300 an hour per key, marking articles published 30 an hour and re-checking findability 20 an hour per account.
- Your plan's limits apply as they do in the app: sites, tracked questions, engines and seats. `GET /me` lists them.

## Pagination

Lists answer a page at a time.

- `limit`: items per page, 1 to 200 (50 by default).
- `cursor`: the `next_cursor` from the page before.
- `next_cursor` is `null` on the last page.

```bash
curl "https://app.gotopeach.com/api/v1/sites/acme.com/questions?limit=100" \
  -H "Authorization: Bearer $PEACH_API_KEY"
```

```json
{ "prompts": [ { "id": "…", "text": "…" } ], "next_cursor": "MTAw" }
```

The list's name is the one the endpoint always uses, such as `data`, `prompts` or `opportunities`. Treat the cursor as an opaque string.

## Request ids

Every answer carries `X-Request-Id`, and errors repeat it as `request_id`. The developer console's Logs page finds any request by its id, with its time, endpoint, status, latency and credits. Logs are kept for 30 days. Request and response bodies are never stored.

If you need help with a request, email [hello@gotopeach.com](mailto:hello@gotopeach.com) with its id.
