# Hadith API
> The major Hadith collections as an API, built on an open public dataset. Browse the canonical books — Sahih al-Bukhari, Sahih Muslim, Sunan Abu Dawud, Jami at-Tirmidhi, Sunan an-Nasai, Sunan Ibn Majah, Muwatta Malik and more — each available in many languages (English, Arabic, Urdu, Bengali, Indonesian, Turkish, French and others). Fetch any single hadith by its number, with its full text, authenticity grading and book/hadith reference; list a section (kitab) of a collection; or pull a random hadith. Real data, no key needed upstream. Ideal for Islamic study and reference apps, daily-hadith widgets, search tools and research.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/hadith-api/..."
```

## Pricing
- **Free** (Free) — 13,000 calls/Mo, 2 req/s
- **Starter** ($2/Mo) — 160,000 calls/Mo, 8 req/s
- **Pro** ($14/Mo) — 780,000 calls/Mo, 25 req/s
- **Mega** ($52/Mo) — 3,600,000 calls/Mo, 50 req/s

## Endpoints

### Hadith

#### `GET /v1/collections` — All collections and their editions

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hadith-api/v1/collections"
```

**Response:**
```json
{
    "data": {
        "count": 10,
        "collections": [
            {
                "name": "Sunan Abu Dawud",
                "editions": [
                    {
                        "edition": "ara-abudawud",
                        "language": "Arabic",
                        "direction": "rtl",
                        "has_books": false
                    },
                    {
                        "edition": "ara-abudawud1",
                        "language": "Arabic",
                        "direction": "rtl",
                        "has_books": false
                    },
                    {
                        "edition": "ben-abudawud",
                        "language": "Bengali",
                        "direction": "ltr",
                        "has_books": false
                    },
                    {
                        "edition": "eng-abudawud",
                        "language": "English",
                        "direction": "ltr",
                        "has_books": false
                    },
                    {
                        "edition": "fra-abudawud",
                        "language": "French",
                        "direction": "ltr",
                        "has_books": false
                    },
                    {
                        "edition": "ind-abudawud",
                        "language": "Indonesian",
                        "direction": "ltr",
                        "has_books":
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/hadith` — A single hadith by number

**Parameters:**
- `edition` (query, required, string) — Edition slug, e.g. eng-bukhari (or just bukhari) Example: `eng-bukhari`
- `number` (query, required, string) — Hadith number Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hadith-api/v1/hadith?edition=eng-bukhari&number=1"
```

**Response:**
```json
{
    "data": {
        "hadith": {
            "text": "Narrated 'Umar bin Al-Khattab: I heard Allah's Messenger (ﷺ) saying, \"The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended. So whoever emigrated for worldly benefits or for a woman to marry, his emigration was for what he emigrated for",
            "grades": [],
            "number": 1,
            "edition": "eng-bukhari",
            "reference": {
                "book": 1,
                "hadith": 1
            },
            "arabic_number": 1
        },
        "collection": "Sahih al Bukhari"
    },
    "meta": {
        "timestamp": "2026-06-08T01:19:02.663Z",
        "request_id": "e5a54975-3f2b-48cf-a599-0c4bb19f3c6c"
    },
    "status": "ok",
    "message": "Hadith retrieved successfully",
    "success": true
}
```

#### `GET /v1/random` — A random hadith

**Parameters:**
- `edition` (query, required, string) — Edition slug, e.g. eng-bukhari Example: `eng-bukhari`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hadith-api/v1/random?edition=eng-bukhari"
```

**Response:**
```json
{
    "data": {
        "hadith": {
            "text": "Narrated Ibn `Abbas:A man came to the Prophet (ﷺ) and said to him, \"My sister vowed to perform the Hajj, but she died (before fulfilling it).\" The Prophet (ﷺ) said, \"Would you not have paid her debts if she had any?\" The man said, \"Yes.\" The Prophet (ﷺ) said, \"So pay Allah's Rights, as He is more entitled to receive His rights",
            "grades": [],
            "number": 6699,
            "edition": "eng-bukhari",
            "reference": {
                "book": 83,
                "hadith": 76
            },
            "arabic_number": 6699
        },
        "collection": "Sahih al Bukhari"
    },
    "meta": {
        "timestamp": "2026-06-08T01:19:29.119Z",
        "request_id": "10e81e01-b5f4-4db5-a6eb-045f2e2a2d90"
    },
    "status": "ok",
    "message": "Random hadith retrieved successfully",
    "success": true
}
```

#### `GET /v1/section` — A section (kitab) of a collection

**Parameters:**
- `edition` (query, required, string) — Edition slug, e.g. eng-bukhari Example: `eng-bukhari`
- `section` (query, required, string) — Section number Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hadith-api/v1/section?edition=eng-bukhari&section=2"
```

**Response:**
```json
{
    "data": {
        "count": 51,
        "edition": "eng-bukhari",
        "hadiths": [
            {
                "text": "Narrated Ibn 'Umar: Allah's Messenger (ﷺ) said: Islam is based on (the following) five (principles): 1. To testify that none has the right to be worshipped but Allah and Muhammad is Allah's Messenger (ﷺ). 2. To offer the (compulsory congregational) prayers dutifully and perfectly. 3. To pay Zakat (i.e. obligatory charity) . 4. To perform Hajj. (i.e. Pilgrimage to Mecca) 5. To observe fast during the month of Ramadan",
                "grades": [],
                "number": 8,
                "edition": "eng-bukhari",
                "reference": {
                    "book": 2,
                    "hadith": 1
                },
                "arabic_number": 8
            },
            {
                "text": "Narrated Abu Huraira: The Prophet (ﷺ) said, \"Faith (Belief) consists of more than sixty branches (i.e. parts). And Haya (This term \"Haya\" covers a large number of concepts which are to be taken together; amongst them are self respect, modesty, bashfulness, and scruple, etc.) is a part of faith",
                "grades": [],
                "number": 9,
                "edition": "eng-bukhari",
                "reference": {
                    "book": 2,
                    "hadith": 2
                },
                "arabic_number": 9
            },
            {
                "text": "Narrated 'Abdullah bin 'Amr: The Pr
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service description & endpoints

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hadith-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "service": "hadith-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/hadith": "A single hadith (edition=, number=).",
            "GET /v1/random": "A random hadith (edition=).",
            "GET /v1/section": "A section/book of a collection (edition=, section=).",
            "GET /v1/collections": "All collections and their editions."
        },
        "description": "Hadith collections via the open fawazahmed0 dataset: browse the canonical collections (Sahih al-Bukhari, Sahih Muslim, Abu Dawud, Tirmidhi, Nasai, Ibn Majah, Malik and more) and their per-language editions, fetch a single hadith by number with its grading and reference, list a section/book of a collection and pull a random hadith. Real data, no key.",
        "example_editions": [
            "eng-bukhari",
            "eng-muslim",
            "ara-bukhari",
            "eng-abudawud",
            "eng-tirmidhi"
        ]
    },
    "meta": {
        "timestamp": "2026-06-08T01:19:29.337Z",
        "request_id": "d1daad5d-6735-46fb-ae36-e1683335641e"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/hadith-api
OpenAPI spec: https://www.oanor.com/api/hadith-api/openapi.json
