# Get started with the API

> Create an API key, send your first request and learn how requests, lists, errors and rate limits work.

The whatayarn API lets your own code, scripts and AI assistants work with your account without the editor. Read responses, create and publish forms, polls, quizzes and boards, moderate a board and manage webhooks and folders. The API is available on Free and Creator. Each feature it reaches keeps its own plan, so a request that needs a Creator feature is refused on Free with the feature it needs.

## Create an API key

The API is in beta and turning on for accounts a few at a time. If **API keys** isn’t on your **Account** page yet, it isn’t on for your account.

1. Open **Account** and find **API keys**.
2. Enter a **Key name**. Name it after where you’ll use it, so you can tell keys apart.
3. Choose the **Access**. **Read only** keys can read your forms and responses. **Full access** keys can also make changes.
4. Choose **Create key**, then **Copy key**.

You won’t see the key again, so store it somewhere safe, like a password manager. whatayarn stores only a fingerprint of each key, never the key itself. Keys start with `wy_`. An account can hold up to 10 keys at a time.

Each key in the list shows its access level, the first characters of the key, when it was created and when it was last used. To stop a key, choose **Revoke key**. Anything using that key stops working straight away, and this can’t be undone. A key acts as your account, so treat it like a password. Deleting your account deletes its keys.

## Send a request

Every endpoint is under one base URL:

```text
https://whatayarn.com/api/v1
```

Send your key in the `Authorization` header as a bearer token. A Read only key can make `GET` requests. Any other method needs a Full access key, and a Read only key is refused with `read_only_key`.

Keys are for servers, scripts and agents. The API reads no cookies and sends no CORS headers, so a web page can’t call it from a visitor’s browser. Keep keys out of public code and web pages.

### Your first request

`GET /me` returns the account and the key you sent. It’s a quick way to check a key works:

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

```json
{
  "id": "5b0d3c1e-8f2a-4c6b-9d7e-1a2b3c4d5e6f",
  "email": "you@example.com",
  "plan": "creator",
  "key": { "name": "Reporting script", "access": "read" }
}
```

`plan` is `free` or `creator`. `key.access` is `read` for a Read only key and `write` for Full access.

## Requests and responses

Requests and responses are JSON, with camelCase names and ISO 8601 timestamps in UTC, like `2026-11-28T09:30:00.000Z`. Send a request body as JSON. A body field the endpoint doesn’t know is refused, so a misspelt name never goes unnoticed.

A single item comes back as the object itself. An endpoint that creates something answers `201` with the new item. A `DELETE` answers with the ID it deleted:

```json
{ "id": "Xk3vQ9mP2aLd", "deleted": true }
```

An ID in a path that doesn’t exist, or that belongs to another account, answers `404` with `not_found`, exactly as a missing one does. Responses are never cached.

## Page through lists

A list comes back as `data`, with `hasMore` and a `nextCursor` for the next page:

```json
{
  "data": [
    {
      "id": "Xk3vQ9mP2aLd",
      "kind": "poll",
      "title": "Team lunch",
      "status": "live",
      "revision": 3,
      "url": "https://whatayarn.com/sunny-heron",
      "editUrl": "https://whatayarn.com/forms/Xk3vQ9mP2aLd/edit",
      "folderId": null,
      "pinned": false,
      "archived": false,
      "responseCount": 12,
      "createdAt": "2026-11-20T09:15:00.000Z",
      "updatedAt": "2026-11-27T16:40:12.000Z",
      "publishedAt": "2026-11-27T16:40:12.000Z"
    }
  ],
  "hasMore": true,
  "nextCursor": "eyJhdCI6IjIwMjYtMTEtMjAgMDk6MTU6MDAuNDEyMzcxIiwiaWQiOiJYazN2UTltUDJhTGQifQ"
}
```

Send `limit` for the page size, from 1 to 100, or leave it out for 20. To get the next page, send the same request with `cursor` set to `nextCursor`. When `hasMore` is `false`, `nextCursor` is `null` and there are no more pages. Treat a cursor as opaque and send it back exactly as you got it. A cursor the API can’t read is refused with `validation_failed`.

A cursor continues straight after the last item you got, so items added while you page don’t make you skip or repeat one. The one exception is board posts sorted by upvotes, which move as people vote.

Short lists, like a form’s questions, webhooks and folders, come back whole with `hasMore: false` and take no `limit`.

## Errors

Every error has the same shape: a `code` to act on, a `message` you can show and the request’s `requestId`.

```json
{
  "error": {
    "code": "not_found",
    "message": "Form not found.",
    "requestId": "req_3f9c1a7b2e4d4c8f9a0b1c2d3e4f5a6b"
  }
}
```

Every response, successful or not, also has a `Request-Id` header with the same ID. Log it, and include it when you ask us about a request, so we can find exactly what happened.

