# Update person attributes

Operation ID: `person.updatePersonAttributes`

Merge JSON-compatible keys from the request into the Person's existing attributes dictionary and return the complete merged dictionary. Existing keys not present in the request are retained; attributes are scoped to the caller's tenant.

## Public method

`updateAttributes`

Signature: `person.updateAttributes(fhirPersonId, request)`

Return type: `Promise<PersonAttributes>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`PATCH /persons/{person_id}/attributes`

## Path parameters

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

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "care_preferences": {
    "allow_sms": false,
    "preferred_contact_method": "email"
  }
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`UpdatePersonAttributesResponse`](../models/UpdatePersonAttributesResponse.md) | application/json | Complete person attributes dictionary after merge |

## Success response examples

### 200

```json
{}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | The attributes body is not JSON-compatible or the update failed |
| `401` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `404` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | No Person resource exists for person_id in the caller's tenant |

## Error examples

### 400 — The attributes payload could not be stored

```json
{
  "error": "Bad Request"
}
```

### 401 — Missing or invalid access token

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

### 404 — No Person resource matches person_id

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

## NodeJS / TypeScript implementation

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

```ts
const fhirPersonId = "<FHIR_PERSON_ID>";

const request = {
  "care_preferences": {
    "allow_sms": false,
    "preferred_contact_method": "email"
  }
};

const result = await person.updateAttributes(fhirPersonId, request);
```

## cURL

```bash
curl -X PATCH \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"care_preferences":{"allow_sms":false,"preferred_contact_method":"email"}}' \
  'https://dev-api-person.health.cloud/persons/%3CPERSON_ID%3E/attributes'
```

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