Developer docs

Orders

An order is a patient and one or more catalog lines. Place it, follow each line to delivery, cancel it before it ships, and add notes for support.

Order and line statuses

An order and each of its lines have a status. A new order and all its lines start as placed. Cancelling sets the order and every line to cancelled.

Statuses
StatusMeaning
placedThe order was placed and waits for the pharmacy.
atPharmacyThe pharmacy has the order and is preparing it.
shippedThe line was shipped. Tracking appears on the line.
deliveredThe line was delivered.
atRiskThe line may be late and needs attention.
cancelledThe order or line was cancelled.

How an order is priced

Prices are worked out when you place the order, from the catalog prices, and stored on the order.

  • subtotal is the sum of the line prices.
  • fee is the HomelyRx facilitation fee, 5% of the subtotal, rounded to cents.
  • shipping is $30 for each different pharmacy on the order, because each pharmacy ships its own parcel.
  • total is subtotal + fee + shipping.

For example, two lines of $80.00 (Kaduceus) and $65.04 (PerfectRx) give a subtotal of 145.04, a fee of 7.25, shipping of 60 and a total of 212.29.

Order numbers are text and count up from 122701. They are the same in sandbox and production, and unique across both.

Sandbox orders

Send x-hrx-env: staging to place and read sandbox orders. They are kept apart from production orders: each environment lists, reads and cancels only its own. See Sandbox and production.

List orders

GET/v1/orders

Returns a page of orders, newest first. meta.byStatus counts the orders per status after every filter except status, so status tabs stay meaningful.

Who can call it

Any signed-in role.

Query parameters

NameTypeDescription
page, limitintegerPaging. See Requests and responses.
statusstringOne of the statuses above.
qstringSearches patient name, order number, medication and pharmacy. An order number can be written with a letter prefix, such as T122703.
pharmacystringKeeps orders that have a line from a matching pharmacy.
from, tostringPlaced on or after from and on or before to, both days like 2026-11-20 and both inclusive.

Response

200 A page of order summaries, with paging and status counts in meta.

Example response
{
  "data": [
    {
      "id": "6aeb0da3503a52507f605eba",
      "number": "122656",
      "patient": "Priya Shah",
      "patientId": "6aeb0da3503a52507f605ea4",
      "date": "Nov 15",
      "placedAt": "2026-11-15T14:46:19.855Z",
      "medication": "B12 injection 4 mL",
      "pharmacy": "Kaduceus",
      "status": "shipped",
      "total": 114,
      "lineCount": 1
    }
  ],
  "meta": { "page": 1, "limit": 25, "total": 2, "byStatus": { "placed": 3, "delivered": 5, "shipped": 2, "atRisk": 2, "cancelled": 1, "atPharmacy": 1 } }
}

Errors

StatusCodeWhen it happens
400validationstatus is not a status, or a date is not like 2026-11-20.

Examples

curl
curl -b cookies.txt -H "x-hrx-env: staging" "https://app-api.homelyrx.com/v1/orders?status=placed&from=2026-11-01&limit=10"

List order lines

GET/v1/orders/lines

Returns one row for each line of your 200 most recent orders, with aging and tags. It suits a dashboard that tracks lines rather than orders. Not paged.

Who can call it

Any signed-in role.

Response

200 A list of lines. aging is onTime, overdue (older than 14 days and not delivered) or atRisk. tags can include shipped, delivered, waiting, risk and overdue.

Example response
{
  "data": [
    {
      "line": "122662-001",
      "orderNumber": "122662",
      "pharmacy": "Kaduceus",
      "patient": "Priya Shah",
      "medication": "B12 injection 4 mL",
      "qty": "1 vial",
      "status": "placed",
      "eta": "Nov 6",
      "ops": "open",
      "elapsed": "4d 8h",
      "aging": "onTime",
      "tags": ["waiting"]
    }
  ]
}

Examples

curl
curl -b cookies.txt "https://app-api.homelyrx.com/v1/orders/lines"

Get one order

GET/v1/orders/:number

Returns the order summary plus its prescriber, delivery choice, price parts, every line and the messages.

Who can call it

Any signed-in role.

Response

200 The order. A line has lineId, sku, name, pharmacy, qty, price, status, ops (open, watch, hold or resolved), and, when known, eta, tracking and tags.

