The patient object
| Field | Type | Description |
|---|---|---|
id | string | The id. |
clinicId | string | The clinic the patient belongs to. |
firstName, lastName | string | The name. name is both joined with a space. |
dob | string | Date of birth, stored as the text you send, for example 03/14/1988. |
sex | string | F, M or X. |
email, phone, address, externalId | string | Contact details and your own id for the patient. A field that was never set is left out of the reply. |
location | string | The city and state read from the end of the address, for example Tampa, FL. Empty when the address has none. |
profile | string | complete when the patient has an email, a phone and a date of birth; otherwise missing. |
List patients
GET/v1/patients
Returns the patients of your clinic, sorted by last then first name. A list also gives each patient's most recent order in lastOrder.
Who can call it
Any signed-in role.
Query parameters
| Name | Type | Description |
|---|---|---|
page, limit | integer | Paging. See Requests and responses. |
q | string | Searches first name, last name, email, your own id and phone. Matching ignores case. |
profile | string | complete or missing. |
sex | string | F, M or X. |
state | string | Two letters. Matches the state at the end of the address. |
hasOrders | string | yes for patients with orders, no for patients without. Counts orders in the chosen environment. |
Response
200 A page of patients, and paging in meta.
{
"data": [
{
"id": "6aeb0da3503a52507f605eaa",
"clinicId": "6aeb0da3503a52507f605e76",
"firstName": "Grace",
"lastName": "Lin",
"name": "Grace Lin",
"dob": "06/11/1995",
"sex": "F",
"email": "[email protected]",
"phone": "(512) 555-0190",
"externalId": "pt-1004",
"location": "",
"profile": "complete",
"lastOrder": { "number": "122661", "placedAt": "2026-11-18T04:46:19.854Z" }
}
],
"meta": { "page": 1, "limit": 5, "total": 3 }
}Errors
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | A filter has a value that is not allowed, such as sex=Z or a state that is not 2 letters. |
| 401 | unauthenticated | There is no session. |
Examples
curl -b cookies.txt "https://app-api.homelyrx.com/v1/patients?limit=5&profile=complete&sex=F"const res = await fetch(`${API}/v1/patients?limit=5&profile=complete&sex=F`, { credentials: 'include' });
const { data: patients, meta } = await res.json();
console.log(meta.total, patients.map((p) => p.name));r = s.get(f"{api}/v1/patients", params={"limit": 5, "profile": "complete", "sex": "F"})
body = r.json()
print(body["meta"]["total"], [p["name"] for p in body["data"]])Get one patient
GET/v1/patients/:id
Returns a patient with their lifetime spend and up to their 20 most recent orders in the chosen environment. Cancelled orders are not counted in lifetimeSpend.
Who can call it
Any signed-in role.
Response
200 The patient with three extra fields: lifetimeSpend, orderCount and orders.
{
"data": {
"id": "6aeb0da3503a52507f605eae",
"clinicId": "6aeb0da3503a52507f605e76",
"firstName": "Leah",
"lastName": "Brooks",
"name": "Leah Brooks",
"dob": "02/08/1990",
"sex": "F",
"externalId": "pt-1006",
"location": "",
"profile": "missing",
"lifetimeSpend": 359.89,
"orderCount": 2,
"orders": [
{ "number": "122631", "placedAt": "2026-11-14T05:46:19.859Z", "medication": "Semaglutide 0.25 mg", "status": "shipped", "total": 98.29 }
]
}
}Errors
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | The id is not a valid id. |
| 404 | notFound | The patient does not exist or belongs to a clinic you are not working in. |
Examples
curl -b cookies.txt "https://app-api.homelyrx.com/v1/patients/PATIENT_ID"Create a patient
POST/v1/patients
Adds a patient to the clinic you are working in. A super admin must choose a clinic first; in an organization's scope you must choose one of its clinics (see Choosing a clinic).
Who can call it
super_admin, owner, admin, staff.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
firstName | string | Required | The first name. |
lastName | string | Required | The last name. |
dob | string | Optional | Date of birth, stored exactly as sent. |
sex | string | Optional | F, M or X. |
email | string | Required | A valid email address. One email is one patient: it can be registered once in each clinic. |
phone, address, externalId | string | Optional | Text. |
clinicId | string | Optional | The clinic, for a super admin. Others cannot choose. |
Response
201 The new patient.
{
"id": "6b0430cecc8f4730ebbf8a43",
"clinicId": "6aeb0da3503a52507f605e76",
"firstName": "Maya",
"lastName": "Patel",
"name": "Maya 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",
"location": "Tampa, FL",
"profile": "complete"
}Errors
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | A field is missing or invalid. |
| 400 | pickClinic | You are working in an organization. Choose a clinic. |
| 400 | clinicRequired | A super admin did not choose a clinic. |
| 409 | patientExists | This email is already registered in the clinic. |
| 403 | forbidden | Your role cannot create patients. |
Examples
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"}'const res = await fetch(`${API}/v1/patients`, {
method: 'POST',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
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',
}),
});
const { data: patient } = await res.json(); // 201
console.log(patient.id);r = s.post(f"{api}/v1/patients", json={
"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",
})
patient = r.json()["data"] # status 201
print(patient["id"])Update a patient
PATCH/v1/patients/:id
Changes only the fields you send. The same fields as creating, all optional; clinicId cannot be changed.
Who can call it
super_admin, owner, admin, staff.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
firstName, lastName, dob, sex, email, phone, address, externalId | string | Optional | Any of the fields of a new patient. A patient who has no email yet must be given one. |
Response
200 The updated patient.
{
"id": "6b0430cecc8f4730ebbf8a43",
"clinicId": "6aeb0da3503a52507f605e76",
"firstName": "Maya",
"lastName": "Patel",
"name": "Maya 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",
"location": "Tampa, FL",
"profile": "complete"
}Errors
| Status | Code | When it happens |
|---|---|---|
| 400 | validation | A field is invalid. |
| 400 | emailRequired | The patient has no email and none was sent. |
| 409 | patientExists | The new email is already registered in the clinic. |
| 403 | forbidden | Your role cannot edit patients. |
| 404 | notFound | The patient does not exist in the clinic you are working in. |
Examples
curl -b cookies.txt -X PATCH "https://app-api.homelyrx.com/v1/patients/PATIENT_ID" \
-H "content-type: application/json" \
-d '{"phone":"(813) 555-0199"}'Delete a patient
DELETE/v1/patients/:id
Removes the patient. Their past orders stay on record.
Who can call it
super_admin, owner, admin.
Response
204 No body.
No body.
Errors
| Status | Code | When it happens |
|---|---|---|
| 403 | forbidden | Your role cannot delete patients (staff cannot). |
| 404 | notFound | The patient does not exist in the clinic you are working in. |
Examples
curl -b cookies.txt -X DELETE "https://app-api.homelyrx.com/v1/patients/PATIENT_ID"