Other error bodies
Some failures use a different body, so do not assumeerror is always an object.
An unknown path returns either 404 (plain text) or 403 with the message
This endpoint is not available, depending on the path.
Status codes
Rate limits and credit
A 429 has the coderate_limit_exceeded and a Retry-After header giving the seconds to wait. Two limits produce it:
- Search suggest allows each account a set number of requests per minute.
- Billable endpoints share a daily credit cap per account, which resets at midnight UTC.
Retry-Afterthen counts down to midnight, so stop rather than retry.
message states your account’s limit. A 402 has no Retry-After: the same request succeeds once the account has enough credit. See Usage and limits.
What a failed request costs
Requests that end in a 4xx or 5xx status are not charged. The exception is a title deed purchase: its error body carriesmoney_state, which is charged, not_charged or unknown. Read it before you retry or refund. unknown means the outcome could not be established: call GET /v1/title-deeds/{titleNumber}/purchase-status, which reports what the account was charged, before retrying. A 202 means the purchase succeeded and is still being delivered; do not treat it as a failure.
With the SDK
SDK methods throw on any 4xx or 5xx response.SDKBaseError, with the raw response text in body. The subclass depends on whether the body matched the documented shape, so branch on statusCode rather than on the class. The SDK’s other error classes and its built-in retries are on TypeScript SDK.
Over HTTP
Read the body as text first, because some errors are plain text. This helper returns a code and message from any of the shapes above:Retry-After when the response has one, back off exponentially when it does not, and cap the attempts. Give up when Retry-After runs to midnight UTC, and do not retry other 4xx statuses.