# Update home address

Operation ID: `patient.updateAddress`

Replace the authenticated patient's FHIR address with a single `home` address built from the request body. Requires a patient Bearer JWT; the patient is always resolved from the token, never from client input.

## Public method

`updateAddress`

Signature: `patient.updateAddress(request)`

Return type: `Promise<UpdatedResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`PUT /patients/address`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "city": "Testville",
  "country": "US",
  "state": "CA",
  "street": "123 Example Street",
  "zip": "12345"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`UpdateAddressResponse`](../models/UpdateAddressResponse.md) | application/json | Address updated |

## Success response examples

### 200

```json
{
  "updated": true
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The address payload failed validation (street, city, state, and zip are required) |
| `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 — Required address fields are missing

```json
{
  "error": "street: is required"
}
```

### 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 { PatientAddressUpdateRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "city": "Testville",
  "country": "US",
  "state": "CA",
  "street": "123 Example Street",
  "zip": "12345"
};

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

## cURL

```bash
curl -X PUT \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"city":"Testville","country":"US","state":"CA","street":"123 Example Street","zip":"12345"}' \
  'https://dev-api-patient.health.cloud/patients/address'
```

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