The Messenger of Allah ﷺ heard a man say, "Allah, I ask You, bearing witness that You are Allah, there is no god but You, the One, the Eternal Refuge, who has not begotten and was not begotten, and to whom none is equal."The Messenger of Allah ﷺ said, "You have asked Allah by the Name which, when He is asked by it, He gives, and when He is called upon by it, He answers."
حدثنا مسدد حدثنا يحيى عن مالك بن مغول
أن رسول الله ﷺ سمع رجلا يقول اللهم إني أسألك أني أشهد أنك أنت الله لا إله إلا أنت الأحد الصمد الذي لم يلد ولم يولد ولم يكن له كفوا أحد فقال لقد سألت الله بالاسم الذي إذا سئل به أعطى وإذا دعي به أجاب
Its chain of transmission is sahih. Ibn Majah narrated it in the Book of Supplication, chapter on the Greatest Name of Allah, no. 3857, through Malik bin Mughul, with this wording. Tirmidhi graded it hasan, no. 3475, Ibn Hibban graded it sahih, no. 2383, and Hakim graded it sahih according to the criteria of the two Shaykhs, 1/504, with Dhahabi concurring with him.