Polyaniline (PAni) thin films are deposited by the electrochemical method and are also doped with Keggin type 12-tungstophosphoric acid (TPA). The doped films (PAniTPA) show a blue shift in the FTIR peaks at 1490, 1305, and 805 cm −1. The UV–vis spectra suggest that the PAni is in the emaraldine salt form. The Tauc plot gives an optical band gap energy of 1.68 (2) eV for PAni and 1.41 (1) eV for PAniTPA and the decrease is attributable to the presence of dopant TPA. The XRD studies of as-prepared and annealed (373 K) films reveal that both PAni and PAniTPA are amorphous in nature. Arrhenius type behaviour is observed when conductivity is plotted against temperature both for PAni and PAniTPA with low activation energies, which confirm the conduction due to polarons. The agglomeration of aggregated TPA is observed in the SEM images of PAniTPA annealed at 373 K. The sensor behaviour of the thin films on exposure to acetone vapor indicates the physical adsorption of acetone on the polymer matrix with a fast recovery of the film on re-exposure to air. A better sensitivity to acetone vapor is observed with PAniTPA than PAni films.