Endoscopy is a method of examining the inside of a patient's digestive tract. It involves inserting a flexible, illuminated tube (an endoscope) through the mouth or anus, allowing the doctor to examine, biopsy, and sometimes treat diseases of the digestive tract. Endoscopy often produces a small amount of bleeding, particularly if biopsies are performed.