# Sunnah.com Hadith Scraper (`axiomworks/sunnah-hadith-scraper`) Actor

Search Sunnah.com or scrape hadith from supplied URLs, including exact references, books, and collections. Get references, English and Arabic text, chapter details, grades, and Arabic isnad with linked narrator IDs. It reads public site pages without requiring an API key.

- **URL**: https://apify.com/axiomworks/sunnah-hadith-scraper.md
- **Developed by:** [Axiom Works](https://apify.com/axiomworks) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.79 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**Returns:** one row per hadith with `reference`, `collectionName`, `bookName`, `chapterTitle`, `textEnglish`, `textArabic`, `grade`, `narrators`.
**Input:** `{"searchQueries": ["intention"], "maxItems": 20}`
**Best for:** hadith research and evidence lookup, building study datasets per topic, exporting a whole book or collection with its isnad.

```json
{
  "reference": "Sahih Muslim 1653 b",
  "collectionName": "Sahih Muslim",
  "bookName": "The Book of Oaths - كتاب الأيمان",
  "inBookReference": "Book 27, Hadith 31",
  "textEnglish": "An oath is to be interpreted according to the intention of the one who takes it.",
  "url": "https://sunnah.com/muslim:1653b"
}
```

### What does Sunnah.com Hadith Scraper do?

Sunnah.com Hadith Scraper exports hadith from Sunnah.com as structured data. You give it search words (in English or Arabic), Sunnah.com URLs, or both, and it returns one clean row per hadith: the canonical reference, the collection and book, the chapter, the English translation, the full Arabic text, the Arabic chain of narration (isnad) with Sunnah.com's narrator IDs, and the grade with the scholar who gave it, when the collection has one.

It works as a Sunnah.com scraper and a lightweight Sunnah.com API in one: search the whole site for a word like "patience", pull every hadith in a book such as Sunan Abi Dawud Book 2, walk a whole collection such as Riyad as-Salihin book by book, or fetch a short list of exact references like `bukhari:1` and `muslim:8a`. Everything comes from public Sunnah.com pages. No login and no API key are needed.

Typical uses are Islamic research and evidence lookup (find every narration on a topic with its grade), building datasets for study apps, quizzes or search tools, and comparing the English and Arabic text or the isnad of narrations across collections.

### What data can you get from Sunnah.com?

Each hadith row has these fields. Fields that a page or collection doesn't show are `null`.

| Field | Description | Example |
|---|---|---|
| `id` | Stable ID, `{collection}:{hadithNumber}` | `bukhari:1302` |
| `reference` | Canonical reference as shown on Sunnah.com | `Sahih al-Bukhari 1302` |
| `collection` | Collection slug from the permalink | `bukhari` |
| `collectionName` | Collection name | `Sahih al-Bukhari` |
| `hadithNumber` | Hadith number, as a string (can be `8a`) | `1302` |
| `url` | Hadith permalink | `https://sunnah.com/bukhari:1302` |
| `bookNumber` | Book number in the collection (`introduction` possible) | `23` |
| `bookName` | English book name | `Funerals (Al-Janaa'iz)` |
| `chapterNumber` | Chapter number (book and hadith pages) | `42` |
| `chapterTitle` | English chapter title (book and hadith pages) | `Patience is to be observed at the first stroke of a calamity` |
| `chapterTitleArabic` | Arabic chapter title (book and hadith pages) | `باب الصَّبْرِ عِنْدَ الصَّدْمَةِ الأُولَى` |
| `inBookReference` | Position inside the book | `Book 23, Hadith 60` |
| `narratorEnglish` | English narrator line | `Narrated Anas` |
| `textEnglish` | English translation | `The Prophet (ﷺ) said, "The real patience is at the first stroke of a calamity."` |
| `textArabic` | Full Arabic text (isnad and matn) | `حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ ...` |
| `sanadArabic` | Arabic chain of narration (isnad) | `حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ ...` |
| `narrators` | Isnad narrators in order: `id`, `name`, `nameAsCited` | `[{"id": "6879", "name": "محمد بن بشار العبدي", ...}]` |
| `grade` | English grade | `Sahih` |
| `gradedBy` | Who gave the grade | `Al-Albani` |
| `gradeArabic` | Arabic grade text | `صحيح (الألباني)` |
| `searchQuery` | Search words that found the hadith (null for URL inputs) | `patience` |
| `scrapedAt` | ISO time of scraping | `2026-10-06T06:33:57.854Z` |
| `sourceUrl` | Sunnah.com page the row was parsed from | `https://sunnah.com/search?q=patience` |

A few notes on coverage, so you know what to expect:

- `grade`, `gradedBy` and `gradeArabic` are filled for collections that Sunnah.com grades, such as Sunan Abi Dawud and Jami`at-Tirmidhi; they are`null\` for Sahih al-Bukhari and Sahih Muslim.
- `chapterNumber`, `chapterTitle` and `chapterTitleArabic` come from book and single-hadith pages; search results leave them `null`.
- `narrators` holds the narrator links Sunnah.com shows inside the Arabic isnad; collections without those links, such as Riyad as-Salihin, return `null` there.
- `bookName` on search results keeps the Arabic suffix exactly as the search page shows it, for example `Funerals (Al-Janaa'iz) - كتاب الجنائز`.

### How to use Sunnah.com Hadith Scraper

1. Open Sunnah.com Hadith Scraper in Apify Console and go to the Input tab.
2. Type one or more search words under **English or Arabic search queries** (for example `patience` or `الصبر`), or paste Sunnah.com links under **Sunnah.com URLs or hadith references**. You can use both at once.
3. Set **Total unique hadith limit** to the number of rows you want. The run stops as soon as it has that many.
4. Click **Start**. Small runs finish in well under a minute.
5. Open the Output tab to see the table, then export as JSON, CSV, Excel, XML or HTML, or read the dataset through the API.

Accepted URL types:

| You give | What you get |
|---|---|
| `https://sunnah.com/search?q=charity` | Every search hit, page after page (50 per page) |
| `https://sunnah.com/riyadussalihin` | The collection's books in order, every hadith in each book |
| `https://sunnah.com/abudawud/2` | Every hadith in that book, with chapter titles |
| `https://sunnah.com/muslim:8a` | That single hadith |
| `bukhari:1` or `bukhari 1` | That single hadith (bare reference) |

Tips:

The `maxItems` limit counts across all inputs together, so with three search words and `maxItems` set to 60, the first word can use all 60 rows if it has enough hits. A hadith found by two inputs is returned once. Book pages can hold hundreds of hadith (Sunan Abi Dawud Book 2 has 771), and the Actor stops reading a page as soon as `maxItems` is reached.

Sunnah.com search is fuzzy, so the Actor keeps only hadith whose text contains at least half of the words of your search. A search with no such hits, or a URL that doesn't exist on Sunnah.com, ends the run successfully with 0 rows and a status message that names the input to fix.

### Input

The `startUrls` editor accepts a JSON array of URL objects or strings, including bare references such as `"muslim:10"`. Existing arrays of `{ "url": "https://sunnah.com/bukhari:1" }` continue to work.

| Field | Type | Required | Description |
|---|---|---|---|
| `searchQueries` | array of strings | One of the two | Words to search on Sunnah.com, in English or Arabic. Each search returns its hits across all collections. |
| `startUrls` | array of URLs | One of the two | Sunnah.com search, collection, book or hadith URLs, or bare references like `bukhari:1`. |
| `maxItems` | integer | No | Maximum number of hadith across all inputs, 1-100000, default 50. |
| `proxyConfiguration` | object | No | Proxy for the browser, default none. Blocked sessions move to Apify Proxy datacenter, then residential, automatically. |

Give at least one search word or one URL. Example input:

```json
{
    "searchQueries": ["patience"],
    "startUrls": [
        { "url": "https://sunnah.com/bukhari:1" },
        { "url": "https://sunnah.com/abudawud/2" }
    ],
    "maxItems": 60,
    "proxyConfiguration": { "useApifyProxy": false }
}
```

### Output

Each row is one hadith. These two rows come from a real run with `startUrls` set to `abudawud:391` and `bukhari:1302` (long Arabic strings shortened here for reading; the dataset has the full text, and `narrators` lists every narrator of the chain):

```json
[
    {
        "id": "abudawud:391",
        "reference": "Sunan Abi Dawud 391",
        "collection": "abudawud",
        "collectionName": "Sunan Abi Dawud",
        "hadithNumber": "391",
        "url": "https://sunnah.com/abudawud:391",
        "bookNumber": "2",
        "bookName": "Prayer (Kitab Al-Salat)",
        "chapterNumber": "146",
        "chapterTitle": "The Obligation To Perform The Salat (Prayers)",
        "chapterTitleArabic": "باب الصَّلاَةِ مِنَ الإِسْلاَمِ",
        "inBookReference": "Book 2, Hadith 1",
        "narratorEnglish": "Talhah b. 'Ubaid Allah said",
        "textEnglish": "A man from among the people of Najd with disheveled hair came to the Messenger of Allah (ﷺ). ...",
        "textArabic": "حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ، عَنْ مَالِكٍ، ...",
        "sanadArabic": "حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ، عَنْ مَالِكٍ، ...",
        "narrators": [
            { "id": "5085", "name": "عبد الله بن مسلمة الحارثي", "nameAsCited": "عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ" },
            { "id": "6659", "name": "مالك بن أنس الأصبحي", "nameAsCited": "مَالِكٍ" }
        ],
        "grade": "Sahih",
        "gradedBy": "Al-Albani",
        "gradeArabic": "صحيح (الألباني)",
        "searchQuery": null,
        "scrapedAt": "2026-10-06T06:33:55.681Z",
        "sourceUrl": "https://sunnah.com/abudawud:391"
    },
    {
        "id": "bukhari:1302",
        "reference": "Sahih al-Bukhari 1302",
        "collection": "bukhari",
        "collectionName": "Sahih al-Bukhari",
        "hadithNumber": "1302",
        "url": "https://sunnah.com/bukhari:1302",
        "bookNumber": "23",
        "bookName": "Funerals (Al-Janaa'iz)",
        "chapterNumber": "42",
        "chapterTitle": "Patience is to be observed at the first stroke of a calamity",
        "chapterTitleArabic": "باب الصَّبْرِ عِنْدَ الصَّدْمَةِ الأُولَى",
        "inBookReference": "Book 23, Hadith 60",
        "narratorEnglish": "Narrated Anas",
        "textEnglish": "The Prophet (ﷺ) said, \"The real patience is at the first stroke of a calamity.\"",
        "textArabic": "حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ، حَدَّثَنَا شُعْبَةُ، عَنْ ثَابِتٍ، ...",
        "sanadArabic": "حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا غُنْدَرٌ، حَدَّثَنَا شُعْبَةُ، عَنْ ثَابِتٍ، ...",
        "narrators": [
            { "id": "6879", "name": "محمد بن بشار العبدي", "nameAsCited": "مُحَمَّدُ بْنُ بَشَّارٍ" },
            { "id": "6904", "name": "محمد بن جعفر الهذلي", "nameAsCited": "غُنْدَرٌ" }
        ],
        "grade": null,
        "gradedBy": null,
        "gradeArabic": null,
        "searchQuery": null,
        "scrapedAt": "2026-10-06T06:33:57.854Z",
        "sourceUrl": "https://sunnah.com/bukhari:1302"
    }
]
```

The run also stores a `RUN_SUMMARY` record in the key-value store with the number of rows, the inputs, and any input that returned nothing or failed.

### How much does it cost to scrape Sunnah.com?

Sunnah.com Hadith Scraper is charged per result: you pay for each hadith row returned, and nothing for searches that find nothing. `maxItems` caps how many rows a run can return, so it also caps the charge. See the Pricing tab for the current price.

The Actor runs a headless browser, so it uses more memory than a plain HTTP scraper; the default run memory is set for that. It reads a whole book page in one request, then extracts hadith in order only until the requested result limit is reached. Search results are also extracted as needed, so a small limit avoids processing unused records.

### Use with AI agents (MCP)

Connect Sunnah.com Hadith Scraper to Claude, Cursor or any MCP client through the Apify MCP server:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com/?tools=axiomworks/sunnah-hadith-scraper"
        }
    }
}
```

Example prompts:

1. "Find 20 hadith about patience on Sunnah.com and list each reference with its grade and who graded it."
2. "Get Sahih al-Bukhari 1, Sahih Muslim 8a and Jami\` at-Tirmidhi 2516 with their English text and the narrators in the isnad."
3. "Export the first 100 hadith of Sunan Abi Dawud Book 2 with chapter titles and grades as a table."

The agent sees the input fields (`searchQueries`, `startUrls`, `maxItems`) and gets back the rows described above.

### Integrations and API

Run Sunnah.com Hadith Scraper from your own code with the Apify API. Set `APIFY_TOKEN` to your Apify API token (send it in the `Authorization` header, never in the URL).

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("axiomworks/sunnah-hadith-scraper").call(
    run_input={"searchQueries": ["patience"], "maxItems": 50}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["reference"], item["grade"], item["textEnglish"][:80])
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('axiomworks/sunnah-hadith-scraper').call({
    startUrls: [{ url: 'https://sunnah.com/abudawud/2' }],
    maxItems: 40,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**cURL**

```bash
curl -X POST "https://api.apify.com/v2/acts/axiomworks~sunnah-hadith-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchQueries": ["charity"], "maxItems": 20}'
```

You can also connect the Actor to Make, Zapier, n8n, Google Sheets, Slack or your own webhooks from the Integrations tab, and schedule runs from the Schedules page, for example to refresh a topic dataset every week.

### FAQ

**Which collections does it cover?**
Everything Sunnah.com publishes: Sahih al-Bukhari, Sahih Muslim, Sunan Abi Dawud, Jami`at-Tirmidhi, Sunan an-Nasa'i, Sunan Ibn Majah, Muwatta Malik, Riyad as-Salihin, the 40 Hadith collections and the rest. Use the collection slug from the Sunnah.com address bar, such as`bukhari`, `nasai`or`riyadussalihin\`.

**Can I search in Arabic?**
Yes. Put Arabic words in `searchQueries`, for example `الصبر`. Sunnah.com's own search handles both languages, and the Actor returns exactly what the search page shows.

**Why is `grade` empty for some rows?**
Sunnah.com shows grades only for some collections. Sahih al-Bukhari and Sahih Muslim carry no grade line, so `grade`, `gradedBy` and `gradeArabic` are `null` for them.

**Why are the chapter fields empty on search results?**
Sunnah.com search pages don't show chapters. Give the book URL (for example `https://sunnah.com/bukhari/23`) or the hadith URL instead, and the chapter number and titles are filled. Some Bukhari chapters have no English title at the source.

**Why did my run return 0 rows?**
A search may find nothing, a URL may not exist, or the site may remain blocked after retries. These targets return no rows and the run succeeds. For an unmatched search, try another spelling or an English or Arabic term. For a missing page, replace the URL with an existing hadith, book or collection URL. For persistent blocks, retry later or configure an available proxy. The status message and the `RUN_SUMMARY` key-value store record explain what happened; neither adds error rows to the dataset. At least one usable target is required: an empty input or only malformed targets fails input validation.

**Do I need a proxy?**
Usually not. Sunnah.com is protected by Cloudflare, and the Actor uses a real browser that loads the site normally. If a session is blocked anyway, the Actor retries on Apify Proxy datacenter IPs and then residential IPs by itself. It never solves CAPTCHAs.

**How fast is it?**
After the browser starts, each Sunnah.com page takes about a second. A search page gives 50 hadith and a book page gives the whole book, so a few hundred rows take a minute or two.

**Can I get the narrator biographies?**
The `narrators` array gives the Sunnah.com narrator ID, the full name and the name as cited in the chain. Biographies are not part of the output.

### Is it legal to scrape Sunnah.com?

This Actor reads only public Sunnah.com pages that anyone can open without an account, at a modest rate of about one page per second. The hadith translations on Sunnah.com may be under copyright, so check the site's terms before you republish large amounts of text, and give credit to the source. You are responsible for how you use the data. This is not legal advice. Sunnah.com Hadith Scraper is an independent tool and is not affiliated with or endorsed by Sunnah.com.

### Feedback

Found a bug, a page type that doesn't parse, or need a field that isn't here? Open an issue on the Issues tab and we'll look at it.

# Actor input Schema

## `searchQueries` (type: `array`):

Full-text search terms as an array of strings, e.g. \["intention"] or \["الصبر"]. Each term is at most 300 characters. Searches all collections until the shared maxItems limit. Supply this or startUrls, or both; an unmatched term succeeds with 0 results. Omitted or empty means no keyword searches.

## `startUrls` (type: `array`):

Targets as a JSON array of {"url":"https://sunnah.com/muslim:8a"} objects or strings, e.g. \["bukhari:1", "bukhari 1"]. Accepts collection, book, hadith and /search?q=charity URLs, including http and www forms. Supply this or searchQueries. Omitted or empty means no URL targets; a missing page succeeds with 0 results. Shares maxItems with searches.

## `maxItems` (type: `integer`):

Total unique hadith to save across all searchQueries and startUrls: 1-100000, default 50, e.g. 20. Stops at this shared limit; repeated hadith IDs are returned once. Fewer records are returned when targets have fewer matches.

## `proxyConfiguration` (type: `object`):

Browser proxy settings, e.g. {"useApifyProxy":false} (default, direct connection). A blocked session retries using fresh sessions on Apify Proxy datacenter then residential. Persistent blocks succeed with 0 results for that target; retry later or configure an available proxy.

## Actor input object example

```json
{
  "searchQueries": [
    "intention"
  ],
  "startUrls": [],
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset with one item per hadith, in the order found.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "intention"
    ],
    "maxItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("axiomworks/sunnah-hadith-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": ["intention"],
    "maxItems": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("axiomworks/sunnah-hadith-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "intention"
  ],
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call axiomworks/sunnah-hadith-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,axiomworks/sunnah-hadith-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/pjVo6aRYi1n9QZFCX/builds/kNk75I1RcDhCvJQdf/openapi.json
