Fulfilment APIs
Fulfilment Use Case
21 min
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 flow chart 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 123 urls 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" "test patient\@test com", "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 for testing to create a prescription record in product, prescriptions will be automatically added when they are received into the pharmacy and a callback triggered over the prescription events 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 }