### Start Bulk Get Document URL Source: https://docs.metriport.com/llms.txt Triggers a process to generate a list of download URLs for all of the patient's documents. ```APIDOC ## Start Bulk Get Document URL ### Description Triggers a process to generate a list of download URLs for all of the patient's documents. ### Method POST ### Endpoint /medical/document/download-url-bulk ### Request Body - **patient_id** (string) - Required - The ID of the patient. ### Response #### Success Response (200) - **process_id** (string) - The ID of the document URL generation process. ``` -------------------------------- ### Example Response for Update Settings Source: https://docs.metriport.com/medical-api/api-reference/settings/post-settings This is an example of the JSON response received after successfully updating settings. It includes the settings ID, the configured webhook URL, and the associated webhook key. ```json { "id": "", "webhookUrl": "https://server.domain.com/webhook/endpoint", "webhookKey": "" } ``` -------------------------------- ### Response Example for Set Patient Facilities Source: https://docs.metriport.com/medical-api/api-reference/patient/set-patient-facilities Example JSON response illustrating the structure of facilities associated with a patient after an update. ```json { "facilities": [ { "id": "018a80c4-292a-7486-a1234-9uiu76yhe234", "eTag": "1", "oid": "2.16.840.1.113883.3.666.123.4.101", "name": "Care Facility, LLC", "npi": "1234567891", "tin": "12-3456789", "active": true, "address": { "addressLine1": "2261 Market Street", "addressLine2": "#4818", "city": "San Francisco", "state": "CA", "zip": "94114", "country": "USA" } }, { "id": "018a80c4-292a-7486-a1234-6hyt345tyu23", "eTag": "1", "oid": "2.16.840.1.113883.3.666.123.4.102", "name": "Care Facility 2, LLC", "npi": "1789123456", "tin": "12-6789345", "active": true, "address": { "addressLine1": "451 Care Street", "addressLine2": "#320", "city": "Austin", "state": "TX", "zip": "78617", "country": "USA" } } ] } ``` -------------------------------- ### Start Bulk Get Document URL (Metriport SDK) Source: https://docs.metriport.com/medical-api/api-reference/document/download-url-bulk Use the Metriport SDK to initiate the generation of download URLs for all of a patient's documents. Pass the patient ID and any desired metadata. The function returns the status of the URL generation process. ```javascript import { MetriportMedicalApi } from "@metriport/api-sdk"; const metriport = new MetriportMedicalApi("YOUR_API_KEY"); const metadata = { youCan: "putAny", stringKeyValue: "pairsHere", }; const status = await metriport.startBulkGetDocumentUrl( "018a80c4-292a-7486-a1234-76yuhe23yu14", metadata ); ``` -------------------------------- ### Example Response for Creating Patient Data Source: https://docs.metriport.com/medical-api/api-reference/fhir/create-patient-consolidated This is an example of the transaction-response Bundle returned after successfully creating a patient's consolidated data. ```json { "resourceType": "Bundle", "id": "bc0fcad0-6457-4b9e-93b3-44212e386138", "type": "transaction-response", "entry": [ { "response": { "status": "201 Created", "location": "Appointment/3/_history/1", "etag": "1", "lastModified": "2023-07-27T21:29:31.491+00:00", "outcome": { "resourceType": "OperationOutcome", "issue": [ { "severity": "information", "code": "informational", "details": { "coding": [ { "system": "https://public.metriport.com/fhir/StructureDefinition/operation-outcome", "code": "SUCCESSFUL_CREATE", "display": "Create succeeded." } ] }, "diagnostics": "Successfully created resource \"Appointment/3/_history/1\". Took 7ms." } ] } } } ] } ``` -------------------------------- ### Pharmacy Data Ready Webhook Example Source: https://docs.metriport.com/medical-api/handling-data/webhooks-with-nq An example payload for the `network-query.pharmacy` event, indicating that pharmacy data is ready. This payload includes a `consolidatedDataUrl` for accessing the aggregated patient record. ```APIDOC ## Pharmacy Example Payload ```json { "meta": { "messageId": "11111111-1111-1111-1111-111111111111", "requestId": "22222222-2222-2222-2222-222222222222", "when": "2024-12-26T10:04:15.000Z", "type": "network-query.pharmacy", "data": { "youCan": "putAny", "stringKeyValue": "pairsHere" } }, "payload": { "patientId": "00000000-0000-0000-0000-000000000000", "externalId": "1234567890", "consolidatedDataUrl": "https://documents.s3.amazonaws.com/consolidated-abc123-Amz-SignedHeaders=host", "source": { "type": "pharmacy", "status": "completed", "completedAt": "2024-12-26T10:04:12.000Z" } } } ``` ``` -------------------------------- ### Lab Data Ready Webhook Example Source: https://docs.metriport.com/medical-api/handling-data/webhooks-with-nq An example payload for the `network-query.lab` event, indicating that laboratory data is ready. This payload includes a `consolidatedDataUrl` for accessing the aggregated patient record. ```APIDOC ## Lab Example Payload ```json { "meta": { "messageId": "11111111-1111-1111-1111-111111111111", "requestId": "22222222-2222-2222-2222-222222222222", "when": "2024-12-26T10:05:30.000Z", "type": "network-query.lab", "data": { "youCan": "putAny", "stringKeyValue": "pairsHere" } }, "payload": { "patientId": "00000000-0000-0000-0000-000000000000", "externalId": "1234567890", "consolidatedDataUrl": "https://documents.s3.amazonaws.com/consolidated-abc123-Amz-SignedHeaders=host", "source": { "type": "lab", "status": "completed", "completedAt": "2024-12-26T10:05:28.000Z" } } } ``` ``` -------------------------------- ### Facility API Response Example Source: https://docs.metriport.com/medical-api/api-reference/facility/list-facilities This is an example of the JSON response structure when listing facilities. It includes details such as ID, name, NPI, TIN, and address for each facility. ```json { "facilities":[ { "id": "018a80c4-292a-7486-a1234-9uiu76yhe234", "oid": "2.16.840.1.113883.3.666.123.4.101", "name": "Care Facility, LLC", "npi": "1234567891", "tin": "12-3456789", "active": true, "address": { "addressLine1": "2261 Market Street", "addressLine2": "#4818", "city": "San Francisco", "state": "CA", "zip": "94114", "country": "USA" } }, { "id": "018a80c4-292a-7486-a1234-6hyt345tyu23", "oid": "2.16.840.1.113883.3.666.123.4.102", "name": "Care Facility 2, LLC", "npi": "1789123456", "tin": "12-6789345", "active": true, "address": { "addressLine1": "451 Care Street", "addressLine2": "#320", "city": "Austin", "state": "TX", "zip": "78617", "country": "USA" } } ] } ``` -------------------------------- ### Initialize SDK with Sandbox Options Source: https://docs.metriport.com/medical-api/getting-started/sandbox To connect to the sandbox environment using the SDK, provide the `options` parameter with `sandbox = true` during initialization. ```javascript import Metriport from "metriport"; const metriport = new Metriport({ sandbox: true, // ... other options }); ``` -------------------------------- ### Get Network Query Status with Metriport SDK Source: https://docs.metriport.com/medical-api/api-reference/network/get-network-query Use this snippet to check the progress of a network query. Ensure you have your API key and the request ID from when the query was started. ```javascript import { MetriportMedicalApi } from "@metriport/api-sdk"; const metriport = new MetriportMedicalApi("YOUR_API_KEY"); const status = await metriport.getNetworkQueryStatus({ requestId: "22222222-2222-2222-2222-222222222222", }); ``` -------------------------------- ### Start Bulk Get Document URL Source: https://docs.metriport.com/medical-api/api-reference/document/download-url-bulk Triggers the generation of download URLs for all documents of a patient. The process is asynchronous and its status is returned in the response. A webhook notification with the URLs is sent upon completion. ```APIDOC ## POST /document/download-url/bulk ### Description Triggers a process to generate a list of download URLs for all of the patient's documents. This is an asynchronous process, and the status is returned in the response to the original request. Initially, the status will be `processing`, and when the process is finished, the status will be updated to `completed` or `failed`. Once completed, a webhook request will be sent to your configured URL containing the document download URLs. The URL will be valid for 10 minutes after which it will expire. ### Method POST ### Endpoint /document/download-url/bulk ### Query Parameters - **patientId** (string) - Required - The ID of the patient for which to initiate the bulk URL generation. ### Request Body - **metadata** (object) - Optional - Key-value pairs for additional metadata. ### Request Example ```json { "youCan": "putAny", "stringKeyValue": "pairsHere" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the URL generation process - can be `processing`, `completed`, or `failed`. - **requestId** (string) - A unique identifier for the request. #### Response Example ```json { "status": "processing", "requestId": "018c1e9d-dfce-70cb-8c0e-edfbbd2a7f5f" } ``` ``` -------------------------------- ### Metriport SDK Usage Examples Source: https://docs.metriport.com/medical-api/api-tools/sdk Examples demonstrating common operations using the initialized Metriport client. These include creating facilities, fetching patient data, and listing patient documents. ```typescript // Create a Facility const patient = await metriportClient.createFacility({ // facility data }); // Get a Patient const patient = await metriportClient.getPatient(patientId); // List the given Patient's available documents/records const documents = await metriportClient.listDocuments(patientId, facilityId); ``` -------------------------------- ### Care Gap API Response Example Source: https://docs.metriport.com/medical-api/api-reference/analytics/care-gaps/get-care-gap This JSON object represents a FHIR Bundle returned by the Get Care Gap API. It includes patient details, a MeasureReport detailing care gap status, and parameters used in the calculation. ```json { "resourceType": "Bundle", "type": "collection", "entry": [ { "fullUrl": "urn:uuid:11111111-1111-1111-1111-111111111111", "resource": { "resourceType": "Patient", "id": "00000000-0000-0000-0000-000000000000", "identifier": [ { "value": "1234567890", "system": "https://public.metriport.com/fhir/StructureDefinition/external-id.json", "use": "secondary" } ], "name": [ { "given": ["Alex"], "family": "Example" } ], "gender": "female", "birthDate": "1980-01-15" } }, { "fullUrl": "urn:uuid:22222222-2222-2222-2222-222222222222", "resource": { "resourceType": "MeasureReport", "id": "BreastCancerScreening.00000000-0000-0000-0000-000000000000.2025-01-01", "status": "complete", "type": "individual", "measure": "http://ncqa.org/fhir/Measure/BreastCancerScreening", "subject": { "reference": "Patient/00000000-0000-0000-0000-000000000000" }, "period": { "start": "2025-01-01", "end": "2025-12-31" }, "extension": [ { "url": "https://public.metriport.com/fhir/StructureDefinition/job-id", "valueString": "99999999-9999-9999-9999-999999999999" } ], "group": [ { "id": "BreastCancerScreening", "code": { "coding": [ { "system": "https://ncqa.org/fhir/CodeSystem/measure-group", "code": "BreastCancerScreening" } ] }, "population": [ { "code": { "coding": [ { "system": "https://ncqa.org/fhir/CodeSystem/measure-group", "code": "initial-population" } ] }, "count": 1 }, { "code": { "coding": [ { "system": "https://ncqa.org/fhir/CodeSystem/measure-group", "code": "denominator" } ] }, "count": 1 }, { "code": { "coding": [ { "system": "https://ncqa.org/fhir/CodeSystem/measure-group", "code": "denominator-exclusion" } ] }, "count": 0 }, { "code": { "coding": [ { "system": "https://ncqa.org/fhir/CodeSystem/measure-group", "code": "numerator" } ] }, "count": 0 } ] } ] } }, { "fullUrl": "urn:uuid:33333333-3333-3333-3333-333333333333", "resource": { "resourceType": "Parameters", "parameter": [ { "name": "Age at end of measurement period", "valueInteger": 42 }, { "name": "Is continuously enrolled", "valueBoolean": true }, { "name": "Initial population", "valueBoolean": true }, { "name": "Denominator", "valueBoolean": true }, { "name": "Numerator", "valueBoolean": false }, { "name": "Mammography screening period", "valuePeriod": { "start": "2023-10-01", "end": "2025-12-31" } } ] } } ] } ``` -------------------------------- ### Initialize Metriport SDK Source: https://docs.metriport.com/medical-api/getting-started/quickstart Initialize the Metriport SDK for Node.js servers. Ensure you have your API key and facility ID ready. ```javascript import Metriport from "metriport" const metriport = new Metriport({ apiKey: "YOUR_API_KEY", facilityId: "YOUR_FACILITY_ID", }) ``` -------------------------------- ### Get Facility Source: https://docs.metriport.com/llms.txt Gets a Facility. ```APIDOC ## Get Facility ### Description Gets a Facility. ### Method GET ### Endpoint /medical/facility/{facility_id} ### Parameters #### Path Parameters - **facility_id** (string) - Required - The ID of the facility. ### Response #### Success Response (200) - **facility_details** (object) - Details of the facility. ``` -------------------------------- ### Sending Metadata with Webhook Requests (SDK Example) Source: https://docs.metriport.com/medical-api/handling-data/webhooks-with-nq This example shows how to pass metadata when using the Metriport SDK to call endpoints that support webhooks. The provided metadata will be echoed in the `meta.data` field of the webhook. ```javascript const metriport = new Metriport(METRIPORT_API_KEY); const response = await metriport.network.search({ query: { "patientId": "018f7c31-bbbb-7bbb-7bbb-7bbbbbbbbbbb", "purposeOfUse": "ias", "proofedIdentityId": "pid_018f7c30-aaaa-4aaa-4aaa-4aaaaaaaaaaa" }, metadata: { "externalId": "1234567890", "source": "my-app" } }); ``` -------------------------------- ### Get Webhook Status Source: https://docs.metriport.com/llms.txt Gets the status of communication with your app's webhook. ```APIDOC ## Get Webhook Status ### Description Gets the status of communication with your app's webhook. ### Method GET ### Endpoint /settings/get-webhook ### Response #### Success Response (200) - **webhookStatus** (string) - The current status of the webhook connection. ``` -------------------------------- ### Get Document URL Source: https://docs.metriport.com/medical-api/api-reference/document/get-document Gets a downloadable URL for downloading the specified document. ```APIDOC ## Get Document URL ### Description Gets a downloadable URL for downloading the specified document. ### Method GET ### Endpoint /document ### Query Parameters - **fileName** (string) - Required - The file name of the document. You can get this from the meta.source attribute of any FHIR resource. - **conversionType** (string) - Optional - The document type to convert to. Either `html` or `pdf`. This parameter should only be used for converting XML/CDA files. ### Response #### Success Response (200) - **url** (string) - The downloadable URL. ### Response Example { "url": "https://example.com/download/document.pdf" } ``` -------------------------------- ### SDK Initialization Source: https://docs.metriport.com/medical-api/api-tools/sdk Initialize the Metriport API client in your Node.js application. ```typescript import MetriportClient from "@metriport/api-sdk"; const metriportClient = new MetriportClient({ apiKey: "YOUR_API_KEY", // other options }); ``` -------------------------------- ### Get Care Gap Source: https://docs.metriport.com/llms.txt Gets detailed information about a specific care gap measure report. ```APIDOC ## Get Care Gap ### Description Gets detailed information about a specific care gap measure report. ### Method GET ### Endpoint /medical/analytics/care-gaps/{measure_id} ### Parameters #### Path Parameters - **measure_id** (string) - Required - The ID of the care gap measure report. ### Response #### Success Response (200) - **care_gap_report** (object) - Detailed information about the care gap measure report. ``` -------------------------------- ### Get Settings Source: https://docs.metriport.com/llms.txt Retrieves the settings for your account. ```APIDOC ## Get Settings ### Description Gets the settings for your account. ### Method GET ### Endpoint /settings/get-settings ### Response #### Success Response (200) - **settings** (object) - An object containing your account settings. ```