Medical data API
Where each kind of medical data goes in the Anpheros API, how it is coded, and how to write, filter, trace, correct and delete it — with working examples.
A medical data API gives software structured access to the contents of patient records: create a patient, record a blood-pressure reading, list active medications, attach a lab report, trace who wrote what. This page describes the data operations of the Anpheros API — which kind of medical data goes where, how it is coded, and how to read it back — with examples that work against the sandbox.
Applications use these operations to treat Anpheros as the medical database of their product: patient records live in the platform's HL7 FHIR R4 store, and the application reads and writes them through the API instead of keeping its own tables of medical data.
For the broader picture (authentication, consent, events) see Healthcare API.
Where each kind of medical data goes
| Medical data | REST v1 | FHIR resource | Coding |
|---|---|---|---|
| The person | POST /v1/patients |
Patient |
name, birth date, gender, identifiers |
| Vital signs, lab results, symptoms, activity, surveys | /v1/patients/{id}/observations |
Observation |
LOINC (symptoms: ICD-10 chapter R); UCUM units |
| Diagnoses and problems | /v1/patients/{id}/conditions |
Condition |
ICD-10 |
| Medications | /v1/patients/{id}/medications |
MedicationStatement |
ATC, product name kept as text |
| Documents (PDF, images) | /v1/patients/{id}/documents |
DocumentReference |
LOINC document kinds |
| A whole lab report | POST /v1/patients/{id}/labs/import |
Observation (laboratory) |
LOINC where known, the lab's own code otherwise |
| Doses taken or skipped, vaccinations, allergies, procedures, reports, care plans, goals, referrals, visits, appointments, care teams, family history, questionnaires | /fhir/R4/{type} |
MedicationAdministration, Immunization, AllergyIntolerance, Procedure, DiagnosticReport, CarePlan, Goal, ServiceRequest, Encounter, Appointment, CareTeam, FamilyMemberHistory, QuestionnaireResponse |
per FHIR code systems |
REST v1 objects and FHIR resources are the same records with the same ids; every v1 object carries its fhir reference.
Writing medical data
# a lab result with its reference range, linked to the report it came from
curl -X POST https://platform.anpheros.com/v1/patients/$PID/observations \
-H "Authorization: Bearer $KEY" -H 'content-type: application/json' -H "Idempotency-Key: $(uuidgen)" -d '{
"code": "4548-4", "display": "Hemoglobin A1c", "category": "laboratory",
"value": 6.4, "unit": "%", "effective_at": "2026-09-01T08:00:00Z",
"reference_range": {"low": 4.0, "high": 5.6},
"derived_from": ["DocumentReference/'$DOC'"], "author_type": "import"
}'
- Observation categories:
vital-signs,laboratory,symptom,activity,survey,exam,imaging,social-history. - Composite measurements such as blood pressure use
components(systolic8480-6, diastolic8462-4inside the panel85354-9). - Author types:
patient,practitioner,device,import,ai. Without one, the platform recordsimport. - Codes you do not know by heart:
GET /v1/terminology/loinc?q=hba1csearches the bundled LOINC subset andGET /v1/search?q=metforminthe catalog of symptoms, conditions and medicines; an observation written without a display name gets the LOINC name automatically.
Reading medical data
curl "https://platform.anpheros.com/v1/patients/$PID/observations?category=laboratory&code=4548-4&from=2026-01-01" -H "Authorization: Bearer $KEY"
curl "https://platform.anpheros.com/v1/patients/$PID/conditions?clinical_status=active" -H "Authorization: Bearer $KEY"
curl "https://platform.anpheros.com/v1/patients/$PID/medications?status=active" -H "Authorization: Bearer $KEY"
curl "https://platform.anpheros.com/v1/patients/$PID/timeline?from=2026-06-01" -H "Authorization: Bearer $KEY"
| Endpoint | Filters |
|---|---|
| observations | category, code, from, to |
| conditions | clinical_status |
| medications | status |
| documents | kind |
| timeline | from, to, types |
Lists are paged with limit and cursor. The timeline merges observations, conditions, medications, documents, visits, appointments, vaccinations and episodes of care into one chronological list — the natural input for a patient history screen.
For anything the REST filters do not cover, use FHIR search: GET /fhir/R4/Observation?patient=$PID&code=http://loinc.org|4548-4&_sort=-date (FHIR platform).
Tracing and correcting data
- Who wrote it:
GET /v1/patients/{id}/provenance/{type}/{resourceId}— one entry per version, with author type, project, organisation and source system. - Every version:
GET /fhir/R4/{type}/{id}/_history; update withIf-Matchto avoid overwriting someone else's change. - Ownership: with consent you can read what other organisations wrote, but change or delete only what your project wrote (
403otherwise). - Deletion:
DELETE /v1/{observations|conditions|medications}/{id}; deleting aPatientdeletes the whole record.
Documents
Create the document (you get an upload target), upload the bytes through the platform or directly to storage, then finalise. After finalisation the original is immutable; its SHA-256 and size are recorded. Up to 25 MiB per file.
Frequently asked questions
What is the best lab data API?
It depends on where the results come from. To receive results from your own laboratory systems, you need an HL7 v2 or FHIR interface to the LIS; to work with one person's results from many laboratories over time, you need a patient-level record that keeps each value with its LOINC code, unit and reference range. Anpheros does the second: results arrive by FHIR, HL7 v2 or CSV, are normalised to LOINC and UCUM, and are read back as FHIR Observation resources with consent. See the lab results API.
Which codes does a medical data API need?
LOINC for laboratory tests and measurements, UCUM for units, ICD-10 or SNOMED CT for conditions, RxNorm or ATC for medicines. Without codes, data from different sources cannot be lined up.
Can I write and read medical data without building a FHIR server?
Yes. A managed FHIR platform stores, validates and versions the data; you call REST or FHIR endpoints. The free sandbox has synthetic patients to start with.
Related
- Health data normalization: codes, units, dates, duplicates, validation
- Medical data provenance explained: who wrote what, and how to record it
- Healthcare API
- Patient medical record
- Build a healthcare app
- API reference (OpenAPI) · Getting started
Ask your AI
Paste this into Claude, ChatGPT, Cursor or Claude Code. Your assistant reads this guide and adapts it to your code.
Read https://developers.anpheros.com/guides/medical-data-api.md and help me apply this guide to my own project. Use the Anpheros sandbox (base URL https://platform.anpheros.com) with my API key from the ANPHEROS_KEY environment variable, never written in the code. Give me complete, runnable code, the response I should expect, and how to fix the errors in https://developers.anpheros.com/guides/troubleshooting.md if a call fails.Open in ClaudeOpen in ChatGPTThis guide as MarkdownBuild the whole integration with an AI coding tool
Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no cardYour first API call in 2 minutes →
