📚 Complete documentation has moved to Documentation/api/
This project provides comprehensive REST and FHIR APIs for OpenEMR, supporting:
- FHIR R4 - Full FHIR Release 4 implementation
- US Core 8.0 - US healthcare compliance
- SMART on FHIR v2.2.0 - Advanced app integration
- OAuth 2.0 / OpenID Connect - Secure authentication
- Bulk Data Export - Population health analytics
Administration → Config → Connectors
- ☑ Enable OpenEMR Standard REST API
- ☑ Enable OpenEMR Standard FHIR REST API
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'- 📘 Complete API Documentation - Start here for overview
- 🔐 Authentication Guide - OAuth2, tokens, and client registration
- 🔑 Authorization & Scopes - Permissions and access control
- 🏥 FHIR API Reference - FHIR R4 endpoints and resources
- ⚡ SMART on FHIR - App integration and launch flows
- 🛠️ Standard API Reference - OpenEMR REST endpoints
- 👨💻 Developer Guide - Internal usage and development
- ✨ Granular Scopes - Fine-grained permissions (
.crudssyntax) - ✨ POST-Based Authorization - More secure auth requests
- ✨ Asymmetric Authentication - JWKS support
- ✨ Token Introspection - Validate token status
- ✨ EHR Launch with Encounter Context - Context-aware apps
- ✨ SMART Configuration Endpoint - Dynamic capability discovery
- ✨ ServiceRequest - Lab orders, imaging requests, referrals
- ✨ Specimen - Laboratory specimen tracking
- ✨ MedicationDispense - Pharmacy dispensing records
- ✨ RelatedPerson - Patient relationships and contacts
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 export
https://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 patient
https://localhost:9300/apis/default/portal
- ✅ HTTPS/TLS Required - All API communication must be encrypted
- ✅ OAuth 2.0 - Industry-standard authorization
- ✅ Granular Scopes - Principle of least privilege
- ✅ PKCE for Public Apps - Enhanced security for native/browser apps
- ✅ Token Validation - Introspection support
- ✅ HIPAA - Protected health information safeguards
- ✅ ONC Cures Update - Information blocking compliance
- ✅ FHIR R4 - HL7 FHIR Release 4
- ✅ US Core 8.0 - US healthcare requirements
- ✅ SMART v2.2.0 - App launch framework
Test endpoints interactively with Swagger UI:
https://your-openemr-install/swagger/
Try the API on live demo instances:
- Demo URL: https://www.open-emr.org/wiki/index.php/Development_Demo
- Click: "API (Swagger) User Interface" link
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
- Complete API Docs - All documentation
- Quick Start Guide - Get started fast
- FAQ & Troubleshooting - Common issues
- Community Forum - Ask questions, share knowledge
- Development Thread - API development discussion
- GitHub Issues - Report bugs, request features
- FHIR R4 Spec - HL7 FHIR specification
- US Core 8.0 IG - US Core Implementation Guide
- SMART App Launch - SMART on FHIR specification
- OAuth 2.0 - OAuth 2.0 framework
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'- Internal API Guide - Using APIs from within OpenEMR
- Example Code - Internal API examples
- Adding Endpoints - Create new API endpoints
- Controllers - Controller architecture
- Services - Business logic layer
- Routing - Route definitions
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:
- HIPAA requirements
- State/federal healthcare regulations
- OpenEMR license terms
| 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:
- Original documentation by OpenEMR developers and contributors
- Technical specifications from the OpenEMR codebase
- Community feedback and real-world implementation experience
The organization, structure, and presentation of this documentation was enhanced using Claude AI (Anthropic) to:
- Reorganize content into a more accessible modular structure
- Add comprehensive examples and use cases
- Improve navigation and cross-referencing
- Enhance clarity and consistency across documents
All technical accuracy is maintained from the original community-authored documentation.
OpenEMR is an open-source project. To contribute to this documentation:
- Report Issues: GitHub Issues
- Discuss: Community Forum
- Submit Changes: Pull Requests
Last Updated: November 2025 License: GPL v3