Quickstart

Make a source-backed request. Then inspect the citations and retrieved sources.

What This Does

Madeenan retrieves Islamic sources, grounds the answer in those sources, and returns citation-ready payloads.

First, Search Sources

Create an API key in your dashboard and set MADEENAN_API_KEY in your server environment. Search does not need a model provider key. A result group can be empty.

$curl "https://api.madeenan.com/v1/search?q=Dua%20of%20Yunus&indexes=quran,hadith,tafsir,dua&limit_per_source=3" \
-H "X-Madeenan-API-Key: $MADEENAN_API_KEY"

For typed clients, use SDK Examples. To connect an assistant host, use MCP Setup.

Then Generate an Answer

Hosted chat uses Madeenan's model configuration and your plan's quota. For your own model, retrieve sources and generate on your backend. See the Model Key Policy. Do not send provider keys in a chat prompt.

$curl https://api.madeenan.com/v1/chat \
-H "X-Madeenan-API-Key: $MADEENAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "Explain the Dua of Yunus with sources"
}'

Example Chat Response

This is an abbreviated illustration, not a guaranteed answer. Source availability and model output can differ.

{
"session_id": "7d7f7a9a-8a5f-4f42-b3db-1c9b5f2f2c30",
"answer": "The Dua of Yunus is a prayer of humility and repentance: 'There is no deity except You; exalted are You. Indeed, I have been of the wrongdoers.' The Qur'an mentions it in Surah al-Anbiya.",
"citations": [
{
"source_id": "quran_21_87",
"type": "quran",
"citation_label": "Qur'an 21:87",
"title": "Surah al-Anbiya",
"arabic": "لَا إِلَٰهَ إِلَّا أَنتَ سُبْحَانَكَ إِنِّي كُنتُ مِنَ الظَّالِمِينَ",
"translation": "There is no deity except You; exalted are You. Indeed, I have been of the wrongdoers."
}
],
"retrieved_sources": [
{
"source_id": "quran_21_87",
"type": "quran",
"citation_label": "Qur'an 21:87",
"title": "Surah al-Anbiya",
"arabic": "لَا إِلَٰهَ إِلَّا أَنتَ سُبْحَانَكَ إِنِّي كُنتُ مِنَ الظَّالِمِينَ",
"translation": "There is no deity except You; exalted are You. Indeed, I have been of the wrongdoers."
}
]
}

Fields Explained

message

Request field. The user prompt, in natural-language English or Arabic.

indexes

Optional request field. The source families to search: Qur'an, Hadith, Tafsir, and dua.

citations

Response field. Sources you can render beside the answer: label, Arabic, translation, and metadata.

retrieved_sources

Response field. The source set used for grounding. Show it when users need more context.

Real Examples

Use search when you want source cards to render directly. For generated answers, call your own model provider from your backend with the returned source blocks.

$curl "https://api.madeenan.com/v1/search?q=Dua%20of%20Yunus&indexes=quran,hadith,tafsir,dua&limit_per_source=3" \
-H "X-Madeenan-API-Key: $MADEENAN_API_KEY"
const sources = await fetch("https://api.madeenan.com/v1/search?q=patience&indexes=quran,hadith,tafsir,dua", {
headers: { "X-Madeenan-API-Key": process.env.MADEENAN_API_KEY }
}).then((res) => res.json());
// Then call your own LLM provider from your backend using the returned
// source blocks as context. Do not send model provider keys to the browser.

Common Mistakes

  • Sending model provider keys from the browser.
  • Hiding required attribution on generated answers.
  • Treating citations as optional UI metadata.
  • Using chat when a direct Search API result is enough.

Security note

Keep Madeenan API keys and model provider keys on your server. Browser apps must call your backend, never a provider API directly.

Published by Madeenan Engineering · Updated