An Endoscopy may also be called, upper endoscopy, EGD or esophagogastroduodenoscopy. An endoscopy is a procedure used to visually examine your upper digestive system with a tiny camera on the end of a long, flexible tube. A specialist in diseases of the digestive system (gastroenterologist) uses an endoscopy to diagnose and, sometimes, treat conditions that affect the esophagus, stomach and beginning of the small intestine (duodenum). You may have an upper endoscopy done in an outpatient surgery center or a hospital. An endoscopy is a very safe procedure. Rare complications include: bleeding, infection, tearing of the gastrointestinal tract, and reaction to sedation. You can reduce your risk of complications by carefully following your doctor’s instructions for preparing for an endoscopy, such as fasting and stopping certain medications. You will need to stop drinking and eating up to eight hours before your endoscopy to ensure your stomach is empty for the procedure. An endoscopy typically takes 15 to 30 minutes, depending on your situation.