Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:12:102

That is from the news of the unseen which We reveal, ˹O Muhammad˺, to you. And you were not with them when they put together their plan while they conspired.  

That, which is mentioned of the matter of Joseph, is of the tidings, the tales, of the Unseen, what has been hidden from you O Muhammad (s), which We reveal to you; for you were not with them, with Joseph’s brothers, when they agreed upon their plan, to plot against him, that is, ˹when˺ they resolved upon it, and schemed, against him; in other words, you were not present among them to know their story and so tell it to others: knowledge of it has come to you through revelation.
القرآن:١٢:١٠٢

ذَٰلِكَ مِنْ أَنْبَاءِ الْغَيْبِ نُوحِيهِ إِلَيْكَ ۖ وَمَا كُنْتَ لَدَيْهِمْ إِذْ أَجْمَعُوا أَمْرَهُمْ وَهُمْ يَمْكُرُونَ  

{ذلك} المذكور من أمر يوسف {من أنباء} أخبار {الغيب} ما غاب عنك يا محمد {نوحيه إليك وما كنت لديهم} لدى إخوة يوسف {إذ أجمعوا أمرهم} في كيده أي عزموا عليه {وهم يمكرون} به أي لم تحضرهم فتعرف قصتهم فتخبر بها وإنما حصل لك علمها من جهة الوحي.

See similar narrations below:

Collected by Qurʾān
quran:3:44

That is from the news of the unseen which We reveal to you, ˹O Muhammad˺. And you were not with them when they cast their pens as to which of them should be responsible for Mary. Nor were you with them when they disputed.  

That, which has been mentioned of the matter of Zachariah and Mary, is of the tidings of the Unseen, of the news of what was unknown to you. We reveal it to you, O Muhammad (s), for you were not with them, when they were casting quills, in the water, drawing their lots so that it be manifested to them, which of them should have charge of, ˹which of them should˺ bring up, Mary; nor were you with them, when they were disputing, about the custodianship of Mary, such that you might have known it and related it; but truly you know it only through revelation.
القرآن:٣:٤٤

ذَٰلِكَ مِنْ أَنْبَاءِ الْغَيْبِ نُوحِيهِ إِلَيْكَ ۚ وَمَا كُنْتَ لَدَيْهِمْ إِذْ يُلْقُونَ أَقْلَامَهُمْ أَيُّهُمْ يَكْفُلُ مَرْيَمَ وَمَا كُنْتَ لَدَيْهِمْ إِذْ يَخْتَصِمُونَ  

{ذلك} المذكور من أمر زكريا ومريم {من أنباء الغيب} أخبار ما غاب عنك {نوحيه إليك} يا محمد {وما كنت لديهم إذ يُلْقُون أقلامهم} في الماء يقترعون ليطهر لهم {أيهم يكْفُلُ} يربي {مريم وما كنت لديهم إذ يختصون} في كفالتها فتعرف ذلك فتخبر به وإنما عرفته من جهة الوحي.