API_README.md
๐ Complete documentation has moved to Documentation/api/
This project provides comprehensive REST and FHIR APIs for OpenEMR, supporting:
Administration โ Config โ Connectors
Set your base URL at: Administration โ Config โ Connectors โ Site Address (required for OAuth2 and FHIR)
curl -X POST https://localhost:9300/oauth2/default/registration \
-H 'Content-Type: application/json' \
--data '{
"client_name": "My App",
"redirect_uris": ["https://myapp.example.com/callback"],
"scope": "openid api:fhir patient/Patient.rs patient/Observation.rs"
}'
curl -X GET 'https://localhost:9300/apis/default/fhir/Patient' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
โ Scopes Reference
โ EHR Launch Flow
.cruds syntax)See complete resource list in FHIR API Documentation
https://localhost:9300/apis/default/fhir
Key Endpoints:
GET /fhir/metadata - Capability statement (no auth required)GET /fhir/Patient - Patient searchGET /fhir/Observation?patient=123 - Patient observationsPOST /fhir/DocumentReference/$docref - Generate CCDGET /fhir/$export - Bulk data exporthttps://localhost:9300/apis/default/api
โ Full Standard API Documentation
Key Endpoints:
GET /api/patient - List patientsGET /api/patient/123 - Get patient detailsGET /api/patient/123/encounter - Patient encountersPOST /api/patient - Create patienthttps://localhost:9300/apis/default/portal
Test endpoints interactively with Swagger UI:
https://your-openemr-install/swagger/
Try the API on live demo instances:
When testing with Swagger, set your client's redirect URI to:
<OpenEMR base URI>/swagger/oauth2-redirect.html
OpenEMR supports multiple sites with site-specific endpoints:
Default site:
https://localhost:9300/apis/default/fhir
https://localhost:9300/apis/default/api
Alternate site:
https://localhost:9300/apis/alternate/fhir
https://localhost:9300/apis/alternate/api
openid
offline_access
patient/Patient.rs
patient/Observation.rs?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs
openid
fhirUser
launch
launch/patient
launch/encounter
user/Patient.rs
user/Encounter.cruds
user/Observation.crs
user/DocumentReference.crs
system/Patient.$export
system/*.$bulkdata-status
system/Binary.read
V1 Scopes (Deprecated but supported):
patient/Patient.read
patient/Observation.read
V2 Scopes (Recommended):
patient/Patient.rs
patient/Observation.rs
Mapping:
.read โ .rs (read + search).write โ .cud (create + update + delete)// Fetch patient data
const response = await fetch('https://localhost:9300/apis/default/fhir/Patient/123', {
headers: {
'Authorization': `Bearer ${accessToken}`,
'Accept': 'application/fhir+json'
}
});
const patient = await response.json();
console.log(`Patient: ${patient.name[0].given[0]} ${patient.name[0].family}`);
import requests
# Fetch observations
response = requests.get(
'https://localhost:9300/apis/default/fhir/Observation',
headers={
'Authorization': f'Bearer {access_token}',
'Accept': 'application/fhir+json'
},
params={'patient': '123', 'category': 'vital-signs'}
)
observations = response.json()
# Get patient medications
curl -X GET 'https://localhost:9300/apis/default/fhir/MedicationRequest?patient=123' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Accept: application/fhir+json'
Request โ Authentication โ Authorization โ Controller โ Service โ Database
โ
Response โ JSON Formatting โ Validation โ Processing
โ Patient, Practitioner, Organization, Location โ Observation, Condition, Procedure, AllergyIntolerance โ MedicationRequest, MedicationDispense, Immunization โ Encounter, Appointment, CarePlan, CareTeam โ DiagnosticReport, ServiceRequest, Specimen โ DocumentReference, Binary, Provenance โ Goal, Device, Coverage, RelatedPerson
โ Read, Search, Create, Update, Delete (per resource) โ Bulk Export ($export) โ CCD Generation ($docref) โ Token Introspection โ Capability Statement
OpenEMR is licensed under GPL v3.
API integrations must comply with:
| Topic | Documentation |
|---|---|
| Authentication | AUTHENTICATION.md |
| Scopes & Permissions | AUTHORIZATION.md |
| FHIR Endpoints | FHIR_API.md |
| SMART Apps | SMART_ON_FHIR.md |
| Standard API | STANDARD_API.md |
| Development | DEVELOPER_GUIDE.md |
This documentation represents the collective knowledge and contributions of the OpenEMR open-source community. The content is based on:
The organization, structure, and presentation of this documentation was enhanced using Claude AI (Anthropic) to:
All technical accuracy is maintained from the original community-authored documentation.
OpenEMR is an open-source project. To contribute to this documentation:
Last Updated: November 2025 License: GPL v3