{"openapi":"3.1.0","info":{"title":"RANLOTTO Public API","version":"1.1.0","description":"Thai government lottery results, historical datasets, and deterministic statistics. Data referenced from the Government Lottery Office (GLO). Historical statistics only — figures describe past published draws and do NOT predict or guarantee any future result. All dates use the Asia/Bangkok timezone. Year parameters accept Gregorian (ค.ศ.) or Buddhist (พ.ศ.) years. Rate limit: 300 requests / 5 minutes per IP. GET responses are cacheable via Cache-Control; POST /ask is never cached. Docs: https://www.ranlotto.com/api-docs · Data dictionary: https://www.ranlotto.com/data-dictionary · Methodology: https://www.ranlotto.com/methodology","license":{"name":"Free for factual reference with attribution to ranlotto.com"}},"servers":[{"url":"https://api.ranlotto.com","description":"Production API"},{"url":"http://localhost:3001","description":"Local development"}],"tags":[{"name":"Results","description":"Published draw results (past draws only)."},{"name":"Schedule","description":"Deterministic draw calendar and upcoming draws."},{"name":"Statistics","description":"Frequency, gaps, and distributions with sample sizes."},{"name":"Analysis","description":"Multi-number comparison and dataset summaries."},{"name":"Ask","description":"Deterministic natural-language question routing (no LLM)."},{"name":"Data","description":"Data provenance, freshness status, and the immutable correction log."},{"name":"Content","description":"Published news + blog articles, categories, tags, covers, and feeds."},{"name":"Legacy","description":"Older v1 endpoints kept for backward compatibility."}],"paths":{"/api/public/v1/lottery/latest":{"get":{"operationId":"getLatest","tags":["Legacy"],"summary":"Latest published draw with all prize tiers","responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/lottery/results":{"get":{"operationId":"getResultsByYear","tags":["Results"],"summary":"Published draws for a year (Gregorian or Buddhist).","parameters":[{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/result/{date}":{"get":{"operationId":"getResultByDate","tags":["Results"],"summary":"A single draw by date, with a routing `state` (published/future/current_pending/past_no_result). Future draws never carry result data.","parameters":[{"name":"date","in":"path","required":true,"schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/schedule":{"get":{"operationId":"getSchedule","tags":["Schedule"],"summary":"Draw calendar for a year with computed weekdays and is_upcoming flags.","parameters":[{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/next-draw":{"get":{"operationId":"getNextDraw","tags":["Schedule"],"summary":"The next upcoming draw date with its computed weekday.","responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/stats":{"get":{"operationId":"getDatasetStats","tags":["Statistics"],"summary":"Dataset-level statistics over the filtered draws.","parameters":[{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."},{"name":"month","in":"query","schema":{"type":"integer","minimum":1,"maximum":12}},{"name":"day","in":"query","schema":{"type":"integer","minimum":1,"maximum":31}},{"name":"weekday","in":"query","schema":{"type":"string"},"description":"0-6 (Sun-indexed), English, or Thai weekday name."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive start draw date (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive end draw date (YYYY-MM-DD)."},{"name":"latest","in":"query","schema":{"type":"integer","minimum":1},"description":"Restrict to the most recent N draws after other filters."},{"name":"exclude_disputed","in":"query","schema":{"type":"boolean","default":false},"description":"Exclude draws whose verification_status is \"disputed\". DEFAULT: disputed draws are INCLUDED."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/stats/weekday/{weekday}.csv":{"get":{"operationId":"getWeekdayStatsCsv","tags":["Statistics"],"summary":"Weekday last-two-digit frequency as CSV (UTF-8 BOM, formula-injection safe).","parameters":[{"name":"weekday","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV download","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid weekday","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/stats/date/{monthDay}.csv":{"get":{"operationId":"getDateStatsCsv","tags":["Statistics"],"summary":"Same-calendar-date cohort draws as CSV.","parameters":[{"name":"monthDay","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"CSV download","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid monthDay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/number/{num}.csv":{"get":{"operationId":"getNumberStatsCsv","tags":["Statistics"],"summary":"Per-number occurrence table as CSV.","parameters":[{"name":"num","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{2,6}$"}}],"responses":{"200":{"description":"CSV download","content":{"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid number","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/stats/weekday/{weekday}":{"get":{"operationId":"getWeekdayStats","tags":["Statistics"],"summary":"Statistics for draws that fell on a given weekday (weekday computed from the real date).","parameters":[{"name":"weekday","in":"path","required":true,"schema":{"type":"string"},"description":"0-6, English, or Thai weekday name."},{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."},{"name":"month","in":"query","schema":{"type":"integer","minimum":1,"maximum":12}},{"name":"day","in":"query","schema":{"type":"integer","minimum":1,"maximum":31}},{"name":"weekday","in":"query","schema":{"type":"string"},"description":"0-6 (Sun-indexed), English, or Thai weekday name."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive start draw date (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive end draw date (YYYY-MM-DD)."},{"name":"latest","in":"query","schema":{"type":"integer","minimum":1},"description":"Restrict to the most recent N draws after other filters."},{"name":"exclude_disputed","in":"query","schema":{"type":"boolean","default":false},"description":"Exclude draws whose verification_status is \"disputed\". DEFAULT: disputed draws are INCLUDED."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/stats/date/{monthDay}":{"get":{"operationId":"getDateStats","tags":["Statistics"],"summary":"Same calendar-date statistics (month+day, year ignored).","parameters":[{"name":"monthDay","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{2}-\\d{2}$"},"description":"MM-DD, e.g. 07-16."},{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."},{"name":"month","in":"query","schema":{"type":"integer","minimum":1,"maximum":12}},{"name":"day","in":"query","schema":{"type":"integer","minimum":1,"maximum":31}},{"name":"weekday","in":"query","schema":{"type":"string"},"description":"0-6 (Sun-indexed), English, or Thai weekday name."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive start draw date (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive end draw date (YYYY-MM-DD)."},{"name":"latest","in":"query","schema":{"type":"integer","minimum":1},"description":"Restrict to the most recent N draws after other filters."},{"name":"exclude_disputed","in":"query","schema":{"type":"boolean","default":false},"description":"Exclude draws whose verification_status is \"disputed\". DEFAULT: disputed draws are INCLUDED."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/number/{num}":{"get":{"operationId":"getNumberStats","tags":["Statistics"],"summary":"Full statistics for one number: frequency, percentage, rank, gaps, distribution.","parameters":[{"name":"num","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{2,6}$"},"description":"2-6 digits; string preserves leading zeros."},{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."},{"name":"month","in":"query","schema":{"type":"integer","minimum":1,"maximum":12}},{"name":"day","in":"query","schema":{"type":"integer","minimum":1,"maximum":31}},{"name":"weekday","in":"query","schema":{"type":"string"},"description":"0-6 (Sun-indexed), English, or Thai weekday name."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive start draw date (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive end draw date (YYYY-MM-DD)."},{"name":"latest","in":"query","schema":{"type":"integer","minimum":1},"description":"Restrict to the most recent N draws after other filters."},{"name":"exclude_disputed","in":"query","schema":{"type":"boolean","default":false},"description":"Exclude draws whose verification_status is \"disputed\". DEFAULT: disputed draws are INCLUDED."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/compare":{"get":{"operationId":"compareNumbers","tags":["Analysis"],"summary":"Compare 2-20 numbers over one filtered dataset.","parameters":[{"name":"numbers","in":"query","required":true,"schema":{"type":"string"},"example":"53,55,88","description":"Comma-separated 2-6 digit numbers (2-20 of them)."},{"name":"year","in":"query","schema":{"type":"integer"},"description":"Gregorian (ค.ศ.) or Buddhist (พ.ศ.) year — auto-detected; e.g. 2026 or 2569."},{"name":"era","in":"query","schema":{"type":"string","enum":["CE","BE","auto"],"default":"auto"},"description":"Force interpretation of `year` as Gregorian or Buddhist."},{"name":"month","in":"query","schema":{"type":"integer","minimum":1,"maximum":12}},{"name":"day","in":"query","schema":{"type":"integer","minimum":1,"maximum":31}},{"name":"weekday","in":"query","schema":{"type":"string"},"description":"0-6 (Sun-indexed), English, or Thai weekday name."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive start draw date (YYYY-MM-DD)."},{"name":"to","in":"query","schema":{"type":"string","format":"date"},"description":"Inclusive end draw date (YYYY-MM-DD)."},{"name":"latest","in":"query","schema":{"type":"integer","minimum":1},"description":"Restrict to the most recent N draws after other filters."},{"name":"exclude_disputed","in":"query","schema":{"type":"boolean","default":false},"description":"Exclude draws whose verification_status is \"disputed\". DEFAULT: disputed draws are INCLUDED."}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/lottery/analyze":{"post":{"operationId":"analyzeDataset","tags":["Analysis"],"summary":"Analyze the dataset for a set of filters.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyzeRequest"},"example":{"filters":{"year":2026,"latest":100}}}}},"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/ask":{"post":{"operationId":"ask","tags":["Ask"],"summary":"Deterministic natural-language question routing. No LLM; answers are templated from canonical services. Prompt-injection safe.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskRequest"},"example":{"question":"เลข 53 ออกกี่ครั้ง"}}}},"responses":{"200":{"description":"Answered, or intent=unknown with suggestions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskResponse"}}}},"400":{"description":"Empty or oversized question","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/data/status":{"get":{"operationId":"getDataStatus","tags":["Data"],"summary":"Data freshness, provenance/verification coverage, and correction count.","responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/data/corrections":{"get":{"operationId":"getCorrections","tags":["Data"],"summary":"Recent entries from the immutable correction log (public-safe).","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/data/corrections/{date}":{"get":{"operationId":"getCorrectionsByDate","tags":["Data"],"summary":"Corrections for a specific draw date.","parameters":[{"name":"date","in":"path","required":true,"schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/status":{"get":{"operationId":"getPlatformStatus","tags":["Data"],"summary":"Public-safe platform status: latest draw, freshness, versions, dependency flags.","responses":{"200":{"description":"Success (PHASE 3 agent envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEnvelope"}}}},"400":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"401":{"description":"Invalid or malformed API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"403":{"description":"API key revoked or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"429":{"description":"Rate limit exceeded (anonymous: per-IP; authenticated: per-key tier)","headers":{"RateLimit-Limit":{"schema":{"type":"integer"},"description":"Requests allowed in the current window."},"RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Requests remaining in the current window."},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"Seconds until the window resets."},"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying (on 429)."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentError"}}}}}}},"/api/public/v1/news":{"get":{"operationId":"listNews","tags":["Content"],"summary":"Published news articles (newest first).","parameters":[{"name":"category","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":50,"default":12}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Published news list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/news/{slug}":{"get":{"operationId":"getNews","tags":["Content"],"summary":"A published news article by slug.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Published news article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleDetailResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/blog":{"get":{"operationId":"listBlog","tags":["Content"],"summary":"Published blog articles (newest first).","parameters":[{"name":"category","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":50,"default":12}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Published blog list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleListResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/blog/{slug}":{"get":{"operationId":"getBlog","tags":["Content"],"summary":"A published blog article by slug.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Published blog article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArticleDetailResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/content/categories":{"get":{"operationId":"listContentCategories","tags":["Content"],"summary":"Content categories with counts.","parameters":[{"name":"type","in":"query","schema":{"type":"string","enum":["news","blog"]}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/content/tags":{"get":{"operationId":"listContentTags","tags":["Content"],"summary":"Content tags with counts.","responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/content/rss/{type}":{"get":{"operationId":"getContentRss","tags":["Content"],"summary":"RSS feed for news or blog.","parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["news","blog"]}}],"responses":{"200":{"description":"RSS XML","content":{"application/rss+xml":{"schema":{"type":"string"}}}}}}},"/api/public/v1/content/sitemap-news":{"get":{"operationId":"getNewsSitemap","tags":["Content"],"summary":"Google News sitemap (recent published news).","responses":{"200":{"description":"XML","content":{"application/xml":{"schema":{"type":"string"}}}}}}},"/api/public/v1/content/{slug}/cover":{"get":{"operationId":"getContentCover","tags":["Content"],"summary":"Cover image for a published article.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"variant","in":"query","schema":{"type":"string","enum":["master","og","card","square"],"default":"master"}}],"responses":{"200":{"description":"Image","content":{"image/webp":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/lottery/draws":{"get":{"operationId":"listDraws","tags":["Legacy"],"summary":"Draw summaries, newest first (or a full year).","parameters":[{"name":"year","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":100,"default":24}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/lottery/draws/{date}":{"get":{"operationId":"getDrawByDate","tags":["Legacy"],"summary":"Full prize results of one draw (legacy shape).","parameters":[{"name":"date","in":"path","required":true,"schema":{"type":"string","format":"date","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/lottery/check":{"get":{"operationId":"checkNumber","tags":["Legacy"],"summary":"Check a 2/3/6-digit number against a draw.","parameters":[{"name":"number","in":"query","required":true,"schema":{"type":"string","pattern":"^(\\d{2}|\\d{3}|\\d{6})$"}},{"name":"date","in":"query","schema":{"type":"string","default":"latest"}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/statistics/frequency":{"get":{"operationId":"legacyFrequency","tags":["Legacy"],"summary":"Most frequent numbers by category.","parameters":[{"name":"type","in":"query","schema":{"type":"string","enum":["last2","last3","front3","first-prize-last2","first-prize-last3"],"default":"last2"}},{"name":"period","in":"query","schema":{"type":"string","default":"all"}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/statistics/missing":{"get":{"operationId":"legacyMissing","tags":["Legacy"],"summary":"Longest-absent (overdue) numbers.","parameters":[{"name":"type","in":"query","schema":{"type":"string","enum":["last2"],"default":"last2"}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/numbers/{number}":{"get":{"operationId":"legacyNumberStats","tags":["Legacy"],"summary":"Historical statistics for one number (legacy shape).","parameters":[{"name":"number","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{2,6}$"}}],"responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}},"/api/public/v1/meta":{"get":{"operationId":"meta","tags":["Legacy"],"summary":"Dataset coverage, endpoint list, documentation links.","responses":{"200":{"description":"Success (legacy envelope)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyEnvelope"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}},"429":{"description":"Rate limit exceeded — 300 requests / 5 minutes per IP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyError"}}}}}}}},"security":[{},{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Optional API key. Anonymous access is allowed with lower rate limits."},"BearerAuth":{"type":"http","scheme":"bearer","description":"Alternatively pass the API key as `Authorization: Bearer <key>`."}},"schemas":{"Author":{"type":"object","properties":{"name":{"type":"string","example":"ทีมงาน RANLOTTO"}}},"CoverAsset":{"type":"object","description":"Persisted cover image served from the content API (webp variants).","properties":{"url":{"type":["string","null"],"description":"Cover URL; append ?variant=master|og|card|square."},"alt":{"type":["string","null"]},"width":{"type":["integer","null"]},"height":{"type":["integer","null"]}}},"SourceReference":{"type":"object","description":"Attribution for external-sourced news (original RANLOTTO summary + link to source).","properties":{"source_name":{"type":["string","null"]},"source_url":{"type":["string","null"],"format":"uri"},"source_published_at":{"type":["string","null"],"format":"date-time"}}},"Pagination":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"ArticleSummary":{"type":"object","description":"List-view article (no full body). Published content only.","properties":{"type":{"type":"string","enum":["news","blog"]},"slug":{"type":"string"},"title":{"type":"string"},"excerpt":{"type":["string","null"]},"category":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"author_name":{"type":["string","null"]},"cover_image_url":{"type":["string","null"]},"cover_image_alt":{"type":["string","null"]},"published_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"reading_time":{"type":["integer","null"]},"featured":{"type":"boolean"},"status":{"type":"string","enum":["published","corrected"]}}},"ArticleDetail":{"allOf":[{"$ref":"#/components/schemas/ArticleSummary"},{"type":"object","description":"Full article with sanitized HTML body + SEO + source.","properties":{"content":{"type":"string","description":"Sanitized HTML body."},"cover_image_width":{"type":["integer","null"]},"cover_image_height":{"type":["integer","null"]},"source_name":{"type":["string","null"]},"source_url":{"type":["string","null"]},"source_published_at":{"type":["string","null"],"format":"date-time"},"canonical_url":{"type":["string","null"]},"seo_title":{"type":["string","null"]},"seo_description":{"type":["string","null"]}}}]},"ArticleListData":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ArticleSummary"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"ArticleListResponse":{"type":"object","properties":{"status":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/ArticleListData"},"meta":{"type":"object"}}},"ArticleDetailResponse":{"type":"object","properties":{"status":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/ArticleDetail"},"meta":{"type":"object"}}},"Provenance":{"type":"object","description":"Optional data-provenance block attached to a published result.","properties":{"checksum":{"type":"string","description":"SHA-256 of the canonical result (order-independent)."},"source_type":{"type":"string","enum":["official","news","archive","manual","migrated"]},"source_url":{"type":["string","null"]},"verification_status":{"type":"string","enum":["unverified","single_source","cross_verified","official_verified","disputed","corrected"]},"retrieved_at":{"type":["string","null"],"format":"date-time"},"verified_at":{"type":["string","null"],"format":"date-time"},"import_batch_id":{"type":["string","null"]}}},"Correction":{"type":"object","properties":{"draw_date":{"type":"string","format":"date"},"field_name":{"type":"string"},"old_value":{"type":["string","null"]},"new_value":{"type":["string","null"]},"reason":{"type":"string"},"source_reference":{"type":["string","null"]},"corrected_at":{"type":["string","null"],"format":"date-time"},"corrected_by_type":{"type":"string"}}},"Source":{"type":"object","properties":{"name":{"type":"string"},"name_th":{"type":"string"},"url":{"type":"string","format":"uri"},"type":{"type":"string"},"source_published_at":{"type":["string","null"]},"retrieved_at":{"type":"string","format":"date-time"}}},"Methodology":{"type":"object","properties":{"description":{"type":"string"},"timezone":{"type":"string","const":"Asia/Bangkok"},"calculation_version":{"type":"string"}}},"AgentEnvelope":{"type":"object","required":["success","generated_at","timezone"],"properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","additionalProperties":true},"facts":{"type":"object","additionalProperties":true},"statistics":{"type":"object","additionalProperties":true},"observations":{"type":"array","items":{"type":"string"}},"methodology":{"$ref":"#/components/schemas/Methodology"},"limitations":{"type":"array","items":{"type":"string"}},"sources":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"sample_size":{"type":"integer","description":"Number of draws the statistics were computed over."},"filters":{"type":"object","additionalProperties":true,"description":"The filters that actually took effect."},"disclaimer":{"type":"string"},"license":{"type":"string"},"generated_at":{"type":"string","format":"date-time"},"timezone":{"type":"string","const":"Asia/Bangkok"}}},"AgentError":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","const":false},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"string"}}},"generated_at":{"type":"string","format":"date-time"},"timezone":{"type":"string","const":"Asia/Bangkok"}}},"AskRequest":{"type":"object","required":["question"],"properties":{"question":{"type":"string","maxLength":500,"description":"Natural-language question (Thai or English). Untrusted text — never executed."}}},"AnalyzeRequest":{"type":"object","properties":{"filters":{"type":"object","additionalProperties":true}}},"AskResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"answer":{"type":["string","null"]},"intent":{"type":"string","enum":["latest_result","result_by_date","next_draw","draw_schedule","number_statistics","weekday_statistics","month_day_statistics","compare_numbers","dataset_summary","unknown"]},"entities":{"type":"object","additionalProperties":true},"result":{"type":["object","null"],"additionalProperties":true},"citations":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"limitations":{"type":"array","items":{"type":"string"}},"suggestions":{"type":"array","items":{"type":"string"}}}},"meta":{"type":"object","properties":{"timezone":{"type":"string","const":"Asia/Bangkok"},"generatedAt":{"type":"string","format":"date-time"},"sampleSize":{"type":["integer","null"]},"methodology":{"type":"string"},"calculationVersion":{"type":"string"}}},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"LegacyEnvelope":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"]},"data":{"type":"object","additionalProperties":true},"meta":{"type":"object","properties":{"source":{"type":"string"},"lastUpdated":{"type":"string"},"methodology":{"type":"string"},"disclaimer":{"type":"string"},"license":{"type":"string"}}}}},"LegacyError":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}},"meta":{"type":"object","additionalProperties":true}}}}}}