# Get a person photo

Operation ID: `person.getPhoto`

Retrieve a person's photo as a FHIR Binary resource. If ?binary_id= is omitted, it is auto-resolved from the person's stored photo_binary_id extension, then from a Binary search by security context — either resolution fails with 400 if the person has never uploaded a photo via person.uploadPhoto.

## Public method

`getPhoto`

Signature: `person.getPhoto(fhirPersonId, query)`

Return type: `Promise<Record<string, unknown>>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /persons/{person_id}/photo`

## Path parameters

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

## Query parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `binary_id` | `string` | Yes |  |  |  | No | binary_id returned by upload_person_photo |

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`person.GetPhotoResponse`](../models/person.GetPhotoResponse.md) | application/json | Person photo |

## Success response examples

### 200

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

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | No binary_id was supplied and none could be auto-resolved |
| `401` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `404` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | No FHIR Binary exists for the resolved binary_id |
| `500` | [`person.ErrorResponse`](../models/person.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 400 — The person has no stored photo and no binary_id was supplied

```json
{
  "error": "Missing query parameter: binary_id"
}
```

### 401 — Missing or invalid access token

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

### 404 — The FHIR Binary resource does not exist

```json
{
  "error": "Photo not found"
}
```

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

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

## NodeJS / TypeScript implementation

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

```ts
const fhirPersonId = "<FHIR_PERSON_ID>";

const query = {
  "binary_id": "<BINARY_ID>"
};

const result = await person.getPhoto(fhirPersonId, query);
```

## cURL

```bash
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  'https://dev-api-person.health.cloud/persons/%3CPERSON_ID%3E/photo?binary_id=%3CBINARY_ID%3E'
```

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