Developers
Get access

Errors

Every call returns errors in the same shape: RFC 9457 problem details. Each error has a type URL that opens a page here explaining it.

The shape of an error

{
  "type": "https://developers.checkmystreet.co.uk/errors/outside-coverage",
  "title": "Outside coverage",
  "status": 422,
  "detail": "We value properties in England and Wales. EH1 1 is in Scotland.",
  "code": "unknown_sector"
}
FieldWhat it tells you
typeA URL that identifies the error. Branch on this in your code.
titleA short, fixed summary of the type.
statusThe HTTP status, repeated in the body.
detailWhat went wrong with this request, in words. Log it rather than parse it.
codeA more specific reason within the type.

Catalogue

StatusTypeWhenWhat to do
400invalid-requestMalformed JSON, an unknown field, a bad valueFix the request. Retrying it unchanged fails again.
401TokenMissing, invalid or expired tokenGet a new token, then retry.
403insufficient-creditsThe balance does not cover the callTop up by card, then retry.
403account-blockedThe account is suspendedContact us.
404not-foundAn unknown id, or nothing held for a postcodeCheck the id you stored.
409request-in-progressSame Idempotency-Key while the first call runsWait, then retry with the same key.
422outside-coverageThe postcode is outside England and WalesDo not retry.
422floor-area-requiredThe bedrooms could not be turned into a floor areaSend floorAreaSqm.
422idempotency-key-reusedThe same key arrived with a different requestUse a new key for a new request.
429rate-limitedToo many requests in a short time, or the daily limit ("code": "daily_limit")Wait the seconds in Retry-After. For the daily limit, stop until midnight UTC.
503data-unavailableSomething we rely on was unavailable. Never charged.Retry shortly, with the same key.
504timeoutThe call ran past 30 secondsRetry with the same key.

Token errors

401 means the token is missing, invalid or expired. It is checked before anything else, so its body is an OAuth error such as {"error": "invalid_token"} rather than a problem document. Get a new token, then retry the call once.

Handling errors in code

Branch on type, and treat anything you do not recognise as a failure you log:

if (!res.ok) {
  const problem = await res.json();
  switch (problem.type) {
    case "https://developers.checkmystreet.co.uk/errors/outside-coverage":
      return showMessage("We can only value homes in England and Wales.");
    case "https://developers.checkmystreet.co.uk/errors/timeout":
    case "https://developers.checkmystreet.co.uk/errors/data-unavailable":
      return retryWithSameKey();
    default:
      throw new Error(`${problem.status} ${problem.title}: ${problem.detail}`);
  }
}

In test mode, the magic postcodes return most of these errors on demand.

Updated