Developer docs

Requests and responses

Every call follows the same pattern: JSON in, JSON out, one envelope for results, and two optional headers that choose the environment and the clinic.

The basics

  • Send and receive JSON. For calls with a body set content-type: application/json. The body can be up to 1 MB.
  • Paths are listed on each page. Everything signed-in lives under /v1; the only other path is GET /healthz.
  • Ids are 24-character text strings. Order numbers are text such as 122703.
  • Dates are ISO 8601 text in UTC, for example 2026-11-23T12:26:00.329Z. A few fields are display text for people, such as the order date (Nov 15); they are named in the page where they appear.
  • Money is a number in US dollars with up to two decimals, for example 98.29.

The response envelope

A successful call returns a JSON object. The result is in data. A list also has meta with paging and counts. Some calls return no body at all and answer 204.

A list
JSON
{
  "data": [ { "id": "6aeb0da3503a52507f605eaa", "name": "Grace Lin" } ],
  "meta": { "page": 1, "limit": 25, "total": 9 }
}

A failed call returns an error object instead. See Errors for every code.

Paging

Lists of patients, orders and catalog offers are paged with two query parameters, and the reply's meta repeats them with the total number of matches.

Paging parameters
ParameterTypeDefaultDescription
pageinteger1The page to return, starting at 1.
limitinteger25How many items per page, from 1 to 100.

Other lists (providers, pharmacies, notifications, clinics) return everything that matches in one reply, with no paging.

Sandbox and production

Orders and notifications exist in two separate environments. Choose one for each call with the x-hrx-env header.

The x-hrx-env header
Header valueMeaning
stagingThe sandbox. Orders you place here are test orders and are not sent to a pharmacy.
production or no headerYour real data. Any value other than staging means production.

An order placed in the sandbox cannot be seen from production, and the other way round: asking for it in the wrong environment returns 404. Patients, providers, clinics and the catalog are the same in both environments.

Choosing a clinic

Patients, providers and orders belong to a clinic. Which clinic a call works on depends on who you are.

  • A clinic user works on their own clinic. Nothing else is visible.
  • A person who works in an organization sees all the clinics beneath it together when reading. To work inside one clinic or sub-organization, send x-clinic-id with its id. A value that is not yours is ignored and you stay in your own scope.
  • Writing needs a clinic. In an organization's scope a write returns 400 with the code pickClinic: choose a clinic with x-clinic-id first.
  • A super admin can work on any clinic. Send x-clinic-id, or add ?clinicId= to the address. A super admin who writes without choosing a clinic gets 400 with the code clinicRequired. When creating a patient, provider or order, the body can also carry clinicId.
Reading one clinic's patients
curl
curl -b cookies.txt -H "x-clinic-id: CLINIC_ID" "https://app-api.homelyrx.com/v1/patients"

Cross-origin calls

The API allows cross-origin browser calls with credentials only from the HomelyRx web app. Call it from your own server, where this does not apply. See Authentication for how to keep the session on a server.