# Look up a CodeSystem concept

Canonical page: https://docs.ovok.com/primitives/lookup-codesystem

`$lookup` finds a concept in a CodeSystem and returns information such as its preferred display, designations, and properties. Provide the code system and code directly, or pass them together in a `Coding`.

| Method | Path |
| --- | --- |
| `GET` or `POST` | `/fhir/R4/CodeSystem/$lookup` |

## GET request [#get-request]

Use query parameters for a simple lookup. `version`, `date`, `displayLanguage`, and repeated `property` values can further constrain or shape the result.

```bash
curl --get 'https://api.sandbox.ovok.com/fhir/R4/CodeSystem/$lookup' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --data-urlencode 'system=http://loinc.org' \
  --data-urlencode 'code=8867-4' \
  --data-urlencode 'displayLanguage=en'
```

## POST request [#post-request]

Pass a `Coding` as a FHIR `Parameters` input when keeping the code system and code together:

```bash
curl --request POST \
  --url 'https://api.sandbox.ovok.com/fhir/R4/CodeSystem/$lookup' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/fhir+json' \
  --data @lookup-codesystem-parameters.json
```

Example `lookup-codesystem-parameters.json`:

```json
{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "coding",
      "valueCoding": {
        "system": "http://loinc.org",
        "code": "8867-4"
      }
    }
  ]
}
```

## Successful response [#successful-response]

The operation returns lookup details in a FHIR `Parameters` resource:

| Response path | Example | Meaning |
| --- | --- | --- |
| `resourceType` | `Parameters` | FHIR wrapper for the operation output. |
| `parameter[name=name].valueString` | `LOINC` | Name of the CodeSystem. |
| `parameter[name=version].valueString` | `<code-system-version>` | Version used for the lookup. |
| `parameter[name=display].valueString` | `Heart rate` | Preferred human-readable term. |
| `parameter[name=designation].part` | `language=en`, `value=Heart rate` | Alternate term and optional language or usage coding. |
| `parameter[name=property].part` | `code=status`, `value=active` | Typed concept property; properties may describe status, hierarchy, or terminology-specific details. |

An unknown code or system is reported with a FHIR `OperationOutcome`.

Reference: [HL7 FHIR R4 CodeSystem `$lookup`](https://hl7.org/fhir/R4/codesystem-operation-lookup.html).
