{"openapi": "3.1.0", "info": {"title": "janus-guru", "version": "2.0.0"}, "paths": {"/admin/api/stats": {"get": {"tags": ["admin"], "summary": "Admin Stats", "description": "Aggregate statistics for the dashboard.", "operationId": "admin_stats_admin_api_stats_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/queries": {"get": {"tags": ["admin"], "summary": "Admin Queries", "description": "Browse query log with filters.", "operationId": "admin_queries_admin_api_queries_get", "security": [{"HTTPBasic": []}], "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "mode", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Mode"}}, {"name": "lang", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Lang"}}, {"name": "has_error", "in": "query", "required": false, "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Has Error"}}, {"name": "search", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Search"}}, {"name": "corpus_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Filter by corpus_id slug", "title": "Corpus Id"}, "description": "Filter by corpus_id slug"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/api/documents": {"get": {"tags": ["admin"], "summary": "Admin Documents", "description": "List documents with chunk counts, optionally filtered by corpus.", "operationId": "admin_documents_admin_api_documents_get", "security": [{"HTTPBasic": []}], "parameters": [{"name": "corpus_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Filter by corpus_id (text slug, e.g. krk_2026)", "title": "Corpus Id"}, "description": "Filter by corpus_id (text slug, e.g. krk_2026)"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/api/documents/{doc_id}/chunks": {"get": {"tags": ["admin"], "summary": "Admin Document Chunks", "description": "Browse chunks of a specific document.", "operationId": "admin_document_chunks_admin_api_documents__doc_id__chunks_get", "security": [{"HTTPBasic": []}], "parameters": [{"name": "doc_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Doc Id"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 200, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/api/faq-cache": {"get": {"tags": ["admin"], "summary": "Admin Faq Cache", "description": "Return current FAQ cache contents.", "operationId": "admin_faq_cache_admin_api_faq_cache_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/system-prompt": {"get": {"tags": ["admin"], "summary": "Admin System Prompt", "description": "Return current system prompt content.", "operationId": "admin_system_prompt_admin_api_system_prompt_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/config": {"get": {"tags": ["admin"], "summary": "Admin Config", "description": "Return non-secret configuration values.", "operationId": "admin_config_admin_api_config_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/embeddings/status": {"get": {"tags": ["admin"], "summary": "Admin Embeddings Status", "description": "Check embedding coverage across all documents.", "operationId": "admin_embeddings_status_admin_api_embeddings_status_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/backfill-embeddings": {"post": {"tags": ["admin"], "summary": "Admin Backfill Embeddings", "description": "Trigger embedding backfill for document chunks.", "operationId": "admin_backfill_embeddings_admin_api_backfill_embeddings_post", "security": [{"HTTPBasic": []}], "parameters": [{"name": "doc_key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Specific doc_key to backfill, or all if omitted", "title": "Doc Key"}, "description": "Specific doc_key to backfill, or all if omitted"}, {"name": "batch_size", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 200, "minimum": 1, "default": 50, "title": "Batch Size"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/api/api-keys": {"get": {"tags": ["admin"], "summary": "List Api Keys", "description": "List all API keys (prefix only, never the full key).", "operationId": "list_api_keys_admin_api_api_keys_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}, "post": {"tags": ["admin"], "summary": "Create Api Key", "description": "Create a new API key. Returns the full key ONCE (only the hash is stored).", "operationId": "create_api_key_admin_api_api_keys_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/CreateApiKeyRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/api-keys/{key_id}/revoke": {"post": {"tags": ["admin"], "summary": "Revoke Api Key", "description": "Revoke an API key.", "operationId": "revoke_api_key_admin_api_api_keys__key_id__revoke_post", "security": [{"HTTPBasic": []}], "parameters": [{"name": "key_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Key Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/admin/api/corpora": {"get": {"tags": ["admin"], "summary": "Admin List Corpora", "description": "List all corpora with stats.", "operationId": "admin_list_corpora_admin_api_corpora_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}, "security": [{"HTTPBasic": []}]}}, "/admin/api/audit-log": {"get": {"tags": ["admin"], "summary": "Admin Audit Log", "description": "Browse audit log entries.", "operationId": "admin_audit_log_admin_api_audit_log_get", "security": [{"HTTPBasic": []}], "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "action", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Action"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/source-refs": {"post": {"summary": "Source Refs", "description": "Return fast retrieval-only source refs for downstream compliance gates.", "operationId": "source_refs_api_source_refs_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SourceRefsRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SourceRefsResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/ask": {"post": {"summary": "Ask", "operationId": "ask_api_ask_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/AskRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AskResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/ask/stream": {"post": {"summary": "Ask Stream", "operationId": "ask_stream_api_ask_stream_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/AskRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/health": {"get": {"summary": "Health", "operationId": "health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}, "head": {"summary": "Health", "operationId": "health_health_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/corpora": {"get": {"summary": "List Corpora", "operationId": "list_corpora_api_corpora_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}, "head": {"summary": "List Corpora", "operationId": "list_corpora_api_corpora_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/metrics": {"get": {"summary": "Metrics", "operationId": "metrics_metrics_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/graph/stats": {"get": {"summary": "Graph Stats", "description": "Get knowledge graph statistics.", "operationId": "graph_stats_api_graph_stats_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}, "/api/graph/query": {"post": {"summary": "Graph Query", "description": "Query the knowledge graph directly.", "operationId": "graph_query_api_graph_query_post", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}}, "components": {"schemas": {"AskRequest": {"properties": {"query": {"type": "string", "maxLength": 2000, "minLength": 1, "title": "Query"}, "style": {"anyOf": [{"type": "string", "pattern": "^(brief|quotes|compare|analytic)$"}, {"type": "null"}], "title": "Style", "description": "Optional response style hint for reestr_texts corpus."}, "corpus_id": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Corpus Id", "description": "Corpus identifier (default: krk_2026)"}, "history": {"items": {"$ref": "#/components/schemas/HistoryMessage"}, "type": "array", "maxItems": 20, "title": "History", "description": "Previous conversation turns (max 20). Each: {role, content}."}}, "type": "object", "required": ["query"], "title": "AskRequest"}, "AskResponse": {"properties": {"request_id": {"type": "string", "title": "Request Id"}, "query": {"type": "string", "title": "Query"}, "mode": {"type": "string", "title": "Mode"}, "lang": {"type": "string", "title": "Lang"}, "answer": {"type": "string", "title": "Answer"}, "latency_ms": {"type": "integer", "title": "Latency Ms"}, "source_refs": {"items": {"type": "string"}, "type": "array", "title": "Source Refs"}, "sources": {"items": {"$ref": "#/components/schemas/SourceRef"}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["request_id", "query", "mode", "lang", "answer", "latency_ms"], "title": "AskResponse"}, "CreateApiKeyRequest": {"properties": {"name": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Name"}, "owner_email": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Owner Email"}, "corpus_ids": {"items": {"type": "string"}, "type": "array", "title": "Corpus Ids"}, "rate_limit_rpm": {"type": "integer", "maximum": 1000.0, "minimum": 1.0, "title": "Rate Limit Rpm", "default": 30}, "rate_limit_rph": {"type": "integer", "maximum": 10000.0, "minimum": 1.0, "title": "Rate Limit Rph", "default": 300}}, "type": "object", "required": ["name"], "title": "CreateApiKeyRequest"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "HistoryMessage": {"properties": {"role": {"type": "string", "pattern": "^(user|assistant)$", "title": "Role"}, "content": {"type": "string", "maxLength": 4000, "title": "Content"}}, "type": "object", "required": ["role", "content"], "title": "HistoryMessage"}, "SourceRef": {"properties": {"ref": {"type": "string", "title": "Ref"}, "doc_key": {"type": "string", "title": "Doc Key"}, "heading": {"type": "string", "title": "Heading"}, "chunk_index": {"type": "string", "title": "Chunk Index"}, "url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Url"}, "title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Title"}, "event_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Event Date"}, "source_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Url"}}, "type": "object", "required": ["ref", "doc_key", "heading", "chunk_index"], "title": "SourceRef"}, "SourceRefsRequest": {"properties": {"query": {"anyOf": [{"type": "string", "maxLength": 2000}, {"type": "null"}], "title": "Query"}, "question": {"anyOf": [{"type": "string", "maxLength": 2000}, {"type": "null"}], "title": "Question"}, "corpus_id": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Corpus Id", "description": "Corpus identifier (default: krk_2026)"}, "limit": {"type": "integer", "maximum": 20.0, "minimum": 1.0, "title": "Limit", "default": 5}}, "type": "object", "title": "SourceRefsRequest"}, "SourceRefsResponse": {"properties": {"request_id": {"type": "string", "title": "Request Id"}, "query": {"type": "string", "title": "Query"}, "mode": {"type": "string", "title": "Mode"}, "lang": {"type": "string", "title": "Lang"}, "latency_ms": {"type": "integer", "title": "Latency Ms"}, "citation_count": {"type": "integer", "title": "Citation Count"}, "raw_text_included": {"type": "boolean", "title": "Raw Text Included"}, "source_refs": {"items": {"type": "string"}, "type": "array", "title": "Source Refs"}, "sources": {"items": {"$ref": "#/components/schemas/SourceRef"}, "type": "array", "title": "Sources"}}, "type": "object", "required": ["request_id", "query", "mode", "lang", "latency_ms", "citation_count", "raw_text_included", "source_refs", "sources"], "title": "SourceRefsResponse"}, "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"}}, "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}}}