Adapter: eClinicalWorks FHIR R4
Read and search eClinicalWorks FHIR R4 (Patient, Appointment, Encounter and other US Core resources) with SMART Backend Services or a client secret.
Purpose
Read and search an eClinicalWorks practice's FHIR R4 API: patients, appointments, encounters and the other US Core resources the practice exposes. Each practice has its own base URL, taken from the FHIR endpoints list on the eClinicalWorks FHIR developer portal; it ends in /fhir/r4/{practice_code}.
Auth
backend-services(default): SMART Backend Services. The engine signs an RS384 client assertion (eClinicalWorks accepts RS384 only) withcredentials.privateKeyPEM, and you register the public key or a JWKS URL for the app on the developer portal.oauth2: client credentials withcredentials.clientSecret, sent as HTTP Basic, for an app registered with symmetric auth.credentials.tokenUrlis thetoken_endpointin{baseUrl}/.well-known/smart-configuration. The adapter does not assume a token host.- Scopes default to
system/Patient.read system/Encounter.read. Ask only for scopes the app is registered for; addsystem/Appointment.readto search appointments. Leave outsystem/Group.read, which is for bulk export (use the FHIR Bulk adapter for that). - The token is cached until shortly before it expires (eClinicalWorks issues short-lived backend tokens with no refresh token) and fetched again once after a 401.
- It takes the shared connection options: a client certificate for mutual TLS, a private CA, a minimum TLS version and a proxy. They apply to its token requests too.
Settings
Auth is chosen with authType: backend-services, oauth2 (default backend-services). Dotted names are fields inside an object setting. Secret settings are encrypted at rest, never returned by a read, and shown masked in the console and in exports; their defaults are not shown.
| Setting | Type | Required | Default | Secret | Description |
|---|---|---|---|---|---|
baseUrl | url | Yes | No | The practice's FHIR R4 base URL, from eCW's FHIR endpoints list (it ends in /fhir/r4/{practice_code}). | |
authType | enum: backend-services, oauth2 | No | backend-services | No | backend-services: SMART Backend Services, an RS384 client assertion signed with your private key (the vendor holds your public key or JWKS URL). oauth2: client credentials with a client secret. |
credentials | object | Yes | |||
credentials.clientId | string | Yes | No | Client ID of your eClinicalWorks system app. Used when authType is backend-services or oauth2. | |
credentials.tokenUrl | url | Yes | No | Token endpoint: token_endpoint in {baseUrl}/.well-known/smart-configuration. Used when authType is backend-services or oauth2. | |
credentials.privateKeyPEM | string | No | Yes | PEM private key that signs the client assertion (backend-services). Used when authType is backend-services. | |
credentials.keyId | string | No | No | kid of the registered public key (backend-services). Used when authType is backend-services. | |
credentials.clientSecret | string | No | Yes | Client secret (oauth2). Used when authType is oauth2. | |
credentials.scopes | string | No | No | Space-separated scopes, a subset of the app's registered scopes (default: system/Patient.read system/Encounter.read). Used when authType is backend-services or oauth2. | |
timeout | number | No | No | Request timeout in milliseconds. | |
tlsCaPem | string | No | Yes | PEM CA certificate(s) to verify the server against. See tlsCaMode. | |
tlsCaMode | enum: replace, add | No | No | Trust: replace = only this CA (default), add = the system CAs plus this CA. Needs tlsCaPem. | |
tlsClientCertPem | string | No | Yes | PEM client certificate, for servers that require mutual TLS. Set with tlsClientKeyPem. | |
tlsClientKeyPem | string | No | Yes | PEM private key for the client certificate (encrypted at rest). | |
tlsClientPfx | string | No | Yes | Client certificate and key as a base64 PKCS#12 (.p12 / .pfx) bundle, instead of the PEM pair. | |
tlsClientPassphrase | string | No | Yes | Passphrase of the PKCS#12 bundle. | |
tlsMinVersion | enum: TLSv1.2, TLSv1.3 | No | No | Lowest TLS version to accept (default TLSv1.2). | |
proxyUrl | url | No | No | HTTP(S) proxy, e.g. http://proxy.example.test:3128 (opens in a new tab). The proxy host must pass the SSRF rules (SSRF_ALLOWLIST for a private one). | |
proxyUsername | string | No | No | Proxy user (Basic auth). | |
proxyPassword | string | No | Yes | Proxy password. | |
noProxy | array of string | No | No | Hosts sent direct, not through the proxy: a name (and its subdomains), .suffix, host:port or *. |
Actions
This adapter only reads or receives: a send step through it is refused. A trailing ? marks an optional step parameter.
| Action | What it does | Step parameters | Keys a message may supply |
|---|---|---|---|
read | Read a FHIR resource by ID. | resourceType, id | resourceType, id |
search | Search FHIR resources. | resourceType, searchParams?, maxPages? | searchParams |
get-patient | Read one Patient by FHIR id. | id | id |
search-patients | Search Patient resources (searchParams, e.g. family, birthdate or identifier). | searchParams?, maxPages? | searchParams |
search-appointments | Search Appointment resources (searchParams, e.g. patient or date). | searchParams?, maxPages? | searchParams |
search-encounters | Search Encounter resources (searchParams, e.g. patient or date). | searchParams?, maxPages? | searchParams |
Minimal example
The smallest profile the engine accepts: the required settings only, with synthetic values. Create it with POST /api/adapter-profiles, then test it with POST /api/adapter-profiles/{id}/test.
{
"name": "eClinicalWorks FHIR R4 (example)",
"adapterType": "ecw-fhir",
"config": {
"baseUrl": "https://ecw-fhir.example.test/base",
"credentials": {
"clientId": "example-clientId",
"tokenUrl": "https://ecw-fhir.example.test/token"
}
}
}Limits
- Read-only: send steps are refused with a read-only error and nothing is sent.
- Rate limit: eClinicalWorks allows 250 calls a minute per practice base URL, token requests included. Over it, the app is blocked for the rest of the minute with a 429 that carries no
Retry-After, so the adapter treats such a 429 as "retry after 60 seconds". A 429 or 5xx is retried by the step's retry settings; a 401 that a new token does not fix, a 403 or another 4xx is not. - Appointment is not in the eClinicalWorks public read API list (scheduling apps go through healow).
search-appointmentsworks only where the practice's CapabilityStatement lists Appointment; run the connection test, then a search, before relying on it. - Search returns one page unless the step sets
maxPages(up to 50). A next link on another origin is not followed, and a search that hits the cap fails rather than return a partial set. - The engine refuses a base or token URL that resolves to a private address unless the host is in
SSRF_ALLOWLIST(see Environment variables). - Testing: the adapter is tested against a local fake FHIR server built from the published documentation. During onboarding we validate it against your practice's endpoint with you.
- Sources: the eClinicalWorks FHIR developer portal (ecwopendev): its Documentation page (backend authentication, RS384, rate limiting) and its FHIR Endpoints page.