When a request fails its schema, `issues` lists each problem. Each issue’s `path` starts with where the value was sent: `params`, `query` or `body`.

```json
{
  "error": {
    "code": "validation_failed",
    "message": "The cursor isn't valid.",
    "issues": [
      {
        "path": "query.cursor",
        "message": "Use the nextCursor from the previous page, or leave it out to start again."
      }
    ]
  }
}
```

When the account’s plan doesn’t include a feature, `feature` names it, so your code can say what to upgrade for:

```json
{
  "error": {
    "code": "plan_required",
    "message": "Visitor details is part of Creator.",
    "feature": "visitorDetails"
  }
}
```

| Code                 | Status | When                                                                            |
| -------------------- | ------ | ------------------------------------------------------------------------------- |
| `unauthorized`       | 401    | The key is missing, unknown or revoked.                                         |
| `read_only_key`      | 403    | A Read only key asked for a change.                                             |
| `plan_required`      | 403    | The account’s plan doesn’t include the feature in `feature`.                    |
| `forbidden`          | 403    | Any other refusal.                                                              |
| `not_found`          | 404    | The path doesn’t exist, or names something the account doesn’t have.            |
| `method_not_allowed` | 405    | The path exists for other methods. The `Allow` header lists them.               |
| `wrong_kind`         | 409    | The endpoint doesn’t serve this kind of form, like posts on a form.             |
| `conflict`           | 409    | The `revision` sent is out of date, or the request can’t apply right now.       |
| `validation_failed`  | 400    | The request fails its schema. `issues` lists each problem.                      |
| `body_too_large`     | 413    | The body is over 2 MB.                                                          |
| `rate_limited`       | 429    | The key or your network is over its limit. `Retry-After` says how long to wait. |
| `internal_error`     | 500    | Something went wrong on our side. No detail is returned, so try again later.    |
| `unavailable`        | 503    | The API is switched off, or the limit couldn’t be checked. Try again later.     |

## Rate limits

Each key can make 120 requests a minute, whatever it calls, and each network 600 across its keys. Past that, the API answers `429` with `rate_limited` and a `Retry-After` header in seconds.

Every response to a valid key says where it stands, so your code can slow down before it’s refused:

| Header                | Means                                    |
| --------------------- | ---------------------------------------- |
| `RateLimit-Limit`     | Requests the key can make in a minute.   |
| `RateLimit-Remaining` | Requests left in the current window.     |
| `RateLimit-Reset`     | Seconds until the window has room again. |

Some actions also keep the limits they have in the app, like sending webhook tests and emailing board updates.

## Connect an AI assistant

The MCP server lets an AI assistant like Claude Code, Codex, Cursor or VS Code use the API for you. It has a tool for every endpoint and works with the same API key: use a Read only key if the assistant should only look. Apps that connect only by signing in, like the Claude and ChatGPT apps, can’t connect yet.

The quickest way is from your **Account** page. Under **API and MCP**, select **Create a key**, choose its access and create it, then copy the prompt for your agent to set itself up, or pick your app: Claude Code, Cursor, Codex, VS Code or another app. Cursor and VS Code add it in one click, and the others get a command or setup to paste with your key already in it.

To add it yourself in Claude Code, run:

```bash
claude mcp add --transport http whatayarn https://whatayarn.com/api/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"
```

Codex reads the key from an environment variable, so the key stays out of its config file. Run:

```bash
codex mcp add whatayarn --url https://whatayarn.com/api/mcp \
  --bearer-token-env-var WHATAYARN_API_KEY
```

Then set `WHATAYARN_API_KEY` to your key where Codex runs, for example with `export WHATAYARN_API_KEY=YOUR_API_KEY` in your shell profile. Codex reads it each time it starts.

In other apps, add a remote MCP server with the URL `https://whatayarn.com/api/mcp` and the header `Authorization: Bearer YOUR_API_KEY`. Each tool call counts as one request toward the key’s rate limit.

Assistants that read the web can also use [whatayarn.com/llms.txt](https://whatayarn.com/llms.txt), and every docs page as Markdown: add `.md` to its address, like [whatayarn.com/docs/api-overview.md](https://whatayarn.com/docs/api-overview.md).

## What the API covers

The API covers forms and their documents, responses and the answer summary, boards with their posts, comments, updates and subscribers, insights, webhooks and folders. The **API reference** lists every endpoint. For the exact shape of every request and response, read the OpenAPI document at [whatayarn.com/api/v1/openapi.json](https://whatayarn.com/api/v1/openapi.json). It needs no key.

Not covered yet: image uploads, Classic pages, Google Sheets, form passwords, AI columns, version history, duplicating a form, editing a response, board events in webhooks and OAuth.
