Upper gastrointestinal (GI) endoscopy is a diagnostic and sometimes therapeutic procedure used to visualize and treat conditions affecting the upper part of the digestive system. This includes the esophagus, stomach, and the initial part of the small intestine (duodenum). In pediatrics, this procedure is conducted by inserting a flexible tube with a camera (endoscope) through the mouth.