Abbasid Revolution Their stay at the Umayyad court was not long, and both Barmak and Khalid soon returned to Khurasan. At some point, Barmak went to
Gurgan, where he arranged Khalid's marriage to a daughter of
Yazid ibn Bara. Barmak disappears from the record after 725/6, but it is implied that he was responsible for Khalid's joining the
Hashimiyya movement in Khurasan. Khalid had joined the Hashimiyya by 742, and, as one of the few non-Arabs, was appointed one of the twenty , the second tier of the inner leadership. In the guise of a cattle merchant, he engaged in missionary activity () in Gurgan,
Tabaristan, and
Rayy. During the
Abbasid Revolution, he played an active role, gathering funds from
Shi'a sympathizers, leading troops in the field, and being entrusted by the Abbasid commander
Qahtaba ibn Shabib al-Ta'i with distributing the plunder to his army. According to the 10th-century historian
al-Jahshiyari, Khalid was placed in charge of redistributing the land tax () of Khurasan by
Abu Muslim, and did so with such fairness that he earned the gratitude of the Khurasanis.
Under al-Saffah 's
Tarikhnama After the establishment of the
Abbasid Caliphate, Khalid won the favour of Caliph
al-Saffah (). Khalid was soon placed in charge of the fiscal departments of the land tax () and of the army (), posts that he kept for the duration of al-Saffah's caliphate. In short order, he reportedly assumed the supervision of all fiscal departments, thus becoming a kind of chief minister; although often given the title of '
vizier' in historical sources, he never actually held it. He is credited with introducing the practice of keeping records in codices, rather than loose sheets as was the custom until then. Khalid apparently benefited from a substantial education, and some previous administrative experience, although the origin of the latter is unknown; he may have acquired it at the Umayyad court, or alongside his father at Balkh. His eloquence was such that al-Saffah initially mistook him for an Arab. His relationship with the caliph was very close: his daughter Umm Yahya was suckled by al-Saffah's wife, while in turn his own wife was made the foster-mother to al-Saffah's daughter, Raytah.
Under al-Mansur Khalid remained head of the land tax department for at least a year into the reign of
al-Mansur (), but court intrigues instigated by the vizier
Abu Ayyub al-Muryani meant that he was soon relegated to the provincial government of
Fars, which he headed for about two years. His tenure there was successful, restoring order by expelling rebellious
Kurds from the province, and governing with wisdom and generosity. According to a well-known, but likely fabricated, story, he persuaded the caliph to not destroy the Sassanid-era palace of
Taq Kasra at
Ctesiphon, arguing that its ruined state was a testament to the superiority of Islam. In 764/65, he was involved in the intrigues that resulted in
Isa ibn Musa's renunciation of succession to the caliphate. Khalid then spent about seven years as governor of
Tabaristan; coins with his name, in the
Arab–Sassanid style, are known from 766/67–772. Succeeding the tyrannical
Rawh ibn Hatim, his tenure was successful: he maintained friendly relations with the local autonomous ruler,
Wandad Hurmuzd, captured the fortress of Ustunavand near
Damavand, founded the town of al-Mansura, and was well liked by the local inhabitants. However, his attempts to spread Islam were quickly undone after his departure, and the settlements he founded were destroyed by the
Bavandid ruler
Sharwin I. Around the same time, Khalid's grandson,
al-Fadl ibn Yahya, was made foster-brother of one of the sons of Caliph
al-Mahdi (), the future
Harun al-Rashid (). In 775, shortly before al-Mansur died, Khalid fell out of favour for some unknown reason, and was obliged to pay a heavy fine of three million
dirhams, within a short notice. He was saved only by his network of friends at court, who were visited by his son,
Yahya ibn Khalid, and surreptitiously forwarded him the necessary sums. But following Kurdish uprisings in
Mosul, Khalid was pardoned and appointed governor of the city. His restoration to favour probably was also the result of the rapidly rising fortunes of Yahya, who was by then one of the chief figures of the Abbasid government.
Under al-Mahdi When al-Mahdi came to the throne, Khalid was appointed again to govern Fars, where he distinguished himself for redistributing the land tax and abolishing an onerous tax on orchards. At the same time, he was given the area of Shammasiya in East Baghdad as his fief. There the Barmakids built their palaces, and Khalid's name survived for centuries in the 'Market of Khalid the Barmakid'. Around 778, Yahya was appointed as tutor to the prince Harun. In 780, Khalid and his son Yahya distinguished themselves at the siege of the
Byzantine fortress Samalu, an expedition which was led by Harun under the auspices of Yahya. He died shortly after, in 781/82, at about 75 years of age. Of his sons, Yahya became an all-powerful vizier under Harun al-Rashid, while
Muhammad became Harun al-Rashid's chamberlain and served as a provincial governor. Likewise, Yahya's sons enjoyed high offices, until the abrupt, and still poorly understood, fall of the family in 803. ==Family tree==