# Search health plans

Operation ID: `graph.searchHealthPlans`

Search the Health Plans index by free-text phrase, network, and/or state. When rag=true in the request body, runs retrieval-augmented generation instead of returning the raw result set.

## Public method

`searchHealthPlans`

Signature: `graph.searchHealthPlans(request)`

Return type: `Promise<HealthPlanSearchResponse | GraphRagResponse<HealthPlanRagCitation>>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /graph/health-plans/search`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "limit": 5,
  "network_id": "network-example-001",
  "offset": 0,
  "phrase": "blue cross",
  "rag": false,
  "state_code": "CA"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`SearchHealthPlansResponse`](../models/SearchHealthPlansResponse.md) | application/json | Health-plan search or grounded RAG answer |

## Success response examples

### 200

```json
{
  "plans": [
    {
      "issuer": "Example Health Plan",
      "name": "Example Silver PPO",
      "network": "Example Preferred Network",
      "network_id": "network-example-001",
      "plan_id": "plan-example-001",
      "plan_type": "PPO",
      "score": 0.96,
      "state": "CA"
    }
  ],
  "request": {
    "limit": 5,
    "network_id": "network-example-001",
    "offset": 0,
    "phrase": "blue cross",
    "rag": false,
    "state_code": "CA"
  },
  "total": 1
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `401` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 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 { HealthPlanSearchRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "limit": 5,
  "network_id": "network-example-001",
  "offset": 0,
  "phrase": "blue cross",
  "rag": false,
  "state_code": "CA"
};

const result = await graph.searchHealthPlans(request);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"limit":5,"network_id":"network-example-001","offset":0,"phrase":"blue cross","rag":false,"state_code":"CA"}' \
  'https://dev-api-graph.health.cloud/graph/health-plans/search'
```

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