# getRelatedByType

**Identifier:** `rxnorm_getRelatedByType`

**Provider:** [RxNorm](https://kirha.com/providers/rxnorm.md)

Get related RxNorm concepts filtered by specific term types for one or more RxCUIs. More targeted than getAllRelatedConcepts — use this when you only need specific types (e.g., branded_drug, clinical_drug, ingredient).

## Run it with the CLI

```bash
kirha tools run rxnorm_getRelatedByType \
  --input '{
    "rxcuis": [
      "<rxcuis>"
    ],
    "tty": [
      "ingredient"
    ]
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "rxnorm_getRelatedByType",
  "input": {
    "rxcuis": [
      "<rxcuis>"
    ],
    "tty": [
      "ingredient"
    ]
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "rxcuis": {
      "description": "From findDrugByName or getDrugProducts",
      "items": {
        "type": "string"
      },
      "maxItems": 5,
      "minItems": 1,
      "type": "array"
    },
    "tty": {
      "items": {
        "enum": [
          "ingredient",
          "multi_ingredient",
          "precise_ingredient",
          "brand_name",
          "clinical_drug",
          "branded_drug",
          "clinical_dose_form",
          "branded_dose_form",
          "clinical_drug_component",
          "branded_drug_component",
          "clinical_drug_group",
          "branded_drug_group",
          "clinical_dose_form_precise",
          "branded_dose_form_precise",
          "clinical_drug_group_precise",
          "dose_form",
          "dose_form_group",
          "generic_pack",
          "branded_pack"
        ],
        "type": "string"
      },
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "rxcuis",
    "tty"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "groups": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "conceptCount": {
            "description": "Concepts of this term type before the cap",
            "type": "number"
          },
          "concepts": {
            "description": "About 750 concepts per call split evenly across inputs: ask for fewer term types or inputs to get more of each",
            "items": {
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "rxcui": {
                  "type": "string"
                }
              },
              "required": [
                "rxcui",
                "name"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "query": {
            "description": "Input RxCUI these concepts relate to",
            "type": "string"
          },
          "tty": {
            "type": "string"
          }
        },
        "required": [
          "query",
          "tty",
          "conceptCount",
          "concepts"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "rxcuis": {
      "description": "Related RxCUIs for use with other RxNorm tools",
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "groups",
    "rxcuis"
  ],
  "type": "object"
}
```

## Related tools

Other RxNorm tools that this tool refers to, or that refer to it.

- [`findDrugByName`](https://kirha.com/providers/rxnorm/findDrugByName.md)
- [`getDrugProducts`](https://kirha.com/providers/rxnorm/getDrugProducts.md)
- [`getAllRelatedConcepts`](https://kirha.com/providers/rxnorm/getAllRelatedConcepts.md)

-----

[All RxNorm tools](https://kirha.com/providers/rxnorm.md) · [< Back to tools list](https://kirha.com/tools.md)