The Zongli yamen 總理衙門, full title Zongli geguo shiwu yamen 總理各國事務衙門, short zongshu 總署 (Manchu name ᡤᡝᡵᡝᠨ ᡤᡠᡵᡠᠨ ᡳ ᠪᠠᡳᡨᠠ ᠪᡝ ᡠᡥᡝᡵᡳᠯᡝᠮᡝ ᡳᠴᡳᡥᡳᠶᠠᡵᠠ ᠶᠠᠮᡠᠨ Geren gurun i baita be uherileme icihiyara yamun), was the Ministry of Foreign Affairs during the late Qing period 清 (1644-1912). It managed the dispatch of diplomats, supervised foreign trade, coastal defence, customs and customs revenues, railroads and mining, telecommunications, military labour, the Court of Colonial Affairs (lifanyuan 理藩院, also called tongwensi 同文寺), as well as the emission of students abroad.
After signing the Treaty of Nanjing in 1842 it became more important to establish diplomatic relations with Western nations, and so in 1861 Prince Ihin (Yixin 奕訢, in the West known as Prince Gong 恭忠親王, 1833-1898), Grand Secretary (daxueshi 大學士) Guiliyang (Guiliang 桂良, 1785-1862) and Left Vice Minister of Revenue (hubu zuo shilang 戶部左侍郎) Wensiyang (Wenxiang 文祥, 1818-1876) submitted a memorial to the throne suggesting that a Foreign Office might be founded in Beijing. This Office might cooperate with the Ministry of Rites (libu 禮部) and the Court of Colonial Affairs (lifanyuan 理藩院) which had until then served as a kind of foreign office for relations with the Mongols and Tibet.
The Foreign Office was founded in March 1862. The staff of the Foreign Office was composed of princes or Grand Ministers of the Council of State (junjichu 軍機處). Its structure imitated that of the Council of State, was headed by one or more Grand Ministers of the Foreign Office (zongli dachen 總理大臣), Expectant Grand Ministers (zongli dachen shang xingzou 總理大臣上行走), Trainee Expectant Grand Ministers (zongli dachen shang xuexi xingzou 總理大臣上學習行走) and Grand Ministers Superintendents (banshi dachen 辦事大臣). The number of Grand Ministers ranged between 3 in the beginning and 10 in later times.
Prince Ihin alone headed the Foreign Office for 28 years and was therefore the most important person foreign diplomats had to deal with. The Grand Ministers had a broad staff of secretaries (zhangjing 章京, siyuan 司員 or siguan 司官), namely four administrative secretaries (zongban zhangjing 縂辦章京), two Manchus and two Chinese, two assistant secretaries (bangban zhangjing 幫辦章京), one Manchu and one Chinese, twenty ordinary secretaries (zhangjing) and an undefined number of supernumerary secretaries (ewai zhangjing 額外章京). Below the level of secretaries, there were many hired employees (gongshi 供事).
The Foreign Office was divided into sections bearing the name of a foreign country, yet each of these sections was also responsible for other countries and a specialized matter concerning foreign affairs. The British Section (Yingguo gu 英國股) was also responsible for Austria-Hungary, international trade, and customs revenues.
The French Section (Faguo gu 法國股) was also responsible for the Netherlands, Spain and Brasil (i.e. Portugal, whose kings lived in exile), matters of religion and missionary activities, and Vietnam.
The Russian Section (Eguo gu 俄國股) also managed affairs concerning Japan and international trade by surface, border affairs, diplomatic protocol, and the staff and financial matters of the Foreign Office.
The American Section (Meiguo gu 美國股) was also responsible for Germany (since 1871), Peru, Italy, Sweden, Norway, Belgium, Denmark and Portugal and the management of trade harbour facilities (Huagong shiwu 華工事務).
The Maritime Defence Section (haifang gu 海防股) also managed the Yangtze River Patrol (Changjiang shuishi 長江水師), the North Ocean Navy (beiyang haijun 北洋海軍), the maritime fortresses along the coast, dockyards, and the purchase of steamships and weaponry from abroad and domestic production of machinery, as well as telegraph facilites, railroads, and mining. After the Sino-Japanese war of 1895 the Section was renamed the Japanese Section (Riben gu 日本股).
The General Services Office or Chancery (siwuting 司務廳) was responsible for diplomatic documents. There were also a house archive (qingdangfang 清檔房), a telegraph bureau (dianbaochu 電報處), the silver vault (yinku 銀庫), the College of Languages (tongwenguan 同文館), and the Bureau of Customs Revenues (haiguan zongshui siwu 海關縂稅務司).
The Three Trade Port Grand Ministers (sankou tongshang dachen 三口通商大臣) resided in Tianjin 天津 to oversee the trade in Tianjin, Niuzhuang 牛莊 (Yingkou 營口) and Dengzhou 鄧州 (Yantai 煙臺). In 1870 their title and responsibility was changed to Superintendent of Trade for the Northern Ports (beiyang tongshang dachen 北洋通商大臣) and they managed international trade and maritime defence of the provinces of Zhili 直隸 (Hebei), Shandong and Fengtian 奉天 (Liaoning). At the same time the Grand Ministers managing the five treaty ports Guangzhou 廣州 (i.e. Canton), Xiamen 廈門 (Fujian), Fuzhou 福州 (Fujian), Ningbo 寧波 (Zhejiang), and Shanghai 上海 were integrated into the Foreign Office as Superintendents of Trade for the Southern Ports (Nanyang tongshang dachen 南洋通商大臣), side by side with the Grand Ministers supervising trade in the northeastern ports. From then on they were resonsible for trade matters with all South East Asian countries and the trade ports along the Yangtze River.
In 1901, when the Boxer Protocol was signed, the Foreign Office (zongli yamen) was changed into a Ministry of Foreign Affairs (waiwubu 外務部). This Ministry was elevated to the same level as tradional Six Ministries (liubu 六部). It was divided into five sections for diplomatic relations with Russia, France, Great Britain, Japan and Germany. The technical work was done by four offices, the Department of Intercourse (hehuisi 和會司), the Department of Technical Affairs (kaogongsi 考工司), the Department of Accounts (quesuansi 榷算司), and the Department of General Affairs (shuwusi 庶務司). The General Services Office or Chancery (siwuting) remained intact.