> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metriport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Follow this guide to start exchanging comprehensive patient medical data.

<img className="h-40" src="https://mintcdn.com/metriport/01VxYc4hqAqnMppL/images/metriport-logo.png?fit=max&auto=format&n=01VxYc4hqAqnMppL&q=85&s=59d019d468e0f0f373a75fd1d1511e60" width="2771" height="762" data-path="images/metriport-logo.png" />

## Overview

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

1. [Create a developer account](#1-create-a-developer-account).
2. [Generate an API key](#2-generate-an-api-key).
3. [Integrate your app with Metriport](#3-integrate-your-app-with-metriport).
4. [Create Facilities and Patients](#4-create-facilities-and-patients).
5. [Query for Patient Data](#5-query-for-patient-data).
6. [Get Patient Medical Data](#6-get-patient-medical-data).
7. [Contribute Medical Data](#7-contribute-medical-data).
8. [Request API access](#8-request-api-access).

Let's get into it! 🤘

## 1. Create a developer account

<Snippet file="create-dev-account.mdx" />

***

## 2. Generate an API key

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

* Toggle the `Sandbox` switch in the Dashboard navbar to enter `Sandbox` mode (learn more about this
  [here](/medical-api/getting-started/sandbox)).
* In the left hand menu, click `Developers`.
* On the Developers page, you'll be able to click the `Generate API Key` button.

<Warning>
  The API key will only be displayed once. Please make sure
  to save it to a secure location before leaving the page.
</Warning>

This API 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](/medical-api/getting-started/api-keys) page to learn more about API key security best practices.

<Tip>
  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.
</Tip>

***

## 3. 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](/medical-api/getting-started/webhooks).
* 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;

<Tip>
  We recommend using Webhooks to ensure you're able to get
  patient data as quickly and easily as possible.
</Tip>

***

## 4. Create Facilities and Patients

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

<Info>
  Pro-tip: you can use our handy [SDK](/medical-api/api-tools/sdk) on your server
  if you're using Node:

  <Snippet file="medical-api-init.mdx" />
</Info>

Now you can now create `Facilities` and `Patients`. First,
you'll need to create your `Facilities`.

<Info>
  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.
</Info>

<Tip>
  In Sandbox mode, you can use the test NPI `1234567893`
  when creating Facilities.
</Tip>

You can create a `Facility` by either:

### Creating Facilities using the API

See the [Create Facility endpoint](/medical-api/api-reference/facility/create-facility) in our API reference.

### Creating Facilities using the Dashboard

* On the `Facilities` page, click `Create Facility`.
* 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 in each facility.

<Tip>
  In Sandbox mode, you can create Patients with pre-defined
  patient demographics to simulate a match and pull example
  clinical data - see our [Sandbox
  guide](/medical-api/getting-started/sandbox#example-clinical-data)
  for more details.
</Tip>

You can create `Patients` by either:

### Creating Patients using the API

See the [Create Patient endpoint](/medical-api/api-reference/patient/create-patient) in our API reference.

### Creating Patients using the Dashboard

* On the `Patients` page, click `Create Patient`.
* Fill in the details and submit the form to add your Patient.

<Info>
  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.
</Info>

***

## 5. Query for Patient Data

Now, you're able to query for your Patients' medical data from all available health data networks including HIEs, pharmacies, and laboratories.

As we query for data, we automatically convert outside records (like XML C-CDA docs) into `FHIR` resources 🔥,
deduplicate the data, standardize it, enrich it with medical code lookups and crosswalks, and store the resulting data
on our servers for you to access at any time through a single endpoint.

To query for a Patient's available data, you can either:

### Query for Patient Data using the API

Start an asynchronous [Network Query](/medical-api/api-reference/network/start-network-query) to initiate a query for the Patient's medical data from all available health data networks.

<Info>
  When data from each source is ready, we'll send you
  webhooks (`network-query.hie`, `network-query.pharmacy`,
  `network-query.lab`) - see [the webhooks
  page](/medical-api/handling-data/webhooks-with-nq) for
  more details.
</Info>

<Info>
  If you don't have webhooks integrated, you can use the
  [Get Network Query
  Status](/medical-api/api-reference/network/get-network-query)
  endpoint to check the status of the query.
</Info>

### Query for Patient Data using the Dashboard

* On the `Patients` page, click on the desired Patient row to be taken to their interactive medical record chart summary page.
* If this is the first time viewing this Patient's chart, Metriport will automatically retrieve the Patient's medical data from all available health data networks;
* Otherwise, you can click `Refresh Patient Data` anytime to get the latest medical data from external sources.

<Info>Note: Only \~95% of patients will have data.</Info>

## 6. Get Patient Medical Data

The aforementioned deduplicated, standardized, and enriched `FHIR` data will allow you to get the source of truth for a Patient's medical data to better understand and treat your Patients.
We refer to this as `Consolidated Data` in Metriport.

<Info>
  The Consolidated Data Query retrieves the **cached**
  result of your most recent Network Query. It does not
  fetch new data from external sources - use Network Query
  for that.
</Info>

<Tip>
  Read our [FHIR guide](/medical-api/fhir/overview) to learn
  more about how Metriport leverages FHIR.
</Tip>

To learn more on how to obtain a Patient's Consolidated data via API, please see the [Start Consolidated Data Query](/medical-api/api-reference/fhir/consolidated-data-query-post) endpoint -
note that this same data is also available via the Dashboard.

<Tip>
  To render this data in a single summary document, refer to
  the [Medical Record
  Summary](/medical-api/handling-data/medical-record-summary)
  guide.
</Tip>

<Tip>
  If you need to access the raw unprocessed Documents, see
  the [Start Bulk Get Document
  URL](/medical-api/api-reference/document/download-url-bulk)
  endpoint.
</Tip>

## 7. Contribute Medical Data

To uphold data quality with Metriport's data sources, and improve patient health outcomes, it's required that your organization reciprocates medical data exchange by making net-new patient clinical data available to the networks. Some examples of this include:

* Remote patient monitoring observations such as weight and blood pressure;
* Clinical progress notes from patient encounters;
* Lab results

Metriport makes it easy to contribute this data - you can:

* Upload FHIR data using our [Create Patient's Consolidated Data](/medical-api/api-reference/fhir/create-patient-consolidated) endpoint.
* Upload binary documents using the [Upload Document](/medical-api/api-reference/document/post-upload-url) endpoint.

For more details on how to contribute data back, see the [Data Contribution](/medical-api/handling-data/contribution) guide.

***

## 8. Request API access

<Warning>
  Access to our Medical API will require you to make
  requests on behalf of a covered entity with an [NPI
  number](https://www.cms.gov/Regulations-and-Guidance/Administrative-Simplification/NationalProvIdentStand)
  for a valid
  [Treatment](https://www.hhs.gov/hipaa/for-professionals/privacy/guidance/disclosures-treatment-payment-health-care-operations/index.html)
  purpose of use.
</Warning>

To start using the Medical API for production workloads, with real patient data, you can take the following steps to request production API access:

* In the left hand menu, click `Products & Billing`.
* Click `Get Started` on the Medical API product.
* Press `Book an Intro Call` and select a time and a date to talk to us.

After the call, we will promptly setup your account.

## Wrapping up

That's it! 🤘

You're now well equipped to use the Metriport API to access, manage, and exchange your Patients' medical data.

As next steps, we'd recommend scoping out our [Medical API Reference](/medical-api/api-reference/organization/create-organization)
in further detail to see the other things you can do with Metriport.
