Hadith

FREEMIUM
By Halim Shams | Updated לפני 23 ימים | Education
Popularity

7.6 / 10

Latency

37,140ms

Service Level

92%

Health Check

0%

README

The Hadith API

The Hadith API enables users to get Hadiths from all noble and genuine collections, including Sahih al-Bukhari, Sahih Muslim, Sunan an-Nasa’i, Jami’ at-Tirmidhi, Sunan Ibn Majah, and Sunan Abi Dawud, along with their complete details.

All six noble collections stated here are comprehensive, 100% genuine (sourced from external literature), and include all the Hadiths or prophet Mohammad (PBUH).

/collection

HTTP GET https://hadith2.p.rapidapi.com/collection

Returns all the available collections with their details.

Sample Request:

import requests

url = "https://hadith2.p.rapidapi.com/collection"

headers = {
	"X-RapidAPI-Key": "ce44afc3c1msha5c3eedb8f7ba36p18ef64jsn6f4583a8b0ac",
	"X-RapidAPI-Host": "hadith2.p.rapidapi.com"
}

response = requests.get(url, headers=headers)

Response:

{
    "collections": [
        {
            "name": "Sahih al-Bukhari",
            "totalBooks": 97,
            "numberOfHadith": 7277
        },
        {
            "name": "Sahih Muslim",
            "totalBooks": 57,
            "numberOfHadith": 7459
        },
        ...
    ]
}

/collection/{collectionName}

HTTP GET https://hadith2.p.rapidapi.com/collection/{collectionName}

Returns a single collection with its details.

Shortcuts for collection names

Collection Endpoint shortcut
Sahih al-Bukhari bukhari
Sahih Muslim muslim
Sunan an-Nasa’i nasai
Sunan Abi Dawud abudawud
Jami at-Tirmidhi tirmidhi
Sunan Ibn Majah ibnmajah

Sample Request:

import requests

url = "https://hadith2.p.rapidapi.com/collection/bukhari"

headers = {
	"X-RapidAPI-Key": "ce44afc3c1msha5c3eedb8f7ba36p18ef64jsn6f4583a8b0ac",
	"X-RapidAPI-Host": "hadith2.p.rapidapi.com"
}

response = requests.get(url, headers=headers)

Response:

{
	"Sahih al-Bukhari": {
		"totalBooks": 97,
		"totalHadith": 7277
	}
}

/collection/{collectionName}/books

HTTP GET https://hadith2.p.rapidapi.com/collection/{collectionName}/books

Returns all the books of a particular collection.

Sample Request:

import requests

url = "https://hadith2.p.rapidapi.com/collection/bukhari/books"

headers = {
	"X-RapidAPI-Key": "ce44afc3c1msha5c3eedb8f7ba36p18ef64jsn6f4583a8b0ac",
	"X-RapidAPI-Host": "hadith2.p.rapidapi.com"
}

response = requests.get(url, headers=headers)

Response:

{
    "Sahih al-Bukhari": {
        "Revelation": {
            "numberOfHadith": 7
        },
        "Belief": {
            "numberOfHadith": 51
        },
        "Knowledge": {
            "numberOfHadith": 76
        },
        ...
    }
}

/{collectionName}/{bookNumber}/{hadithNumber}

HTTP GET https://hadith2.p.rapidapi.com/{collectionName}/{bookNumber}/{hadithNumber}

Returns a signle Hadith.

Book full-name Endpoint shortcut Book number
Sahih al-Bukhari bukhari 1
Sahih Muslim muslim 2
Sunan an-Nasa’i nasai 3
Sunan Abi Dawud abudawud 4
Jami at-Tirmidhi tirmidhi 5
Sunan Ibn Majah ibnmajah 6

Sample Request:

import requests

url = "https://hadith2.p.rapidapi.com/bukhari/3/17"

headers = {
	"X-RapidAPI-Key": "ce44afc3c1msha5c3eedb8f7ba36p18ef64jsn6f4583a8b0ac",
	"X-RapidAPI-Host": "hadith2.p.rapidapi.com"
}

response = requests.get(url, headers=headers)

Response:

{
	"book": "Knowledge",
	"body": {
		"hadith": "Once the Prophet (ﷺ) embraced me and said, \"O Allah! Bestow on him the knowledge of the Book \n(Qur'an).",
		"narrator": "Narrated Ibn `Abbas:",
		"reference": "Sahih al-Bukhari 75"
	}
}

/random

HTTP GET https://hadith2.p.rapidapi.com/random

Returns a random Hadith.

Sample Request:

import requests

url = "https://hadith2.p.rapidapi.com/random"

headers = {
	"X-RapidAPI-Key": "ce44afc3c1msha5c3eedb8f7ba36p18ef64jsn6f4583a8b0ac",
	"X-RapidAPI-Host": "hadith2.p.rapidapi.com"
}

response = requests.get(url, headers=headers)

Response:

{
	"hadith": "The Prophet (ﷺ) said: Taking omens is polytheism; taking omens is polytheism. He said it three times. Every one of us has some, but Allah removes it by trust (in Him).",
	"narrator": "Narrated Abdullah ibn Mas'ud:",
	"reference": "Sunan Abi Dawud 3910"
}
Followers: 1
API Creator:
Rapid account: Halim Shams
Halim Shams
halimshams8
Log In to Rate API
Rating: 5 - Votes: 1