Ṣafwān ibn Idrīs or Abū Baḥr al-Tujībī (1164/6–1202), full name Abū Baḥr Ṣafwān ibn Idrīs ibn Ibrāhīm ibn ʿAbd al-Raḥmān ibn ʿĪsā ibn Idrīs al-Tujībī al-Mursī al-Kātib, was a Muslim traditionist and adīb from al-Andalus (Spain) who wrote poetry in Arabic under the Almohads.
Ṣafwān was born in Murcia (whence the nisba al-Mursī) into a prominent local family, the Banū Idrīs. He was born between 1164 and 1166, probably after the battle of Faḥṣ al-Jullāb on 15 October 1165. He began writing poetry while still a child. Much of what we know of his family comes from his own Zād al-musāfir. He records that he studied under his own father, Abū Yaḥyā, and also under another relative, the qāḍī Abu ʾl-Qāsim ibn Idrīs. Abu ʾl-ʿAbbās ibn Maḍāʾ taught him the Ṣaḥīḥ of Muslim ibn al-Ḥajjāj and Ibn Bashkuwāl gave him the ijāza (the right to transmit ḥadīth) when he was only seventeen years old. He also studied under the prominent Murcian Abu ʾl-Qāsim Ibn Ḥubaysh; under Abu ʾl-Walīd ibn Rushd, the grandfather of the famous philosopher Ibn Rushd; and under the vizier Abū Rijāl ibn Ghalbūn.
In the Zād, Ṣafwān gives a list of his other teachers: Abū Bakr ibn Mughāwir, Abu ʾl-Ḥasan Ibn al-Qāsim, Abū ʿAbd Allāh ibn Ḥumayd, Abū Muḥammad ibn ʿUbayd Allāh al-Ḥajarī, Abū Muḥammad ibn Ḥawṭ Allāh and Ibn ʿAyshūn. Besides poetry and ḥadīth, Ṣafwān was regarded as an expert in adab (etiquette). His closest friend was Abū Muḥammad ibn Ḥāmid (died 1223/4), the vizier of the Caliph al-ʿĀdil. His most famous student was Abu ʾl-Rabīʿ ibn Sālim al-Kalāʿī.
According to his biographers, Ṣafwān travelled to Marrakesh in search of patronage. He wrote panegyrics of the Almohad caliph al-Manṣūr hoping to earn enough money for his daughter's dowry. When this failed, he turned to writing panegyrics of Muḥammad. Subsequently, Muḥammad appeared to al-Manṣūr in a dream and spoke on behalf of Ṣafwān, whose financial difficulties were promptly addressed by the caliph. Although he had a daughter of marriageable age, Ṣafwān was not yet 40 years old at his death. He died in Murcia on 8 or 9 July 1202 and was buried next to the mosque of al-Jurf. His father said the prayer at his funeral.
Ṣafwān wrote at least thirteen works. These include: