structural:reformatting, stylistic:tone
Viceregal era: 1717–1811

The 18th century began poorly for the city economically, as the Bourbon dynasty discontinued the Carrera de Indias convoys. However, with the establishment of the Viceroyalty of New Granada and the constant Anglo-Spanish conflicts, Cartagena took on the stronghold as the "gateway to the Indies of Peru". By 1777, the city included 13,700 inhabitants with a garrison of 1300. The population reached 17,600 in 1809.

In 1731, Juan de Herrera y Sotomayor founded the Military Academy of Mathematics and Practice of Fortifications in Cartagena. He is also known for designing the Puerta del Reloj starting in 1704.