The investigation of pulsars between millimetre and optical wavelengths is challenging due to the faintness of the pulsar signals and the relative low sensitivity of the available facilities compared to 100-m class telescopes operating in the centimetre band. The Kinetic Inductance Detector (KID) technology offers large instantaneous bandwidths and a high sensitivity that can help to substantially increase the ability of existing observatories at short wavelengths to detect pulsars and transient emission. To investigate the feasibility of detecting pulsars with KIDs, we observed the anomalous X-ray pulsar XTE J1810-197 with the New IRAM KIDs Array-2 (NIKA2) camera installed at the IRAM 30-m Telescope in Spain. We detected the pulsations from the pulsar with NIKA2 at its two operating frequency bands, 150 and 260 GHz ($lambda$=2.0 and 1.15 mm, respectively). This is the first time that a pulsar is detected with a receiver based on KID technology in the millimetre band. In addition, this is the first report of short millimetre emission from XTE J1810-197 after its reactivation in December 2018, and it is the first time that the source is detected at 260 GHz, which gives us new insights into the radio emission process of the star.