> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omophub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic Search

## Overview

Find OMOP concepts related in meaning to an English-language query, even when
the wording differs from the concept name. Results are suggestions for review,
not automatic clinical coding decisions.

**Example queries:**

* "heart attack" finds "Myocardial infarction"
* "sugar diabetes" finds "Type 2 diabetes mellitus"
* "high blood pressure" finds "Essential hypertension"
* "belly pain" finds "Abdominal pain"

## When to Use Semantic Search

| Need | Recommended endpoint |
| - | - |
| Related concepts from an English phrase | Semantic search |
| Exact name, synonym, or code lookup | [Basic search](https://docs.omophub.com/api-reference/search/basic-search.md) |
| Convert a source concept to OMOP Standard | [Concept mappings](https://docs.omophub.com/api-reference/mappings/get-concept-mappings.md) |

## Query Parameters

**query** `string` *required*

English natural-language search query. After trimming, queries must contain
3-500 characters. `MI` is also accepted as a case-insensitive abbreviation.
Other 1-2 character queries are rejected.

**page** `integer` (default: 1)

Page number (1-based)

**page\_size** `integer` (default: 20)

Results per page (1-100)

**threshold** `number` (default: 0.5)

Minimum similarity score (0.0-1.0). Higher values return fewer, closer
matches. This score is not a probability or clinical confidence value.

**vocabulary\_ids** `string`

Filter to specific vocabularies (comma-separated). Vocabularies the API key
cannot access are omitted when at least one requested vocabulary is
accessible. A request containing only inaccessible vocabularies returns 403.

**Examples:** `SNOMED`, `SNOMED,ICD10CM`, `SNOMED,ICD10CM,RxNorm`

**domain\_ids** `string`

Filter to specific domains (comma-separated)

**Examples:** `Condition`, `Drug`, `Condition,Drug,Procedure`

**standard\_concept** `string`

Filter by standard concept status

**Values:** `S` (Standard), `C` (Classification), `N` (Non-standard; stored as
null in OMOP)

**concept\_class\_id** `string`

Filter by one or more concept classes (comma-separated).

> [!WARNING]
>
> Filters can exclude relevant concepts. Apply them only when the expected
> vocabulary, domain, or concept type is known.

**vocab\_release** `string`

Vocabulary version (e.g., `2025v2`). Uses default if not specified.

```bash cURL theme={null}
curl -X GET "https://api.omophub.com/v1/search/semantic?query=heart%20attack&page_size=5" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "success": true,
  "data": {
    "query": "heart attack",
    "results": [
      {
        "concept_id": 4329847,
        "concept_name": "Myocardial infarction",
        "domain_id": "Condition",
        "vocabulary_id": "SNOMED",
        "concept_class_id": "Clinical Finding",
        "standard_concept": "S",
        "concept_code": "22298006",
        "similarity_score": 0.92,
        "matched_text": "Myocardial infarction"
      }
    ],
    "total_results": 45,
    "retrieval_truncated": false,
    "totals_are_lower_bound": false,
    "latency_ms": 28
  },
  "meta": {
    "pagination": {
      "page": 1,
      "page_size": 20,
      "total_items": 45,
      "total_pages": 3,
      "has_next": true,
      "has_previous": false
    },
    "request_id": "req_sem_abc123"
  }
}
```

## Response Fields

### Data Object

**success** `boolean`

Whether semantic search completed.

**data** `object`

Semantic results and query metadata.

**meta** `object`

Request, release, and pagination metadata.

**query** `string`

Original search query

**results** `array`

Matching concept suggestions, ordered by similarity.

**total\_results** `integer`

Number of matching concepts found. Check `totals_are_lower_bound` to determine
whether the value is exact.

**retrieval\_truncated** `boolean`

`true` when additional matching concepts may exist beyond those returned.

**totals\_are\_lower\_bound** `boolean`

`true` when the reported totals are minimum known values rather than exact
counts.

**latency\_ms** `number`

Processing time in milliseconds

### Result Object

**concept\_id** `integer`

OMOP concept\_id

**concept\_name** `string`

Primary name of the returned OMOP concept. The concept may be Standard,
Classification, or non-Standard; inspect `standard_concept`.

**similarity\_score** `number`

Relative match score from 0.0 to 1.0. Relevance remains primary, but within an
anchored score band of at most `0.0025` the API may prefer more clinically
useful concepts and demote non-clinical concept classes. Scores are therefore
not guaranteed to be strictly descending. The score is not a probability or
clinical confidence value.

**matched\_text** `string`

Text associated with the match.

**domain\_id** `string`

OMOP domain (e.g., Condition, Drug, Procedure)

**vocabulary\_id** `string`

Source vocabulary (e.g., SNOMED, ICD10CM, RxNorm)

**concept\_class\_id** `string`

Concept classification within the vocabulary

**standard\_concept** `string | null`

Standard concept flag: S (Standard), C (Classification), or null

**concept\_code** `string`

Original code from the source vocabulary

### Pagination Object (in meta)

**page** `integer`

Current page number

**page\_size** `integer`

Number of results per page

**total\_items** `integer`

Approximate total number of matching items (lower bound). Use `has_next` for
reliable pagination.

**total\_pages** `integer`

Approximate total number of pages. Use `has_next` to determine if more pages
exist.

**has\_next** `boolean`

Whether the client should request the next page.

**has\_previous** `boolean`

**Reliable indicator** of whether previous pages exist.

> [!NOTE]
>
> When `totals_are_lower_bound` is `true`, use `has_next` for pagination rather
> than comparing `page` with `total_pages`.

## Usage Notes

* Review the returned concept, domain, vocabulary, and Standard status before
  using a result in a clinical workflow.
* Use `threshold` to narrow results, but do not interpret the score as clinical
  confidence.
* Use [concept mappings](https://docs.omophub.com/api-reference/mappings/get-concept-mappings.md) when you
  need to convert a selected source concept to an OMOP Standard concept.

## Related Endpoints

* [Basic Concept Search](https://docs.omophub.com/api-reference/search/basic-search.md) - Keyword-based search
* [Similar Concepts](https://docs.omophub.com/api-reference/search/search-similar.md) - Find concepts similar to a given concept
* [Autocomplete](https://docs.omophub.com/api-reference/search/search-autocomplete.md) - Type-ahead suggestions

> [!NOTE]
>
> Use `/search/similar` when you want to start from an existing `concept_id`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.