How to Read Clinical Notes and Write Notes Back to the EHR with Unified.to's Healthcare API
·
Your product can read a patient's clinical documents (progress notes, consultation notes, discharge summaries, care summaries and more) from AdvancedMD, athenahealth, CharmHealth, Epic, MEDITECH, NextGen Healthcare, Oracle Health, PointClickCare, SMART on FHIR, TruBridge, Veradigm and other healthcare integrations. On TruBridge and AlayaCare, and on the FHIR servers Aidbox, AWS HealthLake, Azure Health Data Services and Medplum, plus Health Gorilla and Zus Health, it can also write a document back (as of 26 October 2026).
sdk.healthcare.listHealthcareDocuments returns the same Document object on each of them. The document's content (a PDF, an HTML note, plain text) is served from a short-lived document_url, so your product never handles the customer's EHR credentials. Every request is executed directly against the customer's EHR, so what you read is what exists there now.
Why are clinical notes harder to integrate than coded EHR data?
A clinical note is two things in every EHR: a metadata record (who wrote it, for which patient and visit, what kind of note it is) and the content itself, usually stored separately as a binary that only an authenticated request can fetch. Each vendor also classifies notes in its own way.
AI scribes, care coordination tools, prior-authorization assistants and patient-facing apps all need that narrative record, what the clinician wrote, alongside the coded data. The EHR holds it as documents attached to the patient and the visit. Unified.to's Healthcare API maps the metadata into a single Document object and the kind of note into one type field, and retrieves the content for you through document_url, so you build the read once.
What are the steps to build a clinical documents panel?
A clinical documents panel inside your product: the customer connects their EHR, and each patient's notes appear with type, author, visit and a link to open the content. On integrations that support document create, such as TruBridge and AlayaCare, your product can also file a note it generated.
- Authorize the customer's EHR and store one connection ID
- List a patient's documents, optionally filtered by kind of note
- Open the content through
document_url - Write notes back on integrations that accept them (Aidbox, AlayaCare, AWS HealthLake, Azure Health Data Services, Health Gorilla, Medplum, TruBridge and Zus Health)
- Pick up new and changed documents where supported
Connect once and list a patient's documents
Initialize the SDK with your API key. This is the same for every category.
import { UnifiedTo } from '@unified-api/typescript-sdk';
import * as errors from '@unified-api/typescript-sdk/sdk/models/errors';
const sdk = new UnifiedTo({
security: {
jwt: process.env.UNIFIED_API_KEY,
},
});
If your customers require their data to stay in a region, pass serverIdx when initializing: 0 for US, 1 for EU, 2 for AU. A workspace runs in one region: US on every plan; EU or AU on Pro and Scale.
Each end-customer authorizes their own EHR through Unified.to's authorization component, which returns a connection ID. Store one per customer. On SMART on FHIR EHRs such as Epic, Oracle Health and athenahealth, the user signs in at the EHR and the connection is scoped to what they authorized.
Listing a patient's documents takes one call:
const documents = await sdk.healthcare.listHealthcareDocuments({
connectionId,
patientId,
limit: 50,
});
On AlayaCare, Kipu Health, Metriport, Particle Health and Zus Health, listing documents requires a patient filter (as of 26 October 2026).
What does each Document field mean?
type classifies the kind of note: PROGRESS_NOTE, CONSULTATION_NOTE, HISTORY_AND_PHYSICAL, DISCHARGE_SUMMARY, PROCEDURE_NOTE, REFERRAL_NOTE, SUMMARY, LABORATORY_REPORT, IMAGING_REPORT, CONSENT, or OTHER. codes keeps the EHR's original codings so nothing is lost when the type is OTHER. Lab and imaging results also arrive as structured reports (see How to Read Lab and Imaging Reports), and procedure notes join to a patient's procedure history on encounter_id.
Filter on it server-side to show one kind of note at a time:
const discharges = await sdk.healthcare.listHealthcareDocuments({
connectionId,
patientId,
type: 'DISCHARGE_SUMMARY',
});
encounter_id ties the note to the visit, and practitioner_id to its author. Both reference the Encounter and Practitioner objects in the same API, so a note joins to the visit and clinician your product already reads, with no name matching.
status is CURRENT, SUPERSEDED, ENTERED_IN_ERROR or OTHER. Hide ENTERED_IN_ERROR documents and prefer the CURRENT version of a note that has been amended.
authored_at is when the note was written; mime_type and filename tell you how to render the content before you fetch it.
Open the content
document_url is a signed link to Unified.to's download route, valid for one hour. Fetch it from your server and Unified.to retrieves the content from the EHR with the connection's own credentials:
const response = await fetch(document.document_url!);
const body = Buffer.from(await response.arrayBuffer());
// render by document.mime_type: text/plain, text/html, application/pdf …
If the EHR embedded the content in the record, it is returned directly; if the record points at a binary on the EHR, Unified.to streams it.
Don't store document_url; list or get the document again when you need a new link.
Write a note back to the chart
To file a note, call createHealthcareDocument with the note body base64-encoded. This example targets TruBridge (as of 24 October 2026):
const created = await sdk.healthcare.createHealthcareDocument({
connectionId,
healthcareDocument: {
patient_id: patientId,
encounter_id: encounterId,
status: 'CURRENT',
type: 'PROGRESS_NOTE',
mime_type: 'text/plain',
document_data: Buffer.from(noteText).toString('base64'),
authored_at: new Date().toISOString(),
},
});
Pass codes when the EHR expects a specific document code (a progress note is LOINC 11506-3). The request goes to the EHR when you make the call.
Document create is available on Aidbox, AlayaCare, AWS HealthLake, Azure Health Data Services, Health Gorilla, Medplum, TruBridge and Zus Health; elsewhere documents are read-only through the unified Document object. On AlayaCare, the writable fields are document_data, patient_id, codes and name, so leave out status, type, encounter_id and mime_type. Epic documents are read-only through Unified.to today; gate your write-back interface on the capability matrix.
What if an EHR doesn't return documents?
Each EHR's own API determines what Unified.to can return.
Check support before you scope. Field support, write support and list parameters are documented per integration on the Supported Integrations page.
Handle 501 separately from an empty list. Where an EHR doesn't support documents, the request returns 501 Not Implemented rather than an empty list. An empty list means the patient has no documents; a 501 means this EHR can't tell you either way.
try {
return renderDocuments(await sdk.healthcare.listHealthcareDocuments({ connectionId, patientId }));
} catch (error) {
if (error instanceof errors.UnifiedToError && error.statusCode === 501) {
return renderUnsupported();
}
throw error;
}
Render what returns. name, type and authored_at are enough for a working list; author, visit and content are enhancements that appear when the EHR provides them. A document with no document_url has no attached content: list it, but don't offer an "open" action.
How do I know when a note is added or amended?
On 1upHealth, Aidbox, AWS HealthLake, Azure Health Data Services, Health Gorilla, Humana, Medplum, Oracle Health, Particle Health, SMART on FHIR, TruBridge, Veradigm and Welkin Health (as of 26 October 2026), subscribe to changes and let Unified.to's [virtual webhooks](/blog/what_are_virtual_webhooks_how_they_differ_from_sync_based_webhooks) deliver them:
{
"connection_id": "5de520f96e439b002043d8dc",
"hook_url": "https://yourapp.com/webhooks/healthcare",
"object_type": "healthcare_document",
"event": "created",
"interval": 5,
"webhook_type": "virtual"
}
Subscribe separately for created and updated. The interval field sets how often Unified.to checks for changes: as often as every minute on paid plans, 60 minutes on the trial. A check that finds nothing isn't billed. On those same integrations, updatedGte returns only documents changed since a timestamp. On the others, read on a schedule.
→ Start your 30-day free trial → Book a demo
Frequently asked questions
Does Unified.to store the notes it reads?
No. Every request runs directly against the customer's EHR. Unified.to keeps no customer records at rest; connection credentials and operational metadata are encrypted at rest. A HIPAA BAA is available on Scale.
Can I update or delete a note?
Not through the unified Document object. EHRs treat filed notes as part of the legal record; amendments are new documents that supersede the old one, which is why status distinguishes CURRENT from SUPERSEDED.