canonical: https://jentic.com/apis/nextgen.com/nextgen

# Nextgen R4 Fhir

NextGen's FHIR R4 API provides standardized access to electronic health records through 21 clinical resource types including Patient, Observation, MedicationRequest, and DiagnosticReport. Built on the HL7 FHIR R4 standard, the API enables RESTful read and search operations across allergy records, care plans, immunizations, lab results, and encounter data. Healthcare applications can retrieve structured clinical data in JSON format with OAuth 2.0 security to support care coordination, population health analytics, and patient engagement workflows.

## For AI agents

Access electronic health records and clinical data through FHIR R4 standard resources. Retrieve patient demographics, medications, lab results, diagnoses, and immunizations.

## Scope

Does not handle appointment scheduling, billing operations, or patient registration workflows - use for read-only access to clinical data from NextGen EHR only.

## Capabilities

- Retrieve patient demographics, contact information, and clinical identifiers
- Query medication requests, statements, and prescription history
- Access lab results and diagnostic reports with LOINC-coded observations
- Fetch allergy and intolerance records with reaction severity
- Search encounter data including visit types, dates, and care providers
- Pull immunization records with CVX vaccine codes and administration dates
- Retrieve conditions and diagnoses with ICD-10 coding

## Use cases

### Population Health Analytics

Healthcare organizations use the NextGen FHIR R4 API to aggregate clinical data across patient populations for quality reporting and analytics. The API enables bulk retrieval of structured observations, conditions, and procedures coded with standard terminologies like SNRX, ICD-10, and LOINC. Analytics platforms query the API to identify care gaps, track chronic disease management, and generate CMS quality measures. Integration typically requires 3-5 days for authentication, data mapping, and testing across the 21 available FHIR resource types.

Example prompt: Search for all patients with diabetes diagnosis (ICD-10 code E11) and retrieve their most recent HbA1c lab results from the past 6 months

### Care Coordination Across Systems

Health information exchanges and care coordination platforms integrate with NextGen FHIR R4 API to synchronize patient records between organizations. The API supports real-time queries for care plans, care team assignments, and encounter summaries to enable transitions of care. Applications retrieve medication reconciliation data, active problems, and recent procedures to build comprehensive patient care records. The standard FHIR resource structure simplifies interoperability between NextGen and other FHIR-compliant EHR systems without custom data transformation.

Example prompt: Retrieve the active care plan, current medications, and assigned care team for patient ID 12345 to prepare for a transition of care to a specialist

### Patient Engagement Applications

Mobile health apps and patient portals use the NextGen FHIR R4 API to give patients on-demand access to their own medical records. Applications authenticate via OAuth 2.0 patient-facing scopes to retrieve immunization records, lab results, visit summaries, and medication lists in consumer-friendly formats. The FHIR standard's patient compartment ensures queries automatically scope to the authenticated patient's data. Development teams implement the API in 2-4 days for read-only patient access workflows.

Example prompt: Retrieve immunization history, upcoming appointments, and latest lab results for the authenticated patient to display in a mobile health app dashboard

### AI Agent Clinical Decision Support

AI agents integrate with NextGen FHIR R4 API through Jentic to power clinical decision support tools that require real-time EHR data access. Agents search by intent like 'retrieve patient allergies' or 'get recent lab values' and Jentic returns the matching FHIR operation with input schema. The agent executes queries for AllergyIntolerance, Observation, and MedicationRequest resources to check drug interactions, flag abnormal results, and identify care gaps. Through Jentic, OAuth credentials are isolated in the secure vault and agents receive scoped access tokens. Integration time drops from 5-7 days for direct FHIR implementation to under 2 hours via Jentic's intent-based discovery.

