Wei Zhiyi (韋執誼) was an official of the Chinese dynasty Tang Dynasty, serving briefly as chancellor in 805, during the brief reign of Emperor Shunzong and then briefly into the reign of Emperor Shunzong's son Emperor Xianzong. He came to power due to his association with Emperor Shunzong's close associate Wang Shuwen but later broke with Wang; he was nevertheless exiled once Emperor Xianzong became emperor due to his prior association with Wang and died in exile.
It is not known when Wei Zhiyi was born, but it is known that his family was from Jingzhao Municipality (京兆, i.e., the region of the Tang Dynasty capital Chang'an). HIs family traced its ancestry to a line of officials of Han Dynasty, Northern Zhou, and Tang Dynasty. HIs grandfather Wei Zhongchang (韋仲昌) served as a deputy mayor of Jingzhao, and his father Wei Mei (韋浼) served as a prefectural prefect. Wei Zhiyi himself was said to be handsome and talented in his youth.
During Emperor Dezong's reign
During the reign of Emperor Dezong, Wei Zhiyi passed the imperial examinations and was particularly rated highly in the matter of offering strategies. He was made You Shiyi (右拾遺), a low-level consultant at the examination bureau (門下省, Menxia Sheng), and was subsequently made an imperial scholar (翰林學士, Hanlin Xueshi). At that time, he was in his 20s, and he was particularly favored by Emperor Dezong, who favored his writing; they often wrote poems that responded to each other. He became a part of a group of officials who were favored by Emperor Dezong — Pei Yanling, Li Qiyun (李齊運), Wang Shao (王紹), Li Shi (李實), Wei Qumou (韋渠牟), and Wei Zhiyi himself and had easy access to the palace.
On one occasion, on Emperor Dezong's birth, Emperor Dezong's son and crown prince Li Song offered a Buddharupa as a birthday gift to Emperor Dezong. Emperor Dezong had Wei Zhiyi write a text praising the statue, and under Emperor Dezong's direction, Li Song in turn gave Wei a gift of linen. When Wei went to the Crown Prince's palace to thank him, Li Song introduced him to a close associate, Wang Shuwen. Thereafter, Wei and Wang became friends. Later, Wei's mother died and he left governmental service to observe a mourning period for her. After the mourning period was over, he returned to government service to serve as a supervisorial official.
In 803, there was an occasion when an official, Zhang Zhengyi (張正一) had offered suggestions to Emperor Dezong and received an audience with the emperor. Several of his colleagues visited him to congratulate him on this showing of imperial favor. Someone, however, informed Wei that Zhang was criticizing his association with Wang. Wei believed the informant and accused Zhang and his colleagues of partisanship. When Emperor Dezong sent an imperial guard to spy on Zhang and his colleagues, the guard saw that Zhang and his colleagues were feasting beyond their usual proper diet. As a result, Emperor Dezong exiled them, but at that time, no public reason was stated.
During Emperor Shunzong's and Emperor Xianzong's reigns
In spring 805, Emperor Dezong died, and Li Song succeeded him (as Emperor Shunzong). At that time, Li Song was seriously ill, and a group of his close associates, headed by Wang Shuwen and Wang Pi, in association with his concubine Consort Niu and the eunuch Li Zhongyan (李忠言), became very powerful. Wang Shuwen, in order that his reform policies could be carried out, recommended Wei as chancellor. Shortly thereafter, Emperor Shunzong made Wei, who was then Libu Langzhong (吏部郎中), a supervisorial official at the ministry of civil service affairs (吏部, Libu), was promoted to be Shangshu Zuo Cheng (尚書左丞), one of the secretaries general of the executive bureau (尚書省, Shangshu Sheng) and given the designation Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事), making him a chancellor. It was said that when there important decisions to be made, they would be given to Wang Shuwen to be decided at the office of the imperial scholars (翰林院, Hanlin Yuan) and then given to Wei to be executed. On an occasion, when the chancellors, as per custom, were having lunch together, Wang wanted to see Wei and went to the office of the chancellors to do so. When a guard refused to let Wang in, Wang rebuked the guard and ordered him away. Wei rose from his seat and walked away to confer with Wang. Wei's colleagues Zheng Xunyu, Du You, and Gao Ying stopped dining and waited for Wei to return. After a while, they sent the guard to see what the situation was, and the guard stated, "Wang Shuwen had requested food, and Chancellor Wei is dining with him." Neither Du nor Gao dared to say anything, but Zheng stated, "How can I remain here still?" He had his attendants fetch horses, and he went home and refused to return to office.
Meanwhile, as a result of Wei's rise to power, his father-in-law Du Huangshang, who had been trapped in positions with few actual powers, was made the minister of worship. On one occasion, Du Huangshang suggested that Wei lead some other officials in suggesting that Emperor Shunzong make his crown prince Li Chun regent. Wei refused, as his and Wang Shuwen's partisans at the time were apprehensive of Li Chun.
Around this time, however, Wei and Wang began to break with each other, as Wei wanted not to be seen as a puppet of Wang's. For example, when Yang Shi'e (羊士諤), a messenger from Xuanshe Circuit (宣歙, headquartered in modern Xuancheng, Anhui), and Liu Pi, a messenger from Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan), made demands on behalf of their superiors, Wang angrily wanted to execute both of them, but Wei opposed, and Yang was only exiled, while Liu fled back to Xichuan. Wei further threw himself off Wang's policies when Wang had to leave governmental service to observe a mourning period for his mother in summer 805. With several important eunuchs (including Ju Wenzhen (俱文珍) and Liu Guangqi (劉光琦), in addition to Li Zhongyan) then in control of the very ill Emperor Shunzong, Wang Shuwen's party lost power quickly. Soon thereafter, Emperor Shunzong passed the throne to Li Chun, who took the throne as Emperor Xianzong, and thereafter, all associates of Wang Shuwen's were purged, and Wang Shuwen himself was soon thereafter ordered to commit suicide.
Wei remained as chancellor for some time, and in fall 805, as the official in charge of editing the imperial history, had his subordinates draft a new calendar. By this point, though, he was constantly in fear of being exiled. Emperor Xianzong, who made Du Huangshang chancellor, did not immediately carry out any actions against Wei on Du's account, but in winter 805 demoted him to be the military advisor to the prefect of Yai Prefecture (崖州, in modern Sanya, Hainan). Wei died there of natural causes — as while Du was unable to save him from exile, Du made certain that he was not prosecuted further. After Wei's death, Du requested Emperor Xianzong to allow his casket to be returned, and Du gave him a proper burial.