MUSLIM MUSLIM APIDeveloper Documentation · v1.0
REST API · JSON · v1.0

MUSLIM API
Developer Documentation

Official integration guide for the MUSLIM Encyclopedia of the Noble Prophetic Hadith API, designed for iOS, Android and web developers.

Quick Start
GET https://api.example.com/api/v1/health
Formatapplication/json
AuthBearer Token
API Versionv1.0
01

Getting Started

All requests use the /api/v1 namespace and return JSON.

Base URL

https://api.example.com

Replace this with your deployed Muslim.API host.

JSON

Content Type

application/json

Use JSON for requests and responses.

🔐

Protected Routes

Authorization: Bearer <token>

Send the token only to protected endpoints.

02

Authentication

Register and login return an opaque token; SQL stores only its SHA-256 hash.

For iOS: Store the Bearer token in Keychain, never in UserDefaults.
HTTP Header
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Accept: application/json
03

Search & AI

AI assists retrieval and translation; it is not a source of hadith.

Arabic source remains authoritative

Semantic search interprets user intent and prepares Arabic retrieval concepts against the encyclopedia database. MUSLIM AI does not create a hadith or alter its text, grade or source. Translation is a separate supporting layer.

!

Responses & Errors

Handle the HTTP status code first, then inspect the JSON response.

200OK

Request completed successfully.

400Bad Request

Invalid input or request body.

401Unauthorized

Missing/invalid token or invalid credentials.

404Not Found

Requested resource was not found.

409Conflict

Conflict such as an email already registered.

500Server Error

Server-side error; do not expose sensitive details to end users.

iOS Integration

Recommended stack: URLSession + async/await + Codable + Keychain.

1

Bootstrap

Call /api/v1/app/bootstrap?lang=<selected-language> at startup and use feature flags.

2

Hadith Home

Call /api/v1/hadiths without q; v1 returns one hadith by default.

3

Semantic Search

Keep the progress overlay visible until the POST response finishes.

4

Translation

Use /translate-cards for result lists and full translation only when opening details.

5

Account Deletion

Expose permanent account deletion in-app and clear the Keychain token after success.

Swift · URLSession
struct Hadith: Decodable {
    let HadithID: Int
    let TitleArabic: String?
    let HadithTextArabic: String?
}

func loadHadith(id: Int) async throws -> Hadith {
    let url = URL(string: "\(baseURL)/api/v1/hadiths/\(id)?lang=ar")!
    let (data, response) = try await URLSession.shared.data(from: url)

    guard let http = response as? HTTPURLResponse,
          (200...299).contains(http.statusCode) else {
        throw URLError(.badServerResponse)
    }

    return try JSONDecoder().decode(Hadith.self, from: data)
}