Healthcare API development: what it is and how to build one
What a healthcare API is, how one call works, what to look for, and a free FHIR R4 healthcare API with patient consent, provenance and EU hosting — with examples and FAQ.
A healthcare API is a programmatic interface through which software reads and writes health data — patient records, observations, diagnoses, medications, documents — and through which access to that data is authorised. The Anpheros Platform API is a healthcare API over a patient-controlled HL7 FHIR R4 record: applications use it to store and retrieve medical data, to obtain a patient's consent and to be notified of changes.

How a healthcare API call works
Whatever the vendor, a healthcare API call passes the same checkpoints: who is calling, which patient and which data they may touch, where the data is stored, who wrote it, and who needs to know it changed.
- Your appSends a request with an API key or a patient's OAuth token
- AuthorisationKey → your project's patients; token → one patient, granted scopes only
- FHIR recordRead or write a coded resource; every version kept
- Provenance + auditWho wrote it, for which organisation; the read is logged
- EventsA signed webhook tells your other systems what changed
Kinds of healthcare APIs
| Kind | What it exchanges | Typical use |
|---|---|---|
| FHIR REST APIs | FHIR resources over HTTP (GET /Observation?patient=…) |
the modern standard for clinical data exchange |
| SMART on FHIR / OAuth | authorisation for FHIR APIs | letting third-party apps reach a record with the user's permission |
| HL7 v2 messaging | pipe-delimited messages (ORU^R01 for results, ADT for admissions) |
laboratory and hospital systems, often over interfaces rather than HTTP |
| Document exchange | clinical documents (PDF, CDA, FHIR document bundles) | summaries, discharge letters, referrals |
| Proprietary REST APIs | vendor-specific JSON | a single product's own mobile app or integrations |
Anpheros combines the first two as its core, accepts HL7 v2 laboratory results as input, stores documents with their originals and produces FHIR document bundles (the International Patient Summary). It also offers a simpler REST API over the same data for developers who do not want to work with FHIR directly.
Healthcare API development: from scratch or on a FHIR backend
Healthcare API development has two paths. You can build everything yourself: the data model, storage, authorisation, consent, audit and hosting. Or you can build your product's API on a FHIR backend that already provides those parts, and write only what is specific to your product.
| From scratch | On a FHIR backend (for example Anpheros) | |
|---|---|---|
| Data model | design your own, map it to FHIR later for integrations | HL7 FHIR R4 from the first request |
| Patient consent and OAuth | build a consent screen, tokens and revocation | OAuth 2.1 with PKCE, SMART on FHIR scopes and a consent page included |
| Audit and provenance | build logging of every read and write | every read and write logged; provenance on every write |
| Hosting and data residency | choose, secure and certify the infrastructure | EU hosting; a US region on request |
| HIPAA / GDPR paperwork | your own BAA chain and processing records | a BAA (US) or data processing agreement (EU) with the platform |
| First working request | after the infrastructure exists | minutes, in a free sandbox with synthetic patients |
The steps on a FHIR backend:
- Get a sandbox key in the dashboard (Google sign-in, no card).
- Model your data as FHIR resources: a reading is an
Observation, a diagnosis aCondition, a medicine aMedicationStatement. - Write and read through the API:
curl -X POST "https://platform.anpheros.com/fhir/R4/Observation" -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/fhir+json" -d '{
"resourceType": "Observation", "status": "final",
"code": {"coding": [{"system": "http://loinc.org", "code": "8867-4", "display": "Heart rate"}]},
"subject": {"reference": "Patient/'$PID'"},
"effectiveDateTime": "2026-11-01T08:30:00Z",
"valueQuantity": {"value": 72, "unit": "/min", "system": "http://unitsofmeasure.org", "code": "/min"}}'
- Add patient consent with OAuth, so each person decides what your app can read.
- Subscribe to webhooks to react when data changes.
- Go to production with the same code and a production key, after the data processing agreement (and, for US patient data, the BAA).
The TypeScript tutorial builds a complete healthcare API this way, step by step.
HIPAA and GDPR. Health data is a special category under GDPR (Article 9) and protected health information under HIPAA. On a FHIR backend you still decide what your app collects and why, and you remain responsible for your own app; the platform covers storage, access control, audit and residency under its agreement with you. See Security, privacy and data residency.
What to look for in a healthcare API
The rest of this page shows how each of these appears in the Anpheros API.
The Anpheros API at a glance
| Surface | Base path | Purpose |
|---|---|---|
| FHIR R4 | /fhir/R4 |
30 resource types; read, search, create, update, delete, history, transactions, $everything, $summary, $validate |
| REST v1 | /v1 |
patients, observations, conditions, medications, documents, timeline, provenance, AI context, lab import, terminology, webhooks |
| OAuth 2.1 | /oauth |
consent page, tokens (PKCE), revocation, OpenID Connect keys |
| Patient side | /me |
a person's own records, who has access, access log, revoke |
| Discovery | /fhir/R4/metadata, /fhir/R4/.well-known/smart-configuration, /openapi.json |
machine-readable descriptions of the API |
Base URL: https://platform.anpheros.com. The sandbox and production share it; the key decides the data plane.
Authentication
- API keys (
sk_test_…,sk_live_…) for your servers; they see the patients your project created. - OAuth access tokens (
at_…) for an application acting for one patient under a consent.
curl https://platform.anpheros.com/v1/patients -H "Authorization: Bearer $KEY"
Writing safely
POST requests accept an Idempotency-Key: a retried request with the same key returns the original response and creates nothing. Every write gets a Provenance; the author type is sent in the body (author_type) or in headers such as X-Anpheros-Author-Type, X-Anpheros-Source-System, X-Anpheros-Origin-Id and X-Anpheros-On-Behalf-Of.
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": "29463-7", "display": "Body weight", "category": "vital-signs",
"value": 71.4, "unit": "kg", "effective_at": "2026-09-28T07:30:00Z", "author_type": "patient"}'
Errors and limits
FHIR endpoints answer with OperationOutcome; the others with {"error": {"type", "message", "field"}}. Every response carries Anpheros-Request-Id. The default limit is 600 requests per minute per key and per IP. Errors · Limits
Events
Signed webhooks for resource.created, resource.updated, resource.deleted, consent.granted, consent.revoked, document.finalized and ping. Webhooks
Choosing between FHIR and REST v1
Use FHIR when you already work with FHIR, need resource types that /v1 does not cover (for example Immunization, Procedure or CarePlan), or exchange data with other FHIR systems. Use REST v1 for application code that wants flat JSON for the common cases. Both read and write the same resources with the same ids, so a project can mix them. Medical data API describes the data operations in detail.
Frequently asked questions
Is there a REST API tutorial for healthcare?
Yes. How to store medical records using FHIR R4 is a step-by-step REST API tutorial with curl: create a patient, write readings, search them and share them. TypeScript tutorial: build a healthcare API step by step does the same from a Node.js backend.
What does healthcare API development involve?
Healthcare API development means defining how software reads and writes health data, usually as HL7 FHIR R4, and building the parts health data requires: authorisation with patient consent, audit of reads and writes, provenance, safe retries and compliant hosting. Building on a FHIR backend gives you those parts, so you develop only your product's own logic.
How long does healthcare API development take on a FHIR backend?
The first request works in minutes in the sandbox, and the Getting started guide reaches patients, consent and webhooks in about an hour. The time that remains is your product's own features.
What is a healthcare API?
A programmatic interface through which software reads and writes health data — patient records, observations, diagnoses, medications and documents — and through which access to that data is authorised. Modern healthcare APIs use HL7 FHIR R4 for the data and OAuth 2.0 or 2.1 with SMART on FHIR for authorisation.
What is the difference between a healthcare API and a FHIR API?
FHIR is one standard a healthcare API can follow. A FHIR API exchanges FHIR resources over REST; a healthcare API may also accept HL7 v2 messages, documents or proprietary JSON. Anpheros offers a FHIR R4 API and a simpler REST API over the same data.
Is there a free healthcare API for developers?
Yes. The Anpheros sandbox is free and self-service: sign in with Google, get an API key and work with 30 synthetic patients over FHIR R4 or REST. Production starts at €99 a month, with the first month free.
How do patients give consent to a healthcare API?
Through OAuth 2.1 with PKCE: the application sends the person to a consent page with SMART on FHIR scopes; the person chooses what to share and for how long, can see an access log and can revoke access at any time.
Where is the data stored?
In the European Union: the service and its databases run in Google Cloud europe-west4 (Netherlands).
Which healthcare API should I choose?
Compare the data standard, who authorises access, provenance and audit, data residency, how retries and errors behave, and whether you can test with realistic data for free. Healthcare API platform: what it includes and how to choose turns these into questions to ask any vendor.
Related
- EHR API and medical records API
- Healthcare API platform: what it includes and how to choose
- TypeScript tutorial: build a healthcare API: step-by-step tutorial with Express
- How to store medical records using FHIR R4: step-by-step tutorial with curl
- Healthcare API with patient consent
- SMART on FHIR backend
- Medical data API
- FHIR platform
- Healthcare data interoperability
- Healthcare integrations
- API reference (OpenAPI) · Authentication and OAuth
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/healthcare-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 →
