The Hanlinyuan 翰林院 "Hanlin Academy" (literally: Brush Forest Court) was an institution subordinated to the central government and entrusted with the draft of official documents. It was never consistently organised but was loosely staffed with so-called academicians (Hanlin xueshi 翰林學士). The first literati entrusted with the task to draft official proclamations were sent to the Academy during the reign of Emperor Xuanzong 唐玄宗 (r. 712-755) of the Tang dynasty 唐 (618-907). From then on the Hanlin Academy became a fixed institution of the imperial central government. The academicians had various disciplinary backgrounds. Some were poets, others experts in the Confucian Classics, some others were actually experts of Daoist techniques (e.g. prognostication or rituals) or in Buddhist writings, and there were also experts in divination and calligraphy.
Those most highly regarded of the academicians were literati because they were able to write in refined and polished language. Normally the task to draft edicts was carried out by officials in the Palace Secretariat (zhongshusheng 中書省), but especially in the early Tang period, academicians from the North Gate (Beimen 北門) were entrusted with the draft of edicts. Emperor Xuanzong wanted to entrust this important task to real experts and therefore ordered Zhang Yue 張說 (663-730), Zhang Jiuling 張九齡 (673-740), and Xu Anzhen 徐安貞 (dates unknown) to assign trustworthy experts in literature as Hanlin academicians. The Academy was located within the palace compound west of the Linde Hall 麟德宮 and thus located closer to the imperial lodge than the Secretariat.
In 738, a new building was constructed where the academicians had to live, the Hanlin xueshi yuan 翰林學士院. At the same time the title of academician was institutionalized. An additional title was gongfeng 供奉 "for court service" or daizhao 待詔 "editorial assistant". The exact number of academicians of that time is not known, but it must have been considerable: In 805, Emperor Shunzong 唐順宗 (r. 805) dismissed all diviners, chess masters and physicians from the Academy, numbering 32 persons. The old Institute of Academicians (xueshiyuan 學士院) lived on in the old place.
The title of "academician" (xueshi 學士) was a term for duty assignment (chaiqian 差遣) to special posts, and not only for the Hanlin Academy. There were various institutions of the central government in need of experts as the academicians were. Such were the Institute for the Advancement of Literature (Hongwenguan 弘文館), the Institute for the Veneration of Worthies (Chongxianguan 崇賢館) or the Academy of Scholary Worthies (Jixianyuan 集賢院). For this reason there was actually no fixed number of offices to be filled, and the academicians appointed to the Academy were not attributed a defined official rank. Each of them brought with him the rank of the previous office and was paid his salary according to the former position. Members of the Secretariat could also be assigned to the Academy. Only somewhat later, a number of six academicians was fixed, with one of them acting as "recipient of edicts" (chengzhi 承旨). During the rebellion of An Lushan 安祿山 (703-757), the position of the Hanlin academicians greatly improved, and some of them were not only used to do the paperwork but were also consulted in political matters by the emperor. During the reign of Emperor Dezong 唐德宗 (r. 779-804), academician Lu Zhi 陸贄 (754-805) had such a high influence on political decisions that he was called the "inner Counsellor-in-chief" (neixiang 内相).
The Hanlin Academy and the Imperial Secretariat divided their work among each other. The former mainly took over the draft of important documents about the appointment or dismissal of counsellors-in-chief and other high ministers, the proclamation of amnesties, and imperial commands during military campaigns. These documents of "inner regulation" (neizhi 内制) were written on white hemp paper and were therefore called baima 白麻. The Secretariat took over the draft of documents of minor importance, the so-called "outer regulations" (waizhi 外制). These documents were written on yellow hemp paper and therefore called huangma 黃麻. Some academicians were entrusted with the task of helping the emperor reading or writing documents. These were called academician reader-in-waiting (shidu xueshi 侍讀學士) resp. *academician calligrapher-in-waiting (shishu xueshi 侍書學士). The position of the Hanlin academicians became so powerful that Emperor Jingzong 唐敬宗 (r. 824-826) once planned to replace this institution by a new one. Later on, there were even academic commissioners (yuanshi 院使) appointed to mediate between the Academy and the emperor. For a short time in the 940s, the task of drafting all documents was shifted back to the Secretariat.
The Song dynasty 宋 (960-1279) continued the institution of the Hanlin Academy without changing the duties of the six academicians. At some times a seventh, supernumerary academician (yuanwai xueshi 員外學士) could be assigned. As during the Tang period, many an academician rose to a high position, and some counsellors-in-chief were selected from among their ranks. Academicians could be assigned to other duties in various central government agencies, and then obtained the additional title of "drafter" (zhi zhigao 知制誥). After the government reform of the Xianfeng reign-period 元豐 (1078-1085), the position of Hanlin academician became a fixed position, with the official rank 3A.
From then on, all drafters were Hanlin academicians, and vice versa. The number of academicians was fixed at two. If any additional persons were entrusted with the draft of edicts, they were given the designation of auxiliary Hanlin academician (zhi xueshi yuan 直學士院, short zhiyuan 直院)．Auxiliary academicians assigned in case of a vacancy of the two full academicians were called provisional auxilary Hanlin academicians (quan zhi xueshi yuan 權直學士院, shortly quanzhi 權直), and if their original official rank was higher than 3A, the title was provisional Hanlin academician (quan Hanlin xueshi 權翰林學士)．The term Hanlinyuan was during the Song period often used for the institute of academicians (xueshiyuan). To make matter even more complicated, there was an Artisans Institute of the Palace Domestic Service called Hanlinyuan.
During the Yuan period 元 (1279-1368), the Hanlin Academy was retained, but there was also a Mongolian Hanlin Academy (Menggu Hanlin yuan 蒙古翰林院) entrusted with the translation of documents. The task to supervise imperially sponsored publications, especially the dynastic histories, became an ever more important aspect of the Hanlin Academy.
The structure of the Hanlin Academy became more complex from the Ming period 明 (1368-1644) on. At the head of the institution was a Chancellor of the Hanlin Academy (Zhangyuan xueshi 掌院學士, rank 5A) supervising an academician expositor-in-waiting (shijiang xueshi 侍講學士, rank 6A), an academician reader-in-waiting (shidu xueshi, rank 6A), and an hereditary erudite of the Five Classics (shixi wujing boshi 世襲五經博士, rank 8A), as well as several Hanlin bachelors of the Six Offices of Scrutiny (liuke shujishi 六科庶吉士, cooperating with the Six Ministries) with or without an official rank. Although the official rank of the academicians was not very high, a post in the Academy could serve as a booster for further career. Academicians were, furthermore, allowed to enter the Wenyuan Hall 文淵閣 to consult secret documents.
The number of academicians increased considerably under the Qing dynasty 清 (1644-1911). There were two Chancellors (rank 5A), a Manchu and a Chinese, selected from among the grand academicians (daxueshi 大學士), the ministers of the Six Ministries (liubu shangshu 六部尚書) and the vice ministers (shilang 侍郎). There were six readers-in-waiting (rank 5B) and six expositors-in-waiting (rank 5B), half staffed by Manchus and half by Chinese; an hereditary erudite of the Court of Imperial Sacrifices (Shengyi taichangsi boshi 聖裔太常寺博士, rank 7A), a position inheritable to the descendants of the third son of Duke Yansheng 衍聖公, a descendant of Confucius; an hereditary erudite of the Five Classics (rank 8A), and Hanlin bachelors of the six offices of scrutiny.
The high positions of the Qing-period Hanlin academicians were not occupied by professional drafters, but were mere honorific posts often occupied by persons concurrently acting in another position. The persons occupying the hereditary positions were also not entrusted with the drafting of documents, but instead had to supervise the administration of the national Confucius temples and those of the Song-period Neo-Confucian scholar Zhu Xi 朱熹 (1130-1200). The official posts in the Hanlin Academy were thus only vain titles, but titles of high regard. Once obtaining such a title, it would be easy to rise into higher positions in the central government. Persons occupying the lower ranks of the Hanlin Academy were often assigned to positions concurrently serving in the Southern Study (nanshufang xingzou 南書房行走) and thus had easily access to the emperor or the crown prince and had insight and perhaps even influence on the daily business, or were at least highly estimated by outsiders.