Guide. An upper gastrointestinal (UGI) endoscopy is a procedure that allows your doctor to look at the inside lining of your esophagus, your stomach, and the first part of your small intestine (duodenum).