Developers
Medical record retrieval API
The Tavrn Enterprise API v2 is a REST API for medical record retrieval from any US provider: create a case, attach the patient’s signed authorization, open one retrieval request per provider, and receive a signed webhook on every status change until the documents are ready to download. Bearer keys, idempotent POSTs and a self-serve sandbox; every section links to its page in the reference.
At a glance
One REST contract, two hosts
Nothing in an integration changes between sandbox and production except the base URL and the key.
| Topic | Enterprise API v2 | Reference |
|---|---|---|
| Production base URL | https://enterprise.tavrn.ai/v2 | Authentication guide |
| Sandbox base URL | https://sandbox.tavrn.ai/v2, tavrn_sk_test_ keys only | Sandbox guide |
| Authentication | Authorization: Bearer <key>; live keys start with tavrn_sk_live_, scoped per resource | Authentication guide |
| Versioning | Dated versions pinned with the Tavrn-Version header; additive changes ship to every version | Versioning guide |
| Idempotency | Idempotency-Key header on any POST; the first outcome is replayed for 24 hours | Idempotency guide |
| Pagination | Cursor-based; limit defaults to 20, maximum 100 | API reference |
| Errors | One JSON envelope with error.code, error.message and error.request_id; every response carries a Request-Id header | Errors guide |
| Webhooks | Signed HTTPS deliveries on status changes, action requests and documents available | Webhooks guide |
Endpoints
Cases, retrieval requests, documents, webhooks
Every record request lives under a case. A retrieval request is one provider with its own status, timeline and documents; facilities, requestors and events are the supporting resources.
| Resource | Method | Path | Returns |
|---|---|---|---|
| Cases | POST | /v2/cases | A case to attach retrieval requests and documents to |
| Cases | POST | /v2/cases/{case_id}/sign-upload | Presigned URL for the authorization PDF or attachments |
| Retrieval requests | POST | /v2/cases/{case_id}/retrieval-requests | id, order_number, status |
| Retrieval requests | GET | /v2/retrieval-requests/{id} | Status, timeline, action requests |
| Retrieval requests | POST | /v2/retrieval-requests/{id}/action-response | Answer a question from the team |
| Documents | GET | /v2/retrieval-requests/{id}/documents | Retrieved files, each with a download URL |
| Webhooks | POST | /v2/webhooks | Signed deliveries on every status change |
Request status
- received
- Accepted; the team is validating the authorization and provider.
- processing
- Being worked with the provider; follow-ups every 48 hours.
- action_required
- Tavrn needs something from you — answer via the action-response endpoint.
- completed
- Terminal. Documents are ready to list and download.
- cancelled
- Terminal. Cancelled by you or because the provider cannot fulfil it.
Authentication
Bearer keys, scoped and environment-bound
Send the key as Authorization: Bearer on every request. Keys are shown once at creation and can be rotated.
- Two prefixes, two hosts
- tavrn_sk_test_ keys work only against sandbox.tavrn.ai, tavrn_sk_live_ keys only against enterprise.tavrn.ai: a test key on production returns 401 invalid_api_key, a live key on the sandbox 400 wrong_environment.
- Scopes per resource
- A key carries read or write scopes for cases, documents, retrievals, requestors and webhooks, so a reconciliation job can hold read-only access.
- Who issues keys
- Sandbox keys are self-serve with a work email. Production keys are created by an organization admin in the Tavrn platform after onboarding.
Idempotency
Retry any POST safely
A timeout on a POST leaves you unsure whether Tavrn processed it. Send an Idempotency-Key (1–255 characters, a UUID v4 is recommended) and Tavrn runs the operation once, replaying the stored outcome for 24 hours. Keys are scoped to the organization, so a retry still replays after a key rotation.
| Request with the same key | Result |
|---|---|
| Same body, first request finished | The original status and body, with Idempotent-Replayed: true |
| Different body | 422 idempotency_key_reused_with_different_payload |
| First request still running | 409 idempotency_key_in_use; retry after it completes |
| First request answered with a 5xx | Nothing is stored; the retry executes again |
| Same patient and facility already active (any key) | 409 duplicate_request_detected unless allow_duplicate is true; a separate check |
Webhooks
Signed deliveries on every status change
Register an HTTPS endpoint with POST /v2/webhooks and choose the events. Each delivery carries the event id, type and timestamp and an HMAC-SHA256 signature over the timestamp and raw body in X-Tavrn-Signature-V1; verify it, store the event, return 2xx within five seconds.
- Three retrieval events
- retrieval_request.status_changed, retrieval_request.action_required when the team needs an answer, and retrieval_request.documents_available when files can be downloaded with the same key.
- Retries and disabling
- Up to nine attempts per event over about 72 hours, each with the same event id. After five consecutive failed events the endpoint is disabled and a webhook_endpoint.disabled event goes to your other endpoints; re-enable it with a PATCH.
- Delivery log and redelivery
- GET /v2/webhooks/{id}/deliveries lists every attempt for 90 days; any delivery can be queued again with the redeliver endpoint for 30 days.
- Reconciliation without webhooks
- GET /v2/events returns 30 days of events, and the request list accepts public_updated_since, so a poll can catch up after an outage.
Sandbox
Synthetic data, the production contract
A separate deployment of the Enterprise API v2 for integration work before you have a Tavrn account: same endpoints, stages and webhook signatures; synthetic facilities and patients; test keys that never touch production.
- 01
Sign up with a work email
sandbox.tavrn.ai/sign-up issues a tavrn_sk_test_ key; free-mail and disposable addresses are rejected. The key page shows usage and rotates or revokes the key.
- 02
Run the five calls
Create a case, upload a synthetic authorization through sign-upload, open a retrieval request, read it, list its documents. Every call is the production call with the sandbox host and key.
- 03
Pick a scenario
The X-Tavrn-Sandbox-Scenario header drives the lifecycle: complete by default, no_records, action_required_payment and others. POST /v2/retrieval-requests/{id}/advance moves it forward now; it returns 404 on production.
- 04
Go to production
Sandbox limits: 25 retrieval requests, 3 webhook endpoints, 20 uploads, 300 requests a minute. An organization admin creates the live key after onboarding; only the host and the key change.
Compared with network APIs
Retrieval by request, not a network query
Particle Health, Health Gorilla and Metriport query the national health-data networks for a patient and return what participating organizations share. Tavrn requests the record from each provider the patient named, on the patient’s authorization, including providers outside every network. Many teams run both.
| Topic | Tavrn | Particle Health | Health Gorilla Patient360 | Metriport |
|---|---|---|---|---|
| Mechanism | One retrieval request per provider; Tavrn requests the custodian by network, release-of-information vendor, portal, fax, mail, email or phone | A query per registered patient across the Particle network (CommonWell and Carequality) | A Patient360 query per patient across CommonWell, Carequality, eHealth Exchange and TEFCA QHINs | A Network Query per patient across the connected health data networks, pharmacies and labs, with a webhook as each source completes |
| Coverage | Any US provider: networks, vendors and portals return about 63% of a patient’s visits in Tavrn’s requests; the other 37% are requested directly | Organizations participating in the networks Particle queries | Organizations participating in the connected networks, plus Health Gorilla’s own HIN | Organizations on the connected networks; Metriport’s docs note that about 95% of patients return data |
| Legal basis | The patient’s signed HIPAA authorization (45 CFR 164.508) naming your organization and purpose; no treatment relationship required | Network purpose of use; CommonWell and Carequality are built on the treatment use case | Clinical purposes under the networks’ purpose-of-use rules | Production access requires a covered entity, an NPI and a treatment purpose of use |
| What comes back | The documents each provider released, searchable, with a download URL: records, bills, imaging reports and DICOM, pathology, as requested | Clinical data in FHIR, flat or C-CDA formats, parsed from the network documents | FHIR R4 resources, with STU3 for Patient360 document retrieval | A consolidated FHIR R4 record, with C-CDA and PDF on request |
| Getting started | Self-serve sandbox key with a work email; production key from an organization admin after onboarding | Register a patient, then query; see the Particle docs for access | OAuth 2.0 and SMART on FHIR; a sandbox base URL alongside production | Sandbox without the production requirements; open-source codebase |
Security
Controls for sensitive medical records
Protected health information, handled under HIPAA and audited for SOC 2.
Security detailsFAQ
The retrieval API, answered
Start building
First request in four calls, on synthetic data
A sandbox key with a work email, or a demo to set up production access.