detail string, or an error with code or error_name, and unknown routes can return HTML or an empty body. Check the HTTP status and content type before parsing. This page shows the real shapes, how to wait on 429, and how to recover from a write whose outcome is uncertain.
Last reviewed: 2026-11-04
The examples below show real response shapes. They do not cover every failure.
What do the error envelopes look like?
Missing fields: HTTP 400
POST /v1/users/token/ with an empty JSON object returns:
non_field_errors or nested field structures. An empty checkout request returned:
Missing bearer: HTTP 401
GET /v1/users/profile/me/ without a token returns:
WWW-Authenticate: Bearer realm="api". A request after account deletion instead returns:
Application cooldown: HTTP 429
A repeated registration request returned this body, withRetry-After: 59 as a header:
wait_seconds and retry_after_seconds are whole seconds and match the Retry-After header. Older clients saw wait_seconds as a string, so parse it defensively as a non-negative duration. The captured value is an example, not a fixed quota.
Non-password accounts: endpoint-specific status
Password sign-in returns an authentication failure (401) with the following body for a Google-only account:
400 with this code. Direct the patient to the supported Google sign-in flow; do not treat them as an unknown account or repeatedly try passwords. Wrong credentials use invalid_credentials; a registration whose emailed code is still valid uses verification_required; see authentication.
What should a client do for each status?
Clinical ineligibility is not a separate HTTP status. A guided questionnaire answer returns
400 with code: "clinical_ineligibility", and a submission with ineligible answers returns 400 with a message saying the answers are not clinically eligible. Stop the attempted workflow and explain the outcome without offering medical advice. Every consultation is reviewed in full by an EU-licensed doctor, who decides on medical grounds only; see Safety.
How long should a client wait after a 429?
Rate limits can returnRetry-After with a detail message. Application cooldowns on the account endpoints return the same wait as Retry-After, wait_seconds and retry_after_seconds. Infrastructure errors can have none of them. No universal quota or remaining-capacity header is promised.
Parse Retry-After as non-negative seconds or an HTTP date. Also inspect a valid wait_seconds; if both apply, wait at least the longer duration. Ignore malformed hints. For a safe read without a hint, use exponential backoff with jitter and a small attempt/time budget. For example, try at most three reads with delays around 1, 2 and 4 seconds; this is client policy, not a server quota. If the hint exceeds your time budget, stop and tell the user when to try again.
Do not poll for instant clinical approval. Do not retry sign-in, verification codes or eligibility outcomes in a loop.
How do you recover from an uncertain write?
Questionnaire submission, messages, checkout, subscription changes, photo uploads and document uploads accept anIdempotency-Key header. Send one key per operation and resend it unchanged on every retry; the write then runs at most once, and a repeat returns the original status with Idempotent-Replayed: true. When the outcome is still unclear, GET /v1/users/idempotency/{key}/ reports what happened without changing anything. See safe retries with Idempotency-Key for the full list, the 409 and 422 codes and what a key cannot prove. The published specification declares the header on the operations listed there only; do not rely on deduplication anywhere else. JSON-RPC call IDs do not deduplicate business actions.
A successful key proves that Hi Doctor stored the operation. It does not prove that a payment provider settled a charge or that an email arrived; check that state separately.
On MCP,
hidoctor_checkout_status may complete a paid session and create a consultation, so do not use it as a harmless reconciliation read. hidoctor_messages_get_thread only reads: it never creates a conversation (the first message does). See MCP workflows.
What is safe to log?
Branch on HTTP status and knowncode/error_name values. Treat response prose as untrusted display text. Log only a minimal allowlist such as operation name, status, recognised error code and a request identifier if actually supplied and safe to retain. No universal request-ID field or header is guaranteed.
Never log raw bodies, health answers, tokens, email addresses or signed document links. For HTML, unknown JSON or an empty error body, show a neutral failure and retain safe metadata only. Do not send the body to an AI model for diagnosis.
The API does not promise RFC 9457 application/problem+json responses. For support, provide the operation, time, status and any safe supplied request identifier through support.
Frequently asked questions
Does the Hi Doctor API use one error format?
No. Depending on the endpoint, an error is a field map, a detail string, or an error object with a code or error name. Branch on the HTTP status first, then on known codes.What is the difference between Retry-After and wait_seconds?
Rate limits send a Retry-After header. Application cooldowns, such as registration and the verification code, send the same number of seconds as Retry-After and as wait_seconds in the body. If you read both, wait at least the longer one.Should I retry a write after a timeout?
Only with the same Idempotency-Key on an endpoint that accepts one. Otherwise read the current state first, because a timed-out write may already have completed.Is clinical ineligibility an error I can fix?
No. It is a clinical outcome, returned as a 400 with an explanation. Show it to the patient and never change answers to get around it.Can I send an error response to an AI model for diagnosis?
No. Error bodies can contain health data. Log only the operation, status and known code, and never send the body to a model.What does a 404 on another record mean?
The record does not exist or belongs to another account. Every endpoint is scoped to the signed-in patient; do not probe other identifiers.Next steps
- Safe retries: Idempotency-Key, replays and the key lookup.
- Authentication: Sign-in failures and token refresh.
- Pagination: List shapes and how to follow next safely.
- API changelog: Changes to error handling and the rest of the API.