An endoscopy is a procedure in which a thin, flexible tube with a camera on the end is inserted into the digestive tract to examine the esophagus, stomach, and small intestine.