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

> Get the list of available relationship types for a specific OMOP concept so you can filter, paginate, or traverse only the links you care about.

## Overview

This endpoint returns all available relationship types that exist for a specific concept. This is useful for building dynamic UI components like dropdowns and understanding what relationships are available for a concept.

## Path Parameters

<ParamField path="conceptId" type="integer" required>
  The unique OMOP concept ID to get relationship options 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 relationship options

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

    <ResponseField name="available_relationships" type="array">
      Array of available relationship types for this concept

      <Expandable title="available_relationships">
        <ResponseField name="id" type="string">
          Unique relationship type ID (e.g., "Is a", "Maps to")
        </ResponseField>

        <ResponseField name="name" type="string">
          Human-readable relationship name
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

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

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

    <ResponseField name="timestamp" type="string">
      ISO 8601 timestamp
    </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/relationships/options" \
    -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}/relationships/options"

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

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

  print(f"Concept ID: {data['data']['concept_id']}")
  print("Available relationship types:")
  for rel in data['data']['available_relationships']:
      print(f"  - {rel['name']} ({rel['id']})")
  ```

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

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

  console.log(`Concept ID: ${data.concept_id}`);
  console.log('Available relationships:');
  data.available_relationships.forEach(rel => {
    console.log(`  - ${rel.name} (${rel.id})`);
  });
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "concept_id": 201826,
      "available_relationships": [
        {
          "id": "Is a",
          "name": "Is a"
        },
        {
          "id": "Maps to",
          "name": "Maps to"
        },
        {
          "id": "Mapped from",
          "name": "Mapped from"
        },
        {
          "id": "Subsumes",
          "name": "Subsumes"
        }
      ]
    },
    "meta": {
      "request_id": "req_relationship_options_123",
      "timestamp": "2024-12-22T10:00:00Z",
      "vocab_release": "2025.1"
    }
  }
  ```
</ResponseExample>

## Usage Examples

### Basic Relationship Options

Get all available relationship types for a concept:

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

### With Specific Vocabulary Version

Get relationship options for a specific vocabulary release:

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

### UI Dropdown Integration

Use in a dropdown component:

```javascript theme={null}
async function loadRelationshipOptions(conceptId) {
  const response = await fetch(`/v1/concepts/${conceptId}/relationships/options`, {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  });
  const result = await response.json();

  return result.data.available_relationships.map(rel => ({
    value: rel.id,
    label: rel.name
  }));
}

// Use in UI
const options = await loadRelationshipOptions(201826);
const selectHtml = options.map(opt =>
  `<option value="${opt.value}">${opt.label}</option>`
).join('');
```

## Important Notes

* **Dynamic options** - Available relationship types vary by concept
* **Both directions** - Returns relationships where the concept is either source or target
* **Valid only** - Only returns relationships with valid (non-deprecated) status

## Related Endpoints

* [Get Concept Relationships](/api-reference/concepts/get-concept-relationships) - Get actual relationships for a concept
* [Get Relationship Types](/api-reference/relationships/get-relationship-types) - Get all relationship types in the system
