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).
[2] During the reign of Emperor Dezong, Wei Zhiyi passed the imperial examinations and was particularly rated highly in the matter of offering strategies.
[2] 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.
When Wei went to the Crown Prince's palace to thank him, Li Song introduced him to a close associate, Wang Shuwen.
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 important decisions were 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.
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.
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.
[4] 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.
[5][6] Wei Zhiyi is buried around 20 km south of Haikou, the capital city of Hainan province.