Check your first draft
Start the mock server, check a short draft, read the findings, and look up the rule behind one of them. About 15 minutes.
In this tutorial, you check a short help article against the Watership rules. By the end, you’ll have sent an authenticated request, read a list of findings, looked up the rule behind a finding, and done the same check from a script.
You don’t need to know anything about Watership. You need:
- Node.js 24.18 or later, and npm
curl- A copy of the API docs repository, which holds the spec and the mock server
About the mock server
The hosted API doesn’t exist yet, so you’ll run a mock server on your own computer. The mock doesn’t run the checks. It answers every request with the example response from the API spec. The example for a check is the real check engine’s output for the draft in this tutorial, which is why you’ll use that exact draft.
Start the mock server
In the repository folder, install the dependencies and start the mock:
npm install
npm run mockWhen the mock is ready, it prints a line for each endpoint, such as POST http://127.0.0.1:4010/v1/checks. Leave it running, and open a second terminal for the rest of the tutorial.
Send a request without a key
Every request needs an API key. To see what happens without one, ask for the list of voices:
curl -i http://127.0.0.1:4010/v1/voicesThe response is 401 Unauthorized, with a body like this:
{
"type": "https://watership.ca/api/problems/unauthorized",
"title": "Authentication failed",
"status": 401,
"detail": "Send your API key in the Authorization header as \"Bearer <key>\".",
"instance": "req_5Lr1cN8eQ4"
}Every error from the API has this shape. The type says what kind of problem it is, and the detail says what to do about it.
Add a key
Send the same request with a key in the Authorization header. The mock accepts any key, so use wsk_test_tutorial:
curl http://127.0.0.1:4010/v1/voices \
-H "Authorization: Bearer wsk_test_tutorial"This time you get 200 OK and a list of voices. You’re ready to check some text.
Check the draft
Here’s the draft you’ll check. It’s a short help article with problems a reviewer would catch:
# Getting Started With Exports
It's important to note that you can easily utilize the export tool. It allows you to download a seamless copy of your data. Please click Export to begin.
Exports finish within a day; it is rare for one to fail. The next maintenance window is 11/04/2026.A check request is JSON with the text in a text field. Save this as check.json:
{
"text": "# Getting Started With Exports\n\nIt's important to note that you can easily utilize the export tool. It allows you to download a seamless copy of your data. Please click Export to begin.\n\nExports finish within a day; it is rare for one to fail. The next maintenance window is 11/04/2026.\n",
"format": "markdown"
}Send it to POST /v1/checks:
curl http://127.0.0.1:4010/v1/checks \
-H "Authorization: Bearer wsk_test_tutorial" \
-H "Content-Type: application/json" \
--data @check.jsonThe response starts with a summary:
{
"release": "0.3.3",
"engine_version": "1.0.0",
"counts": { "error": 1, "warning": 8, "suggestion": 2 },
"truncated": false,
"findings": [ ... ]
}counts gives the number of findings at each level, and findings lists them in the order they appear in the draft.
Read a finding
Find the item in findings whose level is error. It’s the only error:
{
"check": "SlashDates",
"style": "Watership",
"rule_ids": ["num-no-slash-dates"],
"tier": "never",
"level": "error",
"group": "numbers",
"message": "Write the date “11/04/2026” with the month in full, such as September 15, 2026, or in the ISO form, such as 2026-09-15, where a machine reads it.",
"match": "11/04/2026",
"span": { "index": 275, "length": 10, "line": 5, "column": 89 },
"link": "https://watership.ca/style-guide/numbers-dates-and-units/#num-no-slash-dates"
}Read it from the top:
rule_idsnames the rule the text breaks:num-no-slash-dates.tierisnever, the strongest tier, so a review reports it first. Theleveliserrorfor the same reason.matchandspanshow where it is: the text11/04/2026, on line 5, column 89.messagesays what to change.
Now find the finding for Please. Its tier is avoid and its level is warning: worth fixing, but a writer can keep it with a reason.
Look up the rule
A finding gives you a rule id. To get the rule itself, pass the id to GET /v1/rules/{rule_id}. Look up the rule behind the Please finding:
curl http://127.0.0.1:4010/v1/rules/term-please \
-H "Authorization: Bearer wsk_test_tutorial"The response has the rule’s guidance in body, and an example of the fix:
{
"id": "term-please",
"name": "Please in instructions",
"guide": "style-guide",
"tier": "avoid",
"check": "mechanical",
"automated": true,
"body": "**Don’t write “please” in documentation or interface text.** An instruction is not a favor, ...",
"examples": [
{
"instead": "Please select Save to keep your changes.",
"write": "Select Save to keep your changes."
}
]
}This is how the API works throughout. It tells you which rule applies and where, and the rule tells you why. It doesn’t rewrite your text.
Check the draft from a script
Save the draft as draft.md, then save this script beside it. It reads the file, checks it, and prints one line per finding.
import { readFile } from 'node:fs/promises';
const API_URL = process.env.WATERSHIP_API_URL ?? 'http://127.0.0.1:4010';
const API_KEY = process.env.WATERSHIP_API_KEY ?? 'wsk_test_tutorial';
const text = await readFile('draft.md', 'utf8');
const response = await fetch(`${API_URL}/v1/checks`, {
method: 'POST',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ text, format: 'markdown' }),
});
if (!response.ok) {
const problem = await response.json();
throw new Error(`${problem.status} ${problem.title}: ${problem.detail}`);
}
const result = await response.json();
const { error, warning, suggestion } = result.counts;
console.log(`Release ${result.release}: ${error} error, ${warning} warnings, ${suggestion} suggestions\n`);
for (const finding of result.findings) {
const where = `${finding.span.line}:${finding.span.column}`.padEnd(6);
console.log(`${where} ${finding.level.padEnd(10)} ${finding.rule_ids.join(', ').padEnd(28)} ${finding.message}`);
}Run it:
node check-draft.mjsThe output lists every finding in the order it appears in the draft:
Release 0.3.3: 1 error, 8 warnings, 2 suggestions
1:3 warning cap-sentence-case-headings Use sentence case for headings: “Getting Started With” looks like title case.
3:1 warning floor-importance-flagging Cut “It's important to note”; if it matters, say it.
3:37 warning incl-no-simply Delete “easily”; the instruction reads the same without it.
3:44 warning term-use, floor-banned-words Use “use” instead of “utilize”.
3:72 warning term-lets-you Use “lets you” instead of “allows you to”.
3:97 warning floor-banned-words “seamless” is on the slop guard’s banned list.
3:125 warning term-please Don’t write “please” in documentation or interface text.
3:132 warning ui-select-verb Use “select” instead of “click”.
5:28 suggestion punct-semicolon Prefer a period to a semicolon.
5:30 suggestion voice-contractions Write “it is rare” with a contraction: “it’s”, “you’re”, or “you’ll”.
5:89 error num-no-slash-dates Write the date “11/04/2026” with the month in full, such as September 15, 2026, or in the ISO form, such as 2026-09-15, where a machine reads it.What you did
You started a mock of the API, saw how it rejects a request without a key, and checked a draft. You read a finding’s rule id, tier, and position, and used the rule id to get the rule. Then you ran the same check from a script.
Here’s the draft with every finding fixed, for comparison:
# Get started with exports
Export a copy of your data from the export tool. Select **Export** to begin.
Exports finish within a day, and they rarely fail. The next maintenance window is November 4, 2026.The fix reads 11/04/2026 as November 4. A reader in another country could read it as April 11, which is why the rule is never-tier: only the writer knows which date they meant.
Next steps
- To block a pull request on errors, follow Check a pull request in CI.
- To see every field a finding can have, read The finding object.
- To understand why the API reports rule ids and leaves the rewriting to you, read Why findings carry rule ids.
Overview
The Watership Check API checks prose against the Watership style guide, UX writing guide, and slop guard, and responds with each finding and the id of the rule it breaks.
Run the mock server
Start a local mock of the API from the spec, choose which response it sends, and see why it rejected a request.

