{"openapi":"3.0.0","paths":{"/v1/sections/search":{"post":{"description":"Retrieval-augmented answering: semantic retrieval, LLM rerank, then generated answer from top sections. Requires app-key header. Optional header: X-Session-Id (identifies mobile; used for metrics and queries-per-session). Returns answer plus source sections.","operationId":"SectionsController_searchSections","parameters":[{"name":"x-session-id","required":true,"in":"header","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SectionSearchQueryDto"}}}},"responses":{"200":{"description":"Generated answer and source sections ordered by relevance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SectionSearchResponseDto"}}}}},"security":[{"app-key":[]}],"summary":"RAG search (mobile)","tags":["Sections"]}}},"info":{"title":"Greenbook API (Public)","description":"Public API for mobile app (sync, sections stream, RAG search).","version":"1.0","contact":{}},"tags":[],"servers":[],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"},"app-key":{"type":"apiKey","in":"header","name":"app-key","description":"Mobile app key (for sync-sections, mobile-app-sections, search)"}},"schemas":{"SectionSearchQueryDto":{"type":"object","properties":{"query":{"type":"string","description":"Search query message (e.g. user question or topic)","example":"What are the penalties for tax evasion?","maxLength":2000},"limit":{"type":"number","description":"Maximum number of sections to return (default: 10, max: 50)","default":10,"minimum":1,"maximum":50}},"required":["query"]},"SectionSearchResultItemDto":{"type":"object","properties":{"section":{"type":"object","description":"Section id and title only"},"score":{"type":"number","description":"Similarity score (0–1, higher = more similar)","example":0.87}},"required":["section","score"]},"SectionSearchResponseDto":{"type":"object","properties":{"answer":{"type":"string","description":"RAG-generated answer based on retrieved sections","example":"According to the retrieved sections, penalties for tax evasion include..."},"sections":{"description":"Source sections used for the answer (reranked by LLM), ordered by relevance","type":"array","items":{"$ref":"#/components/schemas/SectionSearchResultItemDto"}},"cacheId":{"type":"number","description":"Cache entry id; use this to submit feedback (accepted/rejected) via POST /v1/sections/query-cache/:id/feedback","example":42}},"required":["answer","sections"]}}}}