{"openapi":"3.1.0","info":{"title":"Zntext API","version":"1.0.0","description":"Zntext gives every AI the exact curriculum context a student is studying — books, syllabus, notes and trusted resources — chapter by chapter. Read-only, no authentication. Workflow: searchChapters to find a chapterId, then getChapterContext to read the chapter's context pack (or getChapterOutline first, then only the pages/sections needed), and answer from it. findSections collects one section kind, e.g. every author introduction, across many chapters."},"servers":[{"url":"https://zntext.vercel.app"}],"security":[],"paths":{"/api/v1/search":{"get":{"operationId":"searchChapters","summary":"Search chapters by title or subject","description":"Find chapters by English, Bangla or romanized title or subject (e.g. 'photosynthesis', 'ভগ্নাংশ', 'shubha'), optionally within a class/subject, or the chapter holding a printed page (page + subject). Returns chapterIds; suggestions when nothing matches.","parameters":[{"name":"q","in":"query","required":false,"description":"Search text: a chapter title, topic word, or subject name, in English, Bangla or romanized Bangla. 1–200 characters. Required unless page and subject are given.","schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"grade","in":"query","required":false,"description":"Class id or slug from getCatalog, e.g. \"nctb-c9-10\" or \"c9-10\".","schema":{"type":"string"}},{"name":"subject","in":"query","required":false,"description":"Subject id or slug from getCatalog, e.g. \"nctb-c9-10-bangla-sahitya\" or \"bangla-sahitya\".","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Printed page: keeps chapters whose printed page range holds it. With subject and no q, finds the chapter that contains that page of the book.","schema":{"type":"integer","minimum":1,"maximum":9999}},{"name":"limit","in":"query","required":false,"description":"Maximum results (1–50). Default 20.","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Matching published chapters, best match first; suggestions when there are none.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"400":{"description":"Missing or invalid query parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this client (searchChapters, searchText, lookupWord and checkQuote share 60/min; findSections 30/min). Wait details.retryAfter seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/search/text":{"get":{"operationId":"searchText","summary":"Find where a phrase appears in textbook text","description":"Search the published text of chapters (not just titles) for a word or phrase, optionally within a class/subject. Returns chapter, printed page, a short verbatim snippet and a reader link per hit.","parameters":[{"name":"q","in":"query","required":true,"description":"Word or phrase to find, in English or Bangla. 2–200 characters.","schema":{"type":"string","minLength":2,"maxLength":200}},{"name":"grade","in":"query","required":false,"description":"Class id or slug from getCatalog, e.g. \"nctb-c9-10\" or \"c9-10\".","schema":{"type":"string"}},{"name":"subject","in":"query","required":false,"description":"Subject id or slug from getCatalog, e.g. \"nctb-c9-10-bangla-sahitya\" or \"bangla-sahitya\".","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum hits (1–50). Default 10.","schema":{"type":"integer","minimum":1,"maximum":50,"default":10}}],"responses":{"200":{"description":"Hits in book order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextSearchResponse"}}}},"400":{"description":"Missing or invalid query parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this client (searchChapters, searchText, lookupWord and checkQuote share 60/min; findSections 30/min). Wait details.retryAfter seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/glossary":{"get":{"operationId":"lookupWord","summary":"Look up a word's textbook meaning","description":"Meaning of a word as the textbooks' word-meaning sections (শব্দার্থ ও টীকা) give it, with chapter and printed page. Use it before explaining a difficult word from a lesson.","parameters":[{"name":"word","in":"query","required":true,"description":"The word, usually Bangla. 1–100 characters.","schema":{"type":"string","minLength":1,"maxLength":100}},{"name":"grade","in":"query","required":false,"description":"Class id or slug from getCatalog, e.g. \"nctb-c9-10\" or \"c9-10\".","schema":{"type":"string"}},{"name":"subject","in":"query","required":false,"description":"Subject id or slug from getCatalog, e.g. \"nctb-c9-10-bangla-sahitya\" or \"bangla-sahitya\".","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Maximum entries (1–50). Default 10.","schema":{"type":"integer","minimum":1,"maximum":50,"default":10}}],"responses":{"200":{"description":"Matching glossary entries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlossaryResponse"}}}},"400":{"description":"Missing or invalid query parameter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this client (searchChapters, searchText, lookupWord and checkQuote share 60/min; findSections 30/min). Wait details.retryAfter seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/sections":{"get":{"operationId":"findSections","summary":"Collect one section kind across many chapters","description":"One section kind cut from every chapter in a curriculum, class or subject, e.g. kinds=author (every লেখক/কবি-পরিচিতি, an author masterclass) or kinds=about (every পাঠ-পরিচিতি). Page with part until part = totalParts.","parameters":[{"name":"kinds","in":"query","required":true,"description":"Comma-separated section kinds: text, author (লেখক/কবি-পরিচিতি), about (পাঠ-পরিচিতি), summary (সারসংক্ষেপ), objectives (পাঠের উদ্দেশ্য), glossary (শব্দার্থ ও টীকা), activities (কর্ম-অনুশীলন), questions (নমুনা প্রশ্ন), mcq (বহুনির্বাচনি প্রশ্ন), creative (সৃজনশীল প্রশ্ন), short (সংক্ষিপ্ত-উত্তর প্রশ্ন), essay (বর্ণনামূলক প্রশ্ন), exercises (অনুশীলনী). Only author, about, objectives, summary may be collected without grade or subject.","schema":{"type":"string"}},{"name":"curriculum","in":"query","required":false,"description":"Curriculum id or slug, e.g. \"nctb\". Default: every curriculum.","schema":{"type":"string"}},{"name":"grade","in":"query","required":false,"description":"Class id or slug from getCatalog, e.g. \"nctb-c9-10\" or \"c9-10\".","schema":{"type":"string"}},{"name":"subject","in":"query","required":false,"description":"Subject id or slug from getCatalog, e.g. \"nctb-c9-10-bangla-sahitya\" or \"bangla-sahitya\".","schema":{"type":"string"}},{"name":"part","in":"query","required":false,"description":"1-based part to return when the text is split. Default 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"maxChars","in":"query","required":false,"description":"Maximum characters per part, clamped to 5000–200000. Default 60000.","schema":{"type":"integer","minimum":5000,"maximum":200000,"default":60000}}],"responses":{"200":{"description":"One part of the collection.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SectionsPart"}}}},"400":{"description":"Invalid parameter, a kind that needs grade or subject, or part out of range (details.totalParts gives the count).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No published subject matches the curriculum/grade/subject.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this client (searchChapters, searchText, lookupWord and checkQuote share 60/min; findSections 30/min). Wait details.retryAfter seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/catalog":{"get":{"operationId":"getCatalog","summary":"List all curricula, classes, subjects and chapters","description":"Full tree of published curricula → classes → subjects → chapters with chapter IDs. Use to browse what exists or when search finds nothing. Large; prefer searchChapters for a specific topic.","responses":{"200":{"description":"The published catalog tree.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Catalog"}}}}}}},"/api/v1/chapters/{chapterId}":{"get":{"operationId":"getChapter","summary":"Get chapter metadata","description":"Chapter title, number, class, subject, curriculum, which sources its context pack contains (no text), trusted links, URLs and available agent modes. Use getChapterContext to read the actual content.","parameters":[{"name":"chapterId","in":"path","required":true,"description":"Chapter ID from searchChapters or getCatalog, e.g. \"nctb-c8-science-ch06\" (NCTB Class 8 Science, chapter 6). Format: {curriculum}-{class}-{subject}-ch{NN}, sub-parts like \"nctb-c8-mathematics-ch04-1\".","schema":{"type":"string"}}],"responses":{"200":{"description":"Chapter metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChapterDetail"}}}},"404":{"description":"Unknown or unpublished chapter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/chapters/{chapterId}/context":{"get":{"operationId":"getChapterContext","summary":"Read a chapter's context pack","description":"Returns the chapter's study sheet, verbatim textbook, notes, syllabus, questions and links as markdown. pages/sections return only those printed pages or section kinds. Answer only from it and cite printed pages. If totalParts > part, call again with part+1.","parameters":[{"name":"chapterId","in":"path","required":true,"description":"Chapter ID from searchChapters or getCatalog, e.g. \"nctb-c8-science-ch06\" (NCTB Class 8 Science, chapter 6). Format: {curriculum}-{class}-{subject}-ch{NN}, sub-parts like \"nctb-c8-mathematics-ch04-1\".","schema":{"type":"string"}},{"name":"part","in":"query","required":false,"description":"1-based part to return when the text is split. Default 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"maxChars","in":"query","required":false,"description":"Maximum characters per part, clamped to 5000–200000. Default 60000.","schema":{"type":"integer","minimum":5000,"maximum":200000,"default":60000}},{"name":"pages","in":"query","required":false,"description":"Only these printed pages, e.g. \"58\", \"85-87\" or \"85-87,90\" (Bangla digits work). Pages are listed by getChapterOutline.","schema":{"type":"string"}},{"name":"sections","in":"query","required":false,"description":"Only these section kinds (comma-separated): text, author (লেখক/কবি-পরিচিতি), about (পাঠ-পরিচিতি), summary (সারসংক্ষেপ), objectives (পাঠের উদ্দেশ্য), glossary (শব্দার্থ ও টীকা), activities (কর্ম-অনুশীলন), questions (নমুনা প্রশ্ন), mcq (বহুনির্বাচনি প্রশ্ন), creative (সৃজনশীল প্রশ্ন), short (সংক্ষিপ্ত-উত্তর প্রশ্ন), essay (বর্ণনামূলক প্রশ্ন), exercises (অনুশীলনী). Combined with pages, both must match.","schema":{"type":"string"}},{"name":"kinds","in":"query","required":false,"description":"Comma-separated source kinds to include (default all): study, textbook, notes, syllabus, questions. Example: \"study,questions\" for a short pack.","schema":{"type":"string"}},{"name":"format","in":"query","required":false,"description":"pack = raw context markdown (default). handoff = context wrapped in tutoring rules and an agent mode.","schema":{"type":"string","enum":["pack","handoff"],"default":"pack"}},{"name":"agent","in":"query","required":false,"description":"Academic agent mode: tutor (step-by-step teaching), explain (concepts), summarize (revision summary), quiz (exam-style questions), solve (worked solutions), revise (plan + flashcards). Default tutor. In getChapterContext it only applies with format=handoff.","schema":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"],"default":"tutor"}}],"responses":{"200":{"description":"One part of the chapter context.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextPart"}}}},"400":{"description":"Invalid parameter or part out of range (details.totalParts gives the count).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown or unpublished chapter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/chapters/{chapterId}/outline":{"get":{"operationId":"getChapterOutline","summary":"List a chapter's printed pages and sections","description":"What a chapter contains, without the text: its printed pages and its sections by kind (author, about, glossary, creative, …) with their pages and sizes. Use it to call getChapterContext with only the pages or sections needed.","parameters":[{"name":"chapterId","in":"path","required":true,"description":"Chapter ID from searchChapters or getCatalog, e.g. \"nctb-c8-science-ch06\" (NCTB Class 8 Science, chapter 6). Format: {curriculum}-{class}-{subject}-ch{NN}, sub-parts like \"nctb-c8-mathematics-ch04-1\".","schema":{"type":"string"}}],"responses":{"200":{"description":"The chapter outline.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChapterOutline"}}}},"404":{"description":"Unknown or unpublished chapter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/chapters/{chapterId}/quote":{"get":{"operationId":"checkQuote","summary":"Check that a quotation is in the chapter","description":"Whether a line or sentence appears in the chapter's published text, and on which printed page. Call it before quoting the textbook to the student.","parameters":[{"name":"chapterId","in":"path","required":true,"description":"Chapter ID from searchChapters or getCatalog, e.g. \"nctb-c8-science-ch06\" (NCTB Class 8 Science, chapter 6). Format: {curriculum}-{class}-{subject}-ch{NN}, sub-parts like \"nctb-c8-mathematics-ch04-1\".","schema":{"type":"string"}},{"name":"text","in":"query","required":true,"description":"The quotation to check. 1–2000 characters.","schema":{"type":"string","minLength":1,"maxLength":2000}}],"responses":{"200":{"description":"Whether and where the text was found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteCheck"}}}},"400":{"description":"Missing or invalid text.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown or unpublished chapter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests from this client (searchChapters, searchText, lookupWord and checkQuote share 60/min; findSections 30/min). Wait details.retryAfter seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/chapters/{chapterId}/handoff":{"get":{"operationId":"getHandoff","summary":"Get a copy-paste prompt and open-in links","description":"Builds a self-contained prompt (rules, agent mode, full context) to paste into any AI, plus a short link prompt and ChatGPT/Claude/Perplexity links that open a new chat with it.","parameters":[{"name":"chapterId","in":"path","required":true,"description":"Chapter ID from searchChapters or getCatalog, e.g. \"nctb-c8-science-ch06\" (NCTB Class 8 Science, chapter 6). Format: {curriculum}-{class}-{subject}-ch{NN}, sub-parts like \"nctb-c8-mathematics-ch04-1\".","schema":{"type":"string"}},{"name":"agent","in":"query","required":false,"description":"Academic agent mode: tutor (step-by-step teaching), explain (concepts), summarize (revision summary), quiz (exam-style questions), solve (worked solutions), revise (plan + flashcards). Default tutor. In getChapterContext it only applies with format=handoff.","schema":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"],"default":"tutor"}}],"responses":{"200":{"description":"Prompt and links.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Handoff"}}}},"400":{"description":"Invalid agent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown or unpublished chapter.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/agents":{"get":{"operationId":"listAgents","summary":"List academic agent modes","description":"The academic agents (tutor, explain, summarize, quiz, solve, revise) with descriptions, starter messages and the instructions each follows. Use to pick a mode for getChapterContext format=handoff.","responses":{"200":{"description":"All agents.","content":{"application/json":{"schema":{"type":"object","required":["agents"],"properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}}}}}}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["bad_request","unauthorized","forbidden","not_found","conflict","unprocessable","rate_limited","internal_error","upstream_error","unavailable"]},"message":{"type":"string","description":"Human-readable explanation, safe to show the student."},"details":{"description":"Optional extra data, e.g. { totalParts } for an out-of-range part; on 429 { scope, retryAfter (seconds), limit, resetsAt (ISO) }; on 503 { dependency }."}}}}},"CatalogChapter":{"type":"object","description":"A chapter in the catalog tree. Use `id` as chapterId.","required":["id","slug","number","title","titleBn","printedPages","summary","sortOrder","published","href","markdownUrl"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"number":{"type":"string","description":"Printed chapter number, e.g. \"6\" or \"4.1\"."},"title":{"type":"string"},"titleBn":{"type":["string","null"]},"printedPages":{"type":["string","null"],"description":"Printed page range, e.g. \"55-64\"."},"summary":{"type":["string","null"]},"sortOrder":{"type":"integer"},"published":{"type":"boolean"},"href":{"type":"string","description":"Student page path on the Zntext site (relative)."},"markdownUrl":{"type":"string","format":"uri","description":"Raw markdown context pack URL."}}},"CatalogSubject":{"type":"object","required":["id","gradeId","slug","name","nameBn","bookTitle","language","description","sortOrder","published","createdAt","updatedAt","chapters"],"properties":{"id":{"type":"string"},"gradeId":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]},"bookTitle":{"type":["string","null"]},"language":{"type":"string","description":"Textbook language: \"bn\" (Bangla) or \"en\" (English)."},"description":{"type":["string","null"]},"sortOrder":{"type":"integer"},"published":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"chapters":{"type":"array","items":{"$ref":"#/components/schemas/CatalogChapter"}}}},"CatalogGrade":{"type":"object","required":["id","curriculumId","slug","name","nameBn","sortOrder","published","createdAt","updatedAt","subjects"],"properties":{"id":{"type":"string"},"curriculumId":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string","description":"Class name, e.g. \"Class 8\"."},"nameBn":{"type":["string","null"]},"sortOrder":{"type":"integer"},"published":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"subjects":{"type":"array","items":{"$ref":"#/components/schemas/CatalogSubject"}}}},"CatalogCurriculum":{"type":"object","required":["id","slug","name","nameBn","description","country","sortOrder","published","createdAt","updatedAt","grades"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]},"description":{"type":["string","null"]},"country":{"type":["string","null"]},"sortOrder":{"type":"integer"},"published":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"grades":{"type":"array","items":{"$ref":"#/components/schemas/CatalogGrade"}}}},"Catalog":{"type":"object","required":["curricula"],"properties":{"curricula":{"type":"array","items":{"$ref":"#/components/schemas/CatalogCurriculum"}}}},"ChapterRef":{"type":"object","description":"A published chapter. Use `chapterId` with the chapter endpoints.","required":["chapterId","number","title","titleBn","subject","grade","curriculum","href","markdownUrl","apiUrl"],"properties":{"chapterId":{"type":"string","description":"Pass to getChapterContext / getChapterOutline / getChapter."},"number":{"type":"string"},"title":{"type":"string"},"titleBn":{"type":["string","null"]},"subject":{"type":"object","required":["id","name","nameBn"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]}}},"grade":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"curriculum":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"href":{"type":"string","description":"Student page path on the Zntext site (relative)."},"markdownUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"}}},"SearchResult":{"type":"object","required":["chapterId","number","title","titleBn","subject","grade","curriculum","href","markdownUrl","apiUrl","match"],"properties":{"chapterId":{"type":"string","description":"Pass to getChapterContext / getChapterOutline / getChapter."},"number":{"type":"string"},"title":{"type":"string"},"titleBn":{"type":["string","null"]},"subject":{"type":"object","required":["id","name","nameBn"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]}}},"grade":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"curriculum":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"href":{"type":"string","description":"Student page path on the Zntext site (relative)."},"markdownUrl":{"type":"string","format":"uri"},"apiUrl":{"type":"string","format":"uri"},"match":{"type":"string","enum":["title","subject","romanized","page","fuzzy"],"description":"Why it matched: title, subject name, romanized Bangla (e.g. 'shubha'), the printed page given in `page`, or a fuzzy (misspelt) match."}}},"SearchResponse":{"type":"object","required":["query","results","suggestions"],"properties":{"query":{"type":["string","null"],"description":"The trimmed q; null for a page lookup without q."},"results":{"type":"array","items":{"$ref":"#/components/schemas/SearchResult"}},"suggestions":{"type":"array","items":{"$ref":"#/components/schemas/ChapterRef"},"description":"Up to 5 nearest chapters, only when results is empty. Offer them to the student instead of guessing."}}},"SectionKind":{"type":"string","enum":["text","author","about","summary","objectives","glossary","activities","questions","mcq","creative","short","essay","exercises"],"description":"Section kind: text, author (লেখক/কবি-পরিচিতি), about (পাঠ-পরিচিতি), summary (সারসংক্ষেপ), objectives (পাঠের উদ্দেশ্য), glossary (শব্দার্থ ও টীকা), activities (কর্ম-অনুশীলন), questions (নমুনা প্রশ্ন), mcq (বহুনির্বাচনি প্রশ্ন), creative (সৃজনশীল প্রশ্ন), short (সংক্ষিপ্ত-উত্তর প্রশ্ন), essay (বর্ণনামূলক প্রশ্ন), exercises (অনুশীলনী). \"questions\" includes every question kind."},"OutlineSection":{"type":"object","required":["kind","label","level","pages","chars"],"properties":{"kind":{"$ref":"#/components/schemas/SectionKind"},"label":{"type":"string","description":"Heading or inline label as printed; empty for unlabelled text."},"level":{"type":"integer","description":"Heading level 1–6, 7 for an inline label, 0 for unlabelled text."},"pages":{"type":"array","items":{"type":"integer"},"description":"Printed pages the section covers."},"chars":{"type":"integer"}}},"OutlineSource":{"type":"object","required":["id","kind","title","chars","pages","sections"],"properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["study","textbook","notes","syllabus","questions"]},"title":{"type":"string"},"chars":{"type":"integer"},"pages":{"type":"array","items":{"type":"integer"}},"sections":{"type":"array","items":{"$ref":"#/components/schemas/OutlineSection"}}}},"ChapterOutline":{"type":"object","required":["chapter","urls","pages","kinds","chars","sources"],"properties":{"chapter":{"$ref":"#/components/schemas/ChapterRef"},"urls":{"$ref":"#/components/schemas/ContextUrls"},"pages":{"type":"array","items":{"type":"integer"},"description":"Every printed page in the chapter, in order. Pass ranges as `pages`."},"kinds":{"type":"array","items":{"$ref":"#/components/schemas/SectionKind"},"description":"Section kinds present. Pass as `sections`."},"chars":{"type":"integer","description":"About the size of the whole pack."},"sources":{"type":"array","items":{"$ref":"#/components/schemas/OutlineSource"}}}},"SectionEntry":{"type":"object","required":["chapterId","number","title","titleBn","subject","subjectBn","grade","pages","chars","href"],"properties":{"chapterId":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"titleBn":{"type":["string","null"]},"subject":{"type":"string"},"subjectBn":{"type":["string","null"]},"grade":{"type":"string","description":"Class name, e.g. \"Class 9–10\"."},"pages":{"type":"array","items":{"type":"integer"},"description":"Printed pages of the matched sections."},"chars":{"type":"integer"},"href":{"type":"string","format":"uri","description":"Reader link to the first printed page of the match."}}},"SectionsPart":{"type":"object","required":["kinds","scope","totalChapters","entries","url","part","totalParts","chars","markdown"],"properties":{"kinds":{"type":"array","items":{"$ref":"#/components/schemas/SectionKind"}},"scope":{"type":"string","description":"Scope description, e.g. \"NCTB · Class 9–10\"."},"totalChapters":{"type":"integer","description":"Chapters with a match in the whole collection."},"entries":{"type":"array","items":{"$ref":"#/components/schemas/SectionEntry"},"description":"Chapters whose blocks start in this part."},"url":{"type":"string","format":"uri","description":"Raw markdown of the collection (/sections/{kinds}.md)."},"part":{"type":"integer","description":"1-based index of this part."},"totalParts":{"type":"integer","description":"If greater than part, call again with part+1 to read the rest."},"chars":{"type":"integer","description":"Length of `markdown`."},"markdown":{"type":"string","description":"One block per chapter, cut verbatim from its context pack with printed-page markers. Cite chapter and page."}}},"TextHit":{"type":"object","required":["chapter","sourceKind","page","snippet","href"],"properties":{"chapter":{"$ref":"#/components/schemas/ChapterRef"},"sourceKind":{"type":"string","enum":["study","textbook","notes","syllabus","questions"]},"page":{"type":["integer","null"],"description":"Printed page of the match, when known."},"snippet":{"type":"string","description":"Short verbatim excerpt around the match."},"href":{"type":"string","format":"uri","description":"Reader link to the page."}}},"TextSearchResponse":{"type":"object","required":["query","results"],"properties":{"query":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TextHit"}}}},"GlossaryHit":{"type":"object","required":["chapter","word","meaning","page","href"],"properties":{"chapter":{"$ref":"#/components/schemas/ChapterRef"},"word":{"type":"string","description":"The word as printed."},"meaning":{"type":"string","description":"Its meaning as printed in the textbook's word meanings (শব্দার্থ ও টীকা)."},"page":{"type":["integer","null"]},"href":{"type":"string","format":"uri"}}},"GlossaryResponse":{"type":"object","required":["word","results"],"properties":{"word":{"type":"string"},"results":{"type":"array","items":{"$ref":"#/components/schemas/GlossaryHit"}}}},"QuoteCheck":{"type":"object","required":["chapterId","found","matches"],"properties":{"chapterId":{"type":"string"},"found":{"type":"boolean","description":"True when the text appears in the chapter's published sources."},"matches":{"type":"array","items":{"type":"object","required":["sourceKind","page","snippet","href"],"properties":{"sourceKind":{"type":"string","enum":["study","textbook","notes","syllabus","questions"]},"page":{"type":["integer","null"]},"snippet":{"type":"string"},"href":{"type":"string","format":"uri"}}}}}},"SourceInfo":{"type":"object","description":"One document inside the context pack (body not included).","required":["id","kind","title","language","chars"],"properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["study","textbook","notes","syllabus","questions"]},"title":{"type":"string"},"language":{"type":"string"},"chars":{"type":"integer","description":"Length of this source's markdown body."}}},"Resource":{"type":"object","description":"Trusted external link for the chapter.","required":["id","kind","title","url","note","scope"],"properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["pdf","video","website","book","other"]},"title":{"type":"string"},"url":{"type":"string","format":"uri"},"note":{"type":["string","null"]},"scope":{"type":"string","enum":["chapter","subject"],"description":"Attached to this chapter or to the whole subject."}}},"ContextUrls":{"type":"object","required":["page","markdown","api"],"properties":{"page":{"type":"string","format":"uri","description":"Student page for this chapter."},"markdown":{"type":"string","format":"uri","description":"Raw markdown context pack."},"api":{"type":"string","format":"uri","description":"This chapter's REST resource."}}},"AgentSummary":{"type":"object","required":["id","name","description","starter"],"properties":{"id":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"]},"name":{"type":"string"},"description":{"type":"string"},"starter":{"type":"string","description":"Example first message a student might send."}}},"Agent":{"type":"object","required":["id","name","description","starter","instructions"],"properties":{"id":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"]},"name":{"type":"string"},"description":{"type":"string"},"starter":{"type":"string","description":"Example first message a student might send."},"instructions":{"type":"string","description":"Behaviour the agent follows on top of the shared rules."}}},"ChapterDetail":{"type":"object","required":["chapter","curriculum","grade","subject","href","sources","resources","urls","chars","agents"],"properties":{"chapter":{"type":"object","required":["id","slug","number","title","titleBn","printedPages","summary"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"titleBn":{"type":["string","null"]},"printedPages":{"type":["string","null"]},"summary":{"type":["string","null"]}}},"curriculum":{"type":"object","required":["id","slug","name","nameBn","country"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]},"country":{"type":["string","null"]}}},"grade":{"type":"object","required":["id","slug","name","nameBn"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]}}},"subject":{"type":"object","required":["id","slug","name","nameBn","bookTitle","language"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"nameBn":{"type":["string","null"]},"bookTitle":{"type":["string","null"]},"language":{"type":"string"}}},"href":{"type":"string","description":"Student page path on the Zntext site (relative)."},"sources":{"type":"array","items":{"$ref":"#/components/schemas/SourceInfo"}},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resource"}},"urls":{"$ref":"#/components/schemas/ContextUrls"},"chars":{"type":"integer","description":"Total length of the full context pack markdown."},"agents":{"type":"array","items":{"$ref":"#/components/schemas/AgentSummary"}}}},"ContextPart":{"type":"object","required":["chapterId","format","part","totalParts","chars","markdown"],"properties":{"chapterId":{"type":"string"},"format":{"type":"string","enum":["pack","handoff"]},"agent":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"],"description":"Present when format is handoff."},"part":{"type":"integer","description":"1-based index of this part."},"totalParts":{"type":"integer","description":"If greater than part, call again with part+1 to read the rest."},"chars":{"type":"integer","description":"Length of `markdown`."},"markdown":{"type":"string","description":"The chapter context. Treat as the source of truth for answers."}}},"Handoff":{"type":"object","required":["chapterId","agent","prompt","chars","linkPrompt","links"],"properties":{"chapterId":{"type":"string"},"agent":{"type":"string","enum":["tutor","explain","summarize","quiz","solve","revise"]},"prompt":{"type":"string","description":"Self-contained prompt (rules + mode + full context) to paste into any AI."},"chars":{"type":"integer","description":"Length of `prompt`."},"linkPrompt":{"type":"string","description":"Short prompt that points at the public markdown URL; fits in a link."},"links":{"type":"object","required":["chatgpt","claude","perplexity"],"properties":{"chatgpt":{"type":"string","format":"uri"},"claude":{"type":"string","format":"uri"},"perplexity":{"type":"string","format":"uri"}}}}}}}}