Document
Start Document Query
POST

/medical/v1/document/query

x-api-key*
curl --request POST \
  --url https://api.metriport.com/medical/v1/document/query \
  --header 'x-api-key: <x-api-key>'

When executed, this endpoint triggers an asynchronous document query with HIEs and immediately returns the status of document query, processing.

When the asynchronous document query finishes, it stores new/updated document references for future requests and updates the status of document query to completed - accessible through the List Documents endpoint.

You can also use the List Documents endpoint to get the current query status and query progress, while the query is still processing.

If you were to trigger this endpoint again while the query is still processing, you will get a response that reflects the current query progress. So essentially, only a single document query will be running for a patient at a given time.

Query Params

patientIdrequired
string

The ID of the Patient for which to list available Documents.

facilityIdrequired
string

The ID of the Facility where the patient is receiving care.

Response

queryStatusrequired
string

The status of querying document references across HIEs, either processing or completed.

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

const metriportClient = new MetriportMedicalApi("YOUR_API_KEY");

const status = await api.startDocumentQuery(
"2.16.840.1.113883.3.666.5.2004.4.2005",
"2.16.840.1.113883.3.666.123",
);

{
  "queryStatus": "processing",
  "queryProgress": {
    "completed": 10,
    "total": 100
  }
}