Skip to main content

Epic Adapter

A Source Custom node that polls an Epic FHIR endpoint on an interval and pushes every matching resource downstream as JSON.

Part of the Linkiir Adapters package — see requesting the package.

What it does

On each interval the node authenticates against Epic, runs the FHIR search you configured, and pushes one message per resource returned. It caches the access token and reuses it until it nears expiry, so a short interval does not mean a token request every cycle. If the search matches nothing, it logs that and pushes nothing.

Epic FHIR endpoint → Epic Adapter → your next node

Before you start

Register your application with Epic as a backend services client, through open.epic or App Orchard, and collect:

  • The client ID Epic issued.
  • An RSA keypair, with the public half registered against that client.
  • The base URL of the Epic environment you are pointed at.

If you do not already have a keypair, generate one:

openssl genrsa -out epic_private.pem 2048
openssl rsa -in epic_private.pem -pubout -out epic_public.pem
FileWhat to do with it
epic_public.pemRegister it with Epic against your client
epic_private.pemPut it on the machine running the Linkiir Runtime, readable only by the account the Runtime runs as

The private key stays on disk. The node stores its path, not its contents, so the key never enters the project or an export.

Set it up

  1. Open the EPIC Adapter node in the Workflow Builder and click Edit.

  2. Fill in the connection fields:

    FieldValue
    Base URLYour Epic FHIR root
    Client IDThe client ID Epic issued
    Private Key PathAbsolute path to epic_private.pem
    FHIR VersionR4, unless your endpoint serves something else
  3. Say what to fetch:

    FieldValue
    Resource TypePatient, Encounter, Observation, and so on
    Search QuerySearch parameters as a query string, for example family=Smith&birthdate=1970-01-01

    Epic rejects unfiltered searches for most resource types, so include at least one identifying parameter.

  4. Set Live Mode off, then Save.

  5. Connect a downstream node and start the workflow. The log reads Live Mode is off, no request was sent. — the credentials were still exercised, so this run proves them.

  6. Turn Live Mode on. The log now reports how many resources were pushed.

Configuration reference

FieldTypeDefaultPurpose
Intervalnumber60000Milliseconds between polls
Base URLstringEpic's public sandbox rootRoot of the Epic endpoint. A trailing slash is added if missing
Client IDstring(empty)Client ID from the Epic app registration
Private Key Pathfile path(empty)PEM RSA private key used to sign the token request
FHIR VersionlistR4R4, STU3, or DSTU2. Becomes the version segment of the request path
Resource TypestringPatientFHIR resource type to search each poll
Search Querystring(example)Search parameters as a URL query string
Live ModebooltrueOff simulates the FHIR calls. Authentication is always live
Verify TLSbooltrueVerify Epic's TLS certificate. Turn off only for a local test proxy

Verify it worked

  • With Live Mode off, the node starts without a CONFIG_ERROR or AUTH_FAILED and logs that no request was sent.
  • With Live Mode on, the log reports a count of pushed resources, and the downstream node receives that many messages.
  • Each message is a single FHIR resource as JSON, not a Bundle.

If it didn't work

Symptom in the logCauseFix
CONFIG_ERROR: Client ID is not configuredThe Client ID field is emptyEnter the client ID Epic issued
CONFIG_ERROR: cannot open private key at …Wrong path, or the Runtime's account cannot read the fileCorrect the path; grant read access to the Runtime account
CONFIG_ERROR: private key file is emptyThe path points at a zero-byte or truncated fileRe-copy the key file
AUTH_FAILED with HTTP 400The registered public key does not match your private key, or the client ID is wrongRe-register epic_public.pem, and confirm the client ID
AUTH_FAILED mentioning invalid_clientThe app is not registered for backend services, or is not enabled on this Epic environmentCheck the registration with Epic
FHIR_OPERATION_OUTCOME: No patient identifiers suppliedSearch Query has no identifying parameterAdd one, such as family= or identifier=
HTTP_404FHIR Version does not match what the endpoint serves, or Resource Type is misspelledCorrect the version or the resource type
Live Mode is off and nothing is pushedWorking as configuredTurn Live Mode on
No error, but nothing pushedThe search succeeded and matched nothingWiden the Search Query

Two Epic behaviors worth knowing: most resource types require at least one search parameter, and a search that matches nothing is a success with an empty result, not an error.

Next