# Add a dependent

Operation ID: `patient.addDependent`

Create a FHIR RelatedPerson dependent (e.g. spouse, child) linked to the authenticated patient. Requires a patient Bearer JWT.

## Public method

`saveDependent`

Signature: `patient.saveDependent(data, dependentId)`

Return type: `Promise<JsonValue>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /patients/dependents`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "dob": "2015-04-02",
  "first_name": "Jamie",
  "last_name": "Example",
  "relationship": "Child"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `201` | [`AddDependentResponse`](../models/AddDependentResponse.md) | application/json | Dependent created |

## Success response examples

### 201

```json
{
  "dob": "2015-04-02",
  "first_name": "Jamie",
  "id": "dependent-example-001",
  "last_name": "Example",
  "relationship": "Child"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The request body failed schema validation |
| `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 — The request body failed validation

```json
{
  "details": [
    {
      "loc": [
        "first_name"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": "Invalid request body"
}
```

### 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";
```

```ts
const data = "<DATA>";

const dependentId = "2026-08-15T09:00:00Z";

const result = await patient.saveDependent(data, dependentId);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"dob":"2015-04-02","first_name":"Jamie","last_name":"Example","relationship":"Child"}' \
  'https://dev-api-patient.health.cloud/patients/dependents'
```

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