# Quick start

> Set up the Peach API with your AI coding assistant, or by hand with curl, from checking your key to reading the results of a check.

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

> **In short.** Save your key as `PEACH_API_KEY` on your server. Then either paste the instructions below into your AI coding assistant, or follow the curl steps.

You need access first: see [Request API access](https://www.gotopeach.com/docs/api-request-access.md). Make a key in the developer console and keep it in a private setting on your server. See [Authentication and keys](https://www.gotopeach.com/docs/api-authentication.md).

## Set it up with your AI assistant

Paste this into Claude Code, Cursor or another AI coding assistant, and tick what you want built. It never contains your key: the assistant reads it from your server's settings.

```text
Integrate Peach (gotopeach.com) into this project.

1. Read Peach's API docs: https://www.gotopeach.com/docs/api/llms.txt
   and the OpenAPI description: https://app.gotopeach.com/api/v1/openapi.json
2. Read the API key only from the server environment variable PEACH_API_KEY.
   Call Peach from server code only. Never put the key in browser code,
   never log it, never commit it. If PEACH_API_KEY is missing, stop and
   ask me to add it.
3. Paid calls use Peach credits. Before running anything paid in a loop,
   call it once with ?dry_run=true to see the price, and handle a 402
   insufficient_credits answer by telling me, not by retrying.
4. Build what I choose below:
   [ ] Show our AI visibility (score, trend, top competitors) in our admin dashboard
   [ ] Pull articles approved in Peach into our CMS as drafts, then call
       POST /articles/{id}/published with the live URL once published
   [ ] Receive Peach webhooks and verify their signatures
5. Tell me what you changed and how to test it.
```

## By hand with curl

These steps assume your key is in the `PEACH_API_KEY` environment variable of the terminal you run them in, and that your site is `acme.com`.

### 1. Check your key

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

The answer shows your account, plan and limits, the key's permissions and sites, and your credit balance.

### 2. List your sites

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

Each site's `domain` is what other endpoints take, as in `/sites/acme.com/...`. A site appears once it has been analysed, in the app or with [`POST /analyses`](https://www.gotopeach.com/docs/api-sites-and-analyses.md).

### 3. See the price first

A check asks every tracked question on each of your plan's engines, so its price depends on how many questions you track. Ask first:

```bash
curl -X POST "https://app.gotopeach.com/api/v1/sites/acme.com/checks?dry_run=true" \
  -H "Authorization: Bearer $PEACH_API_KEY"
```

Nothing runs and nothing is charged. The answer looks like this:

```json
{
  "dryRun": true,
  "credits": 280,
  "breakdown": [
    { "action": "answer.chatgpt", "label": "One answer from ChatGPT", "count": 40, "each": 3, "credits": 120, "engine": "chatgpt" },
    { "action": "answer.gemini", "label": "One answer from Gemini", "count": 40, "each": 4, "credits": 160, "engine": "gemini" }
  ],
  "balance": 9500,
  "enough": true
}
```

### 4. Start the check

```bash
curl -X POST https://app.gotopeach.com/api/v1/sites/acme.com/checks \
  -H "Authorization: Bearer $PEACH_API_KEY" \
  -H "Idempotency-Key: acme-check-2026-11-03"
```

It answers `202` with `{ "check": { "id": "…", "status": "queued", … } }`. The `X-Credits-Charged` header says what was taken.

### 5. Follow it

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

`status` goes from `queued` to `running`, then ends as `done`, `partial` (an engine didn't answer every question) or `failed`. Ask every 15 to 30 seconds, or receive the `check.finished` [webhook](https://www.gotopeach.com/docs/api-webhooks.md) instead. Answers that didn't come back are refunded when it ends.

### 6. Read the results

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

How often your brand was named, share of voice, per engine and over time, with the number of answers behind each figure. Reading is free.

## Retrying safely

Send an `Idempotency-Key` header with any `POST`, `PUT`, `PATCH` or `DELETE`, for example a value your system already has for the task. If the network drops and you send the same request again with the same key:

- the first answer comes back, with the header `Idempotent-Replayed: true`, and nothing runs or is charged a second time;
- the same key with a different request answers `422 idempotency_key_reused`;
- if the first request is still running, it answers `409 idempotency_in_progress`: wait a moment and try again;
- a `402`, `429` or `5xx` answer isn't kept, so the same key can try again once the cause is fixed.

A key is 1 to 200 visible characters and is remembered for a day.

## Where to next

- [Credits and pricing](https://www.gotopeach.com/docs/api-credits.md): every price, and what is refunded.
- [Content](https://www.gotopeach.com/docs/api-content.md#the-cms-flow): pulling approved articles into your CMS.
- [Webhooks](https://www.gotopeach.com/docs/api-webhooks.md): being told when something finishes.
- [MCP server](https://www.gotopeach.com/docs/api-mcp.md): connecting your AI tools.
