Demo All names and records here are made up, and the data resets every night. Please do not enter real personal information. ← Back to Find Care Scotland software · All software
Care Core

Documentation › API › API errors

API errors

The problem documents the API returns, and how to retry safely.

Every error is a problem document (RFC 9457), with content type application/problem+json:

{
  "type": "https://YOUR-CARE-CORE/docs/api-errors#validation_failed",
  "title": "Unprocessable request",
  "status": 422,
  "code": "validation_failed",
  "detail": "The request body has 2 problems.",
  "errors": [
    { "field": "last_name", "message": "This field is required." },
    { "field": "date_of_birth", "message": "Must be a real date in the form YYYY-MM-DD." }
  ],
  "request_id": "9f3c2a54b0e14c43"
}
  • Branch on code, which is stable. detail is for people and may be reworded.
  • errors lists field-level problems where there are any (otherwise it is empty).
  • When a rule of the domain refuses a change (for example “Only current staff can be key workers”), the message is in detail. The same text appears in the web interface.
  • A refused request changes nothing. Changes are all-or-nothing.
  • Quote request_id if you ask for help.

Codes

StatusCodeMeaning and what to do
400bad_requestThe request itself is malformed: invalid JSON, a body that is not an object, a bad query parameter (limit, cursor, a date, an unknown kind…). Fix the request.
401unauthorizedThe key is missing, invalid, revoked or expired. Do not retry until you have a valid key.
403forbiddenThe key lacks the scope, or is not allowed from this address. The detail says which.
403https_requiredUse HTTPS. Never send a key over plain HTTP.
404not_foundNo such endpoint, or no such resource visible to this key (it may exist but be in another organisation, or need a scope the key lacks). The API does not reveal which.
405method_not_allowedWrong method for that address. The Allow header lists the right ones.
409request_in_progressA request with that Idempotency-Key is still being processed. Wait for Retry-After, then repeat.
415unsupported_media_typeSend Content-Type: application/json.
422validation_failedThe request was understood but refused: a field is missing or wrong (see errors), or a rule of the domain forbids it (see detail). Change the request. Retrying unchanged will fail the same way.
422idempotency_mismatchThat Idempotency-Key was already used for a different request.
429rate_limitedToo many requests for this key. Wait Retry-After seconds.
500internal_errorOur fault. Retry with the same Idempotency-Key after a short delay; if it persists, report the request_id.

Retrying safely

  • Retry on 429 (after Retry-After), 500, 502, 503, 504, 409 request_in_progress, and network errors, with exponential back-off and a limit on attempts.
  • Always send an Idempotency-Key on POST so that a retry cannot do something twice.
  • Do not retry 400, 401, 403, 404, 405, 415 or 422 without changing something.
  • GET, PATCH and DELETE are safe to retry (a DELETE of something already deleted may return a 422).