> ## 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 Relationship Types

> Retrieve all available OMOP relationship types - Maps to, Is a, Subsumes, and the complete set of OHDSI-defined links between medical concepts.

This endpoint returns all relationship types from the OMOP CDM RELATIONSHIP table, which defines the types of connections that can exist between concepts.

## Query Parameters

<ParamField query="page" type="integer" optional default="1">
  Page number for pagination (1-based)
</ParamField>

<ParamField query="page_size" type="integer" optional default="100">
  Number of relationship types to return per page (max 500)
</ParamField>

<ParamField query="vocab_release" type="string" optional>
  Specific vocabulary release version

  <br />

  **Example:** `2025.1`
</ParamField>

## Response

<ResponseField name="relationship_types" type="array">
  Array of relationship type objects from the OMOP CDM RELATIONSHIP table

  <Expandable title="Relationship Type Object">
    <ResponseField name="relationship_id" type="string">
      Unique identifier for the relationship type (e.g., "Is a", "Maps to")
    </ResponseField>

    <ResponseField name="relationship_name" type="string">
      Display name of the relationship type
    </ResponseField>

    <ResponseField name="is_hierarchical" type="string">
      Whether this relationship creates hierarchical structure ("0" or "1")
    </ResponseField>

    <ResponseField name="defines_ancestry" type="string">
      Whether this relationship is used in CONCEPT\_ANCESTOR computation ("0" or "1")
    </ResponseField>

    <ResponseField name="reverse_relationship_id" type="string">
      The relationship\_id of the reverse relationship (e.g., "Subsumes" for "Is a")
    </ResponseField>

    <ResponseField name="relationship_concept_id" type="integer">
      Concept ID representing this relationship type in the CONCEPT table
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="meta" type="object">
  Response metadata including pagination

  <Expandable title="Metadata Object">
    <ResponseField name="pagination" type="object">
      <ResponseField name="page" type="integer">Current page number</ResponseField>
      <ResponseField name="page_size" type="integer">Items per page</ResponseField>
      <ResponseField name="total_items" type="integer">Total relationship types</ResponseField>
      <ResponseField name="total_pages" type="integer">Total number of pages</ResponseField>
      <ResponseField name="has_next" type="boolean">Whether next page exists</ResponseField>
      <ResponseField name="has_previous" type="boolean">Whether previous page exists</ResponseField>
    </ResponseField>

    <ResponseField name="request_id" type="string">Unique request identifier</ResponseField>
    <ResponseField name="vocab_release" type="string">Vocabulary release version used</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.omophub.com/v1/relationships/types?page_size=50" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

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

  url = "https://api.omophub.com/v1/relationships/types"
  params = {"page_size": 50}
  headers = {"Authorization": "Bearer YOUR_API_KEY"}

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

  print(f"Total relationship types: {data['meta']['pagination']['total_items']}")
  for rel_type in data['data']['relationship_types']:
      hierarchical = "Yes" if rel_type['is_hierarchical'] == '1' else "No"
      print(f"  {rel_type['relationship_id']} -> {rel_type['reverse_relationship_id']} (Hierarchical: {hierarchical})")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.omophub.com/v1/relationships/types?page_size=50', {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });

  const data = await response.json();
  console.log(`Found ${data.meta.pagination.total_items} relationship types`);

  data.data.relationship_types.forEach(type => {
    console.log(`${type.relationship_id} <-> ${type.reverse_relationship_id}`);
  });
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "relationship_types": [
        {
          "relationship_id": "Is a",
          "relationship_name": "Is a",
          "is_hierarchical": "1",
          "defines_ancestry": "1",
          "reverse_relationship_id": "Subsumes",
          "relationship_concept_id": 44818821
        },
        {
          "relationship_id": "Maps to",
          "relationship_name": "Maps to",
          "is_hierarchical": "0",
          "defines_ancestry": "0",
          "reverse_relationship_id": "Mapped from",
          "relationship_concept_id": 44818981
        },
        {
          "relationship_id": "Has finding site",
          "relationship_name": "Has finding site",
          "is_hierarchical": "0",
          "defines_ancestry": "0",
          "reverse_relationship_id": "Finding site of",
          "relationship_concept_id": 44818788
        }
      ]
    },
    "meta": {
      "request_id": "req_abc123",
      "vocab_release": "2025.1",
      "pagination": {
        "page": 1,
        "page_size": 100,
        "total_items": 642,
        "total_pages": 7,
        "has_next": true,
        "has_previous": false
      }
    }
  }
  ```
</ResponseExample>

## Usage Examples

### All Relationship Types

Get all available relationship types:

```bash theme={null}
curl "https://api.omophub.com/v1/relationships/types" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Paginated Results

Navigate through pages of relationship types:

```bash theme={null}
curl "https://api.omophub.com/v1/relationships/types?page=2&page_size=50" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Related Endpoints

* [Get Concept Relationships](/api-reference/relationships/get-concept-relationships) - Relationships for specific concepts
* [Get Concept Mappings](/api-reference/mappings/get-concept-mappings) - Cross-vocabulary mappings
* [Get Vocabularies](/api-reference/vocabulary/get-vocabularies) - Available vocabularies

## Notes

* Relationship types come from the OMOP CDM RELATIONSHIP table
* All relationships exist symmetrically (both directions)
* Hierarchical relationships (like "Is a") are used to build the CONCEPT\_ANCESTOR table
* The `defines_ancestry` field indicates which relationships contribute to ancestor computation
* Each relationship type has a corresponding concept in the CONCEPT table
