Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) and Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrate: The Prophet (peace and blessings be upon him) said: "O Allah, I take a covenant with You which You will not break: I am only a human being. Whichever believer I hurt, or speak ill of (the narrator is unsure; perhaps the words are:) or curse, or flog, then make that for him a means of purification, mercy and nearness by which You bring him near to You on the Day of Resurrection."
Ahmad and Abu Ya'la recorded it, and its chain is hasan (good).