Example response
{
  "data": {
    "id": "6aeb0da3503a52507f605ebe",
    "number": "122631",
    "patient": "Leah Brooks",
    "patientId": "6aeb0da3503a52507f605eae",
    "date": "Nov 14",
    "placedAt": "2026-11-14T05:46:19.859Z",
    "medication": "Semaglutide 0.25 mg",
    "pharmacy": "PerfectRx",
    "status": "shipped",
    "total": 98.29,
    "lineCount": 1,
    "prescriber": "Elena Ruiz",
    "shipTo": "patient",
    "subtotal": 65.04,
    "fee": 3.25,
    "shipping": 30,
    "lines": [
      {
        "lineId": "122631-001",
        "sku": "FIZY-SEM025",
        "name": "Semaglutide 0.25 mg",
        "pharmacy": "PerfectRx",
        "qty": "1 vial",
        "price": 65.04,
        "status": "shipped",
        "ops": "open",
        "eta": "Nov 4",
        "tracking": "UPS 1Z122631R1345111735",
        "tags": []
      }
    ],
    "messages": []
  }
}

Errors

StatusCodeWhen it happens
404notFoundNo order has this number in the clinic and environment you are working in.

Examples

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

Place an order

POST/v1/orders

Places an order for one patient with one or more catalog lines. The prices are taken from the catalog, so you send only SKUs. The reply is the order summary; read the order to see its lines.

Who can call it

super_admin, owner, admin, staff.

Request body

NameTypeRequiredDescription
patientIdstringRequiredA patient of the clinic you are working in.
lineslistRequiredAt least one line. Each line is an object with a sku. Repeat a SKU to order it twice.
shipTostringOptionalpatient (default) or clinic.
clinicIdstringOptionalThe clinic, for a super admin.

Response

201 The summary of the new order. medication shows the first line and, with more lines, how many more (B12 injection 4 mL +1). A notification is also created.

Example response
{
  "id": "6b0430d8cc8f4730ebbf8a5f",
  "number": "122703",
  "patient": "Docs Example",
  "patientId": "6b0430cecc8f4730ebbf8a43",
  "date": "Nov 23",
  "placedAt": "2026-11-23T12:26:00.329Z",
  "medication": "B12 injection 4 mL +1",
  "pharmacy": "Kaduceus",
  "status": "placed",
  "total": 212.29,
  "lineCount": 2
}

Errors

StatusCodeWhen it happens
400validationpatientId is missing, or lines is empty.
400offerNotFoundA SKU is not in the catalog.
400pickClinicYou are working in an organization. Choose a clinic.
400clinicRequiredA super admin did not choose a clinic.
403forbiddenYour role cannot place orders.
404patientNotFoundThe patient is not in this clinic.

Examples

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"}]}'

Cancel an order

POST/v1/orders/:number/cancel

Cancels the order and all its lines. There is no request body.

Who can call it

super_admin, owner, admin.

Response

200 The order summary with the status cancelled.

Example response
{
  "id": "6b0430d8cc8f4730ebbf8a5f",
  "number": "122703",
  "patient": "Docs Example",
  "patientId": "6b0430cecc8f4730ebbf8a43",
  "date": "Nov 23",
  "placedAt": "2026-11-23T12:26:00.329Z",
  "medication": "B12 injection 4 mL +1",
  "pharmacy": "Kaduceus",
  "status": "cancelled",
  "total": 212.29,
  "lineCount": 2
}

Errors

StatusCodeWhen it happens
403forbiddenYour role cannot cancel orders (staff cannot).
404notFoundNo order has this number in the clinic and environment you are working in.
409alreadyCancelledThe order was already cancelled.

Examples

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

Add a message to an order

POST/v1/orders/:number/messages

Adds a note from the clinic to HomelyRx support on this order. Messages appear in messages when you read the order.

Who can call it

super_admin, owner, admin, staff.

Request body

NameTypeRequiredDescription
bodystringRequiredThe text, 1 to 2000 characters after trimming spaces.

Response

201 The message.

Example response
{ "data": { "from": "clinic", "author": "Rohit Suthar", "body": "Please confirm the ship date.", "at": "2026-11-23T12:26:00.432Z" } }

Errors

StatusCodeWhen it happens
400validationThe text is empty or longer than 2000 characters.
403forbiddenYour role cannot add messages.
404notFoundNo order has this number in the clinic and environment you are working in.

Examples

curl
curl -b cookies.txt -X POST "https://app-api.homelyrx.com/v1/orders/ORDER_NUMBER/messages" \
  -H "x-hrx-env: staging" \
  -H "content-type: application/json" \
  -d '{"body":"Please confirm the ship date."}'