Server-side API

Developer API overview

Read a clinic's patient records from your own backend, and keep your patient index in sync, with a secret API key locked to your servers' addresses.

The widgets in this documentation run in a browser and book on a patient's behalf. The Developer API is the other half: your hospital system, EMR or data platform reading the clinic's records from your own backend.

It is a records API. Fourteen routes read, and three write:

  • Patients: look up by MRN, email or phone, page through the roster, and read a patient's profile, visits, vitals and medical history.
  • Appointments: read one, search a date window, and book, reschedule or delete one as the clinic's staff do.
  • Clinical records: prescriptions (as data and as the rendered PDF) and documents.
  • Reference data: the clinic's locations and practitioners, and a practitioner's open slots on a day.
  • The clinical writes: create or update a patient from your own master patient index, record a vitals reading, and replace a medical history.
  • The appointment writes: book, reschedule, set the status of and cancel an appointment, the way the clinic's front desk does in Medos.

Patient self-booking, online payments and patient OTP are not part of the Developer API. They run in the widgets, on the patient's own session, where the patient's consent is checked.

Which one do you want?

WidgetDeveloper API
Runs inYour visitor's browserYour server
CredentialPublishable mk_ keySecret mk_ key, sent as x-api-key
Is the key a secret?No, it is public by designYes, treat it like a password
Locked toYour website's domainYour servers' IP addresses
Good forPatients booking on your websiteSyncing records into your HMS, EMR or reporting

They are not exclusive. Most clinics embed a widget for patients and use the Developer API for back-office integration.

Keys come in three types, and the dashboard asks which you want at creation: SDK widget for the browser, Developer API for your backend, and Internal for Medos first-party services, which is not issued to customers. This section is about Developer API keys. A Developer API key will not work in a browser and is not meant to. For that you want an SDK widget key.

The trust model

Your API key is the credential. Your IP allowlist is what keeps a copy of it useless.

There is nothing to sign and no keypair to manage: every request carries the API key, and Medos checks it. That makes the key a real secret, since anyone who has it can call the API as you. Two things matter:

Keep the key on your server. In a secret manager or an environment variable, never in a browser, a mobile app, or a code repository. It is shown in full once, when you create it.

Register the addresses your servers call from. A request from any other address is refused, even with the right key. That is what stops a key copied out of a log, a leaked config file or a screenshot from being used by anyone else.

The allowlist is doing real work

With no signature involved, the allowlist is the second factor. Register the narrowest addresses you can (your NAT gateway's address rather than your cloud provider's whole range), and rotate the key if it is ever exposed. See IP allowlist.

What every request carries

What it isWhat it does
x-api-keyYour API keyIdentifies your key and authenticates the request. Required.
Your source IPWhere the request came fromMust be on the key's allowlist.
X-Acting-User-IdA staff member's MDU_… idOptional. Attributes the call to that person; see Acting user.

How a request travels

Your server calls the Medos gateway with its API key. The gateway checks the key and your address, works out which workspace the key belongs to, checks that the workspace's plan includes the route, and then reads from the Medos core on your behalf.

your backend ──[x-api-key]──> Medos gateway ──> Medos core
                                  │
                                  ├── checks the key is live
                                  ├── checks your source IP
                                  ├── binds the request to the key's workspace
                                  └── checks the route's entitlement

Three properties follow from that:

  • The workspace is decided by the key, not by your request. Nothing you send can reach another clinic's data, and a workspaceId parameter is refused.
  • You reach the twenty-four documented routes and nothing else. Anything else is a 403 ROUTE_NOT_AVAILABLE, including the routes the widget uses. See Endpoints.
  • Each route is a separate grant. Reading the roster and reading one patient are different entitlements.

Next

On this page