Treaty of Guayaquil
The Treaty of Guayaquil, officially the Treaty of Peace Between Colombia and Peru, and also known as the Larrea–Gual Treaty after its signatories, was a peace treaty signed between Gran Colombia and Peru in 1829 that officially put an end to the Gran Colombia–Peru War. The treaty called for the removal of troops and the restoration of the status quo ante bellum. Background

On July 3, 1828, Colombia declared war on Peru, after a series of diplomatic incidents that resulted in the expulsion of the diplomatic representatives of both countries. The war ended after the Battle of Tarqui when the Peruvian advance lost momentum, with both parties signing the Girón Agreement on the same day, but later continuing hostilities until the abrupt end of the war after a coup that deposed President José de la Mar. Causes
Traditionally, it has been argued that the cause of the war was territorial, since each of the belligerent countries demanded from the other party the return of territories that they considered theirs:
 Gran Colombia, governed by Bolívar, claimed the territories of Tumbes, Jaén (today in Cajamarca) and Maynas (today the Peruvian departments of Loreto and Amazonas). Peru claimed the Colombian territory of Guayaquil, which it considered unjustly seized by Bolívar in 1822. On July 26, 1822, Bolívar and San Martín met in Guayaquil, one of the results of which was the permanence of said city in the limits of the Real Audiencia of Quito. Bolívar demanded for Gran Colombia the return of Tumbes, Jaén and Maynas, de facto in Peruvian possession. However, when he was dictator in Peru from 1823 to 1826, he never worked in favor of such a return even though he had the power to do so. Rather, he administered these provinces, as head of the executive branch of the Peruvian nation, appointing their governors. Even from a letter from Bolívar himself to Francisco de Paula Santander, dated August 3, 1822, it appears that the Liberator recognized that both Jaén and Maynas legitimately belonged to Peru. The Treaty

With La Mar overthrown, the way was paved for an agreement between Peru and Colombia. General Agustín Gamarra, already provisional president of Peru, gave instructions in this regard. Both parties signed the Piura Armistice on July 10, 1829, by which a 60-day armistice was agreed, as well as the return of Guayaquil to Gran Colombia and the suspension of the Peruvian blockade of the Pacific coast of Gran Colombia, among other agreements. Subsequently, the Peruvian and great Colombian delegates, José de Larrea y Loredo and Pedro Gual, met in Guayaquil. The first agreement they made was to extend the armistice, which had expired. In total they had six meetings, between September 16 and 22, 1829, the day the treaty was signed. Despite not being its focus, the treaty also addressed the territorial dispute between the both states. Articles 6 and 7 provided that a Commission of two people should be appointed for each Republic to go through, rectify and fix the dividing line, work that should begin 40 days after the treaty was ratified by both countries. The drawing of the line would begin in the Tumbes River. In case of disagreement, it would be submitted to arbitration by a government of mutual accord. Aftermath
The signing of the treaty created instability in the region and did not manage to end the dispute between both states, itself complicating further with the latter dissolution of the Gran Colombia and the creation of Ecuador. References

Bibliography
 
 

Territorial disputes of Peru
Territorial disputes of Colombia
1829 in Peru
1829 in Colombia
Colombia–Peru border