Developer docs

HomelyRx developer documentation

Everything you need to connect your own software to HomelyRx: sign in, manage patients and providers, browse the catalog, place orders and follow them to delivery.

What the API does

The HomelyRx API is the same API the HomelyRx portal uses. With it your software can create and update patients, list prescribers, search the catalog of pharmacy offers, place and cancel orders, and read order status, notifications and dashboard numbers.

Base address and versions

Every call goes to the API address of your environment, followed by a path. All signed-in routes start with /v1. Production is https://app-api.homelyrx.com. The test environment is https://stage-api.homelyrx.com; use it to build and try your integration before going live. On a local machine the address is http://localhost:8112.

To check that the API is running, call the health route. It needs no sign-in.

Health check
curl "https://app-api.homelyrx.com/healthz"

Quick start

These five steps sign in, find patients, add a patient, place a sandbox order for them and cancel it. Every example keeps the session cookie from step 1. In curl that is the cookie file cookies.txt; in JavaScript it is credentials: 'include'; in Python it is a requests.Session.

1. Sign in

Send your email and password. The reply describes you, and the API sets the hrx_session cookie.

curl -c cookies.txt -X POST "https://app-api.homelyrx.com/v1/auth/login" \
  -H "content-type: application/json" \
  -d '{"email":"[email protected]","password":"your-password"}'
Response 200
JSON
{
  "data": {
    "id": "6afe9b3c3a44248dcd845972",
    "email": "[email protected]",
    "name": "Rohit Suthar",
    "role": "owner",
    "clinicId": "6aeb0da3503a52507f605e76",
    "canCreateOrganizations": false
  }
}

2. List patients

Lists are paged and can be filtered. This asks for five female patients whose profile is complete.

curl -b cookies.txt "https://app-api.homelyrx.com/v1/patients?limit=5&profile=complete&sex=F"

3. Create a patient

Only a first and last name are required. The patient is added to your clinic.

curl -b cookies.txt -X POST "https://app-api.homelyrx.com/v1/patients" \
  -H "content-type: application/json" \
  -d '{"firstName":"Maya","lastName":"Patel","dob":"03/14/1988","sex":"F","email":"[email protected]","phone":"(813) 555-0123","address":"401 E Jackson St, Tampa, FL 33602","externalId":"pt-2001"}'

4. Place a sandbox order

The x-hrx-env: staging header makes this a sandbox order, so nothing is sent to a pharmacy. Each line names a catalog SKU. The reply is a summary of the order, with its number and total.

curl -b cookies.txt -X POST "https://app-api.homelyrx.com/v1/orders" \
  -H "x-hrx-env: staging" \
  -H "content-type: application/json" \
  -d '{"patientId":"PATIENT_ID","shipTo":"patient","lines":[{"sku":"FIZY-278DYJ"},{"sku":"FIZY-SEM025"}]}'

5. Cancel the order

Orders can be cancelled by an owner or admin until a pharmacy ships them. Cancelling twice returns a 409 with the code alreadyCancelled.

curl -b cookies.txt -X POST "https://app-api.homelyrx.com/v1/orders/ORDER_NUMBER/cancel" \
  -H "x-hrx-env: staging"

Where to go next

The pages of this reference are listed below. Each endpoint shows who can call it, its parameters, an example response and its errors.

  • AuthenticationSign in to the HomelyRx API with an email and password, keep the session cookie, read who you are, sign out, and understand roles and cookie settings.
  • Requests and responsesHow HomelyRx API calls look: base address, JSON bodies, the data and meta envelope, paging, sandbox and production, and choosing a clinic with headers.
  • ErrorsEvery error the HomelyRx API returns: the response shape, each error code with its HTTP status and meaning, and how to read field-level validation errors.
  • Organizations and clinicsHow organizations and clinics work in the HomelyRx API: the tree, who can create what, scoping with x-clinic-id, and the endpoints to list, create and edit them.
  • PatientsUse the HomelyRx patients API to list and filter patients, read one patient with order history, create, update and delete patients, with curl, JavaScript and Python.
  • ProvidersUse the HomelyRx providers API to list prescribers with their NPI and licensed states, search and filter them, read one provider and add a new one.
  • Catalog and pharmaciesSearch the HomelyRx catalog of pharmacy offers by name, SKU, pharmacy, stock and type, read the catalog summary, and list the partner pharmacies.
  • OrdersUse the HomelyRx orders API to place orders from catalog SKUs, list and filter them, read lines and tracking, cancel an order and add a message, with curl, JavaScript and Python.
  • Notifications and dashboardRead the latest HomelyRx notifications, mark them all as read, and get the dashboard summary of orders, spend, delivery rate and patients for the last 30 days.
  • WebhooksReceive order events from HomelyRx at your own address: create a webhook in the portal, verify the signature, and handle order.created, order.cancelled and order.message.