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

# FHIR CodeSystem/$validate-code for OMOP concepts

> Check whether a code exists in a FHIR CodeSystem backed by OMOP vocabularies - validates SNOMED, LOINC, RxNorm, ICD-10, and HCPCS codes on the wire.

## Overview

Validates whether a code is valid in a given code system. Returns `true`/`false` with the display name.

**Important:** Per the FHIR spec, `$validate-code` uses the `url` parameter (not `system`). This differs from `$lookup` which uses `system`.

## Request

```bash theme={null}
curl "https://fhir.omophub.com/fhir/r4/CodeSystem/\$validate-code?\
url=http://snomed.info/sct&code=44054006" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

With display verification:

```bash theme={null}
curl "https://fhir.omophub.com/fhir/r4/CodeSystem/\$validate-code?\
url=http://snomed.info/sct&code=44054006&\
display=Type%202%20diabetes%20mellitus" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Parameters

| Parameter | Type   | Required         | Description                                      |
| --------- | ------ | ---------------- | ------------------------------------------------ |
| `url`     | uri    | Yes (type-level) | FHIR code system URI (NOTE: `url`, not `system`) |
| `code`    | code   | Yes              | The code to validate                             |
| `display` | string | No               | Expected display text to verify                  |

## Response (valid code)

```json theme={null}
{
  "resourceType": "Parameters",
  "parameter": [
    { "name": "result", "valueBoolean": true },
    { "name": "display", "valueString": "Type 2 diabetes mellitus" }
  ]
}
```

## Response (display mismatch)

```json theme={null}
{
  "resourceType": "Parameters",
  "parameter": [
    { "name": "result", "valueBoolean": true },
    { "name": "display", "valueString": "Type 2 diabetes mellitus" },
    { "name": "message", "valueString": "Display mismatch: provided 'Diabetes type 2', actual 'Type 2 diabetes mellitus'." }
  ]
}
```

## Response (invalid code)

```json theme={null}
{
  "resourceType": "Parameters",
  "parameter": [
    { "name": "result", "valueBoolean": false },
    { "name": "message", "valueString": "Code '999999' not found in SNOMED" }
  ]
}
```
