{"openapi":"3.1.0","info":{"title":"Yaqeen Public API","description":"Read published courses and approved sources, or ask the tutor in English and Arabic.\n\nIn [Swagger](/api/v1/swagger), click **Authorize** and paste only your access token (without `Bearer`) to try requests.\n\n[Developer guide](/api/v1/docs) · [Full schema reference](/api/v1/reference)","version":"1.0.0"},"servers":[{"url":"/api/v1"}],"paths":{"/courses":{"get":{"tags":["Courses"],"summary":"List published courses","operationId":"courses_courses_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}},{"name":"track","in":"query","required":false,"schema":{"anyOf":[{"enum":["explore","first-steps","deepen"],"type":"string"},{"type":"null"}],"title":"Track"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoursePage"},"example":{"items":[{"id":"example-course","title":{"en":"Example course","ar":"دورة نموذجية"},"summary":{"en":"Illustrative response.","ar":"استجابة توضيحية."},"subject":"belief","tracks":["explore"],"level":1,"minutes":4,"status":"published"}],"total":1,"offset":0,"limit":25}}}},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Content Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Service Unavailable"}}}},"/courses/{course_id}":{"get":{"tags":["Courses"],"summary":"Read a published course and its approved sources","operationId":"course_courses__course_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"course_id","in":"path","required":true,"schema":{"type":"string","title":"Course Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCourse"},"example":{"id":"example-course","title":{"en":"Example course","ar":"دورة نموذجية"},"summary":{"en":"Illustrative response.","ar":"استجابة توضيحية."},"subject":"belief","tracks":["explore"],"level":1,"minutes":4,"status":"published","cards":[{"id":"example-card","kind":"concept","title":{"en":"Example card"},"body":{"en":"Illustrative content."},"sources":["example-source"]}],"sources_by_id":{"example-source":{"id":"example-source","kind":"reference","ref_en":"Example reference","text_en":"Canonical source wording appears here.","review_status":"approved"}}}}}},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Content Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Service Unavailable"}}}},"/sources/{source_id}":{"get":{"tags":["Sources"],"summary":"Read an approved source","operationId":"source_sources__source_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSource"},"example":{"id":"example-source","kind":"reference","ref_en":"Example reference","text_en":"Canonical source wording appears here.","review_status":"approved"}}}},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Content Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Service Unavailable"}}}},"/tutor/ask":{"post":{"tags":["Tutor"],"summary":"Ask the tutor and receive cited evidence","operationId":"ask_tutor_ask_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicAskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TutorAnswer"},"example":{"tier":"B","answer":[{"type":"text","text":"An illustrative tutor answer."},{"type":"source","id":"example-source"}],"sources":{"example-source":{"id":"example-source","kind":"reference","ref_en":"Example reference","text_en":"Canonical source wording appears here.","review_status":"approved"}},"follow_ups":[],"ai_generated":true,"practice_fallback":false}}}},"default":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"Content Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"Bi":{"properties":{"en":{"type":"string","maxLength":12000,"title":"En","default":""},"ar":{"type":"string","maxLength":12000,"title":"Ar","default":""}},"type":"object","title":"Bi","description":"Text in English, Arabic, or both. Learner pages fall back to the language that exists."},"Card":{"properties":{"id":{"type":"string","maxLength":100,"minLength":1,"title":"Id"},"kind":{"type":"string","enum":["concept","quote","practice","check"],"title":"Kind"},"title":{"$ref":"#/components/schemas/Bi"},"body":{"anyOf":[{"$ref":"#/components/schemas/Bi"},{"type":"null"}]},"html":{"anyOf":[{"$ref":"#/components/schemas/Bi"},{"type":"null"}]},"takeaway":{"anyOf":[{"$ref":"#/components/schemas/Bi"},{"type":"null"}]},"sources":{"items":{"type":"string"},"type":"array","maxItems":30,"title":"Sources"},"references":{"anyOf":[{"items":{"type":"string","maxLength":600,"minLength":1},"type":"array","maxItems":30},{"type":"null"}],"title":"References"},"label":{"anyOf":[{"type":"string","enum":["obligatory","recommended","suggestion"]},{"type":"null"}],"title":"Label"},"image":{"anyOf":[{"type":"string","maxLength":700000,"pattern":"^(/[\\w./-]+|https://\\S+|data:image/(png|jpeg|webp);base64,[A-Za-z0-9+/=]+)$"},{"type":"null"}],"title":"Image"},"visual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visual"},"audio":{"anyOf":[{"additionalProperties":{"type":"string"},"propertyNames":{"enum":["en","ar"]},"type":"object"},{"type":"null"}],"title":"Audio"}},"additionalProperties":false,"type":"object","required":["id","kind","title"],"title":"Card"},"CoursePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CourseSummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"offset":{"type":"integer","title":"Offset"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["items","total","offset","limit"],"title":"CoursePage"},"CourseSummary":{"properties":{"id":{"type":"string","title":"Id"},"title":{"$ref":"#/components/schemas/Bi"},"summary":{"$ref":"#/components/schemas/Bi"},"subject":{"type":"string","title":"Subject"},"tracks":{"items":{"type":"string"},"type":"array","title":"Tracks"},"level":{"type":"integer","title":"Level"},"minutes":{"type":"integer","title":"Minutes"},"cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover"},"status":{"type":"string","const":"published","title":"Status"}},"type":"object","required":["id","title","summary","subject","tracks","level","minutes","status"],"title":"CourseSummary"},"ErrorDetail":{"properties":{"code":{"type":"string","title":"Code"},"message":{"type":"string","title":"Message"}},"type":"object","required":["code","message"],"title":"ErrorDetail"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}},"type":"object","required":["error"],"title":"ErrorResponse"},"Explain":{"properties":{"prompt":{"$ref":"#/components/schemas/Bi"},"key_ideas":{"items":{"$ref":"#/components/schemas/Idea"},"type":"array","maxItems":50,"minItems":1,"title":"Key Ideas"}},"type":"object","required":["prompt","key_ideas"],"title":"Explain"},"Idea":{"properties":{"en":{"type":"string","maxLength":12000,"title":"En","default":""},"ar":{"type":"string","maxLength":12000,"title":"Ar","default":""},"id":{"type":"string","maxLength":100,"minLength":1,"title":"Id"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"}},"type":"object","required":["id"],"title":"Idea"},"PracticeQuestion":{"properties":{"id":{"type":"string","title":"Id"},"question":{"$ref":"#/components/schemas/Bi"},"options":{"items":{"$ref":"#/components/schemas/Bi"},"type":"array","title":"Options"},"answer":{"type":"integer","title":"Answer"},"hint":{"additionalProperties":{"type":"string"},"type":"object","title":"Hint"},"explanation":{"$ref":"#/components/schemas/Bi"},"source":{"type":"string","title":"Source"}},"type":"object","required":["id","question","options","answer","hint","explanation","source"],"title":"PracticeQuestion"},"PublicAskRequest":{"properties":{"question":{"type":"string","maxLength":1500,"minLength":1,"title":"Question"},"lang":{"type":"string","enum":["en","ar"],"title":"Lang","default":"en"},"course_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Course Id"},"card_id":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Card Id"},"practice":{"type":"boolean","title":"Practice","default":false},"practice_avoid":{"items":{"type":"string","maxLength":800},"type":"array","maxItems":1000,"title":"Practice Avoid"},"track":{"anyOf":[{"type":"string","enum":["explore","first-steps","deepen"]},{"type":"null"}],"title":"Track"},"history":{"items":{"$ref":"#/components/schemas/Turn"},"type":"array","maxItems":20,"title":"History"}},"additionalProperties":false,"type":"object","required":["question"],"title":"PublicAskRequest","examples":[{"lang":"en","question":"What is wudu?"}]},"PublicCourse":{"properties":{"id":{"type":"string","title":"Id"},"title":{"$ref":"#/components/schemas/Bi"},"summary":{"$ref":"#/components/schemas/Bi"},"subject":{"type":"string","title":"Subject"},"tracks":{"items":{"type":"string"},"type":"array","title":"Tracks"},"level":{"type":"integer","title":"Level"},"minutes":{"type":"integer","title":"Minutes"},"cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover"},"status":{"type":"string","const":"published","title":"Status"},"cards":{"items":{"$ref":"#/components/schemas/Card"},"type":"array","title":"Cards"},"explain_back":{"anyOf":[{"$ref":"#/components/schemas/Explain"},{"type":"null"}]},"quiz":{"anyOf":[{"items":{"$ref":"#/components/schemas/Quiz"},"type":"array"},{"type":"null"}],"title":"Quiz"},"sources_by_id":{"additionalProperties":{"$ref":"#/components/schemas/PublicSource"},"type":"object","title":"Sources By Id"}},"type":"object","required":["id","title","summary","subject","tracks","level","minutes","status","cards","sources_by_id"],"title":"PublicCourse"},"PublicSource":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"ref_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ref En"},"ref_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ref Ar"},"text_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text En"},"text_ar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text Ar"},"translation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Translation"},"translation_status_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Translation Status En"},"origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Origin"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"grading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Grading"},"review_status":{"type":"string","enum":["approved","unreviewed"],"title":"Review Status"},"eligibility":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eligibility"}},"type":"object","required":["id","kind","review_status"],"title":"PublicSource"},"Quiz":{"properties":{"id":{"type":"string","maxLength":100,"minLength":1,"title":"Id"},"question":{"$ref":"#/components/schemas/Bi"},"options":{"items":{"$ref":"#/components/schemas/Bi"},"type":"array","maxItems":10,"minItems":2,"title":"Options"},"answer":{"type":"integer","minimum":0.0,"title":"Answer"},"explanation":{"anyOf":[{"$ref":"#/components/schemas/Bi"},{"type":"null"}]},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"}},"type":"object","required":["id","question","options","answer"],"title":"Quiz"},"SourceBlock":{"properties":{"type":{"type":"string","const":"source","title":"Type"},"id":{"type":"string","title":"Id"}},"type":"object","required":["type","id"],"title":"SourceBlock"},"TextBlock":{"properties":{"type":{"type":"string","const":"text","title":"Type"},"text":{"type":"string","title":"Text"}},"type":"object","required":["type","text"],"title":"TextBlock"},"Turn":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"content":{"type":"string","maxLength":4000,"title":"Content"}},"type":"object","required":["role","content"],"title":"Turn"},"TutorAnswer":{"properties":{"tier":{"type":"string","title":"Tier"},"answer":{"items":{"anyOf":[{"$ref":"#/components/schemas/TextBlock"},{"$ref":"#/components/schemas/SourceBlock"}]},"type":"array","title":"Answer"},"sources":{"additionalProperties":{"$ref":"#/components/schemas/PublicSource"},"type":"object","title":"Sources"},"referral":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Referral"},"follow_ups":{"items":{"type":"string"},"type":"array","title":"Follow Ups"},"ai_generated":{"type":"boolean","title":"Ai Generated"},"safety_outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Safety Outcome"},"practice":{"anyOf":[{"items":{"$ref":"#/components/schemas/PracticeQuestion"},"type":"array"},{"type":"null"}],"title":"Practice"},"practice_fallback":{"type":"boolean","title":"Practice Fallback","default":false}},"type":"object","required":["tier","answer","sources","ai_generated"],"title":"TutorAnswer"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}}}