Fulfilment Use Case
This page describes a basic Fulfilment API scenario.
Purpose
The fulfilment API allows third parties access to CaryRx infrastructure to drive end-to-end prescription fulfilment through the CaryRx platform:
- Register Webhooks - receive real time events when prescriptions or orders change
- Manage patients - create patients and their delivery locations
- Manage prescriptions - create prescription records (for simulation only) and retrieve them. Note that 'real' prescriptions will be added automatically when they are received into the pharmacy
- Manage orders - create orders with specified delivery options that bundle prescriptions and designate a location
Example Flow

Authentication
An API key will be provided to you for development, UAT and production. The API key is passed as a header with each REST call:
apikey: test-123-test-123URLs will be provided for each environment.
Flow Overview
- Register event webhooks (prescriptions and orders) so your system receives callbacks
- Create a patient (unless patient already exists)
- Create a patient location (delivery address for an order)
- Create a prescription (only used in development to simulate prescriptions)
- Create an order linking patient, prescription(s) and location
- Track updates via GET calls and callbacks
Registering for prescription events
Register webook URLs so CaryRx can POST prescription events. Upon first registering an endpoint you will receive a test payload.
Method | POST |
|---|---|
URL | /v1/prescriptions/events |
Headers | apikey:test-123, Content-Type: application/json |
{
"callbackUrl": "https://webhook.site/47dbf796-eec4-4049-8768-95a5f404d9a0",
"authType": "none"
}Sample Response:
{
"id": "test_object",
"status": "Pending",
"source": "escript",
"medication_name": "AMOXICILLIAN 10MG",
"qty_written": 10,
"last_fill": "01-01-2000",
"days_supply": 10,
"total_tablets_remaining": 10,
"refills_remaining": 0,
"refills_written": 0,
"qty_dispensed": 0,
"patient": {
"entity_type": "Prescription",
"id": "d0aBcdoA",
"created_at": "2020-12-15T09:23:30.097Z",
"updated_at": "2020-12-15T09:23:30.097Z"
}
}Register for order events
Register webook URLs so CaryRx can POST order events. Upon first registering an endpoint you will receive a test payload.
Method | POST |
|---|---|
URL | /v1/orders/events |
Headers | apikey:test-123, Content-Type: application/json |
{
"callbackUrl": "https://webhook.site/47dbf796-eec4-4049-8768-95a5f404d9a0",
"authType": "none"
}{
"id": "d1aBcxoX",
"shipping_method": "sameday_delivery",
"packaging_method": "USPS_FirstClass",
"address_to_name": "string",
"address_to_street1": "string",
"address_to_street2": "string",
"address_to_city": "string",
"address_to_state": "string",
"address_to_zip": "string",
"shipment_tracking_url": "string",
"shipment_tracking_eta": "2020-12-15T19:56:49.685Z",
"sameday_location_x": "string",
"sameday_location_y": "string",
"order_status": "ready_to_fill",
"prescriptions": [
{
"entity_type": "Order",
"id": "d0aBcdoA",
"created_at": "2020-12-15T19:56:49.685Z",
"updated_at": "2020-12-15T19:56:49.686Z"
}
],
"patient": {
"entity_type": "Patient",
"id": "d0aBcdoA",
"created_at": "2020-12-15T19:56:49.686Z",
"updated_at": "2020-12-15T19:56:49.686Z"
}
}Create Patient
Create a patient record to associate with prescriptions, orders and locations.
Method | POST |
|---|---|
URL | /v1/patients |
Headers | apikey:test-123, Content-Type: application/json |
{
"first_name": "Test",
"last_name": "Patient",
"dob": "2000-01-01",
"email": "[email protected]",
"phone_number": "1000010101"
}Example response:
{
"entity_type": "Patient",
"id": "wuYhOSgwUC",
"created_at": "2020-01-25T18:01:02.704Z",
"updated_at": "2020-01-25T18:01:02.704Z"
}Create Location
Add a delivery address for a patient (used when creating an order with a physical shipping method).
Method | POST |
|---|---|
URL | /v1/patients/:patientId/location |
Headers | apikey:test-123, Content-Type: application/json |
{
"patientId": "wuYhOSgwUC",
"locationName": "Home",
"address_to_street1": "123 Main St",
"address_to_street2": "Apt 4",
"address_to_city": "New York",
"address_to_state": "NY",
"address_to_zip": "27511",
"address_to_latitude" : 1,
"address_to_longitude" : 1
}Example response:
{
"entity_type": "PatientLocation",
"id": "2ZgoXnmqJy",
"created_at": "2025-01-25T19:19:15.360Z",
"updated_at": "2025-01-25T19:19:15.360Z"
}Create a Prescription
This endpoint should only be used in production through prior agreement.
If a prescription is added by the pharmacy (upon receipt of escript/fax/call) or by this endpoint it will trigger a callback to the registered prescription webhook.
Method | POST |
|---|---|
URL | /v1/prescriptions |
Headers | apikey:test-123, Content-Type: application/json |
{
"patientId": "wuYhOSgwUC",
"medication_name" : "Atorvastatin",
"qty_written" : 10,
"refills_written" : 0,
"days_supply" : 10,
"data" : "null"
}Example response:
{
"entity_type": "Prescription",
"id": "uCcmDXBO8y",
"created_at": "2025-01-25T18:56:55.873Z",
"updated_at": "2025-01-25T18:56:55.873Z"
}Create an Order
Create a fulfilment order that ships one or more prescriptions to a patient location.
Method | POST |
|---|---|
URL | /v1/orders |
Headers | apikey:test-123, Content-Type: application/json |
{
"shipping_method": "sameday_delivery",
"central_fill" : false,
"patient_id": "wuYhOSgwUC",
"patient_location_id": "2ZgoXnmqJy",
"prescriptions": [
{ "id": "uCcmDXBO8y" }
],
"patient_delivery_note": "Leave at front desk",
"patient_pharmacy_note": "Note for info",
"order_status": "pending"
}Example response:
{
"id": "WbBUBgC6s5",
"shipping_method": "2day_mailorder",
"delivery_schedule": "MailOrder",
"patient_location_id": "2ZgoXnmqJy",
"address_to_street1": "123 Main St",
"address_to_street2": "Apt 4",
"address_to_city": "New York",
"address_to_state": "NY",
"address_to_zip": "27511",
"order_status": "pending",
"prescriptions": [
{
"entity_type": "Prescription",
"id": "uCcmDXBO8y",
"created_at": "2025-01-25T18:56:55.873Z",
"updated_at": "2025-01-25T18:56:55.873Z"
}
],
"patient": {
"entity_type": "Patient",
"id": "wuYhOSgwUC",
"created_at": "2025-01-25T18:01:02.704Z",
"updated_at": "2025-01-25T18:01:02.704Z"
}
}Get Patient
Retrieve a patient record.
Method | GET |
|---|---|
URL | /v1/patients/:patientId |
Headers | apikey:test-123, Content-Type: application/json |
Example response:
"first_name": "Test",
"last_name": "Patient",
"dob": "2000-01-01",
"state": null,
"cary_patient": false,
"id": "wuYhOSgwUC",
"pause_interventions": false,
"tags": [],
"prescriptions": [
{
"entity_type": "Prescription",
"id": "X1yx8VbBCf",
"created_at": "2021-01-25T18:21:01.942Z",
"updated_at": "2021-01-25T18:21:01.942Z"
},
{
"entity_type": "Prescription",
"id": "i7mMsZSI84",
"created_at": "2021-01-25T18:34:14.848Z",
"updated_at": "2021-01-25T18:34:14.848Z"
},
{
"entity_type": "Prescription",
"id": "uCcmDXBO8y",
"created_at": "2021-01-25T18:56:55.873Z",
"updated_at": "2021-01-25T18:56:55.873Z"
}
],
"orders": [
{
"entity_type": "Order",
"id": "l1arhUg55V",
"created_at": "2021-01-25T19:22:33.849Z",
"updated_at": "2021-01-25T19:25:00.840Z"
},
{
"entity_type": "Order",
"id": "UfHos4pREi",
"created_at": "2021-01-25T20:35:55.000Z",
"updated_at": "2021-01-25T20:35:55.000Z"
}
],
"contact_info": []
}Get Prescription
Get a prescription record.
Method | GET |
|---|---|
URL | /v1/prescriptions/:prescriptionId |
Headers | apikey:test-123, Content-Type: application/json |
Sample response:
{
"id": "uCcmDXBO8y",
"source": "escript",
"status": "verified",
"medication_name": "Atorvastatin",
"last_fill": "2021-01-01",
"days_supply": 30,
"qty_written": 30,
"total_tablets_remaining": 30,
"refills_remaining": 0,
"qty_dispensed": 0,
"refills_written": 0,
"prior_auth_status": null,
"rx_number": 1231234,
"prior_auth_last_update": null,
"auto_refill": false,
"payment_token": null,
"external_id": null,
"patient": {
"entity_type": "Patient",
"id": "wuYhOSgwUC"
},
"prescriber": {
"prescriber_name": "Peter Brown",
"prescriber_clinic": "Test Hospital",
"prescriber_address": "1 street",
"prescriber_address2": "room 203",
"prescriber_city": "Washington",
"prescriber_state": "DC",
"prescriber_zip": "20001",
"prescriber_phone": null,
"prescriber_fax": null,
"prescriber_npi": null,
"prescriber_dea": null
}
}Get Order
Retrieve an order record.
Method | GET |
|---|---|
URL | /v1/orders/:orderId |
Headers | apikey:test-123, Content-Type: application/json |
Sample response:
{
"id": "mu0Cu5Dv3f",
"shipping_method": "2day_mailorder",
"packaging_method": "USPS_FirstClass",
"order_status": "pending",
"created_at": "2022-01-26T16:34:09.493Z",
"updatedAt": "2022-01-26T16:34:09.493Z",
"flags": null,
"prescriptions": [
{
"entity_type": "Prescription",
"prescription": "Atorvastatin",
"is_refill": false,
"id": "uCcmDXBO8y",
"created_at": "2022-01-25T18:56:55.873Z",
"updated_at": "2022-01-25T18:56:55.873Z"
}
],
"patient": {
"entity_type": "patient",
"id": "wuYhOSgwUC"
},
"activationCode": null
}