{"openapi":"3.1.0","info":{"title":"مكتبة شاملة — API","description":"وصول برمجي إلى فهرس مكتبة شاملة: استرجاع مقاطع مبوّبة للاستشهاد، بحث على مستوى الصفحة، قراءة الصفحات والكتب والأجزاء، ودردشة فوق النصوص متوافقة مع OpenAI.\n\n**التوثيق:** `Authorization: Bearer jb_live_...` — مفتاح مجاني من `POST /v1/register`.\n**الحصص:** 300 استدعاء يومياً و10 في الدقيقة للخطة المجانية. كل رد يحمل ترويسات X-RateLimit وX-Quota.","version":"1.0.0"},"paths":{"/v1/retrieve":{"get":{"summary":"استرجاع مقاطع جاهزة للتضمين (RAG)","operationId":"v1_retrieve_v1_retrieve_get","parameters":[{"name":"q","in":"query","required":true,"description":"نص البحث بالعربية (2–500 حرف)","schema":{"type":"string"},"example":"حكم نقض الوضوء بالقهقهة"},{"name":"limit","in":"query","description":"عدد المقاطع (يُقيّد حسب الخطة)","schema":{"type":"integer","default":8,"maximum":20}},{"name":"book","in":"query","description":"معرّف الكتاب أو جزء من اسمه","schema":{"type":"string"},"example":"217"},{"name":"category","in":"query","description":"تصفية بالتصنيف","schema":{"type":"string"},"example":"الفقه الحنبلي"},{"name":"author","in":"query","description":"تصفية بالمؤلف","schema":{"type":"string"},"example":"ابن تيمية"},{"name":"max_chars","in":"query","description":"أقصى طول المقطع","schema":{"type":"integer","default":700,"minimum":120,"maximum":2000}},{"name":"page","in":"query","description":"أضف نص الصفحة كاملة في page_text","schema":{"type":"integer","enum":[0,1]}}],"responses":{"200":{"description":"المقاطع المسترجعة","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetrieveResponse"}}}},"422":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"description":"يبحث في فهرس المكتبة كلها ويعيد مقطعاً من داخل الصفحة حول كلمات الاستعلام، مع بيانات الحكتاب والجزء ومعرّف الصفحة للاستشهاد. هذا هو endpoint الرجوع للبناء عليه.","tags":["البحث"],"security":[{"bearerAuth":[]}]}},"/v1/search":{"get":{"summary":"بحث على مستوى الصفحة (مقاطع أوسع)","description":"يعيد مقطعاً أوسع من الصفحة (حتى ضعف max_chars) حين لا تريد تفتيت الصفحات، مثل بناء فهرس أو قاعدة معرفة.","operationId":"v1_search_v1_search_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"},"example":"زكاة الفطر"},{"name":"limit","in":"query","schema":{"type":"integer","default":8}},{"name":"book","in":"query","schema":{"type":"string"}},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"author","in":"query","schema":{"type":"string"}},{"name":"max_chars","in":"query","schema":{"type":"integer","default":600}}],"responses":{"200":{"description":"نتائج على مستوى الصفحة","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetrieveResponse"}}}},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["البحث"],"security":[{"bearerAuth":[]}]}},"/v1/page":{"get":{"summary":"نص صفحة كاملة","operationId":"v1_page_v1_page_get","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"},"example":"217-45"},{"name":"html","in":"query","schema":{"type":"integer","enum":[0,1]}}],"responses":{"200":{"description":"الصفحة","content":{"application/json":{"schema":{"type":"object","properties":{"found":{"type":"boolean"},"id":{"type":"string","description":"معرّف الصفحة (كتاب-صفحة)","example":"217-45"},"book_id":{"type":"string","example":"217"},"book":{"type":"string","example":"المغني"},"category":{"type":"string","example":"الفقه الحنبلي"},"authors":{"type":"string","example":"ابن قدامة"},"part":{"type":"string","description":"اسم الجزء/الباب","example":"كتاب الطهارة"},"chars":{"type":"integer"},"text":{"type":"string"}}}}}},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"description":"يعيد نص الصفحة مع بيانات كتابها وجزئها، أو بصيغته الأصلية مع html=1.","tags":["المكتبة"],"security":[{"bearerAuth":[]}]}},"/v1/book":{"get":{"summary":"بيانات كتاب","operationId":"v1_book_v1_book_get","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"},"example":"8653"}],"responses":{"200":{"description":"بيانات الكتاب وعدد أجزائه"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/toc":{"get":{"summary":"فهرس أجزاء كتاب","operationId":"v1_toc_v1_toc_get","parameters":[{"name":"book","in":"query","required":true,"schema":{"type":"string"},"example":"8653"},{"name":"limit","in":"query","schema":{"type":"integer","default":500}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"أجزاء الكتاب"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/books":{"get":{"summary":"تصفّح كتب المكتبة","operationId":"v1_books_v1_books_get","parameters":[{"name":"q","in":"query","schema":{"type":"string"},"example":"المغني"},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"author","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"with_parts","in":"query","schema":{"type":"integer","enum":[0,1]}}],"responses":{"200":{"description":"قائمة الكتب"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"description":"قائمة كتب مع بحث بالاسم أو المؤلف، وتصفية بالتصنيف والمؤلف، وترقيم صفحات.","tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/categories":{"get":{"summary":"تصنيفات المكتبة مع عدد كتب كل تصنيف","operationId":"v1_categories_v1_categories_get","responses":{"200":{"description":"التصنيفات"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/authors":{"get":{"summary":"المؤلفون مرتّبون بعدد كتبهم","operationId":"v1_authors_v1_authors_get","parameters":[{"name":"q","in":"query","schema":{"type":"string"},"example":"تيمية"},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":500}}],"responses":{"200":{"description":"المؤلفون"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/stats":{"get":{"summary":"إحصاءات الفهرس (صفحات، أجزاء، كتب، مؤلفون)","operationId":"v1_stats_v1_stats_get","responses":{"200":{"description":"الإحصاءات"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الفهرس"],"security":[{"bearerAuth":[]}]}},"/v1/chat/completions":{"post":{"summary":"دردشة تجيب من نصوص المكتبة (متوافقة مع OpenAI)","operationId":"chat_completions_v1_chat_completions_post","responses":{"200":{"description":"إجابة chat.completion","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object"}},"usage":{"type":"object"},"jahbath":{"type":"object","properties":{"hits":{"type":"integer"},"ai":{"type":"boolean"},"sources":{"type":"array","items":{"type":"object"}}}}}}}}},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"description":"نفس جسم طلب OpenAI. الإجابة مبنية على نصوص المكتبة فقط، وتأتي مع قائمة المصادر في الحقل jahbath.sources. يدعم stream=true.","tags":["الذكاء الاصطناعي"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"model":{"type":"string","default":"jahbath-rag"},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"stream":{"type":"boolean","default":false}}},"example":{"model":"jahbath-rag","messages":[{"role":"user","content":"اذكر مسألة في قضاء الصلاة إذا فاتته ركعة"}]}}}},"security":[{"bearerAuth":[]}]}},"/v1/models":{"get":{"summary":"النماذج المتاحة","operationId":"models_v1_models_get","responses":{"200":{"description":"قائمة النماذج"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الذكاء الاصطناعي"],"security":[{"bearerAuth":[]}]}},"/v1/register":{"post":{"summary":"إنشاء مفتاح مجاني","operationId":"register_v1_register_post","responses":{"201":{"description":"المفتاح الجديد","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"plan":{"type":"string"},"limits":{"type":"object"}}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"description":"يعيد مفتاحاً مجانياً. 3 مفاتيح لكل بريد يومياً و5 لكل عنوان IP. المفتاح يظهر مرة واحدة فقط.","tags":["الحساب"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"org":{"type":"string","description":"اسم المشروع أو الجهة"}}},"example":{"email":"you@example.com","org":"مشروعي"}}}}}},"/v1/me":{"get":{"summary":"بيانات مفتاحك واستهلاكك","operationId":"me_v1_me_get","responses":{"200":{"description":"بيانات المفتاح"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الحساب"],"security":[{"bearerAuth":[]}]}},"/v1/usage":{"get":{"summary":"استهلاك آخر N يوماً","operationId":"usage_v1_usage_get","parameters":[{"name":"days","in":"query","schema":{"type":"integer","default":30,"maximum":90}}],"responses":{"200":{"description":"سجلّ الاستهلاك"},"401":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"429":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}},"502":{"description":"خطأ موحّد: message, type, code, param","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"message":"مفتاح API مطلوب.","type":"authentication_error","code":"missing_api_key","param":null}}}}}},"tags":["الحساب"],"security":[{"bearerAuth":[]}]}},"/admin/keys":{"post":{"summary":"Admin New Key","operationId":"admin_new_key_admin_keys_post","parameters":[{"name":"x-admin-token","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/keys/{key_id}/plan":{"post":{"summary":"Admin Set Plan","operationId":"admin_set_plan_admin_keys__key_id__plan_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}},{"name":"x-admin-token","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/keys/{key_id}/rpd":{"post":{"summary":"Admin Set Rpd","operationId":"admin_set_rpd_admin_keys__key_id__rpd_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}},{"name":"x-admin-token","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/keys/{key_id}/status":{"post":{"summary":"Admin Set Status","operationId":"admin_set_status_admin_keys__key_id__status_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}},{"name":"x-admin-token","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/stats":{"get":{"summary":"Admin Stats","operationId":"admin_stats_admin_stats_get","parameters":[{"name":"x-admin-token","in":"header","required":false,"schema":{"type":"string","default":"","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/healthz":{"get":{"summary":"حالة الخدمة ومحرّك الفهرس","operationId":"healthz_healthz_get","responses":{"200":{"description":"الخدمة تعمل"},"503":{"description":"المحرّك متوقف"}},"tags":["الحساب"],"security":[]}},"/":{"get":{"summary":"Landing","operationId":"landing__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/docs":{"get":{"summary":"Docs Page","operationId":"docs_page_docs_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/plans":{"get":{"summary":"الخطط والأسعار","operationId":"plans_page_plans_get","responses":{"200":{"description":"تفاصيل الخطط"}},"tags":["الحساب"],"security":[]}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"param":{"type":"string","nullable":true},"details":{"type":"array","nullable":true,"items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}},"Passage":{"type":"object","properties":{"id":{"type":"string","description":"معرّف الصفحة (كتاب-صفحة)","example":"217-45"},"page_id":{"type":"string","description":"معرّف الصفحة (كتاب-صفحة)","example":"217-45"},"book_id":{"type":"string","example":"217"},"book":{"type":"string","example":"المغني"},"category":{"type":"string","example":"الفقه الحنبلي"},"authors":{"type":"string","example":"ابن قدامة"},"part":{"type":"string","description":"اسم الجزء/الباب","example":"كتاب الطهارة"},"score":{"type":"float"},"start":{"type":"integer","description":"إزاحة المقطع داخل الصفحة"},"length":{"type":"integer"},"page_chars":{"type":"integer"},"text":{"type":"string","description":"نص المقطع"},"url":{"type":"string","description":"رابط النص الكامل للصفحة"},"book_url":{"type":"string","description":"رابط بيانات الكتاب"}}},"RetrieveResponse":{"type":"object","properties":{"query":{"type":"string"},"mode":{"type":"string","enum":["passage","page"]},"hits":{"type":"integer","description":"عدد النتائج المطابقة في الفهرس كله"},"passages":{"type":"array","items":{"$ref":"#/components/schemas/Passage"}},"returned":{"type":"integer"}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"jb_live_...","description":"مفتاح API"}}},"servers":[{"url":"https://api.91.229.245.90.nip.io","description":"الإنتاج"}],"tags":[{"name":"البحث","description":"استرجاع المقاطع والبحث"},{"name":"الفهرس","description":"الكتب والأجزاء والمؤلفون والتصنيفات"},{"name":"المكتبة","description":"قراءة الصفحات"},{"name":"الذكاء الاصطناعي","description":"دردشة فوق النصوص متوافقة مع OpenAI"},{"name":"الحساب","description":"المفاتيح والحصص"}]}