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

# Get Concept Level

> Get the hierarchical level and depth of an OMOP concept within its vocabulary tree for quick classification and hierarchy-aware filtering.

## Overview

This endpoint returns basic hierarchical positioning information for a concept, including its depth from root concepts and counts of ancestors and descendants.

## Path Parameters

<ParamField path="conceptId" type="integer" required>
  The unique OMOP concept ID to get level information for
</ParamField>

## Query Parameters

<ParamField query="vocab_release" type="string">
  Specific vocabulary release version (e.g., "2025.1")
</ParamField>

## Response

<ResponseField name="success" type="boolean" required>
  Indicates whether the request was successful
</ResponseField>

<ResponseField name="data" type="object" required>
  Response data containing concept level information

  <Expandable title="data">
    <ResponseField name="concept_id" type="integer">
      The concept ID that was queried
    </ResponseField>

    <ResponseField name="level" type="integer">
      The level of the concept in the hierarchy (0-based)
    </ResponseField>

    <ResponseField name="depth_from_root" type="integer">
      Number of levels from the root concept to this concept
    </ResponseField>

    <ResponseField name="breadth_at_level" type="integer" nullable>
      Number of concepts at the same level (may be null if not calculated)
    </ResponseField>

    <ResponseField name="total_descendants" type="integer">
      Total number of descendant concepts below this concept
    </ResponseField>

    <ResponseField name="total_ancestors" type="integer">
      Total number of ancestor concepts above this concept
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="meta" type="object" required>
  Response metadata and API information

  <Expandable title="meta">
    <ResponseField name="request_id" type="string">
      Unique request identifier for debugging
    </ResponseField>

    <ResponseField name="timestamp" type="string">
      ISO 8601 timestamp of the response
    </ResponseField>

    <ResponseField name="vocab_release" type="string">
      Vocabulary release version used
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.omophub.com/v1/concepts/201826/level" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  concept_id = 201826  # Type 2 diabetes
  url = f"https://api.omophub.com/v1/concepts/{concept_id}/level"

  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.get(url, headers=headers)
  data = response.json()

  level_info = data['data']

  print(f"Concept ID: {level_info['concept_id']}")
  print(f"Depth from root: {level_info['depth_from_root']}")
  print(f"Total ancestors: {level_info['total_ancestors']}")
  print(f"Total descendants: {level_info['total_descendants']}")
  ```

  ```javascript JavaScript theme={null}
  const conceptId = 201826; // Type 2 diabetes
  const response = await fetch(`https://api.omophub.com/v1/concepts/${conceptId}/level`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const levelInfo = await response.json();
  const data = levelInfo.data;

  console.log(`Concept ID: ${data.concept_id}`);
  console.log(`Depth from root: ${data.depth_from_root}`);
  console.log(`Total ancestors: ${data.total_ancestors}`);
  console.log(`Total descendants: ${data.total_descendants}`);
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "concept_id": 201826,
      "level": 0,
      "depth_from_root": 4,
      "breadth_at_level": null,
      "total_descendants": 15,
      "total_ancestors": 3
    },
    "meta": {
      "request_id": "req_concept_level_123",
      "timestamp": "2024-12-22T10:00:00Z",
      "vocab_release": "2025.1"
    }
  }
  ```
</ResponseExample>

## Usage Examples

### Basic Level Information

Get hierarchy level for a concept:

```bash theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/level" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### With Specific Vocabulary Version

Get level information for a specific vocabulary release:

```bash theme={null}
curl -X GET "https://api.omophub.com/v1/concepts/201826/level?vocab_release=2025.1" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Important Notes

* **Depth interpretation** - `depth_from_root` indicates how many "Is a" relationship steps exist between this concept and the root
* **Descendant count** - `total_descendants` includes all child concepts at any depth below
* **Ancestor count** - `total_ancestors` includes all parent concepts up to the root

## Related Endpoints

* [Get Concept Hierarchy](/api-reference/concepts/get-concept-hierarchy) - Full hierarchical tree
* [Get Concept Ancestors](/api-reference/concepts/get-concept-ancestors) - Parent concepts
* [Get Concept Descendants](/api-reference/concepts/get-concept-descendants) - Child concepts
