{"openapi":"3.0.3","info":{"title":"Platform Delivery — Data Feed API","version":"1.6.0","description":"Pull delivery, route, stop, driver, and metrics data scoped to your API key.\n\n**`from` and `to` are REQUIRED on every data endpoint** (`/deliveries`, `/stops`, `/routes`, `/drivers`, `/metrics`, `/reviews`). On the delivery endpoints they are matched against the route's **scheduled date** (`YYYY-MM-DD`); on `/reviews` they are matched against the date the review was submitted (server time zone).\n\n`/reviews` returns driver, client and NPS (0–10) reviews. Filter with `type=driver|client|nps`, or add `group=driver|client|nps` to get that review type grouped per driver / per client with a summary (average, counts, and for NPS the promoter/passive/detractor split and NPS score). There is no maximum range length.\n\nAdd `group=route` to `/deliveries` or `/stops` (or `include=stops` on `/routes`) to receive one object per route — `{ route, client, driver, stops[] }` — with each stop's `rx_items` nested inside. Without it the flat record list is returned unchanged.\n\nUnfinished stop states are normalized to `incomplete`. Responses only include the fields your key was granted; `rx_items` can additionally be limited to individual line-item keys (granted as `rx_items.<key>`). Call `/whoami` for the exact grant. Authenticate with `Authorization: Bearer <api_key>`."},"servers":[{"url":"https://api.platformdelivery.app/datafeed-v1"}],"components":{"securitySchemes":{"BearerApiKey":{"type":"http","scheme":"bearer","bearerFormat":"Data Feed API key"}},"schemas":{"Delivery":{"type":"object","example":{"delivery_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","route_id":42,"route_name":"04 PM MV - ALEX","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","priority":"normal","deliver_by_start":null,"deliver_by_end":null,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","eta_variance_s":431,"arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"status":"delivered","status_set_by":"driver","status_set_at":"2026-01-30T16:42:11Z","event_type":"delivered","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"log_id":"3444515","patient_name":"Christopher Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"recipient_type":"Recipient","recipient_relationship":"Self","delivery_patient_name":"Christopher Medford","delivery_details":null,"delivery_note":null,"notes":null,"reference_code":null,"copay_amount":12.5,"auto_refill_consent_required":false,"auto_refill_consent_provided":false,"attempt_number":1,"fail_reason":null,"recipient_name":"C. Medford","signature_url":"https://<host>/files/route-photos/<stop_id>/sig-raw-<timestamp>.png?token=<signed>","digitalrx_signature_url":"https://<host>/files/route-photos/<stop_id>/sig-<timestamp>.jpg?token=<signed>","delivery_photo_urls":["https://<host>/files/route-photos/<stop_id>/photo-<timestamp>-0.jpg?token=<signed>"],"pod_url":"https://<host>/pod?delivery_id=8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae&token=<delivery_token>"}},"Stop":{"type":"object","example":{"stop_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","route_id":42,"route_name":"04 PM MV - ALEX","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","kind":"RETAIL","status":"incomplete","status_set_by":null,"status_set_at":null,"priority":"normal","deliver_by_start":null,"deliver_by_end":null,"address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"recipient_type":"Recipient","recipient_relationship":"Self","recipient_name":"C. Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","log_id":"3444515","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"patient_name":"Christopher Medford","copay_amount":12.5,"attempt_number":1,"failure_reason":null,"delivery_details":null,"delivery_note":null,"notes":null,"created_at":"2026-01-30T12:02:00Z"}},"Route":{"type":"object","example":{"route_id":42,"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","name":"04 PM MV - ALEX","status":"completed","order_mode":"auto","is_emergency":false,"scheduled_date":"2026-01-30","scheduled_start_time":"09:00:00","start_address":"26024 Acero Suite 110, Mission Viejo, CA 92691, USA","start_lat":33.6126,"start_lng":-117.6712,"return_to_warehouse":true,"optimized_without_traffic":false,"accepted_at":"2026-01-30T13:55:21Z","checked_in_at":"2026-01-30T13:55:21Z","loaded_at":"2026-01-30T14:08:44Z","started_at":"2026-01-30T14:12:03Z","completed_at":"2026-01-30T18:30:48Z","est_end_at":"2026-01-30T17:45:00Z","stops_total":22,"stops_delivered":20,"stops_failed":2,"stops_incomplete":0,"distance_miles":84.3,"duration_minutes":525,"original_duration_minutes":512,"actual_duration_s":15525,"total_wait_time_s":4830,"created_at":"2026-01-29T22:10:00Z"}},"Driver":{"type":"object","example":{"driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","name":"Alex Rivera","email":"alex@example.com","phone":"(916) 555-0110","status":"on_route","is_active":true,"is_online":true,"vehicle_label":"Van 3","vehicle_plate":"9UXA277","last_seen_at":"2026-01-30T16:39:11Z","active_route_id":42,"deliveries_today":12,"stops_remaining":5,"rating":4.82,"rating_count":41}},"Metric":{"type":"object","example":{"date":"2026-01-30","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","routes_count":4,"stops_count":72,"deliveries_count":68,"failures_count":4,"incomplete_count":0,"completion_rate":0.944,"on_time_rate":0.911,"avg_stop_time_minutes":4.3,"total_distance_miles":187.4,"active_drivers":6}},"Review":{"type":"object","example":{"review_id":"5b1e7c9a-2f4d-4b8e-9a1c-3d2e1f0a9b8c","review_type":"nps","question":"On a scale of 0-10, how likely are you to recommend Mission Plaza Pharmacy to a friend or a family member?","rating":9,"rating_scale":"0-10","nps_category":"promoter","comment":"Always on time.","submitted_at":"2026-01-30T18:04:12Z","client_id":"c1a2b3c4-0000-4000-8000-000000000001","client_name":"Mission Plaza Pharmacy","driver_id":"d1a2b3c4-0000-4000-8000-000000000002","driver_name":"Peter","route_id":1042,"delivery_id":"e1a2b3c4-0000-4000-8000-000000000003"}},"ReviewListResponse":{"type":"object","example":{"data":[{"review_id":"5b1e7c9a-2f4d-4b8e-9a1c-3d2e1f0a9b8c","review_type":"nps","question":"On a scale of 0-10, how likely are you to recommend Mission Plaza Pharmacy to a friend or a family member?","rating":9,"rating_scale":"0-10","nps_category":"promoter","comment":"Always on time.","submitted_at":"2026-01-30T18:04:12Z","client_id":"c1a2b3c4-0000-4000-8000-000000000001","client_name":"Mission Plaza Pharmacy","driver_id":"d1a2b3c4-0000-4000-8000-000000000002","driver_name":"Peter","route_id":1042,"delivery_id":"e1a2b3c4-0000-4000-8000-000000000003"}],"count":1,"from":"2026-01-01","to":"2026-01-31","timezone":"America/Los_Angeles"}},"ReviewGroupedResponse":{"type":"object","example":{"data":[{"client":{"client_id":"c1a2b3c4-0000-4000-8000-000000000001","client_name":"Mission Plaza Pharmacy"},"review_type":"nps","question":"On a scale of 0-10, how likely are you to recommend Mission Plaza Pharmacy to a friend or a family member?","summary":{"review_count":1,"average_rating":9,"comment_count":1,"promoters":1,"passives":0,"detractors":0,"nps":100},"reviews":[{"review_id":"5b1e7c9a-2f4d-4b8e-9a1c-3d2e1f0a9b8c","review_type":"nps","question":"On a scale of 0-10, how likely are you to recommend Mission Plaza Pharmacy to a friend or a family member?","rating":9,"rating_scale":"0-10","nps_category":"promoter","comment":"Always on time.","submitted_at":"2026-01-30T18:04:12Z","client_id":"c1a2b3c4-0000-4000-8000-000000000001","client_name":"Mission Plaza Pharmacy","driver_id":"d1a2b3c4-0000-4000-8000-000000000002","driver_name":"Peter","route_id":1042,"delivery_id":"e1a2b3c4-0000-4000-8000-000000000003"}]}],"count":1,"review_count":1,"group":"nps","from":"2026-01-01","to":"2026-01-31","timezone":"America/Los_Angeles"}},"DeliveryListResponse":{"type":"object","example":{"data":[{"delivery_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","route_id":42,"route_name":"04 PM MV - ALEX","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","priority":"normal","deliver_by_start":null,"deliver_by_end":null,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","eta_variance_s":431,"arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"status":"delivered","status_set_by":"driver","status_set_at":"2026-01-30T16:42:11Z","event_type":"delivered","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"log_id":"3444515","patient_name":"Christopher Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"recipient_type":"Recipient","recipient_relationship":"Self","delivery_patient_name":"Christopher Medford","delivery_details":null,"delivery_note":null,"notes":null,"reference_code":null,"copay_amount":12.5,"auto_refill_consent_required":false,"auto_refill_consent_provided":false,"attempt_number":1,"fail_reason":null,"recipient_name":"C. Medford","signature_url":"https://<host>/files/route-photos/<stop_id>/sig-raw-<timestamp>.png?token=<signed>","digitalrx_signature_url":"https://<host>/files/route-photos/<stop_id>/sig-<timestamp>.jpg?token=<signed>","delivery_photo_urls":["https://<host>/files/route-photos/<stop_id>/photo-<timestamp>-0.jpg?token=<signed>"],"pod_url":"https://<host>/pod?delivery_id=8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae&token=<delivery_token>"}],"next_cursor":"2026-01-30T16:42:11Z","count":1}},"StopListResponse":{"type":"object","example":{"data":[{"stop_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","route_id":42,"route_name":"04 PM MV - ALEX","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","kind":"RETAIL","status":"incomplete","status_set_by":null,"status_set_at":null,"priority":"normal","deliver_by_start":null,"deliver_by_end":null,"address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"recipient_type":"Recipient","recipient_relationship":"Self","recipient_name":"C. Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","log_id":"3444515","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"patient_name":"Christopher Medford","copay_amount":12.5,"attempt_number":1,"failure_reason":null,"delivery_details":null,"delivery_note":null,"notes":null,"created_at":"2026-01-30T12:02:00Z"}],"next_cursor":"2026-01-30T12:02:00Z","count":1}},"RouteListResponse":{"type":"object","example":{"data":[{"route_id":42,"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","name":"04 PM MV - ALEX","status":"completed","order_mode":"auto","is_emergency":false,"scheduled_date":"2026-01-30","scheduled_start_time":"09:00:00","start_address":"26024 Acero Suite 110, Mission Viejo, CA 92691, USA","start_lat":33.6126,"start_lng":-117.6712,"return_to_warehouse":true,"optimized_without_traffic":false,"accepted_at":"2026-01-30T13:55:21Z","checked_in_at":"2026-01-30T13:55:21Z","loaded_at":"2026-01-30T14:08:44Z","started_at":"2026-01-30T14:12:03Z","completed_at":"2026-01-30T18:30:48Z","est_end_at":"2026-01-30T17:45:00Z","stops_total":22,"stops_delivered":20,"stops_failed":2,"stops_incomplete":0,"distance_miles":84.3,"duration_minutes":525,"original_duration_minutes":512,"actual_duration_s":15525,"total_wait_time_s":4830,"created_at":"2026-01-29T22:10:00Z"}],"next_cursor":"2026-01-29T22:10:00Z","count":1}},"DriverListResponse":{"type":"object","example":{"data":[{"driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","name":"Alex Rivera","email":"alex@example.com","phone":"(916) 555-0110","status":"on_route","is_active":true,"is_online":true,"vehicle_label":"Van 3","vehicle_plate":"9UXA277","last_seen_at":"2026-01-30T16:39:11Z","active_route_id":42,"deliveries_today":12,"stops_remaining":5,"rating":4.82,"rating_count":41}],"count":1}},"MetricListResponse":{"type":"object","example":{"data":[{"date":"2026-01-30","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","routes_count":4,"stops_count":72,"deliveries_count":68,"failures_count":4,"incomplete_count":0,"completion_rate":0.944,"on_time_rate":0.911,"avg_stop_time_minutes":4.3,"total_distance_miles":187.4,"active_drivers":6}],"count":1}},"RouteGroup":{"type":"object","description":"One route with its client, driver and stops (each stop carries its own rx_items).","example":{"route":{"route_id":42,"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","name":"04 PM MV - ALEX","status":"completed","order_mode":"auto","is_emergency":false,"scheduled_date":"2026-01-30","scheduled_start_time":"09:00:00","start_address":"26024 Acero Suite 110, Mission Viejo, CA 92691, USA","start_lat":33.6126,"start_lng":-117.6712,"return_to_warehouse":true,"optimized_without_traffic":false,"accepted_at":"2026-01-30T13:55:21Z","checked_in_at":"2026-01-30T13:55:21Z","loaded_at":"2026-01-30T14:08:44Z","started_at":"2026-01-30T14:12:03Z","completed_at":"2026-01-30T18:30:48Z","est_end_at":"2026-01-30T17:45:00Z","stops_total":22,"stops_delivered":20,"stops_failed":2,"stops_incomplete":0,"distance_miles":84.3,"duration_minutes":525,"original_duration_minutes":512,"actual_duration_s":15525,"total_wait_time_s":4830,"created_at":"2026-01-29T22:10:00Z"},"client":{"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy"},"driver":{"driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera"},"stops":[{"stop_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","route_id":42,"route_name":"04 PM MV - ALEX","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","kind":"RETAIL","status":"incomplete","status_set_by":null,"status_set_at":null,"priority":"normal","deliver_by_start":null,"deliver_by_end":null,"address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"recipient_type":"Recipient","recipient_relationship":"Self","recipient_name":"C. Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","log_id":"3444515","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"patient_name":"Christopher Medford","copay_amount":12.5,"attempt_number":1,"failure_reason":null,"delivery_details":null,"delivery_note":null,"notes":null,"created_at":"2026-01-30T12:02:00Z"}]}},"GroupedListResponse":{"type":"object","description":"Returned when group=route (or include=stops on /routes). `count` is the number of routes, `stop_count` the number of stops across them.","example":{"data":[{"route":{"route_id":42,"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","name":"04 PM MV - ALEX","status":"completed","order_mode":"auto","is_emergency":false,"scheduled_date":"2026-01-30","scheduled_start_time":"09:00:00","start_address":"26024 Acero Suite 110, Mission Viejo, CA 92691, USA","start_lat":33.6126,"start_lng":-117.6712,"return_to_warehouse":true,"optimized_without_traffic":false,"accepted_at":"2026-01-30T13:55:21Z","checked_in_at":"2026-01-30T13:55:21Z","loaded_at":"2026-01-30T14:08:44Z","started_at":"2026-01-30T14:12:03Z","completed_at":"2026-01-30T18:30:48Z","est_end_at":"2026-01-30T17:45:00Z","stops_total":22,"stops_delivered":20,"stops_failed":2,"stops_incomplete":0,"distance_miles":84.3,"duration_minutes":525,"original_duration_minutes":512,"actual_duration_s":15525,"total_wait_time_s":4830,"created_at":"2026-01-29T22:10:00Z"},"client":{"client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy"},"driver":{"driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera"},"stops":[{"stop_id":"8f1c5e4a-2b7d-4c1e-9a3f-6d2e8b4c71ae","route_id":42,"route_name":"04 PM MV - ALEX","client_id":"c0a14b22-7e3d-4f5a-b8c1-2d9e6f0a3b99","client_name":"Harbor Community Pharmacy","driver_id":"d22a9c41-5b8e-4d2f-a7c3-1e6f8b0d4a07","driver_name":"Alex Rivera","scheduled_date":"2026-01-30","sequence":3,"stop_type":"dropoff","kind":"RETAIL","status":"incomplete","status_set_by":null,"status_set_at":null,"priority":"normal","deliver_by_start":null,"deliver_by_end":null,"address":"12441 Meade St, Garden Grove, CA 92841, USA","lat":33.7865,"lng":-117.9634,"eta":"2026-01-30T16:35:00Z","original_eta":"2026-01-30T16:20:00Z","arrived_at":"2026-01-30T16:38:02Z","delivered_at":"2026-01-30T16:42:11Z","wait_time_s":249,"arrived_distance_m":18.4,"recipient_type":"Recipient","recipient_relationship":"Self","recipient_name":"C. Medford","recipient_phone":"(714) 555-0142","recipient_email":"cm@example.com","log_id":"3444515","rx_number":"648107, 648108","rx_date":"2026-01-29","rx_items":[{"rx_number":"648107","rx_id":"56644656","drug_name":"ATORVASTATIN 20 MG TAB","rx_qty":"30","rx_date":"2026-01-29","copay_amount":12.5,"patient_name":"Christopher Medford","delivered":true,"delivered_at":"2026-01-30T16:42:11Z","failure_reason":null,"attempt_number":1}],"patient_name":"Christopher Medford","copay_amount":12.5,"attempt_number":1,"failure_reason":null,"delivery_details":null,"delivery_note":null,"notes":null,"created_at":"2026-01-30T12:02:00Z"}]}],"next_cursor":null,"count":1,"stop_count":1}}}},"security":[{"BearerApiKey":[]}],"paths":{"/whoami":{"get":{"summary":"Inspect this API key","responses":{"200":{"description":"Key metadata","content":{"application/json":{"example":{"id":"<key-id>","name":"<key-name>","scope_mode":"all","allowed_client_ids":[],"allowed_resources":["deliveries","stops","routes","drivers","metrics","reviews"],"allowed_event_types":["delivered","failed"]}}}}}}},"/deliveries":{"get":{"summary":"List completed deliveries (delivered + failed)","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/after (YYYY-MM-DD). Always the route's scheduled date, never the record creation date."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/before (YYYY-MM-DD)."},{"name":"rx_number","in":"query","schema":{"type":"string"},"description":"Match by Rx number — digits only, no prefix (case-insensitive partial). Also matches Rx line items.","example":"648107"},{"name":"log_id","in":"query","schema":{"type":"string"},"description":"Match by Log ID — numeric (case-insensitive partial).","example":"3444515"},{"name":"patient_name","in":"query","schema":{"type":"string"},"description":"Match by patient/recipient name."},{"name":"address","in":"query","schema":{"type":"string"},"description":"Match by stop address."},{"name":"client_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Filter to a specific client (must be allowed by the API key)."},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Use next_cursor from previous page."},{"name":"event_type","in":"query","schema":{"type":"string","enum":["delivered","failed"]}},{"name":"status","in":"query","description":"Alias of event_type.","schema":{"type":"string","enum":["delivered","failed"]}},{"name":"rx_id","in":"query","schema":{"type":"string"}},{"name":"route_id","in":"query","schema":{"type":"integer"}},{"name":"client_name","in":"query","schema":{"type":"string"}},{"name":"driver_name","in":"query","schema":{"type":"string"}},{"name":"group","in":"query","schema":{"type":"string","enum":["route"]},"description":"Set to route to nest deliveries under their route: { route, client, driver, stops[] }."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/DeliveryListResponse"},{"$ref":"#/components/schemas/GroupedListResponse"}]}}}}}}},"/stops":{"get":{"summary":"List stops (any status)","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/after (YYYY-MM-DD). Always the route's scheduled date, never the record creation date."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/before (YYYY-MM-DD)."},{"name":"rx_number","in":"query","schema":{"type":"string"},"description":"Match by Rx number — digits only, no prefix (case-insensitive partial). Also matches Rx line items.","example":"648107"},{"name":"log_id","in":"query","schema":{"type":"string"},"description":"Match by Log ID — numeric (case-insensitive partial).","example":"3444515"},{"name":"patient_name","in":"query","schema":{"type":"string"},"description":"Match by patient/recipient name."},{"name":"address","in":"query","schema":{"type":"string"},"description":"Match by stop address."},{"name":"client_id","in":"query","schema":{"type":"string","format":"uuid"},"description":"Filter to a specific client (must be allowed by the API key)."},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Use next_cursor from previous page."},{"name":"route_id","in":"query","schema":{"type":"integer"}},{"name":"status","in":"query","description":"Use incomplete for stops that are pending, in progress, or arrived internally.","schema":{"type":"string","enum":["incomplete","delivered","failed","skipped","partial","cancelled"]}},{"name":"rx_id","in":"query","schema":{"type":"string"}},{"name":"group","in":"query","schema":{"type":"string","enum":["route"]},"description":"Set to route to nest stops under their route: { route, client, driver, stops[] }."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/StopListResponse"},{"$ref":"#/components/schemas/GroupedListResponse"}]}}}}}}},"/routes":{"get":{"summary":"List routes","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Scheduled date on/after (YYYY-MM-DD)."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Scheduled date on/before (YYYY-MM-DD)."},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","available","accepted","in_progress","completed","cancelled"]}},{"name":"client_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"include","in":"query","schema":{"type":"string","enum":["stops"]},"description":"Set to stops to nest each route's stops (with their rx_items) inside the route object."},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/RouteListResponse"},{"$ref":"#/components/schemas/GroupedListResponse"}]}}}}}}},"/drivers":{"get":{"summary":"List drivers","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Only drivers with routes scheduled on/after this date."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Only drivers with routes scheduled on/before this date."},{"name":"active_only","in":"query","schema":{"type":"boolean"},"description":"Only drivers with an active route in the range."},{"name":"status","in":"query","schema":{"type":"string","enum":["offline","available","on_route","on_break"]},"description":"Filter by the driver's current status."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriverListResponse"}}}}}}},"/metrics":{"get":{"summary":"Daily KPI rollups per client","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/after (YYYY-MM-DD)."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Route scheduled date on/before (YYYY-MM-DD)."},{"name":"client_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricListResponse"}}}}}}},"/reviews":{"get":{"summary":"List driver, client and NPS reviews","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Review submitted on/after this date (YYYY-MM-DD, server time zone)."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"REQUIRED. Review submitted on/before this date (YYYY-MM-DD, server time zone)."},{"name":"type","in":"query","schema":{"type":"string","enum":["driver","client","nps"]},"description":"Only return this review type. Default: all three."},{"name":"group","in":"query","schema":{"type":"string","enum":["driver","client","nps"]},"description":"Group that review type: driver → per driver, client → per client, nps → per client with NPS score."},{"name":"client_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"driver_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ReviewListResponse"},{"$ref":"#/components/schemas/ReviewGroupedResponse"}]}}}}}}}}}