# API reference

Base URL `https://okaytosend.com`. Requests and answers are JSON. Every answer is sent with `Cache-Control: no-store`. The machine-readable spec is at [/openapi.json](/openapi.json).

## Authentication

Send a workspace key as a bearer token:

```http
Authorization: Bearer ots_live_...
```

| Scope | Allows |
| --- | --- |
| `checks:run` | Creating checks |
| `checks:read` | Reading saved checks |
| `projects:read` | Reading projects and their facts (MCP) |
| `sources:write` | Keeping sources on a project (MCP) |

Each key can make 60 requests a minute. Owners and admins create and revoke keys on [Connect your AI](https://okaytosend.com/connect-ai).

## Create a check

`POST /api/v1/checks`

Pass the exact email, never a summary. With one active project you can leave `project` out; the answer names the project it used.

The email is kept as you sent it, for the workspace's retention setting, so signed-in members can see it on the check page. A workspace that deletes straight after the check keeps no email.

| Field | Type | Notes |
| --- | --- | --- |
| `project` | string | The project's name or ID. Optional when the workspace has one active project; with none or several, leaving it out answers `project_required` |
| `subject` | string | The subject line. The check is saved under it unless you pass `title` |
| `preheader` | string | The preview text |
| `from_name` | string | The sender name |
| `html` | string | The email's HTML |
| `text` | string | The plain-text body |
| `parts` | array of `{ name, text }` | Instead of the fields above, when the email arrives in pieces. A part named `html` is read as HTML |
| `image_urls` | array of strings | Up to 8 HTTPS image addresses. The words in them are read |
| `files` | array of `{ download_url, file_id }` | Attachments: HTML, text, PNG, JPEG, WebP or GIF, up to 3 MiB each. Images and files together: up to 8 |
| `sources` | array | Up to 8 sources for this check only. Each has a `title` and exactly one of `url`, `text` (up to 200,000 characters) or `file` (PDF, Word, Excel or CSV, up to 10 MB) |
| `source` | object | Where the email lives: `platform` (`klaviyo`, `mailchimp`, `hubspot`, `braze`, `customer_io`, `gmail`, `outlook`, `other`), `external_id`, and optionally `external_url` and `campaign_name` |
| `revises` | string | The ID of an earlier check this one follows, usually a HOLD. Re-checking a HOLD is free |
| `fresh` | boolean | Read the sources again instead of reusing a result from the last 24 hours. Free when the same email was checked in the last 24 hours; otherwise it counts as one check |
| `title` | string | A label for the check |

The body must fit in 2,000,000 bytes.

```bash
curl https://okaytosend.com/api/v1/checks \
  -H "Authorization: Bearer $OKAYTOSEND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "Willowlight Studio",
    "subject": "Book your Willowlight Workshop ticket",
    "html": "<p>Your Willowlight Workshop ticket costs £45.</p>",
    "sources": [{ "title": "Workshop pricing", "text": "The Willowlight Workshop ticket costs £65." }]
  }'
```

`201 Created` returns the check:

```json
{
  "id": "59c4dcfc-7b7a-4d86-8eaf-0f68ee1cd2b5",
  "url": "https://okaytosend.com/checks/59c4dcfc-7b7a-4d86-8eaf-0f68ee1cd2b5",
  "verdict": "HOLD",
  "final": false,
  "findingCount": 1,
  "findings": [
    {
      "title": "Claim contradicted",
      "rule": "VALUE_MISMATCH",
      "state": "open",
      "level": 2,
      "emailQuote": "ticket costs £45",
      "source": {
        "title": "Workshop pricing",
        "quote": "The Willowlight Workshop ticket costs £65.",
        "url": null,
        "readAt": "2026-11-26T10:00:00Z",
        "location": null
      }
    }
  ],
  "draftNote": "For the final check, send a real test from your email tool to willowlight.example@check.okaytosend.com.",
  "nextSteps": [
    "If the copy is wrong: change it where it's published, then I'll check it again as it is there.",
    "If Workshop pricing is out of date: update it, then I'll check the same copy again.",
    "Or I can check a suggested fix first. It won't change anything that's live."
  ],
  "result": {
    "contractVersion": 2,
    "content": { "kind": "email", "parts": ["subject", "body"] },
    "claims": [
      {
        "id": "claim-1",
        "status": "CONTRADICTED",
        "kind": "price",
        "quote": "ticket costs £45",
        "part": "body",
        "expected": "£65",
        "code": "VALUE_MISMATCH",
        "evidence": [
          {
            "sourceId": "S1",
            "title": "Workshop pricing",
            "origin": "supplied",
            "quote": "The Willowlight Workshop ticket costs £65.",
            "value": "£65",
            "readAt": "2026-11-26T10:00:00Z",
            "role": "contradicts"
          }
        ]
      }
    ],
    "counts": { "VERIFIED": 0, "CONTRADICTED": 1, "UNVERIFIED": 0, "CONFLICTING": 0, "N/A": 0 },
    "limits": [],
    "checkedAgainst": [{ "title": "Workshop pricing", "readAt": "2026-11-26T10:00:00Z", "origin": "supplied" }],
    "startedAt": "2026-11-26T10:00:00Z",
    "finishedAt": "2026-11-26T10:00:03Z"
  }
}
```

### The answer

| Field | Meaning |
| --- | --- |
| `verdict` | `HOLD` or `CLEAR` |
| `final` | `true` only for a real test email sent to the project's check address. A draft is `false`, so `CLEAR` on a draft means CLEAR · draft |
| `findingCount` | How many problems hold the email. `0` on CLEAR |
| `findings` | Every problem, most serious first: `{ title, rule, state, level, emailQuote, source }`. `rule` is the code, `emailQuote` the email's words, and `source` the words that prove it (`{ title, quote, url, readAt, location }`, or `null`) |
| `project` | `{ id, name }`, when you left `project` out and the answer chose it |
| `draftNote` | How to run the final check. Only on `POST`, for an email in a project with a check address |
| `nextSteps` | On a HOLD: the choices the person has |
| `revises` | When this check follows an earlier one: `{ id, url, verdict, kind, inferred }`. See [Check again after a HOLD](#check-again-after-a-hold) |
| `revisionLine` | With `revises`: one sentence on what changed since that check |
| `followUps` | On a HOLD that was checked again later: each later check, `{ id, url, verdict, kind, at }` |
| `source`, `provenanceLine` | When you passed `source`: where the email lives, and one sentence naming it |
| `images` | The images that were read, each `{ ref, url }` |
| `result.claims` | Everything checked. Each has a `status`, a `code`, the `quote` from the email, the `part` it's in, `expected` when the right value is known, and `evidence` |
| `result.counts` | Claims by status |
| `result.limits` | Sources that couldn't be read, and why |
| `result.checkedAgainst` | Every source used, and when it was read |
| `reused` | Present when an identical check from the last 24 hours answered: `{ checkedAt, minutesAgo }`. Free. Only on `POST` |

Statuses and codes are listed in [Rules and verdicts](/docs/rules).

If the check takes longer than about 90 seconds, `POST` answers `202` with `id`, `url`, `status: "checking"` and `estimatedWaitSeconds`, plus `project` and `draftNote` when they apply. Read the check with `GET /api/v1/checks/{id}` after the `Retry-After` header's seconds. A check that fails answers `503` with the error `unavailable`; nothing was checked. (If an identical check was already running and it failed, `POST` answers `200` with the failed shape shown under [Read a check](#read-a-check).)

## What counts as a check

Each new check of an email uses one check from the monthly allowance. These are free:

| Request | Why it's free |
| --- | --- |
| The same email in the same project within 24 hours, with the same sources and no `fresh` or `revises` | The earlier answer comes back with `reused`. The current source text is confirmed without another comparison |
| The same email within 24 hours with `fresh: true` | The sources are read again and the email is checked again, free |
| A check with `revises` set to a HOLD | Checking again after a HOLD is free, at any time, while the HOLD is kept |
| A check with `source.platform` and `source.external_id` that match an earlier HOLD | It links to that HOLD on its own, so it is free in the same way |
| `GET /api/v1/checks/{id}` | Reading a check is free |

Free checks run even when the allowance is used up. Everything else counts: a different email, the same email after its sources changed (unless it revises a HOLD), `fresh: true` on an email not checked in the last 24 hours, and `revises` set to a check that was CLEAR.

## Check again after a HOLD

Send the corrected email to `POST /api/v1/checks` with `revises` set to the HOLD's ID. It is free. The answer has `revises` as `{ id, url, verdict, kind, inferred }`: the earlier check, its verdict, what changed, and whether the link was made for you (`inferred: true`) rather than passed. `revisionLine` says the same in one sentence. What changed is in `revises.kind`:

| `kind` | Meaning |
| --- | --- |
| `resent` | A new test send after a HOLD |
| `platform_edit` | The email was changed in its platform |
| `sources_changed` | The sources changed |
| `proposed` | Wording someone suggested. A proposed fix never makes the real email CLEAR |
| `recheck` | The same email, checked again |

If you pass `source.platform` and `source.external_id`, a check of the same email links to its last HOLD on its own.

## Read a check

`GET /api/v1/checks/{id}` returns `200` with the same answer as `POST`, without `draftNote`, `reused` or `project`. It needs the `checks:read` scope, and reading is free.

A check that failed answers `200` with what went wrong. Nothing was checked, so it is never CLEAR:

```json
{
  "id": "59c4dcfc-7b7a-4d86-8eaf-0f68ee1cd2b5",
  "url": "https://okaytosend.com/checks/59c4dcfc-7b7a-4d86-8eaf-0f68ee1cd2b5",
  "status": "failed",
  "reason": "A project or supplied source could not be read. Check that the sources open, then retry."
}
```

A check that is still running answers `202` with `id`, `url`, `status: "checking"` and `estimatedWaitSeconds`. Read the same ID again after the `Retry-After` header's seconds.

### Findings in more than one part

`findingCount` counts problems. A problem can mark more than one part of an email. Those marks have distinct claim IDs in `result.claims` and share an optional `problemId`. Use the claim IDs to mark the email. Use the shared ID to count the problem once.

### Unsubscribe on a list send

Klaviyo, Mailchimp, HubSpot, Braze and Customer.io identify a list send. A project can also declare list sends. The optional `unsubscribe` result says whether the project or platform identifies a list send (`listSend`) and where the way out was found (`found`). Values are `link`, `platform_tag`, `list_unsubscribe_header`, `visible_option` or `null`. A missing option can HOLD a list send that is not transactional. Other promotional emails may include a `note` when the way out is missing. The note has no effect on the verdict. The same fields are returned by the connector.

## Errors

Errors use `{ "error": { "code": "...", "message": "..." } }`. See [Errors and limits](/docs/errors).
