Base URL
https://api.example.comReplace this with your deployed Muslim.API host.
MUSLIM APIDeveloper Documentation · v1.0
Official integration guide for the MUSLIM Encyclopedia of the Noble Prophetic Hadith API, designed for iOS, Android and web developers.
GET https://api.example.com/api/v1/health
All requests use the /api/v1 namespace and return JSON.
https://api.example.comReplace this with your deployed Muslim.API host.
application/jsonUse JSON for requests and responses.
Authorization: Bearer <token>Send the token only to protected endpoints.
Register and login return an opaque token; SQL stores only its SHA-256 hash.
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Accept: application/json
AI assists retrieval and translation; it is not a source of hadith.
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.
Handle the HTTP status code first, then inspect the JSON response.
Request completed successfully.
Invalid input or request body.
Missing/invalid token or invalid credentials.
Requested resource was not found.
Conflict such as an email already registered.
Server-side error; do not expose sensitive details to end users.
Recommended stack: URLSession + async/await + Codable + Keychain.
Call /api/v1/app/bootstrap?lang=<selected-language> at startup and use feature flags.
Call /api/v1/hadiths without q; v1 returns one hadith by default.
Keep the progress overlay visible until the POST response finishes.
Use /translate-cards for result lists and full translation only when opening details.
Expose permanent account deletion in-app and clear the Keychain token after success.
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)
}