Query and retrieve documents
Build a Document Query
Send the QE, assigning authority, MRN, document types and the Part 2 flag to POST /api/v1/documents/query. Change the values and the request regenerates immediately.
/api/v1/documents/query · QA{
"qe": "BRONX",
"assigningAuthority": "IFH",
"mrn": "PDRTEST-NP2-BRONX-QA02",
"docTypes": [
"CCD",
"Lab",
"Rad",
"TRN"
],
"part2": false
}
curl --http1.1 \
--request POST \
'https://pdr-gateway.qa.healtheconnections.org:10443/api/v1/documents/query' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"qe": "BRONX",
"assigningAuthority": "IFH",
"mrn": "PDRTEST-NP2-BRONX-QA02",
"docTypes": [
"CCD",
"Lab",
"Rad",
"TRN"
],
"part2": false
}'
Request generation only. This page makes no API calls.
Validated QA examples
Synthetic QA query. Returned 3 CCD and 3 TRN DocumentReferences (two shown) and a matched alias row.
{
"qe": "BRONX",
"assigningAuthority": "IFH",
"mrn": "PDRTEST-NP2-BRONX-QA02",
"docTypes": [
"CCD",
"Lab",
"Rad",
"TRN"
],
"part2": false
}
{
"operation": "document-query",
"status": "OK",
"results": [
{
"aliasIndex": 0,
"patientReference": "Patient/d85a7ba7-a6ec-5cd6-a7ee-61ed478a32d5",
"bundle": {
"resourceType": "Bundle",
"type": "searchset",
"total": 6,
"note": "Trimmed for this guide. The QA run returned 3 CCD and 3 TRN DocumentReferences.",
"entry": [
{
"resource": {
"resourceType": "DocumentReference",
"id": "2bc12383-6c34-5893-9228-65b1f38619c7",
"status": "current",
"subject": {
"display": "PDRTEST-NP2-BRONX-QA02",
"reference": "Patient/d85a7ba7-a6ec-5cd6-a7ee-61ed478a32d5"
},
"type": {
"coding": [
{
"code": "MDM_T02",
"display": "MDM_T02",
"system": "http://healtheconnections.org/fhir/CodeSystem/document-type"
},
{
"code": "TRN",
"display": "TRN",
"system": "http://healtheconnections.org/fhir/CodeSystem/input-document-type"
}
],
"text": "MDM^T02"
},
"content": [
{
"attachment": {
"title": "MDM^T02",
"url": "s3://nyec-pdr-qa-bronx/IFH/trn/2026/Nov/19/16/bronx_IFH_f36038d07e22ab1984a7c69c84d792ced830ca0813002982d564f008ad221df9_PDRTEST-NP2-BRONX-QA02-TRN-03-R1.hl7"
}
}
]
}
},
{
"resource": {
"resourceType": "DocumentReference",
"id": "126b0923-5065-54a9-863d-43d005b9b7ad",
"status": "current",
"subject": {
"display": "PDRTEST-NP2-BRONX-QA02",
"reference": "Patient/d85a7ba7-a6ec-5cd6-a7ee-61ed478a32d5"
},
"type": {
"coding": [
{
"code": "34133-9",
"display": "34133-9",
"system": "http://healtheconnections.org/fhir/CodeSystem/document-type"
},
{
"code": "CCD",
"display": "CCD",
"system": "http://healtheconnections.org/fhir/CodeSystem/input-document-type"
}
],
"text": "Summarization of Episode Note"
},
"content": [
{
"attachment": {
"title": "Summarization of Episode Note",
"url": "s3://nyec-pdr-qa-bronx/IFH/ccd/2026/Nov/19/16/bronx_IFH_f36038d07e22ab1984a7c69c84d792ced830ca0813002982d564f008ad221df9_2.16.840.1.113883.3.9999.9000.90d8343f-c210-55bf-9865-8c60c70e5cd9.xml"
}
}
]
}
}
]
}
},
{
"aliasIndex": 1,
"patientReference": "Patient/d85a7ba7-a6ec-5cd6-a7ee-61ed478a32d5",
"bundle": {
"resourceType": "Bundle",
"type": "searchset",
"total": 6,
"note": "The QA run returned the same documents through this matched alias."
}
}
]
}
Review the DocumentReferences
Each available clinical document is a FHIR DocumentReference inside the returned Bundle. Its content[].attachment.url is the value you pass to Retrieve.
{
"resourceType": "DocumentReference",
"id": "126b0923-5065-54a9-863d-43d005b9b7ad",
"status": "current",
"subject": {
"display": "PDRTEST-NP2-BRONX-QA02",
"reference": "Patient/d85a7ba7-a6ec-5cd6-a7ee-61ed478a32d5"
},
"type": {
"coding": [
{
"code": "34133-9",
"display": "34133-9",
"system": "http://healtheconnections.org/fhir/CodeSystem/document-type"
},
{
"code": "CCD",
"display": "CCD",
"system": "http://healtheconnections.org/fhir/CodeSystem/input-document-type"
}
],
"text": "Summarization of Episode Note"
},
"content": [
{
"attachment": {
"title": "Summarization of Episode Note",
"url": "s3://nyec-pdr-qa-bronx/IFH/ccd/2026/Nov/19/16/bronx_IFH_f36038d07e22ab1984a7c69c84d792ced830ca0813002982d564f008ad221df9_2.16.840.1.113883.3.9999.9000.90d8343f-c210-55bf-9865-8c60c70e5cd9.xml"
}
}
]
}
Use this value as documentUri on Retrieve:
s3://nyec-pdr-qa-bronx/IFH/ccd/2026/Nov/19/16/bronx_IFH_f36038d07e22ab1984a7c69c84d792ced830ca0813002982d564f008ad221df9_2.16.840.1.113883.3.9999.9000.90d8343f-c210-55bf-9865-8c60c70e5cd9.xml
Retrieve a document
Pass the document URI returned by Query back to the Gateway as documentUri. The response body is the underlying clinical document payload.
DocumentReference → attachment.url → documentUri → POST /api/v1/documents/retrieve → clinical payload
Synthetic request derived from the Query above (a QA run, 2026-11-20):
{
"qe": "BRONX",
"documentUri": "s3://nyec-pdr-qa-bronx/IFH/trn/2026/Nov/19/16/bronx_IFH_f36038d07e22ab1984a7c69c84d792ced830ca0813002982d564f008ad221df9_PDRTEST-NP2-BRONX-QA02-TRN-03-R1.hl7"
}
Before retrieving, network allowlisting and certificate trust must be complete, and you need the Client ID, Okta audience and issuer URLs, and JWK from onboarding.
Process the payload
The consuming application processes or persists the document according to its type.
| Type | Format |
|---|---|
| CCD | XML / C-CDA |
| Lab | HL7 v2 |
| Rad | HL7 v2 |
| TRN | HL7 v2 |
See Matching & Part 2 for alias rows and sensitivity labels.