Upper gastrointestinal endoscopy, also known as esophagogastroduodenoscopy (EGD), is a diagnostic procedure that allows direct visualization of the upper part of the gastrointestinal tract, including the esophagus, stomach, and duodenum. It is commonly used to investigate symptoms such as abdominal pain, nausea, vomiting, and difficulty swallowing, and can also be used therapeutically, such as for removing foreign bodies or treating bleeding lesions.