Endoscopy is a medical procedure where a long, thin tube is inserted directly into the body of the patient, to examine a tissue or an internal organ in detail. This procedure may be carried out for other tasks as well, such as minor surgeries and imaging.