# Update race

Operation ID: `patient.updateRace`

Replace the authenticated patient's FHIR US Core race extension with the supplied race codes. Requires a patient Bearer JWT; the patient is always resolved from the token, never from client input.

## Public method

`updateRace`

Signature: `patient.updateRace(request)`

Return type: `Promise<UpdatedResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`PUT /patients/race`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "races": [
    "unknown"
  ]
}
```

## Success responses

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

## Success response examples

### 200

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

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Bad request — races is missing/empty, or contains an unrecognized code |
| `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 — races array is required

```json
{
  "error": "races array 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 { PatientRaceUpdateRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "races": [
    "unknown"
  ]
};

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

## cURL

```bash
curl -X PUT \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"races":["unknown"]}' \
  'https://dev-api-patient.health.cloud/patients/race'
```

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