This medication is used to treat a certain type of stomach, bowel, or esophagus cancer (gastrointestinal stromal tumor-GIST). Avapritinib belongs to a class of drugs known as kinase inhibitors. It works by slowing or stopping the growth of cancer cells.