Server-side API

Developer API errors

Every error is an RFC 9457 problem document with a stable code. What each one means, and which are worth retrying.

Every error the Developer API returns is an RFC 9457 problem document, served as application/problem+json:

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
{
  "type": "https://docs.medos.one/errors/invalid-parameter",
  "title": "Invalid parameter",
  "status": 400,
  "detail": "updatedSince must be an ISO-8601 date-time with an offset, e.g. 2026-11-01T00:00:00Z.",
  "instance": "/v1/patients",
  "code": "INVALID_PARAMETER",
  "requestId": "01JCX6Q4W3J7N8Y2H5K9M1B0VD",
  "errors": [
    {
      "field": "updatedSince",
      "detail": "must be an ISO-8601 date-time with an offset, e.g. 2026-11-01T00:00:00Z"
    }
  ]
}
MemberAlways presentMeaning
typeYesA URI naming the kind of problem. It resolves to that code's page on this site.
titleYesA short summary. Fixed per type; it never varies between occurrences.
statusYesThe HTTP status, repeated.
detailYesWhat went wrong this time, for a human. Do not parse it.
instanceYesThe request path. The query string is deliberately left out, because it can hold a patient's phone number or email.
codeYesThe machine-readable code. Branch on this.
requestIdYesOur id for the request. Quote it when you contact us.
errorsWhen it appliesOne entry per field at fault: field and detail.
requiredFeatureOn FEATURE_NOT_ENTITLEDThe feature item the plan lacks.

Branch on code, never on detail. The codes are a fixed, published list. The wording of detail can change in any release.

To correlate with your own logs, send your id as x-request-id: 1–64 characters of A–Z, a–z, 0–9, _ or -. It comes back as requestId. A value in any other format is replaced with one we generate.

One request is answered in the old shape

A request that carries no x-api-key at all is not identifiable as a Developer API call, so its 401 comes back in the widget's legacy shape, { "statusCode": 401, "status": "failed", "message": "Missing credentials…" }. If you see that body, the header did not arrive. Check its exact name, x-api-key, and anything that strips headers between you and us.

Every code

StatusCodeWhat it meansRetry?
400VALIDATION_FAILEDThe body failed validation; errors[] lists each field.No
400UNKNOWN_FIELDA query parameter or body field this route does not accept.No
400INVALID_PARAMETERA value is malformed, out of range, or names something this workspace does not have.No
400INVALID_ACTING_USERX-Acting-User-Id is not an MDU_… staff id.No
400END_USER_REQUIREDNot returned by any Developer API route. Listed for completeness.No
401UNAUTHENTICATEDThe key is unknown, inactive, expired, or not a Developer API key.No
403IP_NOT_ALLOWEDThe calling address is not on the key's allowlist.No
403ROUTE_NOT_AVAILABLEThe path is not one of the twenty-four routes.No
403FEATURE_NOT_ENTITLEDThe plan does not include this route's feature item.No
403ACTING_USER_NOT_A_MEMBERThe acting user is not an active member of this workspace.No
404NOT_FOUNDNo such record in this workspace, or a /v2 path.No
405METHOD_NOT_ALLOWEDThe path exists with other methods, listed in Allow.No
406NOT_ACCEPTABLEAccept allows neither JSON nor PDF.No
409CONFLICTThe write conflicts with an existing record.After re-reading
415UNSUPPORTED_MEDIA_TYPEA body that is not application/json.No
429RATE_LIMITEDOver a rate limit.Yes, after Retry-After
4xxUPSTREAM_REJECTEDThe Medos core refused the request; status is its status.No
500INTERNAL_ERROROur fault.Yes, with backoff
502UPSTREAM_UNAVAILABLEThe Medos core failed or did not answer.Yes, with backoff

The ones that look alike

401 vs 403 IP_NOT_ALLOWED. A 401 means the key itself was not accepted, and it has the same detail for every cause. Telling you which check failed would help someone guessing keys more than it helps you. A 403 IP_NOT_ALLOWED means the key is fine and the address is not; detail names the address we saw. Check IPv4 against IPv6 first: a dual-stack server often arrives over the family you did not register. See IP allowlist.

403 ROUTE_NOT_AVAILABLE vs 403 FEATURE_NOT_ENTITLED. The first means the route is not in the Developer API at all, usually a widget route such as booking, so no grant will open it. The second means the route is in the API, but your plan does not include it yet. See Entitlements.

404 on someone else's record. A patient, appointment or prescription that belongs to another clinic is a 404, exactly like one that does not exist. A 403 would confirm it exists.

INVALID_PARAMETER instead of an empty page. A filter that names something this workspace does not have, such as an unknown doctorId, is a 400 rather than 200 with no rows. Empty results would read as "this practitioner has no records", which is a wrong answer rather than an error you can see.

An upstream 401/403 is a 500. If the Medos core refuses the gateway's own credential, that is our misconfiguration, not your key, so it is reported as 500 INTERNAL_ERROR rather than a 403 that would send you to check a key that works.

Isolate it with one request

Call GET /v1/addresses with nothing but x-api-key, from the server that will run your integration. If that answers 200, the key, the address and the plan are all fine, and the problem is in how the failing request is built.

Retrying safely

Every route but seven is a read, so retrying is always safe. Of the seven writes:

  • The patient upsert is safe to retry when the body carries id or mrnNumber: a retry then finds the record the first attempt created and updates it. Without either, a retry after a timeout can create a second patient.
  • Recording vitals records a new reading on every successful call. After a timeout, read the patient's vitals before retrying, or a retry can record the reading twice.
  • Replacing a medical history is a PUT that sets all three lists to what you send, so repeating it is always safe.
  • Booking books a new appointment on every successful call. After a timeout, search the patient's appointments for that day before retrying, or a retry can book the visit twice.
  • Rescheduling to the same time again is harmless once the first call landed, though Medos may refuse it as a taken slot. Read the appointment to see which happened.
  • Setting a status to the one it already has is accepted, except that COMPLETED and NO_SHOW cannot be left for another status, so read the appointment after a timeout before retrying.
  • Deleting twice answers 404 the second time: the appointment is already gone.
StatusRetry?
400, 401, 403, 404, 405, 406, 415No. The same request fails the same way; fix it first.
409Re-read the record, then decide.
429Yes, after Retry-After seconds.
500, 502Yes, with exponential backoff and a cap.

On this page