Khāqānī, born Afzal al-Dīn Badīl ibn ʿAlī ibn ʿOthmān around the year 1120, emerged as a prominent figure in Persian literature. Hailing from Shirvanshah, a region under the influence of the Seljuks, he dedicated his life to the art of poetry and prose, serving as an ode-writer for the Shirvanshahs.
His literary legacy is most notably encapsulated in his Divān, a collection of qasidas that showcases his mastery of the poetic form. Khāqānī's work is characterized by its rich imagery and profound themes, which have earned him a lasting place in the canon of Persian poetry.
In addition to his poetry, Khāqānī is recognized for his autobiographical travelogue, Tohfat al-ʿErāqayn, which provides insight into his experiences and reflections during his journeys. His contributions to the genre of habsiyāt, or prison poetry, further highlight his versatility and depth as a writer.