Example prompt: Search Jentic for 'retrieve patient medication list', load the MedicationRequest FHIR resource schema, and execute a query for active medications to check for drug-drug interactions before prescribing

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/Patient/{id}` | Retrieve a specific patient record by ID |
| GET | `/Patient` | Search for patients by name, identifier, or demographics |
| GET | `/Observation/{id}` | Get a specific lab result or vital sign observation |
| GET | `/MedicationRequest` | Search medication prescriptions by patient or date |
| GET | `/Condition` | Search patient conditions and diagnoses |
| GET | `/AllergyIntolerance/{id}` | Retrieve a specific allergy or intolerance record |
| GET | `/DiagnosticReport` | Search lab and imaging reports by patient |
| GET | `/Immunization` | Search immunization records by patient |

## Key resources

- **Patient** — Retrieve patient demographics, identifiers, and contact information
- **Observation** — Access vital signs, lab results, and clinical measurements with LOINC codes
- **MedicationRequest** — Query prescription orders with dosage, frequency, and prescriber details
- **Condition** — Fetch diagnoses and clinical conditions with ICD-10 coding
- **AllergyIntolerance** — Retrieve allergy and intolerance records with reaction details and criticality
- **Immunization** — Access vaccination history with CVX codes and administration dates
- **DiagnosticReport** — Pull lab and imaging reports with observations and interpretations
- **Encounter** — Query patient visits, appointments, and care episode data

## Why Jentic

- **Setup:** Wiring the NextGen R4 FHIR API by hand means obtaining and refreshing an OAuth bearer token and building read requests against the `/fhir/R4` base for Patient, Observation, Condition, and other clinical resources. Through Jentic you install once, import the R4 FHIR API from the API Directory, store the OAuth credentials once, and your agent calls it.
- **Permission scoping:** The FHIR API puts the resource id in the URL path (`/Patient/{id}`, `/Observation/{id}`), and this integration exposes read operations only, so scope your agent to the resources it needs, such as reading conditions and allergies, while leaving other resource reads out of the allowed set unless you add them.
- **Credential handling:** Your NextGen OAuth token is stored once, encrypted, by your own Jentic One instance and refreshed and added as the bearer header at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by clinical intent such as 'retrieve patient allergies' or 'get lab results' and Jentic returns the matching FHIR resource operation, such as AllergyIntolerance or Observation, with its search parameters so the agent calls the right endpoint without navigating FHIR capability statements.

## Related APIs

- **Epic FHIR** — Epic's FHIR R4 API serves the largest EHR market share with similar clinical resource coverage
- **athenahealth API** — athenahealth provides ambulatory EHR and practice management with REST API access to clinical data
- **1upHealth FHIR** — 1upHealth aggregates FHIR data from multiple EHR sources into a unified patient record

## FAQ

### What authentication does the NextGen FHIR R4 API use?

The API uses OAuth 2.0 Bearer token authentication. When integrating through Jentic, OAuth credentials are stored encrypted in your Jentic One instance and agents receive scoped access tokens without exposing the raw bearer token. This follows FHIR's SMART on FHIR security framework for patient and provider-facing applications.

### Can I retrieve patient lab results with the NextGen FHIR R4 API?

Yes, you can retrieve lab results through the Observation and DiagnosticReport resources. Query GET /Observation with patient parameter to fetch individual lab values coded with LOINC, or GET /DiagnosticReport to retrieve complete lab report bundles with multiple observations. Results include reference ranges, interpretation flags, and effective dates.

### What are the rate limits for the NextGen FHIR R4 API?

Rate limits are not documented in the OpenAPI specification. NextGen typically enforces rate limits at the OAuth client level. Production integrations should implement exponential backoff for HTTP 429 responses and monitor the X-RateLimit headers if present. Contact NextGen support for specific rate limit policies for your use case.

### How do I search for medications for a patient through Jentic?

Search Jentic with the intent 'retrieve patient medication list'. Jentic returns the MedicationRequest resource with its schema and search parameters. Execute a GET /MedicationRequest query with patient parameter to retrieve active and past prescriptions. The response includes medication codes, dosage, frequency, and prescriber details in FHIR-compliant JSON format.

### Does the NextGen FHIR R4 API support write operations?

The NextGen FHIR R4 API documented in this specification supports read-only operations (GET requests). The 40 endpoints cover retrieval and search across 21 FHIR resource types. Write operations (POST, PUT, PATCH) for creating or updating clinical records are not included in the currently available specification. Check with NextGen for write access availability.

### Which FHIR resources are available in the NextGen R4 API?

The API provides access to 21 FHIR R4 resources: Patient, Observation, MedicationRequest, MedicationStatement, Condition, AllergyIntolerance, Immunization, DiagnosticReport, Encounter, CarePlan, CareTeam, Procedure, Goal, DocumentReference, Device, Location, Organization, Practitioner, RelatedPerson, and Provenance. Each resource supports retrieval by ID and search with resource-specific parameters following the FHIR R4 specification.

### Can I limit what my agent is allowed to do with the NextGen FHIR R4 API?

Yes. Because Jentic One is self-hosted, you set the rules that decide which operations and credentials your agent may use, so you can allow only the specific FHIR resource reads it needs, such as Condition and AllergyIntolerance, and leave every other resource out of the allowed set. This integration exposes read-only operations, with the resource id carried in the URL path like `/Patient/{id}` and `/Observation/{id}`, so an agent cannot create or change clinical records. Your OAuth token stays with your Jentic One instance and is added as the bearer header only when a permitted operation runs.
