The locality was founded on January 28, 1782 by Vizente de Rivera y Mendoza. Three battles were fought there between 6 and 10 July 1819, during Bolívar's campaign to liberate New Granada.