Errors
Errors are JSON. Every error has a message written for people. Many also carry a code for your program to act on.
{ "message": "The user has not accepted the Health Nexus terms yet.", "code": "terms_required" }
Show message when it is about something the person did, such as a wrong code or a weak password. Branch on code and the HTTP status, never on the wording of message.
Status codes
| Status | When | What to do |
|---|---|---|
400 | A header, parameter or body field is missing or invalid. | Fix the request. field names the field when there is one. |
401 | The key is missing, malformed, unknown or disabled. In sign-in, also a wrong password (code: "wrong_password"). | Check the key; for sign-in, ask for the password again. |
403 | The call is not allowed: see the codes below. | |
404 | The person or the record does not exist. | |
409 | The action is not possible in the current state. code says why. | |
413 | An upload is larger than 20 MB. | |
429 | A limit was reached. | Wait for Retry-After seconds. See Limits. |
500 | Something failed on our side. | Retry later; tell us the X-Request-Id. |
502, 503 | A service we depend on could not be reached, or an outcome could not be confirmed. | Retry after Retry-After when present. |
Codes you will meet
code | Status | Meaning |
|---|---|---|
user_not_linked | 403 | The person has not signed in through your integration. |
terms_required | 403 | The person has not accepted the terms. |
ambiguous_subject | 400 | One email holds two records. Send X-Subject-Account-Id. |
wrong_password | 401 | Sign-in: the password is not right. |
already_registered | 409 | Sign-up: this email already has an account. Sign in instead. |
ACCOUNT_NOT_FOUND | 404 | Password reset: no account with this email. |
PASSWORD_NOT_SET | 409 | Password reset: the account has no password yet. Finish setup through the sign-up steps. |
weak_password | 400 | The password does not meet the rule. |
account_closed | 403 | The account is closed. |
captcha_failed | 403 | Production: a step that sends a code arrived without a valid reCAPTCHA token. See bot protection. |
email_code_limit, phone_code_limit, sign_in_attempt_limit | 429 | Too many codes or attempts for one person or number. |
partner_code_limit, partner_text_limit | 429 | Too many code or text-message steps for your key. |
EMPTY_FILE, FILE_TOO_LARGE | 400, 413 | Upload: the declared size is 0 or over 20 MB. |
UPLOAD_NOT_FOUND, SIZE_MISMATCH, NOT_A_PDF | 409, 409, 400 | Upload: the stored file is missing, the wrong size, or not a PDF. |
UPLOAD_IN_PROGRESS, START_UNCONFIRMED | 409, 503 | Upload: a complete call is running, or its outcome is not known yet. Call again later. |
Refusals without a code carry a message only, for example "Partner credential is read-only." (a write with a read-only key) or "Subject user is inactive.".
Reporting a problem
Send an X-Request-Id on your calls. When something goes wrong, give us that id, the time and the endpoint. Every partner call is logged with it for 90 days.