|Prince Shao of Wei|
|Emperor of the Jin dynasty|
|Reign||29 December 1208 – 11 September 1213|
|Died||11 September 1213|
Princess of Qi
|Prince Shao of Wei|
Wanyan Yongji (died 11 September 1213), courtesy name Xingsheng, was the seventh emperor of the Jurchen-led Jin dynasty, which ruled northern China between the 12th and 13th centuries. He reigned for about five years from 1208 until 1213, when he was assassinated by the general Heshilie Zhizhong. Despite having ruled as an emperor, Wanyan Yongji was not posthumously honoured as an emperor. Instead, in 1216, his successor, Emperor Xuanzong, reverted his status back to "Prince of Wei" (衛王) – the title Wanyan Yongji held before he became emperor – and gave him the posthumous name "Shao" (紹), hence Wanyan Yongji is historically referred to as "Prince Shao of Wei" (or Wei Shao Wang).
Wanyan Yongji's birth name was "Wanyan Yunji" (完顏允濟); his given name was changed to "Yongji" later to avoid naming taboo because Emperor Zhangzong's father was Wanyan Yungong (完顏允恭). He was the seventh son of Wanyan Yong (Emperor Shizong) and an uncle of Wanyan Jing (Emperor Zhangzong). His mother was Lady Li, a concubine of Emperor Shizong. In 1171, he was given the title "Prince of Xue" (薛王) but was later changed to "Prince of Sui" (禭王). His princely title had subsequently been changed to "Prince of Lu" (潞王), then "Prince of Han" (韓王), and finally "Prince of Wei" (衛王). When Emperor Zhangzong died without a male heir in 1208, Wanyan Yongji was selected to be the new emperor.
During Wanyan Yongji's reign, the Mongols, under the leadership of Genghis Khan, had been planning to attack the Jin dynasty. The Mongols first attacked Western Xia, a vassal state under the Jin dynasty. When Western Xia requested aid from the Jin dynasty, Wanyan Yongji ignored them; Western Xia eventually surrendered to the Mongols. In 1211, the Mongols launched a full-scale invasion of the Jin dynasty and defeated the Jin armies in some small battles. In the ninth month, the Mongols besieged the Jin central capital, Zhongdu (中都; present-day Xicheng and Fengtai districts of Beijing), but were forced to retreat because of Zhongdu's strong defences. In 1212, the Mongols attacked the Jin dynasty and besieged the Jin western capital, Datong Prefecture (大同府; present-day Datong, Shanxi Province). In the same year, Yelü Liuge (耶律留哥), a Khitan, led a rebellion against the Jin dynasty in Jilin Province. The rebel movement gained thousands of followers within months. Yelü Liuge submitted to the Mongols and led the rebels to defeat a 600,000-strong Jin army in Dijinao'er (迪吉腦兒; near present-day Changtu County, Liaoning Province).
Wanyan Yongji was known for being indecisive, undiscerning, and generally ineffective and weak as a ruler. In the eighth month of 1213, when the Mongols attacked Zhongdu again, the general Heshilie Zhizhong (紇石烈執中; also known as Hushahu 胡沙虎) rebelled against Wanyan Yongji and assassinated him. In the following month, Hushahu installed Wanyan Xun (Emperor Xuanzong) on the throne to replace Wanyan Yongji. He also gathered about 300 officials to support him and openly urged Emperor Xuanzong to posthumously demote Wanyan Yongji to the status of a commoner. Eventually, as a compromise between Hushahu's faction and another opposing faction, Emperor Xuanzong agreed to posthumously demote Wanyan Yongji to the position of "Marquis of Donghai Commandery" (東海郡侯). One month later, Hushahu was assassinated by another general, Zhuhu Gaoqi (朮虎高琪).
In 1216, Emperor Xuanzong posthumously restored Wanyan Yongji to the status of "Prince of Wei" (衛王) – the title Wanyan Yongji held before he became emperor – and gave him the posthumous name "Shao" (紹), hence Wanyan Yongji is historically referred to as "Prince Shao of Wei" (衛紹王) even though he ruled as an emperor in his lifetime.
- Father: Emperor Shizong
- Mother: Empress Guangxian (光獻皇后)
- Lady Tushan (徒單氏), posthumously honoured as the Princess Consort of Wei (衛王后)
- Lady Yuan (袁氏), posthumously honoured as Lady Qinsheng (欽聖夫人), bore the Princess of Qi