# Search codes and drugs by meaning

URL: https://docs.healthcare.dev/reference/search/search-codes-and-drugs-by-meaning

```http
GET https://api.healthcare.dev/v1/search
```

Finds codes and drugs from plain-language descriptions, even when the words differ from the official text (`diabetes with kidney disease` finds E11.22, Type 2 diabetes mellitus with diabetic chronic kidney disease). Searches ICD-10-CM, ICD-10-PCS, HCPCS Level II, RxNorm and NDC products together, or the systems in `system`. Each result has a `match_score` (0 to 1; an exact code or id is 1 and always ranks first), a short `reason` saying why it matched, and, on the first result when the top results are close but from different code families, `did_you_mean` with the alternatives. Ranking blends closeness in meaning with the query words the text contains; it is computed from stored data, with no external service involved. Returns up to the best 100 matches per system. Builder plan and up; other plans get `403 plan-upgrade-required`.

Requires an API key: `Authorization: Bearer hdev_live_...`. See [Authentication](/authentication).

## Query parameters

| Name | Type | Required | Description | Example |
| --- | --- | --- | --- | --- |
| `q` | string | yes | What you're looking for, in plain words or a code | `diabetes with kidney disease` |
| `limit` | integer | no | Page size (max 100) | `25` |
| `cursor` | string | no | Opaque cursor from `links.next` |  |
| `system` | string | no | Only these systems, comma-separated: icd10cm, icd10pcs, hcpcs, rxnorm, ndc (default all) | `icd10cm` |
| `view` | "compact" \| "full" | no | `compact` returns only the fields an agent usually needs (fewer tokens); `full` (default) returns every field | `compact` |
| `fields` | string | no | Comma-separated record fields to return, e.g. `code,display,billable` | `code,display,billable` |

## Examples

**curl**

```sh
curl "https://api.healthcare.dev/v1/search?q=diabetes+with+kidney+disease&limit=25" \
  -H "Authorization: Bearer $HDEV_API_KEY"
```

**TypeScript**

```ts
const res = await fetch("https://api.healthcare.dev/v1/search?q=diabetes+with+kidney+disease&limit=25", {
  headers: { Authorization: `Bearer ${process.env.HDEV_API_KEY}` },
});
const { data, meta } = await res.json();
```

**Python**

```python
import os
import requests

res = requests.get("https://api.healthcare.dev/v1/search?q=diabetes+with+kidney+disease&limit=25", headers={"Authorization": f"Bearer {os.environ['HDEV_API_KEY']}"})
body = res.json()
```

## Response

Results, best first

```json
{
  "data": [
    {
      "system": "icd10cm",
      "code": "string",
      "display": "string",
      "status": "string",
      "href": "string",
      "match_score": 0,
      "reason": "string",
      "did_you_mean": [
        {
          "system": null,
          "code": null,
          "display": null
        }
      ],
      "record": {
        "system": "icd10cm",
        "code": "E11.9",
        "display": "Type 2 diabetes mellitus without complications",
        "description": "Type 2 diabetes mellitus without complications",
        "billable": true,
        "parent": "E11",
        "attributes": {},
        "status": "active",
        "effective_start": "2015-10-01",
        "effective_end": null,
        "replaced_by": []
      }
    }
  ],
  "meta": {
    "source": "cms-icd10",
    "data_version": "2026.1",
    "retrieved_at": "2026-10-24T12:00:00Z",
    "license": "Public domain (CMS). Reference data, not medical advice."
  },
  "links": {
    "self": "/v1/search?q=diabetes+with+kidney+disease&limit=25",
    "next": "/v1/search?q=diabetes+with+kidney+disease&limit=25&cursor=eyJrIjoiRTExLjkifQ"
  }
}
```

### Fields

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `system` | SearchSystem | yes |  |
| `code` | string | yes | The code (icd10cm, icd10pcs, hcpcs), RxCUI (rxnorm) or product NDC (ndc) |
| `display` | string | yes | Description or drug name |
| `status` | string | yes | `active` (retired records are not searched by meaning) |
| `href` | string | yes | Lookup path for the full record, e.g. `/v1/codes/icd10cm/E11.22` |
| `match_score` | number | yes | How well this result matches the query, 0 to 1: 1 is an exact code or id, 0.9 a code prefix; otherwise a blend of closeness in meaning and the query words the text contains (see `reason`). Below 0.5, check the result before relying on it. |
| `reason` | string | yes | Why it matched, in a few words, e.g. `matches "kidney" in the description; close in meaning to "diabetes"` |
| `did_you_mean` | SearchAlternative[] | no | On the first result only, when the query is ambiguous: the top results are close in score but from different code families. The best match of each other family; narrow the query or pass `system` to choose. |
| `record` |  | no | The full record (`view=full`, the default) |

## Errors

Errors are `application/problem+json` ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)). Branch on `type`, not on `title`. See [Errors](/errors).

| Status | `type` | When |
| --- | --- | --- |
| 400 | `invalid-request` | A parameter or the body failed validation; `errors` lists each field. |
| 401 | `unauthorized` | Missing, malformed or revoked API key. |
| 403 | `plan-upgrade-required` | The plan doesn't include this feature; `required_plan` names the plan that does. |
| 404 | `not-found` | No record with that id (retired records are still returned). |
| 429 | `rate-limited / quota-exceeded` | Too many requests per second (retry after `Retry-After`), or the monthly quota is used up. |
| 503 | `dataset-unavailable / unavailable` | The dataset has no published version yet, or the service is degraded. |
