Hasanawayhid or Hasanuyid (Arabic: حسنویه, Kurdish: Dewleta Hesnewiyan) was a Kurdish principality from 961 to 1015, centered at Dinawar (northeast of present-day Kermanshah). The principality ruled western Iran and upper Mesopotamia. The founder of the dynasty was Hasanwayh from the Kurdish tribe of Barzikani. He managed to successfully resist Sahlan ibn Musafir, the Buyid governor of Hamadan, and the Buyid vizier, Ibn al-Amid. In 970 he reached a compromise with Amid's successor which guaranteed his autonomy. Hasanwayh died in 979 at Sarmaj, located in south of Bisitun.
After Hasanwayh's death, conflict broke out between several of his sons. The intervention of Buyid Mu'ayyad al-Dawla of Ray led to defeat of Fakhr al-Dawla, one of Hasanwayh's sons. Then another heir, Badr ibn Hasanwayh (also known as Abu'l-Najm and Nasir al-Dawla), was installed as the leader of Bazikani Kurds, and the principality became a vassal of the Buyids. Badr expanded Hasanwayhid control to Shapur-Khwast, Dinawar, Nahavand, Asadabad, Borujerd, Ahwaz, Ilam, Kermanshah, Hulwan and Sharazur (Kirkuk).