Request patient documents from TEFCA-CommonWell

Last updated: Jun 9, 2026
DEVELOPER
IMPLEMENTATION
Who can use this how-to
  • Existing customers using Network Onramps to connect to TEFCA via CommonWell

To request documents from TEFCA-CommonWell, you use a two-step workflow:

  1. Request a list of relevant document IDs.
  2. Retrieve a specific document from the list. You cannot retrieve a document without first knowing its ID from step 1.

Prerequisites

  • You must use the patient ID and ID type from your own system (i.e., the MR or internal patient ID) to request documents. Don't use the PIAA OID or other TEFCA-CommonWell assigned identifiers, since those are used for matching only, not for document retrieval.
  • (Optional) Test sending these requests with our TEFCA-CommonWell sandbox. Learn about our TEFCA-CommonWell sandbox.
    Use curl for technical validation

    You can copy our code examples and send the test requests with curl (learn more about curl) instead of Postman. If you do, remember to:

    • Remove any comments from the code examples (starting with //).
    • Replace any variables (e.g., {{YOUR-VARIABLE}}).
    • Add the source-id if you have multiple sources. We don’t include {{source-id}} in the code examples, so you’ll have to add them yourself. Learn about including source details.
    • Make sure you have a full request for your own use since some of the code examples are abbreviated.

    Check out these troubleshooting guides if you run into errors:

  • Be familiar with the following terms and concepts to send your queries to TEFCA-CommonWell:

Step 1: Request a list of document IDs

Send ClinicalSummary.DocumentQuery to query TEFCA-CommonWell for a list of document IDs related to a specific patient.

  • The Meta.Destination.ID changes based on environment type:
    • Development destination ID: cf1dca0e-98de-432b-8c9a-dd039816df0e
    • Production destination ID: 79981c00-b9c4-40a9-9844-01980e6e524e
  • For production queries, set the Test value to false.
  • For Patient.Identifiers.ID and Patient.Identifiers.IDType, use the patient values within your own organization, or use the ones in the response from a patient search.
  • Enter one of the following options for the Meta.FacilityCode depending on the result you want (we use Redox for the example below):
    • Option 1: Broach search. To return a list of document IDs from all external organizations where the patient is known, either enter your own OID or set it to null. This initiates a fan-out query to the clinical network.
      When using your own OID

      You never get documents from your own organization if you use your own OID, since TEFCA-CommonWell assumes you already have your own patient documents.

    • Option 2: Narrow search. To return a list of document IDs from one site, enter the specific OID. This comes in the response from a patient search.
  • Review the Clinical Summary data model schema for full requirements.
Which documents to request

It’s possible to get lots of documents that may or may not be useful to you. We recommend requesting the patient’s most recent CCD (i.e., LOINC 34133-9) and progress notes (LOINC 11506-3) from the last three months.

Be aware that responders may have different names for progress notes, like “telephone,” “office visit,” or “emergency.” You can find the document’s LOINC value in the Documents[].Type.Code for each document returned in the ClinicalSummary.documentQueryResponse.

Example: Search for a document list from TEFCA-CommonWell
bash
1
curl \
2
-X POST https://api.redoxengine.com/endpoint \
3
-H "Content-Type: application/json" \
4
-H "Authorization: Bearer $API_TOKEN" \
5
-d '{
6
"Meta": {
7
"Extensions": {
8
"sender-organization-id": {
9
"url": "https://api.redoxengine.com/extensions/sender-organization-id",
10
"string": "{{ORGANIZATION-OID}}"
11
},
12
"user-id": {
13
"url": "https://api.redoxengine.com/extensions/user-id",
14
"string": "{{SENDING-USER-NAME}}"
15
},
16
"user-role": {
17
"url": "https://api.redoxengine.com/extensions/user-role",
18
"coding": {
19
"code": "112247003",
20
"display": "Medical Doctor"
21
}
22
},
23
"purpose-of-use": {
24
"url": "https://api.redoxengine.com/extensions/purpose-of-use",
25
"coding": {
26
"code": "TREATMENT",
27
"display": "Treatment"
28
}
29
}
30
},
31
"DataModel": "Clinical Summary",
32
"EventType": "DocumentQuery",
33
"Test": true,
34
"Destinations": [
35
{
36
"ID": "cf1dca0e-98de-432b-8c9a-dd039816df0e"
37
}
38
],
39
"FacilityCode": "2.16.840.1.113883.3.6147.458.2"
40
},
41
"Patient": {
42
"Identifiers": [
43
{
44
"ID": "{{PATIENT-ID-FROM-LOCATION-SEARCH}}",
45
"IDType": "{{PATIENT-ID-TYPE-FROM-LOCATION-SEARCH}}"
46
}
47
]
48
}
49
}

If successful, you receive ClinicalSummary.DocumentQueryResponse with a list of document IDs related to the patient record. The included document metadata helps you identify the most relevant documents.

Results from external organizations

The results in the DocumentQueryResponse are from external organizations, not your own data on demand repository. The returned document IDs correspond to patient IDs and ID types from external organizations. This means they won’t necessarily match your own patient ID type from the query.

In other words, CommonWell assumes that you’re querying any external organization for your own patients. You might see a list of results from different organizations, not necessarily including the organization(s) listed in the LocationQueryResponse.

Example: Successful response for a document list from TEFCA-CommonWell
json
1
{
2
"Patient": {
3
"Identifiers": [
4
{
5
"ID": "sandbox-tester-on-sandbox-system-456",
6
"IDType": "2.16.840.1.113883.3.6147.450.0.2.19260.0.2"
7
},
8
{
9
"ID": "101-01-0001",
10
"IDType": "SSN"
11
}
12
]
13
},
14
"Documents": [
15
{
16
"ID": "056a016c-1acf-48cb-a331-40e4ee2aade8",
17
"Visit": {
18
"ID": "30311442",
19
"StartDateTime": "2025-05-02T19:36:34.787Z",
20
"EndDateTime": "2025-05-02T19:36:34.787Z"
21
},
22
"DateTime": "2025-05-08T20:10:11.570Z",
23
"FileType": "text/xml",
24
"Location": {
25
"Department": "Vista Oaks Clinic",
26
"Type": "Outpatient Clinic",
27
"Facility": "RHS Vista Oaks Clinic"
28
}
29
}
30
],
31
"Meta": {
32
"DataModel": "Clinical Summary",
33
"EventType": "DocumentQuery",
34
"Message": {
35
"ID": 69912737500
36
},
37
"Source": {
38
"ID": "4c2216a9-cf64-4c14-b817-9cdb2e855bad",
39
"Name": "CommonWell Incoming"
40
},
41
"Destinations": [
42
{
43
"ID": "5aa140d8-79e5-46c5-870f-d0369a344b01",
44
"Name": "CommonWell Sandbox [Integration]"
45
}
46
],
47
"Logs": [
48
{
49
"ID": "0196ef6d-addc-76d9-8d16-fb9a6fd60c2c",
50
"AttemptID": "0196ef6d-addc-7c5a-bc4e-d38774471a6c"
51
}
52
]
53
}
54
}

Step 2: Retrieve a specific document from the list

Send ClinicalSummary.DocumentGet to query for any document from the list. Enter the relevant metadata:

  • The Meta.Destination.ID changes based on environment type:
    • Development destination ID: cf1dca0e-98de-432b-8c9a-dd039816df0e
    • Production destination ID: 79981c00-b9c4-40a9-9844-01980e6e524e
  • For production queries, set the Test value to false.
  • For the Meta.FacilityCode, use the value from the previous step’s response. We use Redox in the example below.
  • For Document.ID, enter the value from the previous step’s response.
Less is more

Documents can only be retrieved one at a time. We recommend retrieving only the most relevant documents, not every document on the list.

Example: Retrieve a document from TEFCA-CommonWell
bash
1
curl \
2
-X POST https://api.redoxengine.com/endpoint \
3
-H "Content-Type: application/json" \
4
-H "Authorization: Bearer $API_TOKEN" \
5
-d '{
6
"Meta": {
7
"Extensions": {
8
"sender-organization-id": {
9
"url": "https://api.redoxengine.com/extensions/sender-organization-id",
10
"string": "{{ORGANIZATION-OID}}"
11
},
12
"user-id": {
13
"url": "https://api.redoxengine.com/extensions/user-id",
14
"string": "{{SENDING-USER-NAME}}"
15
},
16
"user-role": {
17
"url": "https://api.redoxengine.com/extensions/user-role",
18
"coding": {
19
"code": "112247003",
20
"display": "Medical Doctor"
21
}
22
},
23
"purpose-of-use": {
24
"url": "https://api.redoxengine.com/extensions/purpose-of-use",
25
"coding": {
26
"code": "TREATMENT",
27
"display": "Treatment"
28
}
29
}
30
},
31
"DataModel": "Clinical Summary",
32
"EventType": "DocumentGet",
33
"EventDateTime": "2019-08-02T20:09:22.089Z",
34
"Test": true,
35
"Destinations": [
36
{
37
"ID": "cf1dca0e-98de-432b-8c9a-dd039816df0e"
38
}
39
],
40
"FacilityCode": "2.16.840.1.113883.3.6147.458.2"
41
},
42
"Document": {
43
"ID": "{{DOCUMENT-ID-FROM-PREVIOUS-RESPONSE}}"
44
}
45
}

If successful, you receive ClinicalSummary.DocumentGetResponse with the relevant document of interest.

What format to expect

The response includes the raw content in the Data field and the type of content in FileType.

  • If the returned document follows a C-CDA format, you receive it in a Redox-parsed view matching the ClinicalSummary.VisitQueryResponse data model (see the response format). Check out required C-CDA elements. The FileType is always text/xml, and Data is UTF-8 text content.
  • If the returned document is a PDF or any other format, you receive it in raw XML, which can be useful if you have your own document renderer. The FileType is whatever the clinical network sends, and Data is always base64-encoded content. This is to support file types like application/pdf or XML content that isn’t CDA.

Different organizations may include varying amounts of information or specificity, or they may use different code sets to represent the data. We simply pass the data as we receive it from the responding organization.

Example (abbreviated): Successful document retrieval from TEFCA-CommonWell
json
1
"Meta": {
2
"DataModel": "Clinical Summary",
3
"EventType": "DocumentGet",
4
"Message": {
5
"ID": 12720346936
6
},
7
"Source": {
8
"ID": "4c2216a9-cf64-4c14-b817-9cdb2e855bad",
9
"Name": "CommonWell Incoming"
10
},
11
"Destinations": [
12
{
13
"ID": "5aa140d8-79e5-46c5-870f-d0369a344b01",
14
"Name": "CommonWell Sandbox [Integration]"
15
}
16
],
17
"Logs": [
18
{
19
"ID": "0196ef7b-696c-71a2-a4bc-91730fd33ab0",
20
"AttemptID": "0196ef7b-696c-7b82-81d8-cdba601ecc50"
21
}
22
]
23
},
24
"Header": {
25
"Document": {
26
"Title": "C-CDA R2.1 Patient Record: Adolfo Kessler",
27
"Visit": {
28
"Location": null,
29
"VisitNumber": "",
30
"EndDateTime": "",
31
"StartDateTime": ""
32
},
33
"Author": {
34
"Location": {
35
"Facility": "MADISON ANESTHESIOLOGY CONSULTANTS, LLP"
36
}
37
},
38
"ID": "2.16.840.1.113883.19.5^92cce54a-3a9f-634a-4d20-7e566ecc32ab",
39
"TypeCode": {
40
"AltCodes": [],
41
"CodeSystemName": "LOINC",
42
"CodeSystem": "2.16.840.1.113883.6.1",
43
"Name": "Summarization of episode note",
44
"Code": "34133-9"
45
},
46
"Type": "Summarization of episode note",
47
"DateTime": "2020-12-10T17:09:50.000Z",
48
"Locale": "US"
49
},
50
"Patient": {
51
"Demographics": {
52
"MaritalStatus": "",
53
"Religion": "",
54
"Ethnicity": "Not hispanic or latino",
55
"Race": "White",
56
"Address": {
57
"County": "",
58
"ZIP": "53711",
59
"Country": "",
60
"State": "Wisconsin",
61
"City": "Madison",
62
"StreetAddress": "602 Schiller Junction Suite 68"
63
},
64
"Sex": "Male",
65
"SSN": "",
66
"DOB": "2002-10-31T17:09:50.000Z",
67
"EmailAddresses": [],
68
"PhoneNumber": {
69
"Mobile": "",
70
"Office": "",
71
"Home": ""
72
},
73
"LastName": "Kessler",
74
"FirstName": "Adolfo"
75
},
76
"Identifiers": [
77
{
78
"IDType": "2.16.840.1.113883.19.5",
79
"ID": "j8p2NtTbAL7rTWRRhe7kSK"
80
}
81
]
82
}
83
},
84
"Data": "{{UTF-8 text content}}",
85
"FileType": "text/xml",
86
...
87
}

Next steps

FHIR® is a registered trademark of Health Level Seven International (HL7) and is used with the permission of HL7. Use of this trademark does not constitute an endorsement of products/services by HL7®.