# Search medical concepts (POST, legacy)

Operation ID: `graph.searchMedicalConcepts`

Search the unified Medical Concepts index (SNOMED CT, RxNorm, MeSH) by free-text phrase and vocabulary-aware facets. When rag=true in the request body, runs retrieval-augmented generation instead of returning the raw result set. Prefer graph.searchMedicalConceptsGet for query-string-based search — this POST form is kept for legacy callers.

## Public method

`searchMedicalConcepts`

Signature: `graph.searchMedicalConcepts(request)`

Return type: `Promise<MedicalConceptSearchResponse | GraphRagResponse<MedicalConceptRagCitation>>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /graph/medical-concepts/search`

## Path parameters

None.

## Query parameters

None.

## Body parameters

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

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

## Request example

```json
{
  "active": true,
  "code": "195967001",
  "limit": 10,
  "module_id": "900000000000207008",
  "offset": 0,
  "phrase": "asthma",
  "rag": false,
  "sctid": "195967001",
  "semantic_tag": "disorder",
  "top_category": null,
  "tty": null,
  "vocabulary": "SNOMED"
}
```

## Success responses

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

## Success response examples

### 200

```json
{
  "concepts": [
    {
      "active": true,
      "code": "99031000119107",
      "definition_status": "primitive",
      "effective_time": "2015-07-31",
      "fsn": "Acute exacerbation of asthma co-occurrent with allergic rhinitis (disorder)",
      "id": "SNOMED:99031000119107",
      "module_id": "900000000000207008",
      "preferred_term": "Acute exacerbation of asthma co-occurrent with allergic rhinitis",
      "score": 0.98,
      "sctid": "99031000119107",
      "semantic_tag": "disorder",
      "synonyms": [],
      "top_category": null,
      "tree_numbers": null,
      "tty": null,
      "vocabulary": "SNOMED"
    }
  ],
  "request": {
    "active": true,
    "code": "195967001",
    "limit": 10,
    "module_id": "900000000000207008",
    "offset": 0,
    "phrase": "asthma",
    "rag": false,
    "sctid": "195967001",
    "semantic_tag": "disorder",
    "top_category": null,
    "tty": null,
    "vocabulary": "SNOMED"
  },
  "total": 10
}
```

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

```ts
const request = {
  "active": true,
  "code": "195967001",
  "limit": 10,
  "module_id": "900000000000207008",
  "offset": 0,
  "phrase": "asthma",
  "rag": false,
  "sctid": "195967001",
  "semantic_tag": "disorder",
  "top_category": null,
  "tty": null,
  "vocabulary": "SNOMED"
};

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

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"active":true,"code":"195967001","limit":10,"module_id":"900000000000207008","offset":0,"phrase":"asthma","rag":false,"sctid":"195967001","semantic_tag":"disorder","top_category":null,"tty":null,"vocabulary":"SNOMED"}' \
  'https://dev-api-graph.health.cloud/graph/medical-concepts/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.
