# Upload a practitioner photo

Operation ID: `provider.uploadPhoto`

Store a base64-encoded photo as a FHIR Binary resource for the practitioner, and stamp a photo_binary_id extension on their Practitioner resource so provider.getPhoto can find it without a binary_id. Independent of provider.getPhotoUploadUrl's presigned-URL flow.

## Public method

`uploadPhoto`

Signature: `provider.uploadPhoto(fhirPractitionerId, request)`

Return type: `Promise<UploadPractitionerPhotoResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /practitioners/{practitioner_id}/photo`

## Path parameters

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

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "content_type": "image/jpeg",
  "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",
  "photo": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `201` | [`provider.UploadPhotoResponse`](../models/provider.UploadPhotoResponse.md) | application/json | Provider photo stored |

## Success response examples

### 201

```json
{
  "binary_id": "photo-example-001",
  "content_type": "image/jpeg"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | The base64 photo data was not supplied |
| `401` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 400 — Required body field is missing

```json
{
  "error": "Missing photo data (base64)"
}
```

### 401 — Missing or invalid access token

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

### 500 — Unexpected service failure (sanitized example)

```json
{
  "error": "Internal server error"
}
```

## NodeJS / TypeScript implementation

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

```ts
const fhirPractitionerId = "<FHIR_PRACTITIONER_ID>";

const request = {
  "content_type": "image/jpeg",
  "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",
  "photo": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
};

const result = await provider.uploadPhoto(fhirPractitionerId, request);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"content_type":"image/jpeg","data":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==","photo":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="}' \
  'https://dev-api-provider.health.cloud/practitioners/%3CPRACTITIONER_ID%3E/photo'
```

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