Skip to content

Prescriptions

A prescription represents a medication a clinician has prescribed or dispensed for a patient. It is tied to the patient receiving the medication, the doctor prescribing it, and (unless it is a written script) the product in the clinic catalog being dispensed. Refills are tracked as related refill records with their own endpoint, so the original prescription stays the source of truth for the script.

Use prescriptions to surface a patient’s active medications, drive pharmacy fulfilment, or feed compliance dashboards.

Authoritative schemas live in the live Swagger UI. The fields below are a representative subset for orientation.

FieldTypeNotes
idUUIDServer-assigned identifier.
patientIdUUIDPatient the prescription is written for.
prescribingDoctorIdUUIDUser who prescribed the medication.
productIdUUIDCatalog product being dispensed. Null when isWritten is true.
namestringName of the prescription.
directionstringFree-text directions explaining how to use the medication.
quantitydecimalQuantity dispensed.
refillQuantityintegerTotal available refill amount.
refillCountintegerRefills available on the script; cannot exceed refillQuantity.
refillPrnbooleanWhether PRN (as-needed) refills are supported.
isRefillAllowedbooleanTrue when refillQuantity is greater than 0.
isWrittenbooleanTrue for a written script filled outside the clinic; use writtenProduct instead of productId.
writtenProductstringProduct name for a written prescription.
writtenIsControlledbooleanWhether the written product is a controlled substance.
isChronicMedicationbooleanFlags long-term medications.
soapIdUUIDOptional SOAP record this prescription was created against.
expirationDateISO 8601Labeled “Rx Valid Thru” in Shepherd: the last date the script is valid for refills.
isCanceledbooleanWhether the prescription was canceled (cancelNote carries the reason).
clinicIdUUIDClinic the prescription belongs to.
createdByUserIdUUIDUser who created the record.
dateCreatedISO 8601Server-assigned creation timestamp (UTC). Cannot be set or overridden.
dateUpdatedISO 8601Last server-side mutation (UTC).
POST /pav2/open-api-prescriptions

Standard collection envelope. Filter with comma-separated ID lists (patientIds, productIds, clientIds), embed related records such as createdByUser, and page through results with page and rpp.

Terminal window
curl -X POST https://open-api.shepherd.vet/pav2/open-api-prescriptions \
-H "Content-Type: application/json" \
-H "X-Integration-Public-Key: $SHEPHERD_PUBLIC_KEY" \
-H "X-Integration-Private-Key: $SHEPHERD_PRIVATE_KEY" \
-H "X-Clinic-Id: $SHEPHERD_CLINIC_ID" \
-d '{
"patientIds": "12ab...",
"page": 1,
"rpp": 50,
"sort": "dateCreated|desc"
}'
{
"item": [
{
"id": "7ad2...",
"clinicId": "c3f1...",
"patientId": "12ab...",
"prescribingDoctorId": "bb55...",
"createdByUserId": "9c0d...",
"productId": "44de...",
"name": "Amoxicillin 250 mg",
"direction": "Give one tablet by mouth every 12 hours for 7 days.",
"quantity": 14,
"refillQuantity": 2,
"refillCount": 2,
"refillPrn": false,
"isRefillAllowed": true,
"isWritten": false,
"writtenProduct": null,
"writtenIsControlled": null,
"isChronicMedication": false,
"isCanceled": false,
"cancelNote": null,
"substitutionPermitted": false,
"soapId": null,
"expirationDate": "2026-10-21T00:00:00Z",
"dateCreated": "2026-04-21T14:11:09Z",
"dateUpdated": "2026-04-21T14:11:09Z"
}
],
"totalRecords": 312,
"page": 1,
"recordsPerPage": 50,
"sort": "dateCreated|desc",
"searchQuery": null,
"embed": null,
"links": []
}
POST /pav2/open-api-prescriptions/write

Creates a new prescription record. patientId and expirationDate are required. For an in-clinic product, provide productId; for a written script filled outside the clinic, set isWritten to true, provide writtenProduct instead, and omit productId. See the live Swagger UI for the authoritative schemas.

The created record’s dateCreated is assigned by the server at insert time; there is no request field that sets or overrides it (see Dates and backdating).

Terminal window
curl -X POST https://open-api.shepherd.vet/pav2/open-api-prescriptions/write \
-H "Content-Type: application/json" \
-H "X-Integration-Public-Key: $SHEPHERD_PUBLIC_KEY" \
-H "X-Integration-Private-Key: $SHEPHERD_PRIVATE_KEY" \
-H "X-Clinic-Id: $SHEPHERD_CLINIC_ID" \
-d '{
"patientId": "12ab...",
"prescribingDoctorId": "bb55...",
"productId": "44de...",
"quantity": 14,
"refillQuantity": 2,
"direction": "Give one tablet by mouth every 12 hours for 7 days.",
"expirationDate": "2026-12-31T00:00:00Z",
"isChronicMedication": false
}'

Two date behaviors matter when you work with prescriptions, especially if you are moving data from another system:

dateCreated is server-assigned and cannot be backdated. A prescription in Shepherd represents an active dispensing event: creating one runs the live clinical workflow, including label generation, so the system always treats the prescription as something happening now. The API does not expose a prescribed or created date on the write model; this is deliberate and preserves the integrity and auditability of prescription records. Shepherd itself does not support backdating prescriptions, and the API mirrors the product.

expirationDate is the date you control. It is required on create, appears in Shepherd as “Rx Valid Thru”, and represents the last date the script is valid for refills. It can be a date in the past, for example when recording a script whose validity window has already ended.

Passing a soapId associates the prescription with a SOAP record, but it does not change the prescription’s own dateCreated; a prescription linked to an older visit still carries the timestamp of the moment it was created.

Do not create native prescriptions for historical scripts. Every migrated record would carry the migration date as its creation date, which misrepresents the patient’s medication history and triggers the active dispensing workflow for medications that were dispensed long ago.

Instead, import each historical prescription as a patient note. This is the same approach Shepherd’s own data-migration process uses (those notes are labeled “imported prescription”): the note preserves the historical fact that a prescription was issued at a specific point in time, without creating a new dispensing event. Put the original prescribed date, drug, strength, directions, quantity, and refill details in the note body.

Terminal window
curl -X POST https://open-api.shepherd.vet/pav2/open-api-patient-notes/write \
-H "Content-Type: application/json" \
-H "X-Integration-Public-Key: $SHEPHERD_PUBLIC_KEY" \
-H "X-Integration-Private-Key: $SHEPHERD_PRIVATE_KEY" \
-H "X-Clinic-Id: $SHEPHERD_CLINIC_ID" \
-d '{
"patientId": "12ab...",
"title": "Imported prescription: Carprofen 75 mg",
"note": "Prescribed 2024-03-14 by Dr. Alvarez. Carprofen 75 mg, give 1 tablet by mouth every 12 hours for 14 days. Quantity 28, no refills. Rx valid through 2024-09-14."
}'
POST /pav2/open-api-refills

Refills are read-only through the API: they are recorded in Shepherd when the clinic fills a script. Filter by prescriptionIds to pull the refill history for a script, or by patientIds and refillStatusIds; embed refillStatus to inline the status lookup.

Terminal window
curl -X POST https://open-api.shepherd.vet/pav2/open-api-refills \
-H "Content-Type: application/json" \
-H "X-Integration-Public-Key: $SHEPHERD_PUBLIC_KEY" \
-H "X-Integration-Private-Key: $SHEPHERD_PRIVATE_KEY" \
-H "X-Clinic-Id: $SHEPHERD_CLINIC_ID" \
-d '{
"prescriptionIds": "7ad2...",
"embed": "refillStatus"
}'
{
"item": [
{
"id": "e7d8...",
"prescriptionId": "7ad2...",
"name": "Amoxicillin 250 mg",
"prescribingDoctorId": "bb55...",
"refillQuantity": 1,
"refillPrn": false,
"isInitial": false,
"dateFilled": "2026-05-06T15:38:33Z",
"expirationDate": "2026-10-21T00:00:00Z",
"refillStatusId": "d6c5...",
"refillStatus": {
"abrv": "completed",
"name": "Completed",
"id": "d6c5..."
},
"requestedById": "9c0d...",
"dateCreated": "2026-05-06T15:38:28Z",
"dateUpdated": "2026-05-06T15:38:35Z"
}
],
"totalRecords": 3,
"page": 1,
"recordsPerPage": 10,
"sort": null,
"searchQuery": null,
"embed": "refillStatus",
"links": []
}
  • Conventions for pagination, embedding, sorting, and date filters.
  • Errors for the two JSON error body shapes.
  • Products for the catalog products prescriptions reference.
  • SOAP records for the visit records prescriptions can be created against.
  • Providers for the clinicians prescribing medications.