Skip to content
Reference

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.

On this page

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) with credentials.privateKeyPEM, and you register the public key or a JWKS URL for the app on the developer portal.
  • oauth2: client credentials with credentials.clientSecret, sent as HTTP Basic, for an app registered with symmetric auth.
  • credentials.tokenUrl is the token_endpoint in {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; add system/Appointment.read to search appointments. Leave out system/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.

SettingTypeRequiredDefaultSecretDescription
baseUrlurlYesNoThe practice's FHIR R4 base URL, from eCW's FHIR endpoints list (it ends in /fhir/r4/{practice_code}).
authTypeenum: backend-services, oauth2Nobackend-servicesNobackend-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.
credentialsobjectYes
credentials.clientIdstringYesNoClient ID of your eClinicalWorks system app. Used when authType is backend-services or oauth2.
credentials.tokenUrlurlYesNoToken endpoint: token_endpoint in {baseUrl}/.well-known/smart-configuration. Used when authType is backend-services or oauth2.
credentials.privateKeyPEMstringNoYesPEM private key that signs the client assertion (backend-services). Used when authType is backend-services.
credentials.keyIdstringNoNokid of the registered public key (backend-services). Used when authType is backend-services.
credentials.clientSecretstringNoYesClient secret (oauth2). Used when authType is oauth2.
credentials.scopesstringNoNoSpace-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.
timeoutnumberNoNoRequest timeout in milliseconds.
tlsCaPemstringNoYesPEM CA certificate(s) to verify the server against. See tlsCaMode.
tlsCaModeenum: replace, addNoNoTrust: replace = only this CA (default), add = the system CAs plus this CA. Needs tlsCaPem.
tlsClientCertPemstringNoYesPEM client certificate, for servers that require mutual TLS. Set with tlsClientKeyPem.
tlsClientKeyPemstringNoYesPEM private key for the client certificate (encrypted at rest).
tlsClientPfxstringNoYesClient certificate and key as a base64 PKCS#12 (.p12 / .pfx) bundle, instead of the PEM pair.
tlsClientPassphrasestringNoYesPassphrase of the PKCS#12 bundle.
tlsMinVersionenum: TLSv1.2, TLSv1.3NoNoLowest TLS version to accept (default TLSv1.2).
proxyUrlurlNoNoHTTP(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).
proxyUsernamestringNoNoProxy user (Basic auth).
proxyPasswordstringNoYesProxy password.
noProxyarray of stringNoNoHosts 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.

ActionWhat it doesStep parametersKeys a message may supply
readRead a FHIR resource by ID.resourceType, idresourceType, id
searchSearch FHIR resources.resourceType, searchParams?, maxPages?searchParams
get-patientRead one Patient by FHIR id.idid
search-patientsSearch Patient resources (searchParams, e.g. family, birthdate or identifier).searchParams?, maxPages?searchParams
search-appointmentsSearch Appointment resources (searchParams, e.g. patient or date).searchParams?, maxPages?searchParams
search-encountersSearch 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.

json
{
  "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-appointments works 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.

Reference