Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to AdvancedMD

Scalekit connector
Open markdown

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

Tools
89
What they doRead · write · destructive
53 · 24 · 1253 read24 write12 destructive
Users sign in with

What you can do

  • Read clinical records: retrieve a Patient, Practitioner, Organization, Encounter, Condition, Observation, AllergyIntolerance, Immunization, MedicationRequest, DiagnosticReport, Procedure, or Appointment by its FHIR logical ID
  • Search clinical records: find any supported FHIR resource using parameters like patient, clinical status, category, date, and code
  • Create clinical records: add new records for any of the twelve supported FHIR resource types
  • Update clinical records: modify an existing FHIR resource by its logical ID
  • Delete clinical records: remove a FHIR resource by its logical ID
  • Retrieve everything for a patient: invoke the $everything operation on a Patient to pull all associated clinical resources in a single Bundle

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 AdvancedMD connection

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

    Console steps with screenshots

    AdvancedMD uses the SMART on FHIR OAuth 2.0 authorization code flow with PKCE. Because each AdvancedMD FHIR environment exposes its own endpoints, you supply the authorization and token endpoints, the audience (aud), and the FHIR server domain when you create the connection. You also copy the App Key and App Secret from the API Keys section of the AdvancedMD dashboard — these are your client ID and client secret.

    1. Discover your AdvancedMD FHIR server’s SMART configuration

      Your AdvancedMD FHIR server publishes its OAuth endpoints at a well-known discovery URL:

      <advancedmd-fhir-base-url>/.well-known/smart-configuration

      Fetch that URL and note these values:

      • authorization_endpoint — the Authorization endpoint
      • token_endpoint — the Token endpoint
      • the AdvancedMD FHIR base URL, for example https://providerapi.advancedmd.com/v1/r4 — this gives you both the Audience (aud) value and the FHIR server domain (the same URL without the https:// scheme, for example providerapi.advancedmd.com)

      Find your exact FHIR base URL in the AdvancedMD developer program documentation for your office key and environment (sandbox vs. production).

    2. Copy your App Key and App Secret from AdvancedMD

      Register an app through the AdvancedMD developer program, then open the API Keys section of the AdvancedMD dashboard. This is where AdvancedMD issues the credentials Scalekit needs:

      • Key — the App Key. Use this as your client ID in Scalekit.
      • Secret — the App Secret. Click Show secret to reveal it, then use it as your client secret in Scalekit.

      If no key is listed yet, click Add key to generate one, then copy both values.

      API Keys section in the AdvancedMD dashboard showing the Key value and the Show secret button

      When prompted for a redirect URI during app registration, leave the field open for now — you’ll copy the exact value from Scalekit in the next step.

    3. Copy the redirect URI from Scalekit

      In the Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find AdvancedMD and click Create. Copy the redirect URI — it looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

      Return to your AdvancedMD app registration and paste this redirect URI into the app’s allowed redirect URIs.

    4. Create the connection in Scalekit

      Back in the Scalekit dashboard, finish creating the connection with the values you gathered:

      • Client ID — the Key value (App Key) from the AdvancedMD API Keys section
      • Client Secret — the Secret value (App Secret) from the AdvancedMD API Keys section; click Show secret in AdvancedMD to reveal it
      • Authorization Endpoint — the authorization_endpoint from .well-known/smart-configuration
      • Token Endpoint — the token_endpoint from .well-known/smart-configuration
      • Audience (aud) — the AdvancedMD FHIR base URL, sent as the required aud parameter on the authorization request
      • FHIR Server Domain — the AdvancedMD FHIR server domain without the https:// scheme, for example providerapi.advancedmd.com. Scalekit routes every tool call to this host

      Under Scopes, select the SMART on FHIR scopes your agent needs. Start with openid and offline_access for identity and refresh tokens, then add resource-specific scopes such as patient/Patient.read, patient/Observation.read, or the broader patient/*.read and patient/*.rs scopes. The scopes you select here must match what’s enabled on your AdvancedMD app registration.

      Click Save.

    5. Verify the connection is active

      Go to Connected Accounts for your AdvancedMD connection and confirm the status shows Active after a user completes authorization.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • advancedmd_allergy_intolerance_readRetrieve a single FHIR AllergyIntolerance resource by its logical ID.Read-only

    Get Allergy Intolerance

    Retrieve a single FHIR AllergyIntolerance resource by its logical ID. Represents a patient's allergy or intolerance to a substance.

    Inputs

    allergy_intolerance_idstringrequired
    The logical ID of the AllergyIntolerance resource
  • advancedmd_appointment_readRetrieve a single FHIR Appointment resource by its logical ID.Read-only

    Get Appointment

    Retrieve a single FHIR Appointment resource by its logical ID. Appointments represent bookings for a patient, practitioner, or location at a specific time.

    Inputs

    appointment_idstringrequired
    The logical ID of the Appointment resource
  • advancedmd_care_plan_readRetrieve a single FHIR CarePlan resource by its logical ID.Read-only

    Get Care Plan

    Retrieve a single FHIR CarePlan resource by its logical ID. Care plans describe planned activities to manage a patient's health issues.

    Inputs

    care_plan_idstringrequired
    The logical ID of the CarePlan resource
  • advancedmd_care_team_readRetrieve a single FHIR CareTeam resource by its logical ID.Read-only

    Get Care Team

    Retrieve a single FHIR CareTeam resource by its logical ID. Care teams represent the group of practitioners involved in a patient's care.

    Inputs

    care_team_idstringrequired
    The logical ID of the CareTeam resource

Workflows

Proxy API call

Call the FHIR server’s REST API directly through the Scalekit proxy. Use standard FHIR search paths such as /Patient or /Observation.

const result = await actions.request({
connectionName: 'advancedmd',
identifier: 'user_123',
path: '/Patient?family=Smith&_count=10',
method: 'GET',
});
console.log(result);
Search for patients
const patients = await actions.executeTool({
connector: 'advancedmd',
identifier: 'user_123',
toolName: 'advancedmd_patient_search',
toolInput: {
family: 'Smith',
given: 'Jane',
birthdate: '1985-04-12',
_count: 10,
},
});
console.log('Matching patients:', patients);
Retrieve everything for a patient

Invoke the FHIR $everything operation to pull all clinical resources for one patient in a single Bundle. Pass _type to limit the response to specific resource types.

const bundle = await actions.executeTool({
connector: 'advancedmd',
identifier: 'user_123',
toolName: 'advancedmd_patient_everything',
toolInput: {
patient_id: 'a1b2c3d4-0000-1111-2222-333344445555',
_type: 'Condition,Observation,MedicationRequest',
_count: 50,
},
});
console.log('Bundle entries:', bundle);
Search a patient’s observations
const observations = await actions.executeTool({
connector: 'advancedmd',
identifier: 'user_123',
toolName: 'advancedmd_observation_search',
toolInput: {
patient: 'a1b2c3d4-0000-1111-2222-333344445555',
category: 'vital-signs',
date: 'ge2026-01-01',
_count: 25,
},
});
console.log('Observations:', observations);
Record a vital-sign observation

Create an Observation such as a heart-rate reading. The code and code_system identify the measurement — this example uses the LOINC code 8867-4 (Heart rate).

const observation = await actions.executeTool({
connector: 'advancedmd',
identifier: 'user_123',
toolName: 'advancedmd_observation_create',
toolInput: {
patient_id: 'a1b2c3d4-0000-1111-2222-333344445555',
status: 'final',
code: '8867-4',
code_system: 'http://loinc.org',
code_display: 'Heart rate',
category: 'vital-signs',
effective_date_time: new Date().toISOString(),
value: 72,
unit: '/min',
},
});
console.log('Created observation:', observation);