# Refresh patient access tokens

Operation ID: `patient.refreshToken`

Exchange a patient Cognito refresh token for new access/ID tokens. No Bearer JWT is required. tenant_id selects the tenant's patient pool; invalid tenants and invalid/expired refresh tokens intentionally return the same 401 response.

## Public method

`refreshToken`

Signature: `auth.refreshToken(request)`

Return type: `Promise<RefreshTokenResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`POST /auth/refresh`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "refresh_token": "example-refresh-token",
  "tenant_id": "tenant-example-001"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`patient.RefreshTokenResponse`](../models/patient.RefreshTokenResponse.md) | application/json | Refreshed patient tokens |

## Success response examples

### 200

```json
{
  "access_token": "example-access-token-refreshed",
  "expires_in": 3600,
  "id_token": "example-id-token-refreshed",
  "refresh_token": null,
  "token_type": "Bearer"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Bad request — tenant_id or refresh_token is missing |
| `401` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | The refresh token is invalid or expired |

## Error examples

### 400 — Required refresh fields are missing

```json
{
  "error": "tenant_id and refresh_token are required"
}
```

### 401 — Refresh failed

```json
{
  "error": "Invalid or expired refresh token"
}
```

## NodeJS / TypeScript implementation

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

```ts
const request = {
  "refresh_token": "example-refresh-token",
  "tenant_id": "tenant-example-001"
};

const result = await auth.refreshToken(request);
```

## cURL

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"refresh_token":"example-refresh-token","tenant_id":"tenant-example-001"}' \
  'https://dev-api-patient.health.cloud/auth/refresh'
```

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