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

# Batch Concepts

## Overview

Efficiently retrieve information for multiple concepts at once. This endpoint is optimized for bulk operations and reduces the number of API calls needed.

## Request Body

<ParamField body="concept_ids" type="array" required>
  Array of concept IDs to retrieve (max: 100)
</ParamField>

<ParamField body="include_relationships" type="boolean" default="false">
  Include relationships for all concepts
</ParamField>

<ParamField body="include_synonyms" type="boolean" default="false">
  Include synonyms for all concepts
</ParamField>

<ParamField body="include_mappings" type="boolean" default="false">
  Include cross-vocabulary mappings for all concepts
</ParamField>

<ParamField body="vocabulary_filter" type="array" optional>
  Filter results to specific vocabularies
</ParamField>

<ParamField body="standard_only" type="boolean" default="false">
  Only return standard concepts
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.omophub.com/v1/concepts/batch" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "concept_ids": [320128, 201826, 4329847],
      "include_relationships": true,
      "include_synonyms": true
    }'
  ```

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

  payload = {
      "concept_ids": [320128, 201826, 4329847],
      "include_relationships": True,
      "include_synonyms": True,
      "include_mappings": False
  }

  response = requests.post(
      "https://api.omophub.com/v1/concepts/batch",
      headers={"Authorization": "Bearer YOUR_API_KEY"},
      json=payload
  )

  concepts = response.json()
  for concept in concepts['data']['concepts']:
      print(f"{concept['concept_name']} ({concept['vocabulary_id']})")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.omophub.com/v1/concepts/batch', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      concept_ids: [320128, 201826, 4329847],
      include_relationships: true,
      include_synonyms: true
    })
  });

  const data = await response.json();
  console.log(`Retrieved ${data.data.concepts.length} concepts`);
  ```

  ```bash cURL (with filtering) theme={null}
  curl -X POST "https://api.omophub.com/v1/concepts/batch" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "concept_ids": [320128, 201826, 4329847, 313217],
      "vocabulary_filter": ["SNOMED", "ICD10CM"],
      "include_mappings": true,
      "standard_only": true
    }'
  ```

  ```python Python (comprehensive) theme={null}
  import requests

  # Large batch request with comprehensive data
  concept_ids = [320128, 201826, 4329847, 313217, 435216]
  payload = {
      "concept_ids": concept_ids,
      "include_relationships": True,
      "include_synonyms": True,
      "include_mappings": True,
      "standard_only": True
  }

  response = requests.post(
      "https://api.omophub.com/v1/concepts/batch",
      headers={"Authorization": "Bearer YOUR_API_KEY"},
      json=payload
  )

  data = response.json()
  print(f"Successfully retrieved {len(data['data']['concepts'])} concepts")
  print(f"Failed to retrieve {len(data['data']['failed_concepts'])} concepts")

  # Process successful concepts
  for concept in data['data']['concepts']:
      print(f"\n{concept['concept_name']}")
      print(f"  ID: {concept['concept_id']}")
      print(f"  Vocabulary: {concept['vocabulary_id']}")
      print(f"  Domain: {concept['domain_id']}")

      if concept.get('synonyms'):
          print(f"  Synonyms: {len(concept['synonyms'])} found")

      if concept.get('relationships'):
          print(f"  Relationships: {len(concept['relationships'])} found")
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "concepts": [
        {
          "concept_id": 320128,
          "concept_name": "Essential hypertension",
          "concept_code": "59621000",
          "vocabulary_id": "SNOMED",
          "domain_id": "Condition",
          "concept_class_id": "Clinical Finding",
          "standard_concept": "S",
          "valid_start_date": "1970-01-01",
          "valid_end_date": "2099-12-31",
          "invalid_reason": null,
          "synonyms": [
            {
              "concept_synonym_name": "Primary hypertension",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            },
            {
              "concept_synonym_name": "Idiopathic hypertension",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            }
          ],
          "relationships": [
            {
              "relationship_id": "Is a",
              "target_concept_id": 316866,
              "target_concept_name": "Hypertensive disorder",
              "target_vocabulary_id": "SNOMED",
              "relationship_direction": "outbound"
            }
          ]
        },
        {
          "concept_id": 201826,
          "concept_name": "Type 2 diabetes mellitus",
          "concept_code": "44054006",
          "vocabulary_id": "SNOMED",
          "domain_id": "Condition",
          "concept_class_id": "Clinical Finding",
          "standard_concept": "S",
          "valid_start_date": "1970-01-01",
          "valid_end_date": "2099-12-31",
          "invalid_reason": null,
          "synonyms": [
            {
              "concept_synonym_name": "Type II diabetes mellitus",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            },
            {
              "concept_synonym_name": "Adult-onset diabetes",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            }
          ],
          "relationships": [
            {
              "relationship_id": "Is a",
              "target_concept_id": 73211009,
              "target_concept_name": "Diabetes mellitus",
              "target_vocabulary_id": "SNOMED",
              "relationship_direction": "outbound"
            }
          ]
        },
        {
          "concept_id": 4329847,
          "concept_name": "Myocardial infarction",
          "concept_code": "22298006",
          "vocabulary_id": "SNOMED",
          "domain_id": "Condition",
          "concept_class_id": "Clinical Finding",
          "standard_concept": "S",
          "valid_start_date": "1970-01-01",
          "valid_end_date": "2099-12-31",
          "invalid_reason": null,
          "synonyms": [
            {
              "concept_synonym_name": "Heart attack",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            },
            {
              "concept_synonym_name": "MI - Myocardial infarction",
              "language_concept_id": 4180186,
              "language_concept_name": "English"
            }
          ],
          "relationships": [
            {
              "relationship_id": "Is a",
              "target_concept_id": 134057,
              "target_concept_name": "Acute myocardial infarction",
              "target_vocabulary_id": "SNOMED",
              "relationship_direction": "inbound"
            }
          ]
        }
      ],
      "failed_concepts": [],
      "summary": {
        "total_requested": 3,
        "successful_retrievals": 3,
        "failed_retrievals": 0,
        "vocabularies_represented": ["SNOMED"],
        "domains_represented": ["Condition"]
      }
    },
    "meta": {
      "request_id": "req_batch_123",
      "timestamp": "2024-12-22T10:00:00Z",
      "vocab_release": "2025.2",
      "query_time_ms": 45.2
    }
  }
  ```
</ResponseExample>
