Water, renowned for its sustainability and minimal toxicity, is an ideal candidate for environmentally friendly solvent-based microextraction. However, its potential as an extractant solvent in miniaturized sample preparation remains largely unexplored. This paper pioneers using water as the extraction solvent in headspace single-drop microextraction (HS-SDME) for N-nitrosamines from losartan tablets. Autonomous HS-SDME is executed by an Arduino-controlled, lab-made Cartesian robot, using water for the online preconcentration of enriched extracts through direct injection into a column-switching system. Critical experimental parameters influencing HS-SDME performance are systematically explored through univariate and multivariate experiments. While most previously reported methods for determining N-nitrosamines in pharmaceutical formulations rely on highly selective mass spectrometry detection techniques to handle the strong matrix effects typical of pharmaceutical samples, the water-based HS-SDME method efficiently eliminates the interfering effects of a large amount of the pharmaceutical active ingredient and tablet excipients, allowing straightforward analysis using high-performance liquid chromatography with ultraviolet detection (HPLC-UV-Vis). Under optimized conditions, the developed method exhibits linear responses from 100 to 2400ngg-1, demonstrating appropriate detectability, precision, and accuracy for the proposed application. Additionally, the environmental sustainability of the method is assessed using the AGREEprep methodology, positioning it as an outstanding green alternative for determining hazardous contaminants in pharmaceutical products.