API Reference
Hadiths
Stream Search (SSE)

Stream Search (SSE)

A low-latency streaming endpoint implementing Server-Sent Events (SSE). It returns hadiths as soon as they are found in the database, offering progressive rendering in frontend applications without waiting for the entire result set.

GEThttps://api.mumin.ink/hadiths/search-stream
🔐Auth Required

Query Parameters

ParameterTypeRequiredDescription
qstringYesThe search query
languagestringNoThe language code (default: ru)
colstringNoOptional collection slug
gradestringNoFilter by grading level (e.g., sahih)

Response

Instead of a standard JSON response, this endpoint streams data via text/event-stream. Clients will receive events containing matching hadiths.

data: {"id":1,"collection":"Sahih al-Bukhari","arabicText":"...","translation":{"text":"...","grade":"Sahih","languageCode":"ru"}}

data: {"id":2,"collection":"Sahih al-Bukhari","arabicText":"...","translation":{"text":"...","grade":"Sahih","languageCode":"ru"}}

data: [DONE]

Client Implementation Example

const eventSource = new EventSource(
  "https://api.mumin.ink/v1/hadiths/search-stream?q=prayer",
);
 
eventSource.onmessage = (event) => {
  if (event.data === "[DONE]") {
    eventSource.close();
    return;
  }
 
  const hadith = JSON.parse(event.data);
  console.log("Received:", hadith);
};
 
eventSource.onerror = (error) => {
  console.error("SSE Error:", error);
  eventSource.close();
};