# The design preview Source: https://watership.ca/api-docs/docs/concepts/design-preview What exists today, what the API adds on top of it, and why the docs come before the service. The Watership Check API doesn't run anywhere yet. This page says what's real, what's designed, and why the documentation came first. ## What already exists [#what-already-exists] The API is a thin layer over parts of Watership that already work: - **The check engine.** A JavaScript module with no dependencies that runs the mechanical checks of the Watership Vale package, read from that package's `checks.json`. It takes text, returns findings with rule ids, levels, and positions, and runs in Node.js or a browser. Every finding example in these docs is the engine's real output, generated from it when the docs are built. - **The MCP server.** A Model Context Protocol server that gives AI tools the same checks, plus rule lookup and search. It runs the engine in a worker thread with a time limit, and it enforces the limits this API keeps: 100,000 characters of text, 500 findings per check, 5 seconds per check, and 120 requests a minute. - **The guides and their data.** The style guide, the UX writing guide, the slop guard, the terminology list, and the voices are written, and each exports its rules or entries as JSON. The rule, term, and voice examples in the spec come from those exports. ## What the API adds [#what-the-api-adds] The engine is a library, and the MCP server speaks a protocol built for AI clients. Neither suits a CI job, an editor plugin, or a content management system that wants to send text over HTTP and get structured findings back. The API is that HTTP interface: | Engine or MCP server | API | |---|---| | `engine.check(text, { format, minLevel })` | `POST /v1/checks` with `format` and `min_level` | | The `check_text` tool | `POST /v1/checks`, with findings as a flat list instead of grouped by level | | The `search_rules` tool | `GET /v1/rules?q=...` | | Rule data in each guide's `rules.json` | `GET /v1/rules` and `GET /v1/rules/{rule_id}` | | The terminology list's `terms.json` | `GET /v1/terms` and `GET /v1/terms/{term_id}` | | The voices' `voices.json` | `GET /v1/voices` and `GET /v1/voices/{voice_id}` | Some things stay out. The MCP server's `review_draft` tool assembles a review brief for an AI tool to complete. That depends on judgment, so it has no place in an API that promises the same findings for the same text. ## Why the docs come first [#why-the-docs-come-first] Writing the documentation before the service is a way to design the API. A tutorial shows whether the first request is easy to make. An errors page shows whether every failure has a clear next step. A task page for CI shows whether the response has what a pipeline needs, like a count of errors that survives truncation. Problems found in a draft spec cost an edit. Problems found after release cost a version. The spec at [`/openapi.yaml`](https://watership.ca/api-docs/openapi.yaml) is the single source for the reference pages, the mock server, and the request examples. It's linted on every build with a strict ruleset, and the build fails on any problem, including an em dash in a description. ## What the mock can and can't show [#what-the-mock-can-and-cant-show] The mock server validates every request against the spec and answers with the spec's examples. It shows the shape of every request and response, every error, and every header. It can't show behavior that depends on the text: it responds with the same findings whatever you send. [Run the mock server](https://watership.ca/api-docs/docs/tasks/run-the-mock-server) lists the gaps and how to work around them. # How findings map to the guides Source: https://watership.ca/api-docs/docs/concepts/findings-and-guides Where rules come from, how a rule id is built, and why one finding can name rules in two guides. A finding isn't the API's opinion. It points to a rule that a person wrote, in a guide anyone can read. This page explains how that link works, from the guides to the rule ids to the checks. ## Three guides, one set of ids [#three-guides-one-set-of-ids] The rules come from three Watership guides, each a separate site that exports its rules as JSON: | Guide | `guide` value | Rules | What it covers | |---|---|---|---| | [Style guide](https://watership.ca/style-guide/) | `style-guide` | 512 | Voice, spelling, capitalization, punctuation, numbers, procedures, interface text, links, inclusive language, terminology | | [UX writing guide](https://watership.ca/ux-writing/) | `ux-writing` | 34 | Text inside a product: buttons, errors, empty states, dialogs | | [Slop guard](https://watership.ca/slop-guard/) | `slop-guard` | 31 | The habits that make prose read as machine-made | The slop guard applies under every guide and every voice. The style guide and the UX writing guide cover different kinds of writing and share the same tiers. Every rule has an id that's unique across all three guides. The id is built from the section and the rule's name: `punct-semicolon` is in the punctuation section, `term-please` in terminology, and `floor-banned-words` in the slop guard, whose rules all start with `floor-`. Ids don't change when a rule's wording changes, so you can store them, filter on them, and link to them. ## From rule to finding [#from-rule-to-finding] The checks are the [Watership Vale package](https://watership.ca/parts.html#vale-watership), a set of patterns for the [Vale](https://vale.sh) linter. Each check names the rule ids it enforces. The API is designed to run those checks through the Watership JavaScript engine, which applies them the way Vale does. So a finding is the end of a chain: 1. A guide states a rule, with an id, a tier, and examples. 2. A check in the Vale package encodes the pattern for it and names the id. 3. The engine runs the check on your text and reports a match with the id, the tier, and a link back to the guide. Because each step names the same id, you can follow a finding back to the rule, and from a rule forward to every check that enforces it. The `link` on a finding goes straight to the rule's section in its guide. ## Why one finding can name two rules [#why-one-finding-can-name-two-rules] Some rules overlap across guides. The slop guard bans the em dash because readers now take it as a sign of machine text. The style guide's punctuation section also flags it, as a matter of house style. One pattern finds both, so the `EmDash` check reports `punct-em-dash` and `floor-no-em-dashes` together. The API reports one finding with both ids, not two findings for the same character. A reader sees the problem once. A tool that counts by rule still sees both rules. ## Company checks [#company-checks] An organization can add its own checks on top of the stock ones. The API's `company` group holds one kind: claims. A claims check flags wording that an organization's claims policy bans or restricts, such as a promise of perfect availability. These come from the company, not from a Watership guide, so they have `style: Company`, no rule ids, and a `link` to the organization's claims policy instead of a guide. Watership ships no claims lists, so the group stays empty until an organization adds its own. ## Related [#related] - [`GET /v1/rules`](https://watership.ca/api-docs/docs/reference/api/rules/list-rules) lists every rule with its guide and section. - [Look up a rule from a finding](https://watership.ca/api-docs/docs/tasks/look-up-a-rule) shows how to follow the id. # Why findings carry rule ids Source: https://watership.ca/api-docs/docs/concepts/rule-ids-not-rewrites Why the API reports which rule applies and where, and leaves the rewriting to the writer. Plenty of writing tools take a draft and hand back a better one. The Watership Check API doesn't. It responds with findings: a rule id, a position, and a one-line message. This page explains that choice. ## A rewrite hides the reason [#a-rewrite-hides-the-reason] When a tool rewrites a sentence, the writer sees the new sentence and has to guess what was wrong with the old one. Maybe the rewrite fixed a real problem. Maybe it changed a word the writer chose on purpose, or made the sentence longer, or introduced one of the habits the slop guard exists to catch. The writer can't tell which without comparing the two versions line by line, and most won't. A finding states the reason. "Use 'select' instead of 'click'", with the id `ui-select-verb`, tells the writer what's wrong, links to the rule that says why, and leaves the sentence in their hands. The next time, they write "select" without being told. ## The writer knows things the checks don't [#the-writer-knows-things-the-checks-dont] The checks are patterns. They don't know that a quoted error message must keep its original wording, that "please" is right when you ask a reader to report a bug, or that a product's name really is spelled in capitals. An avoid-tier rule exists because the writer is sometimes right to break it. A rewrite would take that decision away. A warning leaves it with the person who has the context. Where a fix is mechanical and safe, the finding carries a `replacement`, such as `select` for `click`. The API never applies it. An editor can offer it as a one-select fix, and the writer still chooses. ## Rule ids make findings usable by other tools [#rule-ids-make-findings-usable-by-other-tools] Because every finding names a rule by a stable id, other tools can act on it without parsing prose: - A CI job can block a merge on never-tier rules and let the rest through. - An editor can show the rule's guidance beside the finding, fetched from `GET /v1/rules/{rule_id}`. - A team can count findings by rule over a quarter and see which rules its writers break most, which is a better guide to training than a pile of rewritten drafts. - An AI writing tool can be told the rules by id and report its own work against them, so a person can check the report. A rewritten draft supports none of these. It's an end product, not data. ## Deterministic results build trust [#deterministic-results-build-trust] The same text checked against the same release always gets the same findings. A rewrite from a language model doesn't have that property: run it twice and the drafts differ. Determinism is what makes it possible to say "this passed on Tuesday and fails today because the latest release added a rule", and to put the check in a pipeline where a flaky result would block real work. ## What this means for you [#what-this-means-for-you] Expect findings, not fixes. Show the writer the message and the rule, offer the replacement when there is one, and let them decide. For the judgment rules the API can't check, use a reader, or a review tool given the rule's full text. ## Related [#related] - [Tiers and check types](https://watership.ca/api-docs/docs/concepts/tiers-and-check-types) explains which rules the API checks. - [The finding object](https://watership.ca/api-docs/docs/reference/finding) lists every field in a finding. # Tiers and check types Source: https://watership.ca/api-docs/docs/concepts/tiers-and-check-types Why every rule has a tier and a check type, and why the API reports only some of the rules. Every Watership rule carries two labels. Its **tier** says how much it matters. Its **check type** says how it can be found. The API is built around both, and most of its design follows from keeping them apart. ## Tiers: how much a rule matters [#tiers-how-much-a-rule-matters] A style guide that treats every rule as equally important stops being read. Writers learn that a page of findings is mostly noise, and they skim past the one that matters. Watership sorts its rules into three tiers so that the cost of breaking a rule is clear before anyone argues about it. | Tier | What it means | Reported as | |---|---|---| | | The strongest tier. Reported first, and no content type or voice lowers it. Your review policy says when it must be fixed. | `error` | | | Edit on one sighting, or keep it with a stated reason. | `warning` | | | A suggestion. Act on it when other problems turn up in the same passage. | `suggestion` | Never-tier rules are few. Of the 577 rules in the three guides, 75 are never-tier: things like an ambiguous date, link text that says "click here", or meaning shown by color alone. Each is a mistake that misleads or excludes a reader, so a review reports it before anything else. Most rules are avoid-tier. The tier exists for rules that are right nearly every time but not every time. "Please" is wrong in an instruction, and right when you ask a reader to report a bug for your benefit. A warning lets the writer make that call and say why. Prefer-tier rules are weak alone. One semicolon doesn't hurt a page. A semicolon, a stacked qualifier, and a hidden actor in one paragraph usually mean the paragraph needs another pass. That's why a suggestion is worth reporting even though no single one is worth fixing. The tiers are the guide's defaults. An organization can move an avoid-tier or prefer-tier rule up or down, though a never-tier rule stays never, so the tier on a finding is the tier in force for that release. ## Check types: how a rule can be found [#check-types-how-a-rule-can-be-found] The second label is about method. A **mechanical** rule is one a pattern can catch: a word on a list, a character, a capital letter, a number format. A **judgment** rule needs a reader: whether a sentence leads with the answer, whether an example fits the reader, whether a paragraph argues with no one. Of the 577 rules, 206 are mechanical and 371 need judgment. The API checks only mechanical rules, and of those, 76 have a check so far. The other 130 are mechanical in principle but don't have a reliable pattern yet. ## Why the API doesn't guess at judgment rules [#why-the-api-doesnt-guess-at-judgment-rules] It would be easy to add checks for judgment rules: flag every sentence over 30 words, every paragraph with a question in it, every "however". Each check would catch a few real problems and many false ones. A reader who gets 10 false findings stops trusting the eleventh. So the API reports only what a pattern can find reliably, and it's explicit about the rest. Every rule in `GET /v1/rules` has a `check` field and an `automated` field. A rule with `automated: false` is one the API will never report, and a review process needs a person, or a review tool that has the rule's full text, to cover it. A clean check result means the mechanical rules pass. It doesn't mean the text is good. ## Level isn't the same as tier [#level-isnt-the-same-as-tier] A finding has both a `tier` and a `level`, and they usually agree. They're separate fields because they answer different questions. The tier belongs to the rule: how much it matters. The level belongs to the check: how confident and how loud the report should be. Today every Watership check reports at the level of its rule's tier, so the two agree. A company claims check is the exception: it has no tier and sets its own level. The fields stay separate so that a check whose pattern misfires often can report more quietly without the rule seeming to matter less. If you want every finding for a tier, filter on `tier`. If you want what the report treats as loudest, filter on `level`. ## Related [#related] - [Filter findings](https://watership.ca/api-docs/docs/tasks/filter-findings) shows how to filter on tier or level. - [How findings map to the guides](https://watership.ca/api-docs/docs/concepts/findings-and-guides) explains where rules come from. # Overview Source: https://watership.ca/api-docs/docs 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. The Watership Check API is a design, not a running service. There's no hosted endpoint and no way to get a key. Everything in these docs runs against a local mock server built from the [OpenAPI spec](https://watership.ca/api-docs/openapi.yaml), so you can try every request today. The [design preview page](https://watership.ca/api-docs/docs/concepts/design-preview) says what exists and what doesn't. ## What the API does [#what-the-api-does] You send text. The API runs the Watership automated checks on it and responds with a list of findings. Each finding says where the problem is, what to change, and which rule it breaks, by a stable rule id such as `term-please` or `num-no-slash-dates`. The API also serves the material the checks come from: - **Rules**: all 577 rules in the [three Watership guides](https://watership.ca/api-docs/docs/concepts/findings-and-guides): the style guide, the UX writing guide, and the slop guard. Each has a tier and a check type. - **Terms**: the terminology list from the [glossary](https://watership.ca/glossary/), with the word to use and the words it replaces. - **Voices**: the six stock [voices](https://watership.ca/voices/) and where each sits on the [tone scales](https://watership.ca/tone-scales/). The checks are the mechanical checks in the [Watership Vale package](https://watership.ca/parts.html#vale-watership). They cover 76 rules. The rest need a pattern nobody has written yet, or a reader, and the API says so instead of guessing. ## How these docs are organized [#how-these-docs-are-organized] Every page is one type of page, and the sidebar groups them by type. The types come from the Watership DITA content model, which is based on DITA. | Type | What it gives you | Start with | |---|---|---| | Tutorials | A guided lesson with a visible result at every step | [Check your first draft](https://watership.ca/api-docs/docs/tutorials/check-your-first-draft) | | Tasks | Steps for one goal you already have | [Check a pull request in CI](https://watership.ca/api-docs/docs/tasks/check-a-pull-request) | | Concepts | How something works, and why | [Why findings carry rule ids](https://watership.ca/api-docs/docs/concepts/rule-ids-not-rewrites) | | Reference | Exact facts: endpoints, fields, errors, and limits | [The finding object](https://watership.ca/api-docs/docs/reference/finding) | | Interface guides | One screen, element by element | [Playground](https://watership.ca/api-docs/docs/reference/playground) | A page sticks to its type. The tutorial doesn't stop to list every field, a task doesn't explain the design, and the reference doesn't teach. When a page needs something from another type, it links to it. DITA, an open standard from the Organization for the Advancement of Structured Information Standards (OASIS), has three core topic types: concept, task, and reference. Watership adds the tutorial, which DITA lacks, and the interface guide, a reference page for a single screen. [The DITA content model](https://watership.ca/content-model/) describes each type. A comparable system is [Diátaxis by Daniele Procida](https://diataxis.fr/), which reaches a similar split and counts the tutorial among its four types. ## Base URL and authentication [#base-url-and-authentication] Every request goes to the mock server at `http://127.0.0.1:4010` and carries an API key as a bearer token: ```sh curl http://127.0.0.1:4010/v1/voices \ -H "Authorization: Bearer wsk_test_example" ``` The mock accepts any key. [Conventions](https://watership.ca/api-docs/docs/reference/conventions) covers keys, versioning, pagination, and headers. ## For AI agents [#for-ai-agents] These docs are written to be read by tools as well as people: - [`/llms.txt`](https://watership.ca/api-docs/llms.txt) lists every page with a one-line summary. - [`/llms-full.txt`](https://watership.ca/api-docs/llms-full.txt) has the full text of every page in one file. - Every page has a Markdown copy. Use **Copy Markdown** at the top of a page, or open `/llms.mdx/` followed by the page path and `content.md`, such as `/llms.mdx/docs/tutorials/check-your-first-draft/content.md`. - [`/openapi.yaml`](https://watership.ca/api-docs/openapi.yaml) is the spec the reference is built from. # Conventions Source: https://watership.ca/api-docs/docs/reference/conventions Base URL, authentication, versioning, pagination, and the headers every response carries. ## Base URL [#base-url] | Server | URL | Status | |---|---|---| | Local mock (Prism) | `http://127.0.0.1:4010` | Runs from the spec with `npm run mock` | | Hosted service | `https://api.watership.ca` | Planned. Not live. | Every path starts with the major version, such as `/v1/checks`. ## Authentication [#authentication] Send an API key as a bearer token in the `Authorization` header: ```http Authorization: Bearer wsk_test_example ``` | Key prefix | Use | |---|---| | `wsk_test_` | Testing. The mock accepts any key. | | `wsk_live_` | Production, when the hosted service exists | A request with no key, or a key that isn't valid, gets `401` with the problem type `unauthorized` and a `WWW-Authenticate: Bearer realm="watership"` header. Keep keys out of source control and out of browser code. ## Requests and responses [#requests-and-responses] - Request bodies are JSON, sent with `Content-Type: application/json`. Any other content type gets `415`. - Successful responses are `application/json`. Errors are `application/problem+json`. See [Errors](https://watership.ca/api-docs/docs/reference/errors). - Field names are `snake_case`. - Text is UTF-8. Positions in a finding's `span` count UTF-16 code units for `index` and `length`, and Unicode code points for `column`. See [The finding object](https://watership.ca/api-docs/docs/reference/finding#span). - A field with no value is `null`, not left out, unless the reference marks it optional. ## Versioning [#versioning] The API has two version numbers, and they change for different reasons. | Version | Where | Changes when | |---|---|---| | API version | The path: `/v1/` | The contract breaks: a field is removed or renamed, or a type changes | | Release | The `Watership-Release` header, and `release` in a check result | The Watership checks change: a check is added, removed, or reworded, or the guides they come from change | Within `v1`, changes are additive: new endpoints, new optional request fields, new response fields, and new values in lists such as `group`. Write clients that ignore fields they don't know and handle enum values they haven't seen. A release is the version of the Watership checks, such as `0.2.0`. The checks are the Watership Vale package, which is generated from the guides, so the release is that package's version, and a new rule or a changed check in a guide means a new release. A new release can add findings to text that passed before, because a new rule or check now applies. The same text checked against the same release always gets the same findings. To compare results over time, store the release with them. ## Pagination [#pagination] The list endpoints (`GET /v1/rules`, `GET /v1/terms`, and `GET /v1/voices`) return one page at a time. | Query parameter | Meaning | |---|---| | `limit` | Items per page, from 1 to 100. The default is 25. | | `cursor` | The `next_cursor` from the previous page. Leave it out for the first page. | | Response field | Meaning | |---|---| | `data` | The items on this page | | `has_more` | `true` if there's another page | | `next_cursor` | The cursor for the next page, or `null` on the last page | Cursors are opaque strings. Use them with the same filters that produced them. [List every rule in a guide](https://watership.ca/api-docs/docs/tasks/list-every-rule) shows a complete loop. ## Response headers [#response-headers] | Header | On | Meaning | |---|---|---| | `Watership-Release` | Every `2xx` | The release of the checks, the Watership Vale package's version | | `RateLimit-Limit` | Every response | Requests allowed per minute for this key | | `RateLimit-Remaining` | Every response | Requests left this minute | | `RateLimit-Reset` | Every response | Seconds until the count resets | | `Retry-After` | `429` | Seconds to wait before the next request | | `WWW-Authenticate` | `401` | The scheme the API expects | The limits themselves are in [Limits](https://watership.ca/api-docs/docs/reference/limits). # Errors Source: https://watership.ca/api-docs/docs/reference/errors Every problem type the API can respond with, with its status code, its cause, and whether a retry can help. Errors are problem objects as defined in [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457), sent with the content type `application/problem+json`. ## The problem object [#the-problem-object] ```json { "type": "https://watership.ca/api/problems/text-too-long", "title": "The text is too long", "status": 400, "detail": "\"text\" is 131,072 characters; the limit is 100,000. Split the text and check each part.", "instance": "req_3Kd9pX7vB2", "limit": 100000, "errors": [{ "pointer": "/text", "detail": "Longer than 100,000 characters." }] } ``` | Field | Type | Always present | Description | |---|---|---|---| | `type` | string (URI) | yes | Identifies the kind of problem. Branch on this. | | `title` | string | yes | A short summary, the same for every problem of one type. | | `status` | integer | yes | The HTTP status code. | | `detail` | string | yes | What went wrong with this request, and what to do. | | `instance` | string | no | An id for this occurrence. Quote it when you report a problem. | | `errors` | array | no | For `invalid-request` and `text-too-long`: one item per field, each with a `pointer` and a `detail`. | | `limit` | integer | no | For `text-too-long` and `payload-too-large`: the limit the request exceeded. | A `pointer` is a JSON Pointer ([RFC 6901](https://www.rfc-editor.org/rfc/rfc6901)) into the request body, such as `/min_level`. For a query parameter, it's the parameter name after `#/query/`, such as `#/query/limit`. The type URIs are stable identifiers. They don't resolve to a page yet. ## Problem types [#problem-types] All types start with `https://watership.ca/api/problems/`. | Type | Status | Cause | Retry? | Mock example | |---|---|---|---|---| | `invalid-request` | 400 | Malformed JSON, a missing or unknown field, or a value outside the allowed set | No. Fix the request. | `invalidRequest` | | `text-too-long` | 400 | `text` is over 100,000 characters | No. Split the text. | `textTooLong` | | `unauthorized` | 401 | No `Authorization` header, or the key isn't valid | No. Fix the key. | `missingKey` | | `not-found` | 404 | No rule, term, or voice has that id | No | `unknownRule` | | `payload-too-large` | 413 | The request body is over 1 MiB (1,048,576 bytes) | No. Split the text. | `bodyTooLarge` | | `unsupported-media-type` | 415 | The body isn't sent as `application/json` | No. Fix the header. | `notJson` | | `rate-limited` | 429 | The key sent more than 120 requests this minute | Yes, after `Retry-After` seconds | `rateLimited` | | `internal` | 500 | A fault on the server | Yes, with backoff | `internal` | | `check-timeout` | 503 | The check took longer than 5 seconds and was stopped | Not with the same text. Split it. | `timeout` | To get one of these from the mock server, send a `Prefer` header with the status code and the example name, such as `Prefer: code=400, example=textTooLong`. ## Endpoints and their errors [#endpoints-and-their-errors] | Endpoint | Can return | |---|---| | `POST /v1/checks` | 400, 401, 413, 415, 429, 500, 503 | | `GET /v1/rules`, `GET /v1/terms`, `GET /v1/voices` | 400, 401, 429, 500 | | `GET /v1/rules/{rule_id}`, `GET /v1/terms/{term_id}`, `GET /v1/voices/{voice_id}` | 400, 401, 404, 429, 500 | [Handle errors and rate limits](https://watership.ca/api-docs/docs/tasks/handle-errors-and-rate-limits) shows how to act on each type. # The finding object Source: https://watership.ca/api-docs/docs/reference/finding Every field of a finding from POST /v1/checks, with its type and what it means. A finding is one place in the text where a check matched. `POST /v1/checks` responds with them in `findings`, sorted by position, then by level from most to least serious. ## Example [#example] This finding is the check engine's output for the draft in [Check your first draft](https://watership.ca/api-docs/docs/tutorials/check-your-first-draft). ```json { "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" } ``` ## Fields [#fields] | Field | Type | Always present | Description | |---|---|---|---| | `check` | string | yes | The check that matched, by its name in the Watership Vale package, such as `SlashDates`. | | `style` | string | yes | `Watership` for a stock check. `Company` for a company claims check. | | `rule_ids` | array of strings | yes | The rules the check enforces. Usually one. Empty for a company claims check. | | `tier` | string or `null` | yes | The strictest tier among `rule_ids`: `never`, `avoid`, or `prefer`. `null` when `rule_ids` is empty. | | `level` | string | yes | `error`, `warning`, or `suggestion`. See [Level and tier](https://watership.ca/api-docs/docs/reference/finding#level-and-tier). | | `group` | string | yes | The check group, such as `numbers` or `slop`. | | `message` | string | yes | What to change, in one sentence. | | `match` | string | yes | The text that matched. | | `span` | object | yes | Where the match is. See [Span](https://watership.ca/api-docs/docs/reference/finding#span). | | `replacement` | string | no | The suggested replacement, when the check has one, such as `select` for `click`. The API never applies it. | | `link` | string (URI) | yes | The rule's page in its guide, or the organization's claims policy for a company claims check. | ## Span [#span] | Field | Type | Description | |---|---|---| | `index` | integer | Where the match starts, in UTF-16 code units from the start of the text you sent. This is the position JavaScript's `String.prototype.slice` uses. | | `length` | integer | The length of the match, in UTF-16 code units. | | `line` | integer | The line the match starts on, counting from 1. | | `column` | integer | The column the match starts at, counting from 1, in Unicode code points. This matches the columns Vale reports. | `index` and `length` refer to the text exactly as you sent it, including `\r\n` line endings. To get the matched text back in JavaScript, use `text.slice(index, index + length)`. In a language that counts code points, such as Python, convert the offsets first, or use `line` and `column`. ## Level and tier [#level-and-tier] The tier is a property of the rule. The level is how the check reports it. They map like this: | Tier | Level | Meaning | |---|---|---| | | `error` | The strongest tier. Reported first; your review policy says when it must be fixed. | | | `warning` | Edit on one sighting, or keep it with a stated reason. | | | `suggestion` | Optional. Act on it when other problems appear in the same passage. | Every Watership check reports at the level of its rule's tier. A company claims check has no tier and sets its own level. To act on every rule of a tier, filter on `tier`. ## Groups [#groups] | Group | Covers | |---|---| | `voice` | Voice and plain words | | `spelling` | Spelling | | `caps` | Capitalization | | `punctuation` | Punctuation | | `numbers` | Numbers, dates, and units | | `interface` | Interface text | | `links` | Links and images | | `inclusive` | Inclusive language | | `terms` | Terminology | | `structure` | Lists, abbreviations, tables, and headings | | `slop` | Slop guard | | `company` | Company claims | New groups can appear within `v1`. Treat a group you don't recognize like any other. # Limits Source: https://watership.ca/api-docs/docs/reference/limits Text length, request size, findings per response, check time, rate limits, and page sizes. The limits come from the Watership MCP server, which runs the same check engine and already enforces them. | Limit | Value | Applies to | When exceeded | |---|---|---|---| | Text length | 100,000 characters | `text` in `POST /v1/checks` | `400`, problem type `text-too-long` | | Request body | 1 MiB (1,048,576 bytes) | Every request | `413`, problem type `payload-too-large` | | Findings per response | 500 | `POST /v1/checks` | The response holds the first 500, and `truncated` is `true` | | Check time | 5 seconds | `POST /v1/checks` | The check is stopped. `503`, problem type `check-timeout` | | Requests | 120 per minute per API key | Every request | `429`, problem type `rate-limited`, with `Retry-After` | | Short strings | 200 characters | Ids, `q`, and `cursor` | `400`, problem type `invalid-request` | | Page size | 1 to 100 items, 25 by default | `limit` on list endpoints | `400`, problem type `invalid-request` | ## Notes [#notes] - **Characters** in the text limit are UTF-16 code units, the length JavaScript reports for a string. Most text has one unit per character. An emoji or a character outside the Basic Multilingual Plane counts as two. - **Truncation** keeps the first 500 findings by position. `counts` still counts every finding, so you can tell how many were left out. - **Check time** depends on the text, not on how busy the service is, so retrying the same text times out again. Split it. [Handle errors and rate limits](https://watership.ca/api-docs/docs/tasks/handle-errors-and-rate-limits#split-long-text) has code for that. - **The rate limit** is a fixed one-minute window per key. The `RateLimit-Remaining` and `RateLimit-Reset` headers on every response say where you stand. # Playground Source: https://watership.ca/api-docs/docs/reference/playground The panel that sends a request to one endpoint from its reference page. Every element on it, what it does, its default, and what changes when you use it. The playground lets you build a request to one endpoint, send it, and read the response without leaving the docs. To open it, go to an endpoint page under **Endpoints** in the sidebar, such as [Check text](https://watership.ca/api-docs/docs/reference/api/checks/check-text), and select **Try in playground** beside the method and path. The playground opens over the page, and on a narrow screen it fills the screen. It has four regions, read from the top: the title bar, the address bar, the request inputs on the left, and the request code and response on the right. On a narrow screen the inputs and the response share one space, and a **Request** and **Response** switch under the address bar chooses which one shows. **Who can see or change it.** The playground runs in your browser. Anyone who can open the docs can use it, and nobody else sees what you enter or what comes back. A request goes only to the server you choose in the address bar. With the local mock server, nothing leaves your computer. The tables below say which values your browser keeps, and for how long. ## Title bar [#title-bar] | Label | What it does | Default | When you use it | |---|---|---|---| | The endpoint name, such as **Check text** | Names the endpoint the playground sends to. | The endpoint of the page you opened it from | It's a heading, not an input. To try another endpoint, close the playground and open it from that endpoint's page. | | **Example** | Lists the named request examples in the spec for this endpoint. Only **Check text** has them: **Check a Markdown draft** and **Report errors only**. Other endpoints don't show this list. | **Check a Markdown draft** | The request inputs are replaced with the example's values, including anything you changed in the body. | | Close (×) | Closes the playground. | None | The page comes back. Your inputs and the last response stay until you leave or reload the page, so they're still there when you open the playground again. | ## Address bar [#address-bar] | Label | What it does | Default | When you use it | |---|---|---|---| | Method, such as **POST** or **GET** | Shows the HTTP method of the endpoint. | The endpoint's method | It can't be changed. | | Server URL, such as `http://127.0.0.1:4010` | Opens the **Server URL** list, which has the servers in the spec: `http://127.0.0.1:4010`, the local mock server, and `https://api.watership.ca`, the planned hosted service. | `http://127.0.0.1:4010` | Requests go to the server you choose. Your browser saves the choice and uses it on every endpoint page, including on later visits. The hosted service isn't live, so a request to it fails. | | Path, such as **/v1/checks** | Shows the endpoint's path. A path parameter, such as `rule_id` in `/v1/rules/{rule_id}`, appears as a box inside the path. The box and the parameter's row under **Path** hold the same value. | The path from the spec, with each path parameter set to the spec's example, such as `term-please` | The value you enter goes into the request address and the request code. | | **Send** | Sends the request. The button shows its shortcut: **Ctrl ↵** (Ctrl+Enter), or **⌘ ↵** on a Mac. | None | Your browser sends the request to the selected server, and the response region shows the result. The response region is dimmed until the response arrives. When it arrives, focus moves to the response, so a screen reader reads it and the keyboard continues from there. On a narrow screen, the switch changes to **Response**. | ## Request inputs [#request-inputs] The left side lists every input the endpoint takes, in sections. A section appears only if the endpoint uses it. ### Authorization [#authorization] | Label | What it does | Default | When you use it | |---|---|---|---| | **Authorization**, with **apiKey** | Names the section and the security scheme in the spec. | None | It's a heading, not an input. | | **Authorization** field, with **header** | Holds the value of the `Authorization` header. Enter your key after `Bearer `. The mock server accepts any key, such as `wsk_test_example`. | `Bearer ` with no key | The header in the request code changes to match. Your browser keeps the value for this tab, so it's filled in on every endpoint page until you close the tab. With no key, the mock server answers `401 Unauthorized`. | ### Path, Query, and Body [#path-query-and-body] **Path** holds the path parameters, **Query** the query parameters, and **Body** the JSON request body. **Path** and **Query** show how many parameters they hold, such as **7** on [List rules](https://watership.ca/api-docs/docs/reference/api/rules/list-rules). Only **Check text** has a **Body**, with these controls in its heading: | Label | What it does | Default | When you use it | |---|---|---|---| | **application/json** | Shows the content type of the body. | `application/json` | It can't be changed. | | **Form** | Shows the body as one row per field. | Selected | The body appears as rows. | | **JSON** | Shows the body as JSON text that you can edit. | Not selected | The body appears as JSON. Edits in either view change the same body, so **Form** shows what you changed in **JSON**. | Each field or parameter is one row. The rows follow the spec, and the names match the [API reference](https://watership.ca/api-docs/docs/reference/api/checks/check-text) exactly. | Label | What it does | Default | When you use it | |---|---|---|---| | Field name, such as **text** or **min_level** | Names the field. A red **\*** after the name marks a required field. | None | It's a label, not an input. | | Field info (ⓘ) | Opens a card with the field's type, its description from the spec, and its limits, such as the 100,000-character limit on `text`. The card also opens while you hover over the icon. | Closed | The card opens. Select anywhere else to close it. | | The value | Holds the field's value. A field with a fixed set of values, such as `format`, `min_level`, `mode`, or `tier`, opens a list of those values. A true-or-false field, such as `automated`, shows **true** and **false**. Other fields take text. | The selected example's value, or the spec's example for the parameter. Otherwise empty, or **Unset** for a list of values. | The request code changes to match. | | Type, such as **string** or **integer** | Shows the field's type from the spec. | None | It's a label, not an input. | | Unset (×) | Removes the field from the request. It appears on any optional field once it has a value. | None | The field is left out of the request, and the API uses its default. | A list field, such as `groups`, shows **Not set**, **1 item**, or the number of items, beside its type, **array<Group>**. Selecting it opens the list in place of the other inputs: | Label | What it does | Default | When you use it | |---|---|---|---| | Back (←) and the path, such as **Body › groups** | Returns to the full list of inputs. Selecting **Body** does the same. | None | The full list comes back, and the field shows how many items it has. | | **Unset** | Removes the whole list from the request. | None | The field is left out, and the API runs every group. | | Item, such as **[0]** | Holds one value in the list. | The first allowed value, such as `voice`. Opening an empty list adds one item. | The request code changes to match. | | Remove item (trash can) | Removes that item. | None | The items after it move up. | | **Add item** | Adds another item. | None | A new row appears at the end. | ## Request code [#request-code] The top of the right side shows the request you've built, as code you can run somewhere else. | Label | What it does | Default | When you use it | |---|---|---|---| | **Request** | Names the region. | None | It's a heading, not an input. | | Language, such as **cURL** | Chooses the language of the code: **cURL**, **JavaScript**, **Go**, **Python**, **Java**, **C#**, or **Rust**. | **cURL** | The code changes to that language. Your browser keeps the choice for this tab, and the code samples on the endpoint pages use it too. | | Copy code (clipboard) | Copies the code, including your key. | None | The icon changes to a check mark to confirm the copy. | ## Response [#response] The bottom of the right side shows the spec's example responses until you send a request, then the real response. ### Before you send [#before-you-send] | Label | What it does | Default | When you use it | |---|---|---|---| | **Response** | Names the region. | None | It's a heading, not an input. | | Status codes, such as **200**, **400**, and **429** | Shows one tab for each response the spec documents for this endpoint. | **200** | The description and the example change to that status. | | Example list | Chooses between examples when one status has more than one, such as the two `400` examples for **Check text**. It doesn't appear otherwise. | The first example | The example changes. | | Description, such as "The check ran. The findings may be empty." | Says what the status means for this endpoint, from the spec. | The `200` description | It changes with the status tab. | | Example body, with Copy code | Shows the example response from the spec. | The first `200` example | Copy code copies it. | The examples are the same ones the mock server responds with. For **Check text**, the `200` example is the real check engine's output, generated when the docs are built, for the **Check a Markdown draft** example. ### After you send [#after-you-send] | Label | What it does | Default | When you use it | |---|---|---|---| | Status, such as **200 OK** or **400 Bad Request** | Shows the status code and its name. Its dot is green for a success, amber for a `4xx` code, and red for a `5xx` code. | None | It's a label, not an input. | | Time and size, such as **25 ms · 3.8 kB** | Shows how long the request took and how large the response body is. It's hidden when the response region is narrow. | None | It's a label, not an input. | | **Body** | Shows the response body. JSON is formatted. | Selected | The body appears. | | **Headers**, with a count | Shows the response headers, such as `Watership-Release` and the `RateLimit-` headers. The count is the number of headers. | Not selected | The headers appear in place of the body. | | Download | Saves the response body as a file. | None | Your browser downloads the file. | | Clear (×) | Removes the response. | None | The example responses come back. | If a request gets no response at all, the region shows **Request failed** and a message that suggests checking the server URL. The usual causes are that the mock server isn't running, or that `https://api.watership.ca` is selected. ## Tasks that use the playground [#tasks-that-use-the-playground] - [Try an endpoint in the playground](https://watership.ca/api-docs/docs/tasks/try-an-endpoint) - [Run the mock server](https://watership.ca/api-docs/docs/tasks/run-the-mock-server), which the playground sends to by default # Check a pull request in CI Source: https://watership.ca/api-docs/docs/tasks/check-a-pull-request Check the Markdown files a pull request changes, annotate each finding on the diff, and fail the build on errors. This guide sets up a GitHub Actions job that sends every changed Markdown file to `POST /v1/checks`. Each finding appears as an annotation on the pull request, up to the limit GitHub sets, and the job fails if any finding is an error. Warnings and suggestions show up but don't block the merge. Until the hosted API exists, the workflow below starts the mock server inside the job, so you can run it end to end today. The mock responds with the same example findings for every file. When the service is live, remove the mock step and set the API address and key as repository secrets. ## Add the check script [#add-the-check-script] Save this script in your repository as `scripts/watership-check.mjs`. It takes file paths as arguments, checks each one, and prints [GitHub workflow commands](https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands) that turn findings into annotations. ```js title="scripts/watership-check.mjs" 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; const COMMAND = { error: 'error', warning: 'warning', suggestion: 'notice' }; // Workflow commands need %, line breaks, and (in properties) : and , escaped. const esc = (s) => String(s).replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A'); const prop = (s) => esc(s).replace(/:/g, '%3A').replace(/,/g, '%2C'); if (!API_KEY) { console.error('Set WATERSHIP_API_KEY.'); process.exit(2); } let errors = 0; for (const file of process.argv.slice(2)) { const text = await readFile(file, 'utf8'); if (!text.trim()) continue; 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(); console.log(`::error file=${prop(file)},title=Watership check failed::${esc(problem.detail)}`); errors++; continue; } const result = await response.json(); for (const f of result.findings) { const title = prop(f.rule_ids.join(', ') || f.check); console.log(`::${COMMAND[f.level]} file=${prop(file)},line=${f.span.line},col=${f.span.column},title=${title}::${esc(f.message)} ${f.link}`); } if (result.truncated) console.log(`::warning file=${prop(file)}::Only the first 500 findings are shown.`); errors += result.counts.error; } if (errors) { console.log(`${errors} error${errors === 1 ? '' : 's'}. Errors are never-tier rules and block the merge.`); process.exit(1); } ``` The script fails the job on `counts.error`, not on the number of findings in the list, so a truncated response still counts every error. ## Add the workflow [#add-the-workflow] Save this as `.github/workflows/watership.yml`: ```yaml title=".github/workflows/watership.yml" name: watership on: pull_request: paths: ['**/*.md', '**/*.mdx'] jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 24 # Design preview: run the mock server from the Watership spec. # Remove these two steps when the hosted API is live. - run: curl -fsSL -o watership.yaml "$WATERSHIP_SPEC_URL" env: WATERSHIP_SPEC_URL: ${{ vars.WATERSHIP_SPEC_URL }} - run: | npx --yes @stoplight/prism-cli@5.16.0 mock watership.yaml --port 4010 & # Any HTTP response, even 401, means the mock is up. for i in $(seq 1 60); do curl -s -o /dev/null http://127.0.0.1:4010/v1/voices && break; sleep 1; done - name: Check changed Markdown env: WATERSHIP_API_URL: ${{ vars.WATERSHIP_API_URL || 'http://127.0.0.1:4010' }} WATERSHIP_API_KEY: ${{ secrets.WATERSHIP_API_KEY || 'wsk_test_ci' }} run: | files=$(git diff --name-only --diff-filter=AM "origin/${{ github.base_ref }}...HEAD" -- '*.md' '*.mdx') if [ -z "$files" ]; then echo "No Markdown changed."; exit 0; fi node scripts/watership-check.mjs $files ``` Set the repository variable `WATERSHIP_SPEC_URL` to the address of `openapi.yaml` on the published docs, or commit a copy of the spec and point the mock at that file instead. ## Check that it works [#check-that-it-works] Open a pull request that changes a Markdown file. In the pull request, select **Files changed**. Each finding appears beside its line, with the rule id as the title. Select the link in an annotation to read the rule. GitHub shows at most 10 annotations of each level (error, warning, and notice) from one step, and 50 from one job, and drops the rest without saying so. The job log keeps every line the script printed, so on a large change, read the full list there: open the **watership** check and select its **Check changed Markdown** step. If any finding is an error, the **watership** check fails. Fix the text, or, if the rule doesn't apply here, ask the team that owns your style guide to adjust it. Your review policy says whether a never-tier finding can ever stay with a recorded reason. This workflow fails on every one. ## Related [#related] - To report only some findings, see [Filter findings](https://watership.ca/api-docs/docs/tasks/filter-findings). - To retry when the API is busy, see [Handle errors and rate limits](https://watership.ca/api-docs/docs/tasks/handle-errors-and-rate-limits). - For what errors, warnings, and suggestions mean, see [Tiers and check types](https://watership.ca/api-docs/docs/concepts/tiers-and-check-types). # Filter findings Source: https://watership.ca/api-docs/docs/tasks/filter-findings Report only the findings you care about, by level, by check group, or by tier and rule id. There are two places to filter. Ask the API for less with fields in the request, or filter the findings in your own code after the response arrives. Filter in the request when you never want the other findings. Filter in your code when different people or steps need different views of one check. ## Report only errors, or errors and warnings [#report-only-errors-or-errors-and-warnings] Set `min_level` in the request. The API leaves out every finding below that level: ```sh curl http://127.0.0.1:4010/v1/checks \ -H "Authorization: Bearer wsk_test_example" \ -H "Content-Type: application/json" \ -d '{"text": "The next maintenance window is 11/04/2026.", "format": "text", "min_level": "error"}' ``` | `min_level` | Reports | |---|---| | `suggestion` (default) | Errors, warnings, and suggestions | | `warning` | Errors and warnings | | `error` | Errors only | The `counts` in the response count only the levels you asked for. ## Run only some groups of checks [#run-only-some-groups-of-checks] Set `groups` to the check groups you want. To check only punctuation and numbers: ```json { "text": "Exports finish within a day; it is rare for one to fail.", "groups": ["punctuation", "numbers"] } ``` The groups are `voice`, `spelling`, `caps`, `punctuation`, `numbers`, `interface`, `links`, `inclusive`, `terms`, `structure`, `slop`, and `company`. To run only the slop guard checks, send `["slop"]`. Each finding's `group` field says which group it came from. ## Filter by tier [#filter-by-tier] To act on every never-tier rule, filter on `tier`, not on `level`. Today every Watership check reports at the level of its rule's tier, so the two agree, but a company claims check has no tier and sets its own level, and a filter on `tier` keeps working if a check's level changes. ```js const result = await response.json(); const blocking = result.findings.filter((f) => f.tier === 'never'); const worthFixing = result.findings.filter((f) => f.tier === 'avoid'); ``` A company claims finding has no rule ids, so its `tier` is `null`. Its `level` is set by the organization's claims list: `error` for a banned claim, `warning` for one on the watch list. If you filter on tier, handle claims separately: ```js const claims = result.findings.filter((f) => f.style === 'Company'); ``` ## Ignore one rule [#ignore-one-rule] To drop one rule's findings, filter on `rule_ids`. A finding can name more than one rule, because one check can enforce rules in two guides, so test whether the list includes the id: ```js const ignored = new Set(['voice-contractions']); const kept = result.findings.filter((f) => !f.rule_ids.some((id) => ignored.has(id))); ``` To drop a rule for everyone in your organization, change the rule's tier in your copy of the guide instead. Filtering hides findings from one report, and a tier change applies everywhere the rule is checked. ## Related [#related] - [The finding object](https://watership.ca/api-docs/docs/reference/finding) lists every field you can filter on. - [Tiers and check types](https://watership.ca/api-docs/docs/concepts/tiers-and-check-types) explains what each tier means. # Handle errors and rate limits Source: https://watership.ca/api-docs/docs/tasks/handle-errors-and-rate-limits Branch on the problem type, retry only what a retry can fix, wait out a rate limit, and split text that’s too long. Every error from the API is a problem object ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)) with the content type `application/problem+json`. Its `type` field says what went wrong. This guide shows how to decide, for each type, whether to retry, wait, fix the request, or split the text. ## Decide what to do from the type [#decide-what-to-do-from-the-type] Branch on `type`, not on `title` or `detail`. The type is stable, and the other two are for people and can change. | `type` ends in | Status | What to do | |---|---|---| | `invalid-request` | 400 | Fix the request. The `errors` list names each field. Don't retry. | | `text-too-long` | 400 | Split the text and check each part. See [Split long text](https://watership.ca/api-docs/docs/tasks/handle-errors-and-rate-limits#split-long-text). | | `unauthorized` | 401 | Check the key and the `Authorization` header. Don't retry. | | `not-found` | 404 | The id doesn't exist. Don't retry. | | `payload-too-large` | 413 | The body is over 1 MiB. Split the text. | | `unsupported-media-type` | 415 | Send `Content-Type: application/json`. | | `rate-limited` | 429 | Wait for `Retry-After` seconds, then retry. | | `internal` | 500 | Retry with backoff, up to a few times. | | `check-timeout` | 503 | Don't retry the same text. Split it and check each part. | The [errors reference](https://watership.ca/api-docs/docs/reference/errors) describes each type in full. ## Retry with backoff [#retry-with-backoff] This function sends a request and retries only the problems a retry can fix: `429` after the time the API asks for, and `500` with exponential backoff and jitter. Every other problem is thrown at once. ```js title="watership-request.mjs" const API_URL = process.env.WATERSHIP_API_URL ?? 'http://127.0.0.1:4010'; const API_KEY = process.env.WATERSHIP_API_KEY; export class WatershipProblem extends Error { constructor(problem) { super(`${problem.title}: ${problem.detail}`); this.problem = problem; this.type = problem.type.split('/').pop(); } } const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); export async function request(path, { method = 'GET', body, maxAttempts = 4 } = {}) { for (let attempt = 1; ; attempt++) { const response = await fetch(`${API_URL}${path}`, { method, headers: { Authorization: `Bearer ${API_KEY}`, ...(body ? { 'Content-Type': 'application/json' } : {}), }, body: body ? JSON.stringify(body) : undefined, }); if (response.ok) return response.json(); const problem = await response.json(); const retryable = response.status === 429 || response.status === 500; if (!retryable || attempt === maxAttempts) throw new WatershipProblem(problem); const retryAfter = Number(response.headers.get('Retry-After')); const backoff = 2 ** attempt * 500 + Math.random() * 250; await sleep(response.status === 429 && retryAfter > 0 ? retryAfter * 1000 : backoff); } } ``` Use it for any endpoint: ```js import { request, WatershipProblem } from './watership-request.mjs'; try { const result = await request('/v1/checks', { method: 'POST', body: { text } }); console.log(result.counts); } catch (e) { if (e instanceof WatershipProblem && e.type === 'unauthorized') { console.error('Check WATERSHIP_API_KEY.'); } else { throw e; } } ``` ## Stay under the rate limit [#stay-under-the-rate-limit] Each key can send 120 requests a minute. Every response says where you stand: | Header | Meaning | |---|---| | `RateLimit-Limit` | Requests allowed per minute | | `RateLimit-Remaining` | Requests left in this minute | | `RateLimit-Reset` | Seconds until the count resets | If you're checking many files, read `RateLimit-Remaining` after each response, and when it reaches zero, wait `RateLimit-Reset` seconds before the next request. That saves a request you know will fail. To check many short texts, combine them into one request where you can. One check of a 20,000-character document is one request. Checking its 50 paragraphs one at a time is 50. ## Split long text [#split-long-text] A check accepts up to 100,000 characters of text, and a request body up to 1 MiB. To check a longer document, split it at paragraph breaks into parts under the limit, check each part, and add each part's starting line to the line numbers in its findings: ```js const LIMIT = 100_000; function split(text) { const parts = []; let start = 0; while (start < text.length) { let end = Math.min(start + LIMIT, text.length); if (end < text.length) { const breakAt = text.lastIndexOf('\n\n', end); if (breakAt > start) end = breakAt + 2; } parts.push({ text: text.slice(start, end), offset: start }); start = end; } return parts; } const findings = []; for (const part of split(text)) { const lineOffset = text.slice(0, part.offset).split('\n').length - 1; const result = await request('/v1/checks', { method: 'POST', body: { text: part.text } }); for (const f of result.findings) { findings.push({ ...f, span: { ...f.span, index: f.span.index + part.offset, line: f.span.line + lineOffset } }); } } ``` The same split fixes `check-timeout`, because a shorter text takes less time to check. ## Test your handling against the mock [#test-your-handling-against-the-mock] The mock never rate-limits or fails on its own. Ask it for an error with the `Prefer` header: ```sh curl -i http://127.0.0.1:4010/v1/checks \ -H "Authorization: Bearer wsk_test_example" \ -H "Content-Type: application/json" \ -H "Prefer: code=429" \ -d '{"text": "Hello."}' ``` The response is `429 Too Many Requests` with `Retry-After: 42`. To get the text-too-long problem, send `Prefer: code=400, example=textTooLong`. [Run the mock server](https://watership.ca/api-docs/docs/tasks/run-the-mock-server) lists the options. # List every rule in a guide Source: https://watership.ca/api-docs/docs/tasks/list-every-rule Page through GET /v1/rules with a cursor to export all the rules in one guide or tier. `GET /v1/rules` responds with rules a page at a time. This guide shows how to follow the cursor to the last page, so you can export every rule in a guide, for example to build a checklist or to load rule names into your own tool. ## Ask for the first page [#ask-for-the-first-page] Filter to the rules you want and set the page size. The largest page is 100 rules, so the style guide's 512 rules take two pages: ```sh curl "http://127.0.0.1:4010/v1/rules?guide=style-guide&limit=100" \ -H "Authorization: Bearer wsk_test_example" ``` The response has the rules in `data`, plus `has_more` and `next_cursor`: ```json { "data": [ ... ], "has_more": true, "next_cursor": "cnVsZTpwcm9jLXZlcmlmeS1lbmQ" } ``` ## Follow the cursor [#follow-the-cursor] While `has_more` is `true`, ask for the next page with `cursor` set to the `next_cursor` you got. Keep the same filters on every page. ```js title="list-rules.mjs" const API_URL = process.env.WATERSHIP_API_URL ?? 'http://127.0.0.1:4010'; const API_KEY = process.env.WATERSHIP_API_KEY ?? 'wsk_test_example'; async function listRules(filters, { maxPages = 50 } = {}) { const rules = []; let cursor = null; for (let page = 0; page < maxPages; page++) { const params = new URLSearchParams({ ...filters, limit: '100' }); if (cursor) params.set('cursor', cursor); const response = await fetch(`${API_URL}/v1/rules?${params}`, { headers: { Authorization: `Bearer ${API_KEY}` }, }); if (!response.ok) throw new Error(`List failed: ${response.status}`); const body = await response.json(); rules.push(...body.data); if (!body.has_more) return rules; cursor = body.next_cursor; } throw new Error(`Stopped after ${maxPages} pages.`); } const neverRules = await listRules({ tier: 'never' }); console.log(neverRules.map((r) => `${r.id}\t${r.name}`).join('\n')); ``` A cursor is opaque. Don't build one yourself or read meaning into it, and don't reuse it with different filters. The mock responds with the same example page every time, with `has_more` set to `true`, so the loop would never end on its own. The `maxPages` limit stops it. Keep a limit like this in production code too, so a fault can't turn into an endless loop. ## Combine filters [#combine-filters] Filters combine, and every one must match. To export the mechanical rules in the style guide that the automated checks don't cover yet: ```js const gaps = await listRules({ guide: 'style-guide', check: 'mechanical', automated: 'false' }); ``` ## Related [#related] - [`GET /v1/rules`](https://watership.ca/api-docs/docs/reference/api/rules/list-rules) in the API reference, with every filter - [Pagination](https://watership.ca/api-docs/docs/reference/conventions#pagination) in the conventions reference # Look up a rule from a finding Source: https://watership.ca/api-docs/docs/tasks/look-up-a-rule Turn a finding’s rule id into the rule’s guidance and examples, and cache rules by release. A finding tells you which rule the text breaks. To show the writer why, fetch the rule. This guide shows how to get a rule from a finding, and how to cache rules so that a check with 40 findings doesn't make 40 extra requests. ## Get the rule [#get-the-rule] Take an id from the finding's `rule_ids` and pass it to `GET /v1/rules/{rule_id}`: ```sh curl http://127.0.0.1:4010/v1/rules/term-please \ -H "Authorization: Bearer wsk_test_example" ``` The rule's guidance is in `body`, as Markdown, and its examples are in `examples`, each a pair of text to avoid and text to write instead. If you only need to send a person to the rule, you don't need a request at all. Every finding has a `link` to the rule's page in its guide. ## Handle a finding with more than one rule [#handle-a-finding-with-more-than-one-rule] Most findings name one rule. A few checks enforce rules in two guides at once. The `Email` check, for example, reports `term-email` from the terminology section and `spell-closed-compounds` from the spelling section. Show the first id as the main rule and link the others: ```js const [main, ...related] = finding.rule_ids; ``` A company claims finding has an empty `rule_ids` list. Use its `link`, which points to the organization's claims policy. ## Cache rules by release [#cache-rules-by-release] Rules and checks change only in a new release, which is a new version of the Watership checks, such as `0.2.0`. Every response carries the release in the `Watership-Release` header, and a check result also has it in `release`. Use the release and the rule id together as the cache key: ```js const cache = new Map(); async function getRule(id, release) { const key = `${release}:${id}`; if (!cache.has(key)) { const response = await fetch(`${API_URL}/v1/rules/${encodeURIComponent(id)}`, { headers: { Authorization: `Bearer ${API_KEY}` }, }); if (response.status === 404) return null; if (!response.ok) throw new Error(`Rule lookup failed: ${response.status}`); cache.set(key, await response.json()); } return cache.get(key); } // Fetch each rule once, however many findings name it. const ids = [...new Set(result.findings.flatMap((f) => f.rule_ids))]; const rules = await Promise.all(ids.map((id) => getRule(id, result.release))); ``` When the release changes, the old keys stop matching and the cache fills again with the new rules. ## Handle an unknown id [#handle-an-unknown-id] A rule id you saved from an old release may have been retired or renamed. The API responds with `404` and a problem object, and the `detail` suggests the closest id when there is one. Treat it as "no rule to show" and fall back to the finding's `message`. ## Related [#related] - [`GET /v1/rules/{rule_id}`](https://watership.ca/api-docs/docs/reference/api/rules/get-a-rule) in the API reference - [How findings map to the guides](https://watership.ca/api-docs/docs/concepts/findings-and-guides) # Run the mock server Source: https://watership.ca/api-docs/docs/tasks/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. The mock server is [Prism](https://stoplight.io/open-source/prism), an open-source tool that serves an API from its OpenAPI file. It validates each request against the spec and answers with the examples in it. Use it to try the API before the hosted service exists, and to test your own client code. ## Start it [#start-it] From the repository folder: ```sh npm install npm run mock ``` The mock listens on `http://127.0.0.1:4010`. To use another port, pass it after `--`: ```sh npm run mock -- --port 8080 ``` Prism needs Node.js 24.18 or later. The repository's `.nvmrc` names the version, so with a version manager such as nvm, run `nvm use` first. ## Get a particular response [#get-a-particular-response] By default, the mock responds with the first success example for the endpoint. To get a different response, send a `Prefer` header: | To get | Send | |---|---| | A particular status code | `Prefer: code=429` | | A particular named example | `Prefer: example=textTooLong` | | Both | `Prefer: code=400, example=textTooLong` | For example, to see a rate-limit response: ```sh curl -i http://127.0.0.1:4010/v1/rules \ -H "Authorization: Bearer wsk_test_example" \ -H "Prefer: code=429" ``` The example names are in the spec, under each response's `examples`. The [errors reference](https://watership.ca/api-docs/docs/reference/errors) lists the ones for each problem type. ## Find out why a request was rejected [#find-out-why-a-request-was-rejected] When a request breaks the spec, the mock responds with the status code the spec gives for it, usually `400`. The body is always the first example for that status, so it may not describe your mistake. The real reason is in the `sl-violations` response header: ```sh curl -i http://127.0.0.1:4010/v1/checks \ -H "Authorization: Bearer wsk_test_example" \ -H "Content-Type: application/json" \ -d '{}' ``` ```txt HTTP/1.1 400 Bad Request sl-violations: [{"location":["request","body"],"severity":"Error","code":"required","message":"Request body must have required property 'text'"}] ``` ## Know what the mock can't do [#know-what-the-mock-cant-do] The mock serves the spec, not the service behind it. It: - Responds with the same example whatever text you send to `POST /v1/checks` - Responds with the same rule, term, or voice whatever id you ask for, so it never responds with `404` on its own - Doesn't count requests, so it never responds with `429` on its own - Accepts any API key, and rejects only a request with no `Authorization` header To test how your code handles one of these cases, ask for it with a `Prefer` header. # Try an endpoint in the playground Source: https://watership.ca/api-docs/docs/tasks/try-an-endpoint Send a request to any endpoint from its reference page, change the inputs, and read the response, without writing code. Each endpoint page has a playground that sends real requests to the mock server. Use it to see how an endpoint responds before you write a client, or to copy a working request as code. You need the mock server running on your computer. If it isn't, follow [Run the mock server](https://watership.ca/api-docs/docs/tasks/run-the-mock-server) first. ## Send a request [#send-a-request] 1. In the sidebar, under **Endpoints**, open the endpoint you want, such as [Check text](https://watership.ca/api-docs/docs/reference/api/checks/check-text). 2. Select **Try in playground**. 3. In the **Authorization** field, enter a key after `Bearer `, such as `wsk_test_example`. The mock accepts any key. 4. Select **Send**, or press Ctrl+Enter (⌘+Enter on a Mac). The response appears on the right, with its status, such as **200 OK**, and its body. Select **Headers** to see the `Watership-Release` and rate limit headers. ## Change the request [#change-the-request] 1. Change a value in the request inputs. For **Check text**, set `min_level` to `error`, or choose **Report errors only** from **Example**. 2. Select **Send** again. The mock responds with the spec's example whatever you send, so the findings don't change with the text. It does reject a request that breaks the spec. To see that, select **JSON** above the body, delete the `text` line, and select **Send**. The response is `400 Bad Request`. ## Copy the request as code [#copy-the-request-as-code] 1. Under **Request**, choose a language, such as **Python**. 2. Select Copy code beside the language. The code includes your key and body, ready to run against the same server. ## Related [#related] - [Playground](https://watership.ca/api-docs/docs/reference/playground) describes every element on the panel. - [Check your first draft](https://watership.ca/api-docs/docs/tutorials/check-your-first-draft) makes the same requests from a terminal. # Check your first draft Source: https://watership.ca/api-docs/docs/tutorials/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](https://watership.ca/parts.html#api-docs), which holds the spec and 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 [#start-the-mock-server] In the repository folder, install the dependencies and start the mock: ```sh npm install npm run mock ``` When 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 [#send-a-request-without-a-key] Every request needs an API key. To see what happens without one, ask for the list of voices: ```sh curl -i http://127.0.0.1:4010/v1/voices ``` The response is `401 Unauthorized`, with a body like this: ```json { "type": "https://watership.ca/api/problems/unauthorized", "title": "Authentication failed", "status": 401, "detail": "Send your API key in the Authorization header as \"Bearer \".", "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 [#add-a-key] Send the same request with a key in the `Authorization` header. The mock accepts any key, so use `wsk_test_tutorial`: ```sh 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 [#check-the-draft] Here's the draft you'll check. It's a short help article with problems a reviewer would catch: ```md title="draft.md" # 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`: ```json title="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`: ```sh curl http://127.0.0.1:4010/v1/checks \ -H "Authorization: Bearer wsk_test_tutorial" \ -H "Content-Type: application/json" \ --data @check.json ``` The response starts with a summary: ```json { "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 [#read-a-finding] Find the item in `findings` whose `level` is `error`. It's the only error: ```json { "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_ids` names the rule the text breaks: `num-no-slash-dates`. - `tier` is `never`, the strongest tier, so a review reports it first. The `level` is `error` for the same reason. - `match` and `span` show where it is: the text `11/04/2026`, on line 5, column 89. - `message` says 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 [#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: ```sh 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: ```json { "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 [#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. ```js title="check-draft.mjs" 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: ```sh node check-draft.mjs ``` ```python title="check_draft.py" import json import os import urllib.error import urllib.request API_URL = os.environ.get("WATERSHIP_API_URL", "http://127.0.0.1:4010") API_KEY = os.environ.get("WATERSHIP_API_KEY", "wsk_test_tutorial") with open("draft.md", encoding="utf-8") as f: text = f.read() request = urllib.request.Request( f"{API_URL}/v1/checks", data=json.dumps({"text": text, "format": "markdown"}).encode("utf-8"), headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, method="POST", ) try: with urllib.request.urlopen(request) as response: result = json.load(response) except urllib.error.HTTPError as e: problem = json.load(e) raise SystemExit(f"{problem['status']} {problem['title']}: {problem['detail']}") counts = result["counts"] print(f"Release {result['release']}: {counts['error']} error, {counts['warning']} warnings, {counts['suggestion']} suggestions\n") for finding in result["findings"]: where = f"{finding['span']['line']}:{finding['span']['column']}" print(f"{where:<6} {finding['level']:<10} {', '.join(finding['rule_ids']):<28} {finding['message']}") ``` Run it: ```sh python check_draft.py ``` The output lists every finding in the order it appears in the draft: ```txt 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 [#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: ```md # 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 [#next-steps] - To block a pull request on errors, follow [Check a pull request in CI](https://watership.ca/api-docs/docs/tasks/check-a-pull-request). - To see every field a finding can have, read [The finding object](https://watership.ca/api-docs/docs/reference/finding). - To understand why the API reports rule ids and leaves the rewriting to you, read [Why findings carry rule ids](https://watership.ca/api-docs/docs/concepts/rule-ids-not-rewrites). # Check text Source: https://watership.ca/api-docs/docs/reference/api/checks/check-text ## POST /v1/checks **Check text** Runs the Watership automated checks on one piece of text and responds with every finding, sorted by position. Each finding names the rule ids it enforces, so you can look up the rule, show its guidance, or decide what to block. The checks cover mechanical rules only: word lists, characters, capitalization, and number formats. Judgment rules need a reader. A check is stateless: the text isn’t stored, and the same text against the same release always gets the same findings. Text can be up to 100,000 characters. One response holds at most 500 findings. When there are more, `truncated` is `true`. ### Request body (application/json) | Field | Type | Required | Description | |---|---|---|---| | `text` | string | yes | The text to check. Up to 100,000 characters. | | `format` | one of `markdown`, `text` | no | `markdown` skips code and reads headings, lists, and tables. `text` treats everything as prose. | | `min_level` | one of `suggestion`, `warning`, `error` | no | The lowest level to report. | | `groups` | array of one of `voice`, `spelling`, `caps`, `punctuation`, `numbers`, `interface`, `links`, `inclusive`, `terms`, `structure`, `slop`, `company` | no | Run only the checks in these groups. Leave it out to run every group. | | `mode` | one of `precise`, `vale` | no | `precise` leaves out matches that are almost always false alarms, such as a banned word inside a quotation or a product name. `vale` reports exactly what the Watership Vale package reports. | ```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", "min_level": "suggestion" } ``` ### Responses - `200`: The check ran. The findings may be empty. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `413`: The request body is over 1 MiB (1,048,576 bytes). - `415`: The request body isn’t JSON. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. - `503`: The check took longer than 5 seconds and was stopped. Retrying the same text won’t help. Example `200` response: ```json { "release": "0.3.3", "engine_version": "1.0.0", "counts": { "error": 1, "warning": 8, "suggestion": 2 }, "truncated": false, "findings": [ { "check": "HeadingCase", "style": "Watership", "rule_ids": [ "cap-sentence-case-headings" ], "tier": "avoid", "level": "warning", "group": "caps", "message": "Use sentence case for headings: “Getting Started With” looks like title case.", "match": "Getting Started With", "span": { "index": 2, "length": 20, "line": 1, "column": 3 }, "link": "https://watership.ca/style-guide/capitalization/#cap-sentence-case-headings" }, { "check": "ImportanceFlags", "style": "Watership", "rule_ids": [ "floor-importance-flagging" ], "tier": "avoid", "level": "warning", "group": "slop", "message": "Cut “It's important to note”; if it matters, say it.", "match": "It's important to note", "span": { "index": 32, "length": 22, "line": 3, "column": 1 }, "link": "https://watership.ca/slop-guard/#floor-importance-flagging" }, { "check": "Minimizers", "style": "Watership", "rule_ids": [ "incl-no-simply" ], "tier": "avoid", "level": "warning", "group": "inclusive", "message": "Delete “easily”; the instruction reads the same without it.", "match": "easily", "span": { "index": 68, "length": 6, "line": 3, "column": 37 }, "link": "https://watership.ca/style-guide/inclusive-and-accessible-language/#incl-no-simply" }, { "check": "Use", "style": "Watership", "rule_ids": [ "term-use", "floor-banned-words" ], "tier": "avoid", "level": "warning", "group": "terms", "message": "Use “use” instead of “utilize”.", "match": "utilize", "span": { "index": 75, "length": 7, "line": 3, "column": 44 }, "replacement": "use", "link": "https://watership.ca/style-guide/terminology/#term-use" }, { "check": "LetsYou", "style": "Watership", "rule_ids": [ "term-lets-you" ], "tier": "avoid", "level": "warning", "group": "terms", "message": "Use “lets you” instead of “allows you to”.", "match": "allows you to", "span": { "index": 103, "length": 13, "line": 3, "column": 72 }, "replacement": "lets you", "link": "https://watership.ca/style-guide/terminology/#term-lets-you" }, { "check": "BannedWords", "style": "Watership", "rule_ids": [ "floor-banned-words" ], "tier": "avoid", "level": "warning", "group": "slop", "message": "“seamless” is on the slop guard’s banned list.", "match": "seamless", "span": { "index": 128, "length": 8, "line": 3, "column": 97 }, "link": "https://watership.ca/slop-guard/#floor-banned-words" }, { "check": "Please", "style": "Watership", "rule_ids": [ "term-please" ], "tier": "avoid", "level": "warning", "group": "terms", "message": "Don’t write “please” in documentation or interface text.", "match": "Please", "span": { "index": 156, "length": 6, "line": 3, "column": 125 }, "link": "https://watership.ca/style-guide/terminology/#term-please" }, { "check": "SelectVerb", "style": "Watership", "rule_ids": [ "ui-select-verb" ], "tier": "avoid", "level": "warning", "group": "interface", "message": "Use “select” instead of “click”.", "match": "click", "span": { "index": 163, "length": 5, "line": 3, "column": 132 }, "replacement": "select", "link": "https://watership.ca/style-guide/ui-elements/#ui-select-verb" }, { "check": "Semicolon", "style": "Watership", "rule_ids": [ "punct-semicolon" ], "tier": "prefer", "level": "suggestion", "group": "punctuation", "message": "Prefer a period to a semicolon.", "match": ";", "span": { "index": 214, "length": 1, "line": 5, "column": 28 }, "link": "https://watership.ca/style-guide/punctuation/#punct-semicolon" }, { "check": "PronounContractions", "style": "Watership", "rule_ids": [ "voice-contractions" ], "tier": "prefer", "level": "suggestion", "group": "voice", "message": "Write “it is rare” with a contraction: “it’s”, “you’re”, or “you’ll”.", "match": "it is rare", "span": { "index": 216, "length": 10, "line": 5, "column": 30 }, "link": "https://watership.ca/style-guide/voice-and-person/#voice-contractions" }, { "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" } ] } ``` # List rules Source: https://watership.ca/api-docs/docs/reference/api/rules/list-rules ## GET /v1/rules **List rules** Lists the rules in the style guide, the UX writing guide, and the slop guard, in guide order. Filter by guide, tier, check type, or whether the automated checks cover the rule. Use `q` to search ids, names, and rule text. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `limit` | query | integer | no | The most items to return in one page. | | `cursor` | query | string | no | The `next_cursor` from the previous page. Leave it out for the first page. | | `guide` | query | one of `style-guide`, `ux-writing`, `slop-guard` | no | Only rules from this guide. | | `tier` | query | one of `never`, `avoid`, `prefer` | no | Only rules of this tier. | | `check` | query | one of `mechanical`, `judgment` | no | Only rules of this check type. | | `automated` | query | boolean | no | `true` for only the rules the automated checks cover, `false` for only the rules they don’t. | | `q` | query | string | no | Words to look for in rule ids, names, and text. Every word must match. | ### Responses - `200`: One page of rules. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "data": [ { "id": "num-no-slash-dates", "name": "No slash dates", "guide": "style-guide", "section": "numbers-dates-and-units", "tier": "never", "check": "mechanical", "automated": true, "link": "https://watership.ca/style-guide/numbers-dates-and-units/#num-no-slash-dates" }, { "id": "link-descriptive-text", "name": "Descriptive link text", "guide": "style-guide", "section": "links-and-cross-references", "tier": "never", "check": "mechanical", "automated": true, "link": "https://watership.ca/style-guide/links-and-cross-references/#link-descriptive-text" } ], "has_more": true, "next_cursor": "cnVsZTpsaW5rLWRlc2NyaXB0aXZlLXRleHQ" } ``` # Get a rule Source: https://watership.ca/api-docs/docs/reference/api/rules/get-a-rule ## GET /v1/rules/{rule_id} **Get a rule** Responds with one rule in full: its tier, its check type, the guidance in Markdown, and its examples. Every finding from `POST /v1/checks` carries rule ids you can pass here. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `rule_id` | path | string | yes | A rule id, such as one from a finding’s `rule_ids`. | ### Responses - `200`: The rule. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `404`: Nothing has that id. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "id": "term-please", "name": "Please in instructions", "guide": "style-guide", "section": "terminology", "tier": "avoid", "check": "mechanical", "automated": true, "link": "https://watership.ca/style-guide/terminology/#term-please", "body": "**Don’t write “please” in documentation or interface text.** An instruction is not a favor, and the word slows every step. The one exception is a request the reader makes for the company’s benefit rather than their own, such as reporting a bug or filling in a survey.", "examples": [ { "instead": "Please select Save to keep your changes.", "write": "Select Save to keep your changes." } ] } ``` # List terms Source: https://watership.ca/api-docs/docs/reference/api/terms/list-terms ## GET /v1/terms **List terms** Lists the entries in the terminology list, in alphabetical order. Each entry gives the preferred word, the words it replaces with their status, and the rule that enforces it. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `limit` | query | integer | no | The most items to return in one page. | | `cursor` | query | string | no | The `next_cursor` from the previous page. Leave it out for the first page. | | `status` | query | one of `preferred`, `restricted`, `prohibited`, `obsolete` | no | Only entries whose headword has this status. | | `q` | query | string | no | Words to look for in the headword, its alternatives, and its usage notes. | ### Responses - `200`: One page of terms. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "data": [ { "id": "sign-in", "term": "sign in", "status": "preferred", "definition": "To start a session in a product by proving who you are, such as with a password or a one-time code.", "usage": [ "Write “sign in,” not “log in,” “login,” or “log on.” Use two words as a verb (“sign in to your account”), and hyphenate only as a modifier, as in “the sign-in page.”" ], "examples": [ { "instead": "Login to Acme Cloud, then logout when you’re done.", "write": "Sign in to Acme Cloud, then sign out when you’re done." } ], "alternatives": [ { "term": "log in", "status": "prohibited" }, { "term": "log-in", "status": "prohibited" }, { "term": "login", "status": "prohibited" }, { "term": "log on", "status": "prohibited" }, { "term": "logon", "status": "prohibited" } ], "rule": { "id": "term-sign-in", "tier": "avoid", "check": "mechanical" }, "related": [ "sign-out" ] } ], "has_more": true, "next_cursor": "dGVybTpzaWduLWlu" } ``` # Get a term Source: https://watership.ca/api-docs/docs/reference/api/terms/get-a-term ## GET /v1/terms/{term_id} **Get a term** Responds with one entry from the terminology list. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `term_id` | path | string | yes | The entry’s id, the headword in lowercase with hyphens. | ### Responses - `200`: The term. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `404`: Nothing has that id. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "id": "sign-in", "term": "sign in", "status": "preferred", "definition": "To start a session in a product by proving who you are, such as with a password or a one-time code.", "usage": [ "Write “sign in,” not “log in,” “login,” or “log on.” Use two words as a verb (“sign in to your account”), and hyphenate only as a modifier, as in “the sign-in page.”" ], "examples": [ { "instead": "Login to Acme Cloud, then logout when you’re done.", "write": "Sign in to Acme Cloud, then sign out when you’re done." } ], "alternatives": [ { "term": "log in", "status": "prohibited" }, { "term": "log-in", "status": "prohibited" }, { "term": "login", "status": "prohibited" }, { "term": "log on", "status": "prohibited" }, { "term": "logon", "status": "prohibited" } ], "rule": { "id": "term-sign-in", "tier": "avoid", "check": "mechanical" }, "related": [ "sign-out" ] } ``` # List voices Source: https://watership.ca/api-docs/docs/reference/api/voices/list-voices ## GET /v1/voices **List voices** Lists the stock voices, each with its personality and its resting position on the six tone scales. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `limit` | query | integer | no | The most items to return in one page. | | `cursor` | query | string | no | The `next_cursor` from the previous page. Leave it out for the first page. | ### Responses - `200`: One page of voices. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "data": [ { "id": "plainspoken", "name": "Plainspoken", "tagline": "Direct, clear, helpful.", "default_for": [ "concept", "task", "tutorial", "reference", "interface guide", "troubleshooting", "migration guide", "comparison" ], "personality": [ { "trait": "Direct", "not": "blunt" }, { "trait": "Clear", "not": "simplistic" }, { "trait": "Helpful", "not": "hovering" } ], "scales": { "register": { "rest": 50, "error": 50, "position": "the center" }, "levity": { "rest": 32, "error": 24, "position": "toward sober" }, "deference": { "rest": 52, "error": 60, "position": "the center" }, "energy": { "rest": 40, "error": 28, "position": "toward calm" }, "confidence": { "rest": 56, "error": 56, "position": "toward assertive" }, "detail": { "rest": 50, "error": 50, "position": "the center" } } }, { "id": "authoritative", "name": "Authoritative", "tagline": "Precise, assured, formal.", "default_for": [ "release notes", "policy page", "security advisory", "technical whitepaper", "backgrounder", "benchmark report", "press release", "media kit", "internal update or email" ], "personality": [ { "trait": "Precise", "not": "pedantic" }, { "trait": "Assured", "not": "arrogant" }, { "trait": "Formal", "not": "stiff" } ], "scales": { "register": { "rest": 68, "error": 68, "position": "toward formal" }, "levity": { "rest": 26, "error": 24, "position": "well toward sober" }, "deference": { "rest": 58, "error": 64, "position": "toward deferential" }, "energy": { "rest": 32, "error": 26, "position": "toward calm" }, "confidence": { "rest": 62, "error": 58, "position": "toward assertive" }, "detail": { "rest": 56, "error": 52, "position": "toward thorough" } } } ], "has_more": true, "next_cursor": "dm9pY2U6YXV0aG9yaXRhdGl2ZQ" } ``` # Get a voice Source: https://watership.ca/api-docs/docs/reference/api/voices/get-a-voice ## GET /v1/voices/{voice_id} **Get a voice** Responds with one stock voice. ### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `voice_id` | path | string | yes | The voice’s id: plainspoken, authoritative, warm, thoughtful, energetic, or steady. | ### Responses - `200`: The voice. - `400`: The request is malformed or a field fails validation. The `type` tells you which. - `401`: The `Authorization` header is missing, or the key isn’t valid. - `404`: Nothing has that id. - `429`: This API key has sent more than 120 requests in the current minute. - `500`: Something failed on the server. Retry with backoff. Example `200` response: ```json { "id": "plainspoken", "name": "Plainspoken", "tagline": "Direct, clear, helpful.", "default_for": [ "concept", "task", "tutorial", "reference", "interface guide", "troubleshooting", "migration guide", "comparison" ], "personality": [ { "trait": "Direct", "not": "blunt" }, { "trait": "Clear", "not": "simplistic" }, { "trait": "Helpful", "not": "hovering" } ], "scales": { "register": { "rest": 50, "error": 50, "position": "the center" }, "levity": { "rest": 32, "error": 24, "position": "toward sober" }, "deference": { "rest": 52, "error": 60, "position": "the center" }, "energy": { "rest": 40, "error": 28, "position": "toward calm" }, "confidence": { "rest": 56, "error": 56, "position": "toward assertive" }, "detail": { "rest": 50, "error": 50, "position": "the center" } } } ```