1823 and 1847 treaties that settled boundary disputes between the Ottoman Empire and Persia
The Treaties of Erzurum were two treaties that were ratified in 1823 and 1847 which settled boundary disputes between the Ottoman Empire and Persia.
First Treaty of 1823.
Throughout history, there has been a constant primary concern of establishing an end to all hostility between the Ottoman Empire and Qajar Persia. Tensions between the two empires had been rising due to the Ottoman Empire's actions of harboring and withholding rebellious tribesmen from the Iranian Azerbaijan Province, which sparked issues with the Kurds. This tension led to an outbreak of wars between the two empires. The Persian also felt that their rights were being violated through unfair treatment by the Ottomans while the Ottomans struggled to view the Persian with respect and were not fond of their eastern neighbors until the Treaties of Erzurum were put in effect. With a goal of reaching a state of tranquility, it was attempted throughout multiple treaties that have all had the same objective in mind of achieving peace dating back to the Treaty of Zuhab in 1639 and leading all the way up to the final Treaty of Erzurum in 1848. Although the Treaty of Zuhab had established the boundary between the Ottoman Empire and Persia, the only clause that was stated in the treaty was that merchants from both realms could pass unharmed and unhampered into the lands of the other. Although, the border in the mountainous Zuhab region remained a site of intermittent conflict in the subsequent two centuries. Over a century later, there were three issues that were still concerning Iranians the most: the levying of unfair taxes on pilgrims, the imposition of the jizya (the head tax on all adult male non-Muslims) on Iranian dhimmis, and the confiscation of the estates of deceased Iranian subjects. Attempting to resolve these issues, the problem was addressed with the Treaty of Kerden in 1746, which affirmed the right of Iranian pilgrims to travel freely and limited the amount of custom duties they could be charged. This treaty, however, did not end the abuse of Iranian Muslims by Ottoman officials which is what led to continuous tension between the two states and what led to Karim Khan Zand invading Ottoman, Iraq in 1776 in attempt to punish the Ottomans for infractions of the treaty. To add on top of that, the Russian Empire was secretly also attempting to put pressure on the Ottoman Empire, who was at war with the Greeks, whom were receiving arms from Russia. At the instigation of the actions of the Russian Empire, Crown Prince Abbas Mirza of Persia, invaded Kurdistan and the areas surrounding Persian Azerbaijan, which led to the commencement of the Ottoman–Persian War.
After the 1821 Battle of Erzurum, resulting in a Persian victory, both empires signed the first Treaty of Erzurum in July 1823, which confirmed the 1639 border. This was composed of 21 leaves, 2 flyleaves, with 11 lines to the page. It was written in nasta'liq ink with the keywords highlighted in red catchwords, margins ruled in gold, and a camel-colored leather binding including an outer hard cover with a ribbon. The treaty had one main primary goal which was to re-establish the state of affairs that existed previously along the troublesome Kurdish frontier, where the Ottoman client state of Baban had just endured a civil war between pro-shah and pro-sultan factions, however the Iranians also wanted to achieve some purely economic objectives in their negotiations. The treaty contained various economic and diplomatic clauses which stated that firstly, Iranian pilgrims would not be subjected to any extraordinary taxes that were ordinary to the Ottoman Empire and that their trade goods would be taxed at a fair and consistent rate. Secondly, the treaty regulated the taxes concerning the pilgrims and for the nomadic tribes pasturing their livestock in the borderlands. There was a specific flat tax rate of 4% that was in direct proportion to the amount of goods that were being transported, which was collected at the first entry point of the merchant, likely Baghdad or Erzurum, or at Istanbul and the money would then be forwarded to Istanbul as part of the province's revenues. There was also the regulation of the taxes concerning the pilgrims and for the nomadic tribes pasturing their livestock in the borderlands. Thirdly, the treaty also allowed for Iranian merchants to freely trade in glass water pipes from Persia to Istanbul. Fourthly, Iranians wanted reforms to be instituted in the ways in which the estates of Iranians who died in the Ottoman Empire were handled. Also included in the treaty, was the guaranteed access for Persian pilgrims to visit holy sites within the Ottoman Empire. This had previously been promised by the 1746 Treaty of Kerden, but those rights had degraded over time. 
With the new Treaty in effect, there was a subtle progression in the way that the Ottomans viewed Persia. There was a shift from sectarian invectives from the 1746 Treaty of Kerden which were not in high favor of the Persian people that were not present in the Treaty of Erzurum. Perhaps the clearest indication of change in the ways that the Ottomans perceived their eastern neighbors was the addition of Iran in 1823 to the list of countries which the bureaucrats at the Porte maintained separate registers of cases involving its citizens who needed state intervention. Although there was no guarantee of extraterritoriality in the treaty, the Ottoman bureaucrats started recognizing Iran as a separate nation whose subjects could call upon the central government for redress if their individual rights had been violated under the treaty - a privilege formerly only offered to European nations. Iran was the first and only Muslim state to achieve this recognition from Istanbul. There was also an agreement that every three years, Persia, as well as the Ottomans would send an envoy to the other country, therefore establishing permanent diplomatic relations with each other.
Second Treaty of 1847.
With the issue of Iranians still being taxed unjustly, and the Porte's fear of never seeing any of the revenue that was being collected on the rise, it instituted a very unwieldy regulation which stipulated that if a merchant would eventually be coming through Istanbul, then taxes would be collected in the capital. In such cases, the customs officers in the border cities were instructed to describe in a written report, but not to tax, all the merchandise being imported. That document would then be given to the merchant who would then present it upon arrival in Istanbul where he would pay the customs duties on the goods. Having this system in place would help insure that both the merchants did not sell their goods along the way and that the central treasury would be able to collect their revenue. However, due to all of the complaints that arose due to the mismanagement of this fiscal solution, it was discovered that Iranian merchants were not only actively trading in their usual destinations such as Baghdad, Aleppo, and Istanbul, but also in the Balkan cities which they were also apparently using as commercial gateways to Europe. After 1830, however, it was discovered that the city from which most of the complaints had originated from was Trabzon. This led to the certainty that trade between Iran and the Ottoman Empire was growing in the second quarter of the nineteenth century and that Iranian subjects, as opposed to Westerners, were its major purveyors.
With the rising border incidents in the 1830s, the Ottoman Empire and Persia found themselves on the brink of war again. European powers Britain and Russia offered to not only mediate, but were also directly involved in its negotiation and drafting of the Treaty, and on May 31,1847, the second Treaty of Erzurum was signed. This treaty consisted of nine articles which exemplified the transplantation of the European model of territorial sovereignty to the Middle East on the wings of European Imperialism. The treaty was the first serious attempt by the two leading powers of the Middle East to divide the disputed region between the two parties and provide for a boundary commission, composed of Ottoman, Persian, Russian, and British representatives, delimiting the entire border. The boundary commission's work encountered several political setbacks but finally completed its task when the two countries agreed to the Constantinople Protocol of November 4, 1913. Once protocols were signed between Iran and the Ottoman state, the evolution of the Iranians into a community with extraterritorial rights received a major boost. In Article 6, it was stated that the tax rate set by the Treaty of Erzurum remained in effect and that no additional charge whatsoever shall be levied over and above the amounts fixed in said Treaty. Although this was not a change in innovation, there was a commercial treaty that was later signed with Great Britain, followed by one in France in which the import rate for Europeans was set at 12%. More significantly, the tax rate for Ottoman subjects was raised to 12% as well. By contrast, the 4% rate for the subjects of the shah was reaffirmed in an order issued on January 4, 1859 which added that another 2% to the proportion of the estimated value of goods could be collected at the time of sale of the goods in the empire. Perhaps the most notable change of all was that the same order stated that Iranians must now be treated the same as the Ottoman Muslims when reiterating their tax rate which was set at a lower rate for the Ottomans. 
Months after the new treaty, an order was received in Aleppo announcing that Khwaja Birz'a was named the shahbandar of Iran and that he was to be treated with the same consideration by city officials that was shown to other consuls of friendly nations. A few years later, officials in a number of other cities including Ankara, and Edirne had received the same orders. Orders named that the Iranian officials in Ottoman cities stated that all cases involving Iranians, criminal or commercial, should be conducted according to the Sharia and that the shahbandar was to be present at the hearings and he could appeal ruling to Istanbul and as important as these changes were, they still did not confer extraterritoriality. Although, the new rulings began giving distinct advantages in the Ottoman legal system to the Iranians and was represented the final shift in the evolution to full extraterritorial status. In the final step to true extraterritoriality, the Iranians had to shift the Ottomans away from the Sharia to secular commercial laws. This final break with the past came with establishment of commercial courts in Istanbul in 1848 which seated both European and Ottoman judges and implemented a distinctly European commercial code. When the Iranians were granted this right, they immediately pushed for the same legal exemptions that the Westerners were given and were finally granted these rights in a treaty that was signed between the two countries in 1875. Fast forwarding to 1877, orders has been received in Aleppo in that stated the rights of Iranians to own property in the Ottoman realms. A similar order established the rights of citizens of the friendly countries including Italy, Austria, Sweden, Denmark, Spain, France, and Britain. This transformation from the geopolitical concept was largely complete and Iran had become just another capitulatory power. This led to the Iranians becoming legally as foreign within the domains of the sultan as the Europeans.
Legacy.
The 1847 treaty was revoked by Iran after World War I and the establishment of the Mandatory Iraq. In the years just before World War I, Britain and Russia made new attempts to push a final settlement on the border, and more particularly on the Shatt al-Arab. On December 21, 1911, a protocol additional to the 1847 Treaty was signed between the two empires at Tehran. The objective of this protocol was to revive Articles 1-3, and the parties accepted that any claims that could not be settled would refer to Article 4. After the compromise was laid down in the Protocol of Constantinople on November 17, 1913, the Ottoman Empire gave up the whole anchorage at Khorramshahr, which was essential for the exploitation of the oil concession that the British were