Skip to content
Design preview: examples use a local mock server.

Conventions

Base URL, authentication, versioning, pagination, and the headers every response carries.

Base URL

ServerURLStatus
Local mock (Prism)http://127.0.0.1:4010Runs from the spec with npm run mock
Hosted servicehttps://api.watership.caPlanned. Not live.

Every path starts with the major version, such as /v1/checks.

Authentication

Send an API key as a bearer token in the Authorization header:

Authorization: Bearer wsk_test_example
Key prefixUse
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

  • 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.
  • 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.
  • A field with no value is null, not left out, unless the reference marks it optional.

Versioning

The API has two version numbers, and they change for different reasons.

VersionWhereChanges when
API versionThe path: /v1/The contract breaks: a field is removed or renamed, or a type changes
ReleaseThe Watership-Release header, and release in a check resultThe 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

The list endpoints (GET /v1/rules, GET /v1/terms, and GET /v1/voices) return one page at a time.

Query parameterMeaning
limitItems per page, from 1 to 100. The default is 25.
cursorThe next_cursor from the previous page. Leave it out for the first page.
Response fieldMeaning
dataThe items on this page
has_moretrue if there’s another page
next_cursorThe 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 shows a complete loop.

Response headers

HeaderOnMeaning
Watership-ReleaseEvery 2xxThe release of the checks, the Watership Vale package’s version
RateLimit-LimitEvery responseRequests allowed per minute for this key
RateLimit-RemainingEvery responseRequests left this minute
RateLimit-ResetEvery responseSeconds until the count resets
Retry-After429Seconds to wait before the next request
WWW-Authenticate401The scheme the API expects

The limits themselves are in Limits.

On this page