Skip to main content
The prescribing flow uses: patient to sync (find, create or update), prescription to draft/sign, order to draft/send, and orders to fetch the result. The first three can change records and are not ID-only fetch tools. You do not need to ask the agent for a draft before sending. Drafting and review are built into the flow. A separate prescription signing call is optional; Photon enforces signing requirements when the order is sent. The JSON examples below are tool arguments. Replace placeholder IDs with IDs returned by Photon.

patient

Sync a patient: find, create or update. First try to match an existing patient using context already available, such as name, date of birth or phone. Don’t ask the clinician to repeat known information or create a new record before attempting a match. To create a patient, first name, last name, date of birth and sex are required (demographic.name.first, demographic.name.last, demographic.dateOfBirth and demographic.sex). A phone number is required to send an order, but not to create the patient. You can start matching an existing patient with fewer details, as in this example:
Send demographic.dateOfBirth as YYYY-MM-DD. If you collect it in a form, use a typed text field, such as MM/DD/YYYY, and convert it before calling the tool. Inspect patient, candidates and changes.unapplied. If several candidates remain, use available context to resolve one or ask for the minimum distinguishing detail. Never guess or silently switch patients. Continue with the selected ID and resend intended fields that have not been applied. Record known clinical context before medication search when possible. Missing history is not confirmed absence. Set an allergy none value only when no known allergies have been confirmed. Don’t ask for a pharmacy during patient sync. Only authenticated patient accounts can save their own volunteered preference in top-level preferredPharmacy. Provider accounts cannot set it. A profile preference does not select an order’s pharmacy.

prescription

Draft prescriptions, with optional standalone signing. Search and progressively complete or update the draft. Start with a drug name or search string before asking for missing strength, dosage, instructions, quantity, units, days supply or refills.
Omit patient if identity is not yet available. This allows medication search; creating a patient prescription requires a resolved patient. Include any prescription details already supplied by the clinician. Use returned choices in changes.unapplied to resolve the treatment and collect missing details. Resend pending inputs with the selected treatment ID, patient and any existing prescription ID. Calls do not retain unapplied inputs for you. Returned treatments include entityKind, a schedule value when available, and templates with source values such as PERSONAL_CATALOG, ORG_CATALOG or RECOMMENDED. Inspect the returned choices instead of assuming every treatment or template is interchangeable. Photon may populate draft directions or dispense details with defaults. Show them to the prescriber and confirm or correct them before signing or submitting. A medication match alone does not establish a complete clinical screen or coverage check; inspect returned screening and warnings.

Sign a reviewed prescription

Optional: use this when your workflow needs to sign a prescription separately from sending the order. It is an explicit call to the same prescription tool, separate from edits. After the prescriber approves the draft, copy its signing.contentHash into signing.signedHash:
Inspect the returned prescription.signing.state and unapplied changes before reporting success. Don’t replace the reviewed hash with a newer one without a new review. Signing does not submit an order. Machine tokens cannot sign.

order

Draft and send orders from existing prescriptions. As part of the send flow, add the drafts for the synced patient:
A call without an order ID may resume a matching draft. Review every prescription in the returned order, including any already present, plus combined screening and unapplied changes. Don’t ask for a pharmacy or make it a prerequisite for submission. Don’t infer a choice from a previous order, profile preference or shopping result. Photon handles the fulfillment link and fallback routing. See Pharmacy changes for an explicitly requested destination.

Submit the reviewed order

The patient must have a phone number before you send an order. If it is missing, update the existing patient with patient, using its ID and contact.phone:
Replace the example phone number with the patient’s confirmed number. After the prescriber approves the complete order, call order with only its ID and submission state:
Photon enforces authorization and signing requirements. If it reports an unmet requirement, resolve that requirement against the existing records before continuing. Confirm the returned signing and order states before reporting success. Submission cannot be combined with content or pharmacy edits. Check order.state, each prescription’s signing state and changes.unapplied, then read back with orders. A DRAFT order has not been submitted. SUBMITTED does not by itself confirm pharmacy receipt. When the result includes PATIENT_SELECTS_PHARMACY, relay its message exactly:
We sent the prescription to your patient and they will select their pharmacy.

Complete clinician verification

Signing or submission can return VERIFICATION_REQUIRED with details.verifyUrl. Give the prescriber that URL exactly as returned, including its query string. They complete verification in Prescribe and return to the chat app. Retry the same signing or submission call after verification; if the reviewed content has changed, obtain a fresh review first. A provider sign-in alone does not establish signing authority.

Read the result and continue

Tool results no longer include links.review. For a handoff, retain the returned record IDs and follow Agent-drafted orders. If clinical context, prescription content, order membership or the destination changes, obtain a fresh review before finalization. Empty or unavailable screening does not establish that a complete check found no problems. For errors, follow userAction when present. INVALID_INPUT reports field paths in details.issues; unknown-key issues also include allowedKeys for the object at that path. Correct the input before retrying. For example, phone belongs in contact, not demographic. An unknown write outcome means the operation may have completed. Preserve returned IDs and inspect the existing record before another write; do not automatically retry or create a replacement.
Last modified on November 13, 2026