This work studied the potential of using moringa oleifera leaf extract (MOLE) as an eco-friendly inhibitor for API 5L X52 steel in acidic media at 0.1 g/L–0.5 g/L concentration and 25 °C–60 °C. The study also evaluated the impact of adding potassium iodide (KI) to the corrosion-inhibiting properties of MOLE. Results from electrochemical testing showed that MOLE exhibited a high inhibition efficacy of 99% at 0.5 g/L concentration and 60 °C. The findings indicated that MOLE functions as a mixed-type corrosion inhibitor. Its efficiency increases with higher inhibitor concentrations following a Langmuir adsorption isotherm, and it is physically adsorbed on the steel surface. FT-IR spectra analysis revealed the presence of hydroxyl, carbonyl, saturated, and unsaturated aliphatic functionalities in the MOLE. The decreased absorption intensity in UV–vis spectra after 2 and 4 h of corrosive acid environment exposure indicates that MOLE was well adsorbed onto the metal surface. Hence, adding KI to the MOLE-containing samples enhanced the inhibitor's adsorption. The SEM-EDX observations supported the findings from electrochemical characterization and confirmed MOLE’s high inhibition performance. Hence, this study suggests that MOLE has promising potential as a green corrosion inhibitor for the API 5L X52 steel in acidic media.