Request patient documents from TEFCA-CommonWell

Last updated: Jun 18, 2025
DEVELOPER
IMPLEMENTATION

After you successfully search and locate patient records at a given organization, you can request patient documents.

You can do this by retrieving a document list, then picking specific documents of interest, either within your own UI or Redox-parsed format.

The returned documents follow a standard format (Consolidated-Clinical Document Architecture, or C-CDA) and include several sections of information related to the patient’s demographics, encounters, medications, diagnoses, allergies, and more. Check out required C-CDA elements.

Request patient docs

To begin, refer to the results from your PatientSearch.LocationQuery. Use ClinicalSummary.DocumentQuery to query TEFCA-CommonWell with the ID and IDType from your patient search response. The response returns a list of PDFs or any other documents that are attached to the patient record.

Then, use ClinicalSummary.DocumentGet to query for any document from the list. You receive the document in both raw XML—which is useful if you have your own document renderer—and in a Redox-parsed view for any data that we can parse.

  1. Using Postman or curl, send ClinicalSummary.DocumentQuery with the relevant metadata:
    • Patient ID and ID type: These values are returned in the PatientSearch.LocationQuery response.
    • Organization OID: The organization OID (from the LocationQuery response) should go in the Meta.FacilityCode field of your request.
      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
      // The OID represents the organization sending the query. Use the OID that corresponds to your CommonWell configuration.
      11
      "string": "{{organization_oid}}"
      12
      },
      13
      "user-id": {
      14
      "url": "https://api.redoxengine.com/extensions/user-id",
      15
      // The user ID should be human-readable (typically name, not an ID) and change per query based on the initiating user.
      16
      "string": "{{user-name}}"
      17
      },
      18
      "user-role": {
      19
      "url": "https://api.redoxengine.com/extensions/user-role",
      20
      // Defines the role of the user identified above. This must be a SNOMED CT code.
      21
      "coding": {
      22
      "code": "{{user_role}}",
      23
      // This is set for the default code (112247003), but change this if you have a different code.
      24
      "display": "Medical Doctor"
      25
      }
      26
      },
      27
      "purpose-of-use": {
      28
      "url": "https://api.redoxengine.com/extensions/purpose-of-use",
      29
      // Identifies the purpose of the TEFCA query, which is almost always TREATMENT.
      30
      "coding": {
      31
      "code": "TREATMENT",
      32
      "display": "Treatment"
      33
      }
      34
      }
      35
      },
      36
      "DataModel": "Clinical Summary",
      37
      "EventType": "DocumentQuery",
      38
      # Remove in production
      39
      "Test": true,
      40
      "Destinations": [
      41
      {
      42
      // This is a standard Redox value that varies between environments. Refer to the destination IDs "Search for patient records" article.
      43
      "ID": "{{destination-id-for-environment}}"
      44
      }
      45
      ],
      46
      // Enter the OID of the organization you want to search.
      47
      // We use Redox for the example below.
      48
      // This should be the organization OID from the organization response in the LocationQueryResponse.
      49
      "FacilityCode": "2.16.840.1.113883.3.6147.458.2"
      50
      },
      51
      "Patient": {
      52
      "Identifiers": [
      53
      {
      54
      // Similar to "FacilityCode" this should come from the LocationQueryResponse search.
      55
      "ID": "{{PatientID}}",
      56
      "IDType": "{{PatientIDType}}"
      57
      }
      58
      ]
      59
      }
      60
      }
  2. If the request is successful, you receive a synchronous ClinicalSummary.DocumentQueryResponse with a document list with an identifier, type, and date for each document so that you can identify the most relevant documents.
    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
    }
  3. Using Postman or curl, send ClinicalSummary.DocumentGet with the relevant metadata, like the document ID and type (from the response in the previous steps) and the organization OID (which goes in the Meta.FacilityCode field).
    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
    // This is the OID that represents you as an organization. If you have multiple levels, it helps to be specific, but you can also use your top-level.
    11
    "string": "{{organization_oid}}"
    12
    },
    13
    "user-id": {
    14
    "url": "https://api.redoxengine.com/extensions/user-id",
    15
    // This should change per request and should be a human-readable ID for the user (typically name, not an actual ID).
    16
    "string": "{{user_human_readable_id}}"
    17
    },
    18
    "user-role": {
    19
    "url": "https://api.redoxengine.com/extensions/user-role",
    20
    // This is a SNOMED CT code that relates to the user above. See https://www.hl7.org/fhir/valueset-practitioner-role.html.
    21
    "coding": {
    22
    "code": "{{user_role}}",
    23
    // This is set for the default code (112247003), but this should change if you have a different code.
    24
    "display": "Medical Doctor"
    25
    }
    26
    },
    27
    "purpose-of-use": {
    28
    "url": "https://api.redoxengine.com/extensions/purpose-of-use",
    29
    // Identifies the purpose of the query, which is almost always TREATMENT. If another purpose of use, participants likely won't respond.
    30
    "coding": {
    31
    "code": "TREATMENT",
    32
    "display": "Treatment"
    33
    }
    34
    }
    35
    },
    36
    "DataModel": "Clinical Summary",
    37
    "EventType": "DocumentGet",
    38
    "EventDateTime": "2019-08-02T20:09:22.089Z",
    39
    "Test": true,
    40
    "Destinations": [
    41
    {
    42
    // This is a standard Redox value that varies between environments. Refer to the destination IDs in the "Search for patient records" article.
    43
    "ID": "{{destination-id-for-environment}}"
    44
    }
    45
    ],
    46
    // Enter the OID of the Carequality organization you want to search. We use Redox in the example below.
    47
    // Use the Organization OID-type ID from the location response.
    48
    "FacilityCode": "2.16.840.1.113883.3.6147.458.2"
    49
    },
    50
    "Document": {
    51
    // Use the value from the previous document query response.
    52
    "ID": "{{document-id}}"
    53
    }
    54
    }
  4. If the request is successful, you receive a synchronous ClinicalSummary.DocumentGetResponse with the relevant document of interest.
    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": "",
    85
    "FileType": "text/xml",
    86
    ...
    87
    }

Next steps