# Update patient flags

Operation ID: `patient.updatePatientFlags`

Partially update the authenticated patient's boolean flags dictionary. Performs a merge, not a replace: only the flag names present in the request body are changed, every other existing flag is preserved unchanged, and the complete updated flags dictionary is returned. Setting the same value again is idempotent. Every value must be a boolean. Requires a patient Bearer JWT; the patient is always resolved from the token, never from client input.

## Public method

`updateFlags`

Signature: `patient.updateFlags(request)`

Return type: `Promise<PatientFlags>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`PATCH /patients/flags`

## Path parameters

None.

## Query parameters

None.

## Body parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `body` | [`UpdatePatientFlagsRequest`](../models/UpdatePatientFlagsRequest.md) | No |  |  |  | No |  |

Request model: [`UpdatePatientFlagsRequest`](../models/UpdatePatientFlagsRequest.md)

## Request example

```json
{
  "imported_vitals": true,
  "onboarding_completed": true
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`UpdatePatientFlagsResponse`](../models/UpdatePatientFlagsResponse.md) | application/json | Complete patient flags dictionary after merge |

## Success response examples

### 200

```json
{
  "imported_vitals": true,
  "onboarding_completed": true
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The request body failed flags validation (e.g. a non-boolean value) |
| `401` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Authorization required — missing, invalid, expired, or non-patient Bearer JWT |
| `404` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The authenticated patient has no FHIR Patient record |

## Error examples

### 400 — A flag value was not a boolean

```json
{
  "error": "imported_vitals: flag value must be a boolean"
}
```

### 401 — Missing or invalid access token

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

### 404 — Patient not found

```json
{
  "error": "Patient not found"
}
```

## NodeJS / TypeScript implementation

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

```ts
const request = {
  "imported_vitals": true,
  "onboarding_completed": true
};

const result = await patient.updateFlags(request);
```

## cURL

```bash
curl -X PATCH \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"imported_vitals":true,"onboarding_completed":true}' \
  'https://dev-api-patient.health.cloud/patients/flags'
```

## 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.
