careCycle

Errors

The careCycle API error format, every error code, and how to recover from each one.

The careCycle API uses standard HTTP status codes. A 2xx status means the request succeeded. Errors return a JSON body with a human-readable message and a machine-readable code.

Error format

{
  "message": "A customer with this MBI already exists",
  "code": "CUSTOMER_ALREADY_EXISTS"
}

Branch on code (or on the HTTP status when no code you recognize is present). Do not parse message: it is written for people and can change.

Some errors carry extra fields:

StatusExtra fieldContents
400, 409detailsAn object with more context about the problem, when available
422errorsOne entry per invalid field: path, message, code, and sometimes expected and received
422failedRecordsSync endpoints only: identifiers of the records that failed validation
429retryAfterSeconds to wait before retrying. See Rate limits

A validation error looks like this:

{
  "message": "Validation failed",
  "code": "VALIDATION_ERROR",
  "errors": [
    {
      "path": ["email"],
      "message": "Invalid email address",
      "code": "invalid_format"
    }
  ]
}

Error codes

StatusCodeMeaningHow to recover
400BAD_REQUESTThe request is well formed but not valid for this operationRead message and details, fix the request, and retry. Retrying unchanged fails again
401UNAUTHORIZEDThe API key is missing or invalidSend a valid key in the x-api-key header. See Authentication
403FORBIDDENThe key is valid but lacks the capability this endpoint needsCreate a key with the required capability. Retrying with the same key fails again
404NOT_FOUNDThe resource does not exist, or your key can't access itCheck the ID. Do not retry
409CONFLICTThe request conflicts with the current state, for example a duplicateFetch the current state, then decide whether to update the existing resource or change the request
422VALIDATION_ERRORThe request failed schema validationFix each field listed in errors, then retry
429RATE_LIMIT_EXCEEDEDThe key exceeded its rate limitWait retryAfter seconds, then retry. See Rate limits
500INTERNAL_SERVER_ERRORSomething went wrong on careCycle's sideRetry with exponential backoff. If it persists, contact support
503SERVICE_UNAVAILABLEThe service is temporarily unavailableRetry with exponential backoff

Endpoint-specific codes

Some endpoints return a more specific code with one of the statuses above. For example, creating a customer whose MBI is already on file returns 409 with CUSTOMER_ALREADY_EXISTS, and booking an appointment slot that was just taken returns 409 with SLOT_NO_LONGER_AVAILABLE. Each endpoint page lists the statuses it can return. Treat any code you don't recognize according to its HTTP status.

Server errors

5xx responses always use a generic message, so the body does not explain the failure. Before retrying a POST that creates something, check whether the first attempt succeeded, to avoid creating a duplicate.

Errors outside the standard format

A few errors are returned before a request reaches an endpoint and use an error field instead of code:

  • Malformed JSON returns 400 with "error": "Invalid JSON".
  • Request bodies over 2 MB return 413.

Fix the request body before retrying.

Request IDs

Every response includes an X-Request-Id header. Include it when you contact careCycle support about a specific request.

On this page

What's next

Versioning