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.
| Status | Meaning |
|---|---|
placed | The order was placed and waits for the pharmacy. |
atPharmacy | The pharmacy has the order and is preparing it. |
shipped | The line was shipped. Tracking appears on the line. |
delivered | The line was delivered. |
atRisk | The line may be late and needs attention. |
cancelled | The 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.
subtotalis the sum of the line prices.feeis the HomelyRx facilitation fee, 5% of the subtotal, rounded to cents.shippingis $30 for each different pharmacy on the order, because each pharmacy ships its own parcel.totalissubtotal + 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
| Name | Type | Description |
|---|---|---|
page, limit | integer | Paging. See Requests and responses. |
status | string | One of the statuses above. |
q | string | Searches patient name, order number, medication and pharmacy. An order number can be written with a letter prefix, such as T122703. |
pharmacy | string | Keeps orders that have a line from a matching pharmacy. |
from, to | string | Placed 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.
{
"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
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | status is not a status, or a date is not like 2026-11-20. |
Examples
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.
{
"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 -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.
{
"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
| Status | Code | When it happens |
|---|---|---|
| 404 | notFound | No order has this number in the clinic and environment you are working in. |
Examples
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
| Name | Type | Required | Description |
|---|---|---|---|
patientId | string | Required | A patient of the clinic you are working in. |
lines | list | Required | At least one line. Each line is an object with a sku. Repeat a SKU to order it twice. |
shipTo | string | Optional | patient (default) or clinic. |
clinicId | string | Optional | The 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.
{
"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
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | patientId is missing, or lines is empty. |
| 400 | offerNotFound | A SKU is not in the catalog. |
| 400 | pickClinic | You are working in an organization. Choose a clinic. |
| 400 | clinicRequired | A super admin did not choose a clinic. |
| 403 | forbidden | Your role cannot place orders. |
| 404 | patientNotFound | The 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"}]}'const res = await fetch(`${API}/v1/orders`, {
method: 'POST',
credentials: 'include',
headers: { 'content-type': 'application/json', 'x-hrx-env': 'staging' },
body: JSON.stringify({
patientId: patient.id,
shipTo: 'patient',
lines: [{ sku: 'FIZY-278DYJ' }, { sku: 'FIZY-SEM025' }],
}),
});
const { data: order } = await res.json(); // 201
console.log(order.number, order.total);r = s.post(
f"{api}/v1/orders",
headers={"x-hrx-env": "staging"},
json={"patientId": patient["id"], "shipTo": "patient", "lines": [{"sku": "FIZY-278DYJ"}, {"sku": "FIZY-SEM025"}]},
)
order = r.json()["data"] # status 201
print(order["number"], order["total"])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.
{
"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
| Status | Code | When it happens |
|---|---|---|
| 403 | forbidden | Your role cannot cancel orders (staff cannot). |
| 404 | notFound | No order has this number in the clinic and environment you are working in. |
| 409 | alreadyCancelled | The 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"const res = await fetch(`${API}/v1/orders/${order.number}/cancel`, {
method: 'POST',
credentials: 'include',
headers: { 'x-hrx-env': 'staging' },
});
const { data: cancelled } = await res.json();
console.log(cancelled.status); // "cancelled"r = s.post(f"{api}/v1/orders/{order['number']}/cancel", headers={"x-hrx-env": "staging"})
print(r.json()["data"]["status"]) # "cancelled"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
| Name | Type | Required | Description |
|---|---|---|---|
body | string | Required | The text, 1 to 2000 characters after trimming spaces. |
Response
201 The message.
{ "data": { "from": "clinic", "author": "Rohit Suthar", "body": "Please confirm the ship date.", "at": "2026-11-23T12:26:00.432Z" } }Errors
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | The text is empty or longer than 2000 characters. |
| 403 | forbidden | Your role cannot add messages. |
| 404 | notFound | No order has this number in the clinic and environment you are working in. |
Examples
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."}'