The A-polynomial of a knot is defined in terms of \(\textrm{SL}(2,\mathbb {C})\) representations of the knot group, and encodes information about essential surfaces in the knot complement. In 2005, Dunfield–Garoufalidis and Boyer–Zhang proved that it detects the unknot using Kronheimer–Mrowka’s work on the Property P conjecture. Here we use more recent results from instanton Floer homology to prove that a version of the A-polynomial detects whether a knot is a torus knot. We moreover completely determine which individual torus knots are detected by this A-polynomial. These results enable progress towards a folklore conjecture about boundary slopes of non-torus knots. Finally, we use similar ideas to prove that a knot in the 3-sphere admits infinitely many \(\textrm{SL}(2,\mathbb {C})\) -abelian Dehn surgeries if and only if it is a torus knot, affirming a variant of a conjecture due to Sivek–Zentner.