> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metriport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Documents

> Lists all Documents that can be retrieved for a Patient.

This endpoint returns the document references available at Metriport which are associated with the
given Patient and match the provided filters, if any.

To start a new Network Query, see the [Start Network Query endpoint](/medical-api/api-reference/network/start-network-query).

## Query Params

<ParamField query="patientId" type="string" required>
  The ID of the Patient for which to list available Documents.
</ParamField>

<ParamField query="dateFrom" type="string" optional>
  The start date (inclusive) for which to filter document references - formatted `YYYY-MM-DD` as per
  ISO 8601. If not provided, no start date filter will be applied.
</ParamField>

<ParamField query="dateTo" type="string" optional>
  The end date (inclusive) for which to filter document references - formatted `YYYY-MM-DD` as per
  ISO 8601. If not provided, no end date filter will be applied.
</ParamField>

<ParamField query="count" type="number" optional>
  The maximum number of `DocumentReference`s to return after search filters are applied. If not provided, no limit is applied.
</ParamField>

<ParamField query="content" type="string" optional>
  Value to search within the document reference and the actual contents of the document (minimum 3 chars). For more details see the "search syntax" section
  below.

  <Expandable title="Search syntax">
    * search terms are separated by spaces;
    * star (`*`) allows to search using “contains” (`pat*` will return docs with `patient` and `paternity`);
    * double quotes (`"`) group words into a single term (to add double quotes as part of the content, escape
      them with \ like so: " );
    * to exclude a term, add the minus sign (`-`) in front of it (`fox -brown` will return docs with `fox` but
      without `brown` on it);
    * to require a term, add the plus sign (`+`) in front of it (`fox +brown` will docs with `fox` and `brown`
      but also those with `brown` but no `fox`);
    * by default terms are considered as either (or);
    * to make terms to require all entries (and), append the plus sign (`+`) in front of every term.

    Example search:
    `quick brown +fox -news "jumps over"`

    * `fox` must be present
    * `news` must not be present
    * `quick`, `brown`, and `jumps over` are optional
    * won't return documents with only `jumps` or `over`, unless they are grouped together as `jumps over`
  </Expandable>
</ParamField>

## Response

An array of the [DocumentReference](/medical-api/fhir/resources/documentreference) available for the
Patient matching the provided filters, if any.

<ResponseField name="documents" type="DocumentReference[]" required>
  See FHIR [DocumentReference](/medical-api/fhir/resources/documentreference).
</ResponseField>

```json theme={null}
{
  "documents": [
    {
      "resourceType": "DocumentReference",
      "id": "018a875a-3181-74e8-8aa4-40c59ed7e1b2",
      "meta": {
        "lastUpdated": "2025-04-17T18:09:29.947Z",
        "source": "01964571-db3c-7953-9987-fe7b62cc278c/01964571-db3c-7953-9987-fe7cb3d109e4/01964571-db3c-7953-9987-fe7b62cc278c_01964571-db3c-7953-9987-fe7cb3d109e4_018a875a-3181-74e8-8aa4-40c59ed7e1b2.xml"
      },
      "contained": [
        {
          "resourceType": "Organization",
          "id": "org522",
          "name": "Hospital 522"
        },
        {
          "resourceType": "Practitioner",
          "id": "auth925",
          "name": [
            {
              "text": "John Snow",
              "family": "Snow",
              "given": ["John"]
            }
          ]
        }
      ],
      "extension": [
        {
          "url": "https://public.metriport.com/fhir/StructureDefinition/data-source.json",
          "valueCoding": {
            "system": "https://public.metriport.com/fhir/StructureDefinition/data-source.json",
            "code": "METRIPORT"
          }
        }
      ],
      "masterIdentifier": {
        "system": "urn:ietf:rfc:3986",
        "value": "018a875a-3181-74e8-8aa4-40c59ed7e1b2"
      },
      "identifier": [
        {
          "use": "official",
          "system": "urn:ietf:rfc:3986",
          "value": "018a875a-3181-74e8-8aa4-40c59ed7e1b2"
        }
      ],
      "status": "current",
      "type": {
        "coding": [
          {
            "system": "http://loinc.org/",
            "code": "34133-9",
            "display": "Summarization of episode note"
          }
        ]
      },
      "subject": {
        "reference": "Patient/018a5164-c0ac-79e2-99cc-9cf951c26d94",
        "type": "Patient"
      },
      "date": "2023-08-15T03:05:58.090Z",
      "author": [
        {
          "reference": "#org522",
          "type": "Organization"
        }
      ],
      "description": "C-CDA R2.1 Patient Record",
      "content": [
        {
          "extension": [
            {
              "url": "https://public.metriport.com/fhir/StructureDefinition/data-source.json",
              "valueCoding": {
                "system": "https://public.metriport.com/fhir/StructureDefinition/data-source.json",
                "code": "METRIPORT"
              }
            }
          ],
          "attachment": {
            "contentType": "application/pdf",
            "url": "http://api.metriport.com/doc-contribution/commonwell/?fileName=965f9957-34ac-442b-9a17-fa09c76c16da/018a5164-c0ac-79e2-99cc-9cf951c26d94/965f9957-34ac-442b-9a17-fa09c76c16da_018a5164-c0ac-79e2-99cc-9cf951c26d94_018a875a-3181-74e8-8aa4-40c59ed7e1b2",
            "size": 1080416,
            "title": "965f9957-34ac-442b-9a17-fa09c76c16da/018a5164-c0ac-79e2-99cc-9cf951c26d94/965f9957-34ac-442b-9a17-fa09c76c16da_018a5164-c0ac-79e2-99cc-9cf951c26d94_018a875a-3181-74e8-8aa4-40c59ed7e1b2",
            "creation": "2023-08-14T22:05:58-05:00"
          },
          "format": {
            "code": "urn:ihe:pcc:xphr:2007"
          }
        }
      ],
      "context": {
        "period": {
          "start": "2023-08-15T02:05:58.090Z",
          "end": "2023-08-15T03:05:58.090Z"
        },
        "sourcePatientInfo": {
          "reference": "Patient/018a5164-c0ac-79e2-99cc-9cf951c26d94",
          "type": "Patient"
        }
      }
    }
  ]
}
```

<ResponseExample>
  ```javascript Metriport SDK theme={null}
  import { MetriportMedicalApi } from "@metriport/api-sdk";

  const metriport = new MetriportMedicalApi("YOUR_API_KEY");

  const { documents } = await metriport.listDocuments(
    "018a80c4-292a-7486-a1234-76yuhe23yu14",
    {
      dateFrom: "2023-08-01",
      dateTo: "2023-08-31",
      content: "john",
      count: 50,
    }
  );
  ```
</ResponseExample>
