A gastroscopy, also known as an upper gastrointestinal endoscopy or UGI endoscopy, is a procedure that allows a doctor to examine the lining of the stomach using a flexible tube inserted through the mouth. Proper preparation is required, including fasting from midnight before the procedure. A gastroscopy can help diagnose conditions like inflammation, ulcers, or cancer by allowing the doctor to view the stomach directly and take biopsies. Complications are rare but can include bleeding, perforation of the stomach lining, or reactions to sedation. Alternative tests like a barium meal or CT scan provide external images but may not replace the need for a gastroscopy.