Rafiq for developers

Introduction

Rafiq answers questions about Islam from a corpus of Qur'an, hadith, tafsir, and scholarly fatwas — and cites what it used. This API gives you the same engine that powers rafiqai.app.

The one thing to understand first

This is not a chat completion API. Rafiq does not answer from a model's memory. Every ruling it states comes from a retrieved scholarly document, and when the corpus holds nothing that answers your question, it declines — deliberately, and with answered: false.

That is a correct outcome, not a failure. If you retry on it you will loop forever. Handle it the way you would handle a search that found nothing.

What you can build

Base URL

https://api.rafiqai.app/v1

Your first call

Every request needs an API key. Create one in your dashboard — it takes about a minute and needs a Nizam account.

curl https://api.rafiqai.app/v1/me \
  -H "Authorization: Bearer rk_live_your_key_here"

If that returns your account and your remaining quota, everything is wired up correctly. Then ask something:

curl https://api.rafiqai.app/v1/chat \
  -H "Authorization: Bearer rk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"message": "What breaks wudu?"}'

Principles worth knowing

PrincipleWhat it means for you
Grounded, not generativeAnswers come from retrieved documents. Sources are returned with every answer.
It abstainsanswered: false is normal. Show it to your user; do not retry.
It does not issue new rulingsRafiq reports what scholars have said. It does not perform ijtihad, and it will decline rather than derive.
Answers varyThe prose is generated, so identical questions differ in wording between calls. The rulings and sources do not.