Error format
Errors return JSON with adetail field.
On the metered routes the body also carries a stable code, a requestId and a retryable flag:
code, not on the text of detail.
Quote requestId when you contact support.
Every code is listed in the error code reference.
Validation errors (422) keep detail as a short string and put the field-level details in errors:
errors[].loc to find the field.
A 422 from a rule that spans several fields (chapter without titleNumber, a malformed Boolean expression) has a plain detail string and no errors array.
Status codes
A
429 has three meanings, told apart by code:
rate_limitedis retryable.quota_exceededis a standing account limit such as the watch cap (see Law change alerts). It hasretryable: false. Delete a watch or upgrade.daily_cap_exceededis the per-key daily cap.
429 on a watch test delivery sends Retry-After: 30.
402 body
A402 adds the numbers behind the refusal when they are known:
GET /credits/balance is free and shows your current balance.
400 versus 422
A422 is schema validation: a field is missing, or its type or range is wrong.
The response carries the loc array shown above.
GET and POST /us/statutes/resolve also return 422 (code invalid_citation_input) for a corpusType or state scope they do not accept. Nothing is charged.
A 400 is a request that is well-formed but not allowed.
POST /watches and PATCH /watches/{id} return it for:
- a
scopethe board cannot be narrowed by, or anactIdscope that does not exist on that board, - a board whose
scopableisfalse, such as the Federal Register, - a missing
webhookUrloremailAddressfor thechannelyou asked for, or one set on a channel that does not use it, - a
webhookUrlthe API refuses as a delivery target, - a
webhookAuth.headerNamethat is not a legal header name, or outbound auth set on an email-only watch.
detail string names the problem. Do not retry without changing the request.
409 on watches
POST /watches returns 409 when you already hold a watch on the same board, channel and scope.
PATCH /watches/{id} returns it when narrowing a watch’s scope would collide with another of your watches.
The subscription already exists, so list your watches with GET /watches and reuse it.
Rate limiting
Limits apply per API key and scale with your plan. Each valid key has its own bucket, and a per-address limit at 10 times your plan limit also applies. A key that does not validate counts against the shared per-address bucket. Every response carries these headers:
On a request with an API key,
X-RateLimit-Scope is key for your key’s own bucket and ip for the shared per-address bucket.
Exceeding a limit returns 429.
A 429 or 503 with a Retry-After header also carries retryAfterSeconds in the error body.
Both are whole seconds. Wait that long, then retry the same request.
If there is no hint, retry with exponential backoff.
daily_cap_exceeded is also a 429, but retrying cannot succeed until the cap resets.
The official SDKs retry the safe cases for you.
If you call the API directly, add exponential backoff.
Retry loop example
Retry loop example
Related
Error code reference
Every machine-readable code, with its status, retry rule and SDK class.
SDKs
The official SDKs map these errors to typed exceptions and retry the safe ones for you.

