Getting Started
Medical API

Access to our Medical API will require you to make requests on behalf of an entity with an NPI number for a valid Treatment purpose of use.

Overview

Getting started with our Medical API is pretty easy, you’ll just need take the following steps:

  1. Create a developer account.
  2. Request API access.
  3. Generate an API key.
  4. Integrate your app with Metriport.
  5. Register your Organization.
  6. Create Facilities and Patients.
  7. Get Patient Medical Documents.
  8. Get Patient FHIR Resources. 🎉🎉🎉

Let’s get into it! 🤘

1. Create a developer account

Click me to go to the developer dashboard!

This will take you to the Metriport developer dashboard where you can create your Metriport account, if you don’t have one already.


2. Request API access

Once you’ve created an account and confirmed your email, you’ll be taken to the dashboard home page. From here, take the following steps to request API access:

  • In the left hand menu, click Products & Billing.
  • Click Get Started on the Medical API product.
  • Fill out the form, and click Request Access to submit the request.

Once the form is submitted, we will review your request promptly and contact you if we need any further information.


3. Generate an API key

After we approve your access request, take the following steps to get your API key:

Once you’ve created an account and confirmed your email, you’ll be taken to the dashboard home page. From here, take the following steps to get your API key:

  • In the left hand menu, click “Products & Billing”.
  • Click Get Started on the Medical API product, and add your payment info.
  • In the left hand menu, click Developers.
  • On the Developers page, you’ll be able to click the “Generate Secret Key” button.

This Secret Key will allow you to start making requests to the entire Metriport API on your behalf. Treat this like a password, and keep it somewhere safe! You can read the API Keys page to learn more about API key security best practices.

If you believe your key has been compromised, you can always revoke it and then generate a new one on the Developers page by clicking the trash button beside the key.

After you get access to the Medical API, you can go to the Developers page and toggle the switch under the Sandbox section. Learn more about it here.


4. Integrate your app with Metriport

Note that there are two ways to receive data from Metriport:

  • Webhook: Metriport sends patient data to your app when it becomes available:
    • your application exposes a webhook (endpoint), which Metriport calls when there’s Patient data available after initiating a query;
    • to learn more about how the Webhook flow works, see our Webhooks guide.
  • API: Your app requests data from Metriport:
    • your application polls Metriport for Patients’ medical data after initiating a query to fetch a Patient’s documents;

We recommend using Webhooks to ensure you’re able to get patient data as quickly and easily as possible.


5. Register your Organization

For the remainder of the steps, you are able to either use the Dashboard UI, or the API - whatever you prefer!

Pro-tip: you can use our handy SDK on your server if you’re using Node:

import { MetriportMedicalApi } from "@metriport/api";

const metriportClient = new MetriportMedicalApi("YOUR_API_KEY");

First, you’ll need to register an Organization in Metriport.

An Organization represents your company’s legal corporate entity - this is needed for HIPAA auditing purposes so the Health Information Exchanges (HIEs) can validate who is making requests to the networks.

You only need to register your Organization once, and you can do so by either:

Using the API

See the Create Organization endpoint in our API reference.

Using the Dashboard

  • In the left hand menu, click Medical API.
  • In the Organization section, click Create.
  • Fill in the details and submit the form to register your Organization.

6. Create Facilities and Patients

Once your Organization is registered, you can now create Facilities and Patients. First, you’ll need to create your Facilities.

In Metriport, a Facility is a location that a Patient receives some form of treatment. You can create multiple Facilities to represent each of your care locations. Note that for telehealth practices, these can be virtual locations.

You can create a Facility by either:

Creating Facilities using the API

See the Create Facility endpoint in our API reference.

Creating Facilities using the Dashboard

  • On the Medical API page, in the Facilities section, click Add.
  • Fill in the details and submit the form to add your Facility.

Once you’ve created all of your Facilities, you can create the Patients that you treat each facility. You can create Patients by either:

Creating Patients using the API

See the Create Patient endpoint in our API reference.

Creating Patients using the Dashboard

  • On the Medical API page, in the Facilities section, click Patients for the Facility under which to add Patients.
  • In the Patients section, click Add.
  • Fill in the details and submit the form to add your Patient.

When you create a Patient, Metriport automatically links the Patient to all HIE data sources related to the Patient based on the demographic and/or identification information provided when creating the Patient.


7. Get Patient Medical Documents

Now, you’re able to access your Patients’ medical Documents. This involves 2 main steps:

  1. Querying for available Documents to get a list of metadata describing the available records.
  2. Downloading the Document data from the URL returned in the metadata.

To query for a Patient’s available Documents, you can either:

Query for Documents using the API

  1. Start an asynchronous Document Query across HIEs;
  2. Then, either process the inbound Webhook message which will be sent if you have Webhooks configured, or poll the API to List Documents to get the available document references returned from HIEs.

Query for Documents using the Dashboard

  • On the Medical API page, in the Facilities section, click Patients for the Facility where the Patient is located.
  • In the desired Patient’s row, click Documents.
  • You’ll see all available Documents in the side panel.
  • To update the list of documents from HIEs, click on Query Documents.
Not all Patients will have available Documents, but they should ~95% of the time.

Once you’ve identified the Document you want to retrieve, you can download them by either:

Downloading a Document using the API

See the Get Document endpoint in our API reference.

Downloading a Document using the Dashboard

  • In the side panel that comes up after clicking Documents, simply click Download on the desired Document.

8. Get Patient FHIR Resources 🎉🎉🎉

As we query for Documents we will automatically convert XML C-CDA docs into FHIR resources.

Other Documents, like PDFs and images, will be left in their original format and not processed.

After the conversion from CDA to FHIR, we will store the resulting FHIR resources and make them available to be queried. This will allow you to get the necessary data you might need to better understand and treat your Patients.

To learn more on how to query for a Patient’s resources please see the Get Patient’s Consolidated Data Query endpoint.

That’s it! You’re now well equiped to use the Metriport API to access and manage your Patients’ medical data.

As next steps, we’d recommend scoping out our Medical API Reference in further detail to see the other things you can do with the API.