# Grammar checking

> Member beta

`POST https://paperpurr.com/v1/check`

Checks English text for grammar, spelling, punctuation and concision, and can apply high-confidence corrections. Quotations, citations, links, code and reference lists are never changed.

## Body parameters

- `text` (string, required) — English text, up to 10,000 words
- `auto_apply` (boolean, default true) — When `false`, only lists suggestions and returns `text` unchanged
- `level` (string, default all) — `all`: grammar, spelling, concision and contractions. `correctness`: grammar and spelling only.
- `dialect` (string, default us) — `us` or `uk`

## Examples

curl:

```bash
curl -X POST "https://paperpurr.com/v1/check" \
  -H "Authorization: Bearer $PAPERPURR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"The results shows that the workshop helped. In order to test this, we has run a second survey.","auto_apply":true}'
```

Python:

```python
import os
import requests

r = requests.post(
    "https://paperpurr.com/v1/check",
    headers={"Authorization": f"Bearer {os.environ['PAPERPURR_API_KEY']}"},
    json={
        "text": "The results shows that the workshop helped. In order to test this, we has run a second survey.",
        "auto_apply": true
    },
)
print(r.json())
```

JS:

```javascript
const r = await fetch("https://paperpurr.com/v1/check", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAPERPURR_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "text": "The results shows that the workshop helped. In order to test this, we has run a second survey.",
    "auto_apply": true
  }),
});
console.log(await r.json());
```

## Response

```json
{
  "text": "The results show that the workshop helped. To test this, we have run a second survey.",
  "corrections": [
    {
      "before": "has",
      "after": "have",
      "category": "correctness",
      "rule": "Agreement",
      "message": "The form of the verb must agree in grammatical number with the pronoun.",
      "sentence": "In order to test this, we has run a second survey."
    },
    {
      "before": "In order to",
      "after": "To",
      "category": "clarity",
      "rule": "wordy-phrase",
      "message": "This phrase can be said in fewer words.",
      "sentence": "In order to test this, we have run a second survey."
    },
    {
      "before": "shows",
      "after": "show",
      "category": "correctness",
      "rule": "subject-verb",
      "message": "The subject and the verb don’t agree in number.",
      "sentence": "The results shows that the workshop helped."
    }
  ],
  "suggestions": [],
  "suggestions_total": 0,
  "words": 18,
  "request_id": "req_3b7e05c2f8a14d96b0e3c5a7"
}
```

- `text` (string, required) — The corrected text
- `corrections` (object[], required) — Corrections that were applied. Fields as in [Natural rewriting](https://paperpurr.com/en/docs/rewrite)
- `suggestions` (object[], required) — Suggestions not applied, up to 40
  - `text` (string, required) — The text at issue
  - `replacements` (string[], required) — What to replace it with. An empty string means delete it
  - `sentence` (string) — The sentence it’s in
  - `category` (string, required) — Category, such as `correctness` or `clarity`
  - `rule` (string, required) — Rule name
  - `message` (string, required) — The reason, in English
- `suggestions_total` (integer, required) — Total suggestions, which can be more than were returned
- `words` (integer, required) — Words you sent
- `request_id` (string, required) — Request ID

> **Tip:** For a text you’ve already polished, use `auto_apply: false` and decide on each suggestion yourself.

## Possible errors

| Status | code | Cause | What to do |
| --- | --- | --- | --- |
| `400` | `missing_parameter` | A required parameter is missing. `param` names it. | Add the parameter. |
| `400` | `invalid_parameter` | A parameter has the wrong type or value. `param` names it. | Fix it to match the type and range in the reference. |
| `400` | `unknown_parameter` | The request has a query parameter or body field the endpoint doesn’t accept. | Remove it or check the spelling. |
| `400` | `invalid_json` | The request body isn’t a JSON object. | Send a single JSON object with `Content-Type: application/json`. |
| `413` | `too_long` | `text` is over the per-call word limit. | Split it by section and call several times. |
| `413` | `body_too_large` | The body is too large: 128 KB at most for REST, 256 KB for MCP. | Send fewer or shorter items. |
| `429` | `rate_limit_exceeded` | A rate limit was hit. `message` explains. | Wait `Retry-After` seconds, then retry. Queue requests if several processes share one key. |
| `429` `503` | `busy` | `429`: the rewriting or check queue is full. `503`: quota or usage can’t be read or recorded for the moment; nothing was processed or counted. | Wait for `Retry-After` if present; otherwise back off and retry. |
| `502` | `upstream_unavailable` | The literature databases, the rewriting model or the check service didn’t respond. | Retry later. Nothing is counted for this call. |

See [Authentication](https://paperpurr.com/en/docs/auth) for auth errors and [Errors](https://paperpurr.com/en/docs/errors) for the full list.

## Metering

- Free during the beta, but counts toward your rate limit.
- Text you check isn’t stored.

Next: [Literature search](https://paperpurr.com/en/docs/search.md)
