Reading the record
Once a patient has connected, you can read their record three ways — from a clean summary you can use immediately, down to conformant FHIR for existing pipelines. All three return the same consented data; they differ only in shape.
All reads use the patient access token:
Authorization: Bearer ptok_sandbox_olivia_martin
The unified record
The simplest read. One call returns the whole record, deduplicated and grouped by resource type — ideal when you just want the answer.
curl https://rail.to/api/v1/patients/pat_olivia_martin/record \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
Each resource carries its provenance (the source it came from) and, where the same fact arrived coded differently by different sources, the original codes alongside the normalized one.
Typed collections
Read one resource type at a time, with familiar FHIR-style search parameters — useful when you want just labs, or a specific code.
# Lab results only
curl "https://rail.to/api/v1/patients/pat_olivia_martin/resources/Observation?category=laboratory" \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
# A specific lab by LOINC code
curl "https://rail.to/api/v1/patients/pat_olivia_martin/resources/Observation?code=4548-4" \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
Conformant FHIR
Need standards-conformant FHIR R4 — for an existing FHIR pipeline or tooling? Ask
for the record as a FHIR Bundle, or any single type:
# The whole record as a FHIR Bundle
curl https://rail.to/api/v1/patients/pat_olivia_martin/fhir \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
# One resource type as a Bundle
curl https://rail.to/api/v1/patients/pat_olivia_martin/fhir/Condition \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
Every resource is also available as conformant FHIR inside the unified record, so you can start simple and drop down to raw FHIR for any item without a second integration.
Derived products
Computed views sit at the same level as a read:
curl https://rail.to/api/v1/patients/pat_olivia_martin/summary \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
Staying up to date
Health records change after the fact — labs get corrected, prescriptions change, diagnoses are re-coded. Instead of re-fetching everything, sync gives you just what changed since your last call, using an opaque cursor:
curl https://rail.to/api/v1/patients/pat_olivia_martin/sync \
-H "Authorization: Bearer ptok_sandbox_olivia_martin"
{
"object": "sync_result",
"added": [ /* … */ ],
"modified": [ /* … */ ],
"removed": [ /* … */ ],
"next_cursor": "…"
}
Persist next_cursor and pass it back next time. You can also subscribe to
webhook events to be notified when new data arrives, then sync.
For the full endpoint details and to try any of this live, see the API Reference.