# Search providers

Operation ID: `graph.searchProviders`

Search the Providers index by free-text phrase, specialty code, and/or state. When rag=true in the request body, runs retrieval-augmented generation instead of returning the raw result set — the response becomes a grounded natural-language answer with citations rather than a list of provider records.

## Public method

`searchProviders`

Signature: `graph.searchProviders(request)`

Return type: `Promise<ProviderSearchResponse | GraphRagResponse<ProviderRagCitation>>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /graph/providers/search`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "limit": 5,
  "offset": 0,
  "phrase": "cardiology",
  "rag": false,
  "specialty_code": "207RC0000X",
  "state_code": "CA"
}
```

## Success responses

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

## Success response examples

### 200

```json
{
  "providers": [
    {
      "city": "Los Angeles",
      "name": "Dr. Alex Smith",
      "npi": "1234567893",
      "phone": "+15550100000",
      "score": 0.99,
      "specialty": "Cardiovascular Disease",
      "specialty_code": "207RC0000X",
      "state": "CA"
    }
  ],
  "request": {
    "limit": 5,
    "offset": 0,
    "phrase": "cardiology",
    "rag": false,
    "specialty_code": "207RC0000X",
    "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 { ProviderSearchRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "limit": 5,
  "offset": 0,
  "phrase": "cardiology",
  "rag": false,
  "specialty_code": "207RC0000X",
  "state_code": "CA"
};

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

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"limit":5,"offset":0,"phrase":"cardiology","rag":false,"specialty_code":"207RC0000X","state_code":"CA"}' \
  'https://dev-api-graph.health.cloud/graph/providers/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.
