API Documentation
ePrescription Extraction Service - Client Interface v3.4
Quick Start
1Get sandbox credentials in the tab
2Exchange for a Bearer token via POST /v1/auth/token
3Add Authorization: Bearer <token> to all requests
4Upload your catalog, then submit prescriptions
https://your-deployment.up.railway.app-H "Content-Type: application/json" \
-d '{"grant_type":"client_credentials","client_id":"YOUR_ID","client_secret":"YOUR_SECRET"}'
Authentication
All API requests (except /v1/health) require a Bearer token. Use the OAuth2 client_credentials flow to exchange your client_id and client_secret for a JWT access token. Tokens expire after 1 hour and must be refreshed by requesting a new one.
Catalog Management
The catalog is the laboratory's master list of test codes. Upload your catalog so the system can map extracted prescription items to your specific client codes. The system continues operating on the previous catalog while a new version is being validated.
- 1Upload a new catalog version via POST /v1/catalog/upload
- 2System validates the catalog asynchronously (JSON envelope is checked immediately; content validation happens in background)
- 3Poll status via GET /v1/catalog/status/{version} or wait for a webhook notification
- 4If PUBLISHED: new catalog is live. If REJECTED: fix the data issues described in the webhook and re-submit
Prescription Processing
Submit prescription images for AI-powered extraction, LOINC mapping, and lab order coding. Each API call represents one prescription. If a prescription spans multiple pages (front/back), include all pages in the same request. Processing must not exceed 2 minutes.
- 1Submit prescription image(s) via POST /v1/prescriptions/process -- receive a job_id
- 2Wait for webhook notification (recommended) or poll GET /v1/prescriptions/{job_id}/status
- 3Retrieve full result via GET /v1/prescriptions/{job_id} -- includes patient, orders, scores
- 4(Optional but recommended) Submit lab actuals via POST /v1/prescriptions/{job_id}/actuals for continuous improvement
Webhooks
Register a webhook URL to receive real-time push notifications instead of polling. The system sends POST requests to your URL when prescription processing completes or catalog status changes. All payloads are signed with HMAC-SHA256 for authenticity verification.
- 1Register your endpoint via POST /v1/settings/webhook with a URL and a signing secret
- 2The system sends POST requests to your URL when events occur
- 3Verify each webhook by computing HMAC-SHA256 of the body with your secret and comparing to X-Medicus-Signature
- 4Events: prescription.completed (PROCESSED or UNPROCESSABLE) and catalog.status_changed (PUBLISHED, REJECTED, SUPERSEDED)
System
Health check endpoint. No authentication required. Use this to verify connectivity and confirm the service is operational before starting integration work.