Pei was a nobleman from Hedong Commandery. His prestigious clan Pei clan of Hedong had contributed numerous politicians to the court in the previous dynasties. Xingjian came from one of the 3 cadet branches of Pei Clan, the Middle house. Xingjian, his brother Xingyan, and his father Renji all served in the military. During the reign of Emperor Taizong of Tang, Xingjian passed the imperial exam. General Su Dingfang saw potentials in Xingjian and personally mentored him. In 665, Pei was appointed the general of Anxi Protectorate. After serving in Anxi for several years, he returned to the imperial court where he collaborated with Li Jingxuan and Ma Zai. In 677, Western Turkic Khan Ashina Duzhi invaded Anxi with his strong forces. At this point of time, Pei asked for the mission of escorting the Persian throne successor Narsieh to his homeland. His strategy was to tackle the affairs of Persia and Turks at the same time. Tang Emperor Gaozong not only granted his wish but also gave him the mission of pacifying the turbulences in Central Asia. During his expedition to the West, he successfully defeated the Turkic forces led by Ashina. However, Pei lost his interests in reinstalling the Persian King and left Narsieh in the Anxi Protectorate alone. Minor Turkic chieftains in the region then pledged their loyalty to the Chinese dynasty due to the defeat of Ashina. The overall result of Pei's expedition was a success for the Tang empire. Upon returning to China, Pei was appointed the minister of rituals and Great general of the right flank guards. In 679, Turkic chieftain Ashide Wenfu rebelled. Protectorate general Xiao Siye, a noble from Lanling Commandery, was defeated by Ashide. Pei then took over the command from Xiao and decisively won a battle against the Turks in an ambush. Ashide fled. Not long after the first defeat, he gathered his troops and united them with the troops of another chieftain Ashina Funian. Pei saw the distrust and suspicions between the two chieftains and exploited this weakness by driving a wedge between them. Eventually, Ashina Funian murdered Ashide Wenfu out of the fear of Tang's revenge against him. When Funian was brought to the Tang court, he was executed regardless of the fact that he surrendered his troops. Pei had promised Ashina that he would not be put to death, however, the court did not respect Pei's promise. Due to this incident, Pei retired himself and felt deep regret. Ashina's death, according to New Book of Tang, was a scheme against Xingjian by his very own clansman Pei Yan who was jealous about his victories in the West. In 682, Pei was again in charge of pacifying yet another Turkic rebellion against the Chinese empire. However, he died of old age before the troops were sent out. The imperial court rewarded him the posthumous name Xian which means "Dedication", as well as the supreme military honorary title Taiwei.
Family
According to his epitaph written by Zhang Yue, Pei had 2 spouses. His first wife was a Xianbei noble from Luoyang. He married his second wife after the first died. His second wife was of Turkic ethnicity. This marital status of Pei made all his children only half Chinese. Pei had 5 sons:
Pei Zhenyin, half Xianbei and the eldest son, died before his father leaving a son, Pei Canyuan.
Pei Chixuan, one of his younger sons. Had a son named Pei Guangdi.