# List a patient's encounters

Operation ID: `ehr.listEncounters`

List FHIR Encounter resources for a patient, optionally filtered by ?status=.

## Public method

`listEncounters`

Signature: `ehr.listEncounters(patientId, status)`

Return type: `Promise<ListEncountersResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /patients/{patient_id}/encounters`

## Path parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `patient_id` | `string` | Yes |  |  |  | No |  |

## Query parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `status` | `string` | No |  | planned, in-progress, finished, cancelled |  | No |  |

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`ehr.ListEncountersResponse`](../models/ehr.ListEncountersResponse.md) | application/json | Patient encounters |

## Success response examples

### 200

```json
{
  "encounters": [
    {
      "appointment_id": "appointment-example-001",
      "created_by": "agent-example-001",
      "created_date": "2026-08-10T08:45:00Z",
      "diagnoses[]": {
        "condition_display": "Mild persistent asthma",
        "condition_id": "condition-example-001",
        "rank": 1,
        "use_code": "CC"
      },
      "encounter_class": "AMB",
      "encounter_id": "00000000-0000-4000-8000-000000000303",
      "fhir_id": "encounter-example-001",
      "hospitalization": {
        "admit_source_code": "emd",
        "destination_id": "location-example-002",
        "discharge_disposition": "home",
        "origin_id": "location-example-001",
        "pre_admission_id": "encounter-example-000",
        "re_admission_code": "R"
      },
      "length_minutes": 30,
      "locations[]": {
        "location_display": "Community Clinic Room 2",
        "location_id": "location-example-001",
        "period_end": "2026-08-10T09:30:00Z",
        "period_start": "2026-08-10T09:00:00Z",
        "status": "completed"
      },
      "participants[]": {
        "participant_type": "PPRF",
        "period_end": "2026-08-10T09:30:00Z",
        "period_start": "2026-08-10T09:00:00Z",
        "practitioner_display": "Dr. Alex Smith",
        "practitioner_id": "provider-example-001"
      },
      "patient_id": "patient-example-001",
      "period_end": "2026-08-10T09:30:00Z",
      "period_start": "2026-08-10T09:00:00Z",
      "priority_code": "R",
      "priority_display": "Routine",
      "reason_code": "185389009",
      "reason_display": "Follow-up visit",
      "service_provider_display": "HealthCloud Community Care",
      "service_provider_id": "organization-example-001",
      "service_type_code": "394802001",
      "service_type_display": "General medicine",
      "status": "finished",
      "type_code": "185389009",
      "type_display": "Follow-up visit"
    }
  ],
  "patient_id": "patient-example-001",
  "total": 1
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `401` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | Internal server error |

## Error examples

### 401 — Missing or invalid access token

```json
{
  "error": "Authorization required"
}
```

### 500 — Unexpected service failure (sanitized example)

```json
{
  "error": "Internal server error"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
```

```ts
const patientId = "<PATIENT_ID>";

const status = "planned";

const result = await ehr.listEncounters(patientId, status);
```

## cURL

```bash
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  'https://dev-api-ehr.health.cloud/patients/%3CPATIENT_ID%3E/encounters?status=planned'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
