- the dispensing history of one patient: medicine, quantity, days supply, date;
- the flags a pharmacist recorded for your linked patients in a date window.
Who can use it
Both endpoints need thedispensing:read permission. It is a patient-data permission, so a live key also needs:
- for a clinic’s own key: the clinic’s API add-on and the accepted API data agreement; or
- for an organization’s key: patient-data approval for the Dispensing history kind, a data-protection addendum your workspace has accepted, and a connection the pharmacy has approved for this scope.
403 with a code that
names it. See Errors.
Linked patients only. An organization’s key sees only patients that are linked to its connection. A patient who is
not linked, a patient the clinic has restricted, and a patient who does not exist all answer 404 not_found. A clinic’s own
key reads its own customers’ history under the same permission.
Try it in the sandbox first. A test key reaches only your workspace’s sandbox. It returns two invented dispensed
items for any patient id you ask about, and one invented flag. Nothing real is involved.
Every example uses a test key and a placeholder clinic. Replace
YOUR_CLINIC_ID and the ids with your own.
The medicine object
Both endpoints describe a medicine the same way:Read a patient’s dispensing history
Returns what the pharmacy dispensed to one patient, one line for each item sold.GET /v1/clinics/{clinic_id}/dispensing/history
The history is ordered by
id, not by date. If you want it newest first, sort by dispensed_at yourself after reading all
the pages.
List dispensing flags
Returns the refill and duplicate-dispensing flags the pharmacy recorded for patients your key is linked to. Each flag says which check fired, the evidence, and the reason the pharmacist gave.GET /v1/clinics/{clinic_id}/dispensing/flags
Which flags you see. A flag appears only when a check actually found something. A sale where no check was run (for
example, when the person at the till was not identified) is not a finding and is not returned. A walk-in with no patient
record is never returned, and an organization’s key sees flags only for its linked patients. Flags are ordered by
id, so
read every page and sort by date yourself if you need them in date order.
Things to know
Refusals you may see
What is never returned. A price, a margin, any other customer of the pharmacy, the name of any staff member, or any
sale of a person the pharmacy could not identify. Each read is recorded in the pharmacy’s access log.
Pagination. Both endpoints are paginated with
limit and starting_after. See Pagination.
No writes, no idempotency keys. There is nothing to create, so there is nothing to retry safely or unsafely: repeat a
read as often as you like within your rate limit.
FHIR. These routes return JSON only.
Related. Sending a pharmacy a request for medicines, and following it until it is dispensed, is a different resource.
See Drug requests. A request reaches dispensed at the till, and the item then appears in the dispensing
history here.
Common tasks
Show a patient what their pharmacy has dispensed.GET …/dispensing/history?patient_id=…, following next_cursor until
has_more is false, then sort by dispensed_at.
Check for early refills last month. GET …/dispensing/flags?since=…&until=…, then show each flag with its reason.text
so a reviewer sees what the pharmacist decided.
Work out whether a repeat is due. Read the history, take the latest dispensed_at for a medicine and add its
days_supply. Treat a null days_supply as unknown, not as zero.