Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to eClinicalWorks

Scalekit connector
Open markdown

The eClinicalWorks connector lets your AI agent act in each user's eClinicalWorks account. Each user signs in to eClinicalWorks once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 77 tools.

Tools
77
What they doRead · write · destructive
55 · 20 · 255 read20 write2 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the eClinicalWorks connection

    In AgentKit > Connections, create an eClinicalWorks connection. The name you give it is the connection_name your code passes. See Configure connections.

    Console steps with screenshots

    eClinicalWorks connections use SMART on FHIR and act as the signed-in clinician. Each eClinicalWorks practice has its own FHIR base URL, so each connection carries that practice’s authorization endpoint, token endpoint, audience (aud) and FHIR server domain, plus the client ID and secret of your eClinicalWorks app.

    1. Create the connection and copy the redirect URI

      In the Scalekit dashboard, go to AgentKit > Connections > Create Connection, find eClinicalWorks and click Create. Copy the Redirect URI.

    2. Register a provider app with eClinicalWorks

      Register a confidential provider app with eClinicalWorks, and note its client ID and client secret:

      • Add the redirect URI exactly as you copied it, including any trailing slash. eClinicalWorks accepts only the exact registered URI.
      • Request refresh tokens (offline_access).

      eClinicalWorks FHIR Support provides sandbox logins and a sandbox practice code. Tools that create, update or delete records need a signed write agreement with eClinicalWorks.

    3. Find the practice’s endpoints

      Each practice has its own FHIR base URL, which is also its issuer, such as https://fhir4.eclinicalworks.com/fhir/r4/<practice-code>. Open <FHIR base>/metadata?_format=json and copy the authorization and token URLs it lists.

    4. Enter the values on the connection

      Back on the eClinicalWorks connection, enter:

      • Client ID and Client Secret: from your eClinicalWorks app.
      • Authorization Endpoint and Token Endpoint: from the practice’s /metadata.
      • Audience (aud): the practice’s full FHIR base URL.
      • FHIR Server Domain: the FHIR base without https://, including its path, such as fhir4.eclinicalworks.com/fhir/r4/<practice-code>.

      Select openid, fhirUser and offline_access, plus the resource scopes your agent needs. Click Save.

      For the example practice in eClinicalWorks’ documentation, the values are below. Replace JAFJCD with your sandbox practice code, and read that practice’s /metadata to confirm the endpoints.

      FieldValue
      Authorization Endpointhttps://oauthserver.eclinicalworks.com/oauth/oauth2/authorize
      Token Endpointhttps://oauthserver.eclinicalworks.com/oauth/oauth2/token
      Audience (aud)https://fhir4.eclinicalworks.com/fhir/r4/JAFJCD
      FHIR Server Domainfhir4.eclinicalworks.com/fhir/r4/JAFJCD

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • eclinicalworks_allergy_intolerance_readGet one AllergyIntolerance resource from the practice's eClinicalWorks chart by its FHIR ID.Read-only

    Get Allergy Intolerance

    Get one AllergyIntolerance resource from the practice's eClinicalWorks chart by its FHIR ID. Returns the AllergyIntolerance with substance code, clinical status, criticality, reactions and onset. Use eclinicalworks_allergy_intolerance_search to find allergy intolerance records when you do not have the ID.

    Inputs

    allergy_intolerance_idstringrequired
    FHIR logical ID of the Allergy Intolerance (the `id` returned by eCW, an opaque string; not an MRN or account number). Example: 12345.
  • eclinicalworks_binary_readGet one Binary resource from the practice's eClinicalWorks chart by its FHIR ID.Read-only

    Get Binary

    Get one Binary resource from the practice's eClinicalWorks chart by its FHIR ID. Returns the Binary with content type and base64 `data` of the document (C-CDA XML or a PDF report). Use it when another resource references this one by ID; eCW offers no search for this resource type. Use it to download the content that a DocumentReference or DiagnosticReport points to.

    Inputs

    binary_idstringrequired
    FHIR logical ID of the Binary (the `id` returned by eCW, an opaque string; not an MRN or account number). Example: 12345.
  • eclinicalworks_care_plan_readGet one CarePlan resource from the practice's eClinicalWorks chart by its FHIR ID.Read-only

    Get Care Plan

    Get one CarePlan resource from the practice's eClinicalWorks chart by its FHIR ID. Returns the CarePlan with category, status, intent, period and plan activities (upcoming appointments and pending orders). Use eclinicalworks_care_plan_search to find care plan records when you do not have the ID.

    Inputs

    care_plan_idstringrequired
    FHIR logical ID of the Care Plan (the `id` returned by eCW, an opaque string; not an MRN or account number). Example: 12345.
  • eclinicalworks_care_team_readGet one CareTeam resource from the practice's eClinicalWorks chart by its FHIR ID.Read-only

    Get Care Team

    Get one CareTeam resource from the practice's eClinicalWorks chart by its FHIR ID. Returns the CareTeam with status and participants with their roles. Use eclinicalworks_care_team_search to find care team records when you do not have the ID.

    Inputs

    care_team_idstringrequired
    FHIR logical ID of the Care Team (the `id` returned by eCW, an opaque string; not an MRN or account number). Example: 12345.
  • eclinicalworks_condition_readGet one Condition resource from the practice's eClinicalWorks chart by its FHIR ID.Read-only

    Get Condition

    Get one Condition resource from the practice's eClinicalWorks chart by its FHIR ID. Returns the Condition with category (problem list, encounter diagnosis or health concern), ICD-10/SNOMED code, clinical and verification status and onset. Use eclinicalworks_condition_search to find condition records when you do not have the ID.

    Inputs

    condition_idstringrequired
    FHIR logical ID of the Condition (the `id` returned by eCW, an opaque string; not an MRN or account number). Example: 12345.