Upper GI endoscopy is a procedure used to diagnose and treat problems in the upper gastrointestinal (GI) tract, which includes the esophagus, stomach, and duodenum. It involves the insertion of a thin, flexible tube called an endoscope into the patient's mouth and down the throat. The endoscope has a tiny camera at its tip that allows the doctor to view the inside of the GI tract on a monitor. The procedure is used to detect and diagnose conditions such as ulcers, inflammation, tumors, and bleeding. It can also be used to take tissue samples (biopsies) or remove polyps or foreign objects. Upper GI endoscopy is usually done as an outpatient procedure and is considered safe with minimal risk of complications. Upper GI endoscopy is usually performed under conscious sedation, which is a combination of medications that make the patient feel drowsy and relaxed during the procedure. In some cases, general anesthesia may be used. The procedure typically takes 20 to 30 minutes, and most patients can go home the same day. Some patients may experience mild discomfort during the procedure, but this usually subsides within a few hours.