{
  "id": "DRUG-SEARCH",
  "title": "Search drugs by name or ingredients",
  "shortTitle": "Search drugs",
  "method": "GET",
  "path": "/v1/drugs/search",
  "queryPath": null,
  "group": "drugs",
  "unsupportedFields": [],
  "availability": "preview",
  "request": {
    "additionalProperties": false,
    "properties": {
      "q": {
        "maxLength": 4096,
        "minLength": 1,
        "type": "string",
        "title": "Q"
      },
      "ingredient_rxcuis": {
        "items": {
          "pattern": "^[1-9][0-9]{0,15}$",
          "type": "string"
        },
        "maxItems": 100,
        "minItems": 1,
        "type": "array",
        "title": "Ingredient Rxcuis"
      },
      "composition_match": {
        "default": "exact",
        "enum": [
          "contains",
          "exact"
        ],
        "title": "Composition Match",
        "type": "string"
      },
      "match_mode": {
        "default": "auto",
        "enum": [
          "auto",
          "exact"
        ],
        "title": "Match Mode",
        "type": "string"
      },
      "limit": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "title": "Limit",
        "type": "integer"
      },
      "cursor": {
        "type": "string",
        "title": "Cursor"
      }
    },
    "title": "DrugSearchRequest",
    "type": "object"
  },
  "response": {
    "$defs": {
      "DrugIngredient": {
        "additionalProperties": false,
        "properties": {
          "rxcui": {
            "pattern": "^[1-9][0-9]{0,15}$",
            "title": "Rxcui",
            "type": "string"
          },
          "concept_type": {
            "enum": [
              "IN",
              "PIN"
            ],
            "title": "Concept Type",
            "type": "string"
          },
          "preferred_name": {
            "title": "Preferred Name",
            "type": "string"
          }
        },
        "required": [
          "concept_type",
          "preferred_name",
          "rxcui"
        ],
        "title": "DrugIngredient",
        "type": "object"
      },
      "DrugMatchedName": {
        "additionalProperties": false,
        "properties": {
          "field": {
            "enum": [
              "brand_name",
              "official_name",
              "product_name",
              "substance_name"
            ],
            "title": "Field",
            "type": "string"
          },
          "whole": {
            "title": "Whole",
            "type": "boolean"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "field",
          "text",
          "whole"
        ],
        "title": "DrugMatchedName",
        "type": "object"
      },
      "DrugSearchHit": {
        "additionalProperties": false,
        "properties": {
          "rxcui": {
            "pattern": "^[1-9][0-9]{0,15}$",
            "title": "Rxcui",
            "type": "string"
          },
          "concept_type": {
            "enum": [
              "IN",
              "MIN",
              "PIN"
            ],
            "title": "Concept Type",
            "type": "string"
          },
          "preferred_name": {
            "title": "Preferred Name",
            "type": "string"
          },
          "ingredients": {
            "items": {
              "$ref": "#/$defs/DrugIngredient"
            },
            "minItems": 1,
            "title": "Ingredients",
            "type": "array"
          },
          "brand_names": {
            "items": {
              "type": "string"
            },
            "title": "Brand Names",
            "type": "array"
          },
          "more_brand_names": {
            "type": "boolean",
            "title": "More Brand Names"
          },
          "dosage_forms": {
            "items": {
              "type": "string"
            },
            "title": "Dosage Forms",
            "type": "array"
          },
          "has_products": {
            "title": "Has Products",
            "type": "boolean"
          },
          "matched_name": {
            "$ref": "#/$defs/DrugMatchedName"
          }
        },
        "required": [
          "concept_type",
          "has_products",
          "ingredients",
          "preferred_name",
          "rxcui"
        ],
        "title": "DrugSearchHit",
        "type": "object"
      }
    },
    "items": {
      "$ref": "#/$defs/DrugSearchHit"
    },
    "type": "array"
  }
}
