SmileCloudDocs

Errors

The API uses conventional HTTP status codes and a single, predictable error body. Any non-2xx response carries a machine-readable problem document.

#Error format

Errors are returned as RFC 9457 application/problem+json:

json
{
  "type": "https://api.smile-app.co.il/problems/forbidden",
  "title": "Missing required scope",
  "status": 403,
  "detail": "This key needs the 'patients:read' scope."
}
FieldTypeDescription
typestring (URI)Stable identifier for the error category.
titlestringShort, human-readable summary.
statusintegerThe HTTP status code, repeated for convenience.
detailstringContext specific to this occurrence (optional).

Always branch on status (or type) rather than matching on title or detail, which are meant for humans and may be reworded.

#Status codes

StatusMeaningWhat to do
400 Bad RequestInvalid parameters (bad cursor, malformed date, unknown filter).Fix the request; don't retry unchanged.
401 UnauthorizedMissing, malformed, invalid, or revoked key.Check the Authorization header and the key.
403 ForbiddenValid key without the required scope.Mint a key with the needed scope.
404 Not FoundThe resource doesn't exist for this clinic.Verify the id; ids are clinic-scoped.
429 Too Many RequestsRate limit exceeded.Back off and retry after the Retry-After window.
500 Internal Server ErrorUnexpected server error.Retry with backoff; if it persists, contact support.
502 / 503Upstream/backend temporarily unavailable.Retry with exponential backoff.

#Handling errors

A small, robust client checks the status, parses the problem body, and only retries on transient failures.

bash
curl -sS -w '\n%{http_code}' https://api.smile-app.co.il/v1/patients/does-not-exist \
  -H "Authorization: Bearer sk_live_..."
json
{
  "type": "https://api.smile-app.co.il/problems/not-found",
  "title": "Patient not found",
  "status": 404,
  "detail": "No patient with id 'does-not-exist'."
}

Retry only transient errors

Retry 429, 500, 502, and 503 with exponential backoff. Never auto-retry 400, 401, 403, or 404 - the request will keep failing until you change it.