Build powerful applications with the Tafheem Research Lab API. Access comprehensive Quranic data, translations, and scholarly commentaries.
https://app.tafheemulquran.net/api/v1All API endpoints are relative to the base URL above. For local development, use:
http://localhost:8000/api/v1Interactive API documentation is available at:
Most endpoints require authentication using JWT (JSON Web Token). Register or log in to obtain a token.
Public Endpoints: Ayah, translation, and Tafseer data endpoints do not require authentication.
POST /api/v1/users/register
Content-Type: application/json
{
"email": "developer@example.com",
"password": "SecurePassword123!",
"username": "developer"
}POST /api/v1/users/login
Content-Type: application/json
{
"email": "developer@example.com",
"password": "SecurePassword123!"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"email": "developer@example.com",
"username": "developer",
"role": "user"
}
}Include the access token in the Authorization header:
curl -H "Authorization: Bearer {access_token}" \
https://app.tafheemulquran.net/api/v1/users/meAccess Quranic verses (Ayahs) with full text, translations, and metadata.
GET /api/v1/ayahs/?skip=0&limit=10
Response:
[
{
"id": 1,
"surah_id": 1,
"ayah_number": 1,
"text_arabic": "بِسْمِ اللَّهِ الرَّحْمَـٰنِ الرَّحِيم",
"page_number": 1,
"juz_number": 1,
"sajda": false
},
...
]GET /api/v1/ayahs/surah/2
# Get specific ayah from surah
GET /api/v1/ayahs/surah/2/ayah/3# Search by English text or translation
GET /api/v1/ayahs/search?q=mercy&skip=0&limit=10
# Search by Arabic text
GET /api/v1/ayahs/search/arabic?q=الرحمن&skip=0&limit=10
# Search by transliteration
GET /api/v1/ayahs/search/transliteration?q=ar-rahman&skip=0&limit=10GET /api/v1/ayahs/juz/1GET /api/v1/ayahs/stats
Response:
{
"total_ayahs": 6236,
"total_surahs": 114,
"total_juz": 30,
"total_pages": 604
}
# Stats by Surah
GET /api/v1/ayahs/surah/2/statsCurrent Limit: 100 requests per minute per IP address for authenticated requests. Public endpoints have a limit of 50 requests per minute.
Rate limit information is included in response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1614556800# 429 Too Many Requests
HTTP/1.1 429 Too Many Requests
Retry-After: 60
{
"detail": "Rate limit exceeded. Retry after 60 seconds."
}
# Recommended retry logic
async function makeRequest(url, options = {}) {
try {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
await new Promise(r => setTimeout(r, retryAfter * 1000));
return makeRequest(url, options);
}
return response.json();
} catch (error) {
console.error('Request failed:', error);
}
}npm install @quranicknowledge/api-sdk
import { QuranicAPI } from '@quranicknowledge/api-sdk';
const api = new QuranicAPI({
baseUrl: 'https://app.tafheemulquran.net/api/v1',
token: 'your-jwt-token'
});
// Get ayahs from Surah Al-Fatiha
const ayahs = await api.ayahs.getBySurah(1);
console.log(ayahs);
// Create article
const article = await api.articles.create({
title: 'My Article',
content: 'Content here...',
surah_id: 1
});pip install quranic-api-sdk
from quranic_api import QuranicAPI
api = QuranicAPI(
base_url='https://app.tafheemulquran.net/api/v1',
token='your-jwt-token'
)
# Get all surahs
surahs = api.ayahs.get_all(limit=10)
# Search ayahs
results = api.ayahs.search(q='mercy', limit=20)# Get Surah Al-Fatiha ayahs
curl -X GET \
'https://app.tafheemulquran.net/api/v1/ayahs/surah/1' \
-H 'Accept: application/json'
# Create article (requires authentication)
curl -X POST \
'https://app.tafheemulquran.net/api/v1/articles' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"title": "Article Title",
"content": "Article content...",
"surah_id": 1
}'The Tafheem Research Lab API is open source. We welcome contributions from the community.
Repository link available on request.
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureFound a bug? Please report it on GitHub Issues with:
Join our developer community:
Community link coming soon.Report bugs and request features:
Issue tracker available on request.Get started with the Tafheem Research Lab API today. Explore the interactive API documentation and begin building amazing applications.