Developer docs

Patients

Patients belong to a clinic. List and filter them, read a patient with their order history, and create, update or delete them.

The patient object

Fields of a patient
FieldTypeDescription
idstringThe id.
clinicIdstringThe clinic the patient belongs to.
firstName, lastNamestringThe name. name is both joined with a space.
dobstringDate of birth, stored as the text you send, for example 03/14/1988.
sexstringF, M or X.
email, phone, address, externalIdstringContact details and your own id for the patient. A field that was never set is left out of the reply.
locationstringThe city and state read from the end of the address, for example Tampa, FL. Empty when the address has none.
profilestringcomplete 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

NameTypeDescription
page, limitintegerPaging. See Requests and responses.
qstringSearches first name, last name, email, your own id and phone. Matching ignores case.
profilestringcomplete or missing.
sexstringF, M or X.
statestringTwo letters. Matches the state at the end of the address.
hasOrdersstringyes for patients with orders, no for patients without. Counts orders in the chosen environment.

Response

200 A page of patients, and paging in meta.

Example response
{
  "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

StatusCodeWhen it happens
400validationA filter has a value that is not allowed, such as sex=Z or a state that is not 2 letters.
401unauthenticatedThere is no session.

Examples

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

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.

Example response
{
  "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

StatusCodeWhen it happens
400validationThe id is not a valid id.
404notFoundThe patient does not exist or belongs to a clinic you are not working in.

Examples

curl
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

NameTypeRequiredDescription
firstNamestringRequiredThe first name.
lastNamestringRequiredThe last name.
dobstringOptionalDate of birth, stored exactly as sent.
sexstringOptionalF, M or X.
emailstringRequiredA valid email address. One email is one patient: it can be registered once in each clinic.
phone, address, externalIdstringOptionalText.
clinicIdstringOptionalThe clinic, for a super admin. Others cannot choose.

Response

201 The new patient.

Example response
{
  "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

StatusCodeWhen it happens
400validationA field is missing or invalid.
400pickClinicYou are working in an organization. Choose a clinic.
400clinicRequiredA super admin did not choose a clinic.
409patientExistsThis email is already registered in the clinic.
403forbiddenYour 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"}'

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

NameTypeRequiredDescription
firstName, lastName, dob, sex, email, phone, address, externalIdstringOptionalAny of the fields of a new patient. A patient who has no email yet must be given one.

Response

200 The updated patient.

Example response
{
  "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

StatusCodeWhen it happens
400validationA field is invalid.
400emailRequiredThe patient has no email and none was sent.
409patientExistsThe new email is already registered in the clinic.
403forbiddenYour role cannot edit patients.
404notFoundThe patient does not exist in the clinic you are working in.

Examples

curl
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

StatusCodeWhen it happens
403forbiddenYour role cannot delete patients (staff cannot).
404notFoundThe patient does not exist in the clinic you are working in.

Examples

curl
curl -b cookies.txt -X DELETE "https://app-api.homelyrx.com/v1/patients/PATIENT_ID"