We present the first fully automated pipeline for making images from the interferometric data obtained from the upgraded Giant Metrewave Radio Telescope (uGMRT) called CAsa Pipeline-cum-Toolkit for Upgraded Giant Metrewave Radio Telescope data REduction - CAPTURE. It is a python program that uses tasks from the NRAO Common Astronomy Software Applications (CASA) to perform the steps of flagging of bad data, calibration, imaging and self-calibration. The salient features of the pipeline are: i) a fully automatic mode to go from the raw data to a self-calibrated continuum image, ii) specialized flagging strategies for short and long baselines that ensure minimal loss of extended structure, iii) flagging of persistent narrow band radio frequency interference (RFI), iv) flexibility for the user to configure the pipeline for step-by-step analysis or special cases and v) analysis of data from the legacy GMRT. CAPTURE is available publicly on github (https://github.com/ruta-k/uGMRT-pipeline, release v1.0.0). The primary beam correction for the uGMRT images produced with CAPTURE is made separately available at https://github.com/ruta-k/uGMRTprimarybeam. We show examples of using CAPTURE on uGMRT and legacy GMRT data. In principle, CAPTURE can be tailored for use with radio interferometric data from other telescopes.