Hasanwayhids or Hasanuyid was a powerful Shia Kurdish dynasty reigning the western parts of Iran such as Iranian Azerbaijan and Zagros Mountains between Shahrizor and Khuzestan from c. 959 to 1015. The last Hasanwayhid ruler died in 1015 in Sarmadj, south of Bisotun, as the Seljuks began entering the region.
The Hasanwayhids were preceded in the region by the Aishanid or 'Ishaniya kurdish tribe. This particular group had ruled territories in the districts of Dinawar, Hamadan and Nahavand.Their emirs Ghanim and Windad (sons of a certain Ahmad) had usurped the rule from the Abbasid caliphate for fifty years, until their death in 960-961.The next generation of Aishani emirs couldn't keep the control of their family castles: Ghānim’s son Daysam was defeated by the Buyid armies, and Windād’s son ʿAbd al-Wahhāb, was taken prisoner by a rival Kurdish group, and handed to the first Hasanwayhid ruler, Hasanwayh. He was a maternal nephew of Ghanim and Windad, and he obtained the castles of their Aishani relatives. 
The name of the dynasty was an eponym to their first ruler Hasanwayh ibn Husayn from the Barzikani tribe. A vassal of the Buyid dynasty, Hasanwayh supported them against the Samanids which enabled him in gaining some power. He would ultimately control much of Lorestan, Dinavar, Nahavand and Hamadan and was powerful to such degree in which the Buyids refrained from disturbing him. The influence of Hasanwayh reached Azerbaijan.
After his death in 979, his son Badr ibn Hasanwayh became ruler and achieved notable gains including imposing order, developing a strong financial administration, building roads and markets in the mountains, securing the safety of pilgrims crossing his territory and striking coins. Like his father, he continued to pledge his allegiance to the Buyids.
Badr ibn Hasanwayh was succeeded by his grandson Zahir in 1014 but only kept power for a year as he was expelled by Buyid Shams al-Dawla and shortly after killed. The Annazids took large parts of its western territory and became their immediate successors. The eastern parts were taken by the Buyids, while the Kakuyids took the southern portions. All of the formerly held Hasanwayhids territory was ultimately taken by Tughril.
- Azakai, Parviz (2017), "آل حسنویه", Center for the Great Islamic Encyclopedia (in Persian)
- Bosworth, C.E. (1996). The New Islamic Dynasties: A Chronological and Genealogical Manual. New York City: Columbia University Press. ISBN 0-231-10714-5.
- Gunter, Michael M. (2010), Historical Dictionary of the Kurds, Scarecrow Press, ISBN 9780810875074
- James, Boris (2019), "Constructing the Realm of the Kurds (al-Mamlaka al-Akradiyya): Kurdish In-betweenness and Mamluk Ethnic Engineering (1130-1340 CE)", Grounded Identities, doi:10.1163/9789004385337_003
- Lane-Poole, Stanley (1894), The Mohammedan Dynasties: Chronological and Genealogical Tables with Historical Introductions, A. Constable and company
- Vanly, Ismet Chériff (1976), "LE DEPLACEMENT DU PAYS KURDE VERS L'OUEST (x e -xv e S.) RECHERCHE HISTORIQUE ET GEOGRAPHIQUE", Rivista degli studi orientali (in French), vol. 50