# Import a health record

Operation ID: `patient.importHealthRecord`

Import a FHIR resource/Bundle (JSON body) or a C-CDA document (XML body, detected via the `Content-Type` header) into the authenticated patient's record. Requires a patient Bearer JWT.

## Public method

`importCCDA`

Signature: `patient.importCCDA(content)`

Return type: `Promise<JsonValue>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /patients/health-record/import`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "entry": [],
  "resourceType": "Bundle"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`ImportHealthRecordResponse`](../models/ImportHealthRecordResponse.md) | application/json | FHIR or C-CDA import result |

## Success response examples

### 200

```json
{
  "errors": [],
  "failed": 0,
  "imported": 0,
  "resource_ids": [
    "resource-example-001"
  ]
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The FHIR resource/Bundle or C-CDA document failed to parse or import |
| `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 document could not be imported

```json
{
  "error": "Invalid FHIR resource"
}
```

### 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 content = "<CONTENT>";

const result = await patient.importCCDA(content);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"entry":[],"resourceType":"Bundle"}' \
  'https://dev-api-patient.health.cloud/patients/health-record/import'
```

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