สุ่มเลขหวยตรวจหวยผลสลากสถิติหวย
REST API

Public API v1 สำหรับนักพัฒนาและ AI agent

RANLOTTO เปิดข้อมูลผลสลากกินแบ่งรัฐบาลย้อนหลัง สถิติเลข และการตรวจรางวัลผ่าน REST API สาธารณะ (อ่านอย่างเดียว) endpoint ชุด /api/public/v1 เป็นสัญญาที่เสถียร

มีทั้งชุดเดิม (envelope { status, data, meta }) และชุด agent endpoints ที่เพิ่มเข้ามา (schedule, next-draw, number, compare, /ask, ข้อมูล provenance) ซึ่งใช้ agent envelope { success, data, facts, statistics, methodology, limitations, sources, sample_size, generated_at, timezone } ใช้งานแบบ anonymous ได้โดยไม่ต้องมี key และรองรับ API key แบบ tier เพื่อ quota ที่สูงขึ้น (ส่ง key ทาง header Authorization: Bearer หรือ X-API-Key)

เอกสารประกอบ

Endpoints (v1)

รายการ endpoint ของ Public API v1
EndpointGET /api/public/v1/lottery/latestคำอธิบายผลงวดล่าสุดครบทุกรางวัล
EndpointGET /api/public/v1/lottery/draws?year=&limit=คำอธิบายรายการงวดล่าสุด หรือทั้งปีที่ระบุ
EndpointGET /api/public/v1/lottery/draws/{date}คำอธิบายผลครบทุกรางวัลของงวดที่ระบุ (YYYY-MM-DD)
EndpointGET /api/public/v1/lottery/check?number=&date=คำอธิบายตรวจเลข 2, 3 หรือ 6 หลักกับงวดที่ระบุ (date=latest ได้)
EndpointGET /api/public/v1/statistics/frequency?type=&period=คำอธิบายเลขออกบ่อย (last2, last3, front3, first-prize-last2, first-prize-last3)
EndpointGET /api/public/v1/statistics/missing?type=last2คำอธิบายเลขไม่ออกนาน (เลขค้าง)
EndpointGET /api/public/v1/numbers/{number}คำอธิบายสถิติของเลขหนึ่งตัว: ความถี่ ออกล่าสุด งวดที่ขาด แยกประเภท/รายปี
EndpointGET /api/public/v1/metaคำอธิบายขอบเขตข้อมูล รายการ endpoint และลิงก์เอกสาร

Agent endpoints

เพิ่มเข้ามาใน Phase 6–8 — ใช้ agent envelope และแนบ methodology, limitations, sources และ sample_size ทุกครั้ง ดูสเปกเต็มที่ /api-docs

Agent endpoints
EndpointGET /api/public/v1/lottery/schedule?year=คำอธิบายปฏิทินงวด พร้อมวันในสัปดาห์ที่คำนวณจริง (รองรับ พ.ศ./ค.ศ.)
EndpointGET /api/public/v1/lottery/next-drawคำอธิบายงวดถัดไปที่กำลังจะออก
EndpointGET /api/public/v1/lottery/results?year=คำอธิบายผลรางวัลทั้งปี (agent envelope)
EndpointGET /api/public/v1/lottery/result/{date}คำอธิบายผลรายงวด + สถานะ + provenance/verification
EndpointGET /api/public/v1/lottery/number/{num}คำอธิบายสถิติเลข 2–6 หลัก: ความถี่ อันดับ gap การกระจาย
EndpointGET /api/public/v1/lottery/stats/weekday/{weekday}คำอธิบายสถิติตามวันในสัปดาห์ (0–6 / อังกฤษ / ไทย)
EndpointGET /api/public/v1/lottery/stats/date/{monthDay}คำอธิบายสถิติวันที่เดียวกัน (MM-DD)
EndpointGET /api/public/v1/lottery/compare?numbers=53,55,88คำอธิบายเปรียบเทียบหลายเลขบนชุดข้อมูลเดียวกัน
EndpointGET POST /api/public/v1/lottery/analyzeคำอธิบายวิเคราะห์ชุดข้อมูลตาม filters
EndpointGET POST /api/public/v1/askคำอธิบายถาม-ตอบแบบ deterministic (ไม่ใช้ LLM)

Data governance (read-only)

สถานะความสดของข้อมูล, coverage การตรวจสอบ และบันทึกการแก้ไขแบบ immutable

Data governance endpoints
EndpointGET /api/public/v1/statusคำอธิบายสถานะแพลตฟอร์มแบบ public-safe (freshness, versions)
EndpointGET /api/public/v1/data/statusคำอธิบายความสดของข้อมูล + coverage การตรวจสอบ + จำนวนการแก้ไข
EndpointGET /api/public/v1/data/correctionsคำอธิบายบันทึกการแก้ไขข้อมูลแบบ immutable
EndpointGET /api/public/v1/data/corrections/{date}คำอธิบายการแก้ไขของงวดที่ระบุ

ลองเรียก API (Playground)

เลือก endpoint กรอกพารามิเตอร์ แล้วดู response จริง พร้อมคัดลอกคำสั่ง curl ไปใช้งานได้ทันที

https://api.ranlotto.com/api/public/v1/lottery/latest

ตัวอย่าง response

{
  "status": "success",
  "data": {
    "drawDate": "2026-07-01",
    "drawDateThai": "1 ก.ค. 2569",
    "prizes": {
      "firstPrize": { "numbers": ["751495"], "rewardAmount": 6000000 },
      "frontThreeDigits": { "numbers": ["001", "980"], "rewardAmount": 4000 },
      "lastThreeDigits": { "numbers": ["304", "531"], "rewardAmount": 4000 },
      "lastTwoDigits": { "numbers": ["62"], "rewardAmount": 2000 }
    }
  },
  "meta": {
    "source": "RANLOTTO historical Thai lottery database — results referenced from the Government Lottery Office (GLO)",
    "lastUpdated": "2026-07-01",
    "disclaimer": "Historical statistics only. They do not predict and cannot guarantee future lottery results."
  }
}

Rate limit & API keys

Anonymous (ไม่มี key): จำกัดต่อ IP สำหรับ /api/public — response แนบ header RateLimit-* มาตรฐาน draft-7

API key (tier): developer / business / internal ได้ quota ต่อ key สูงขึ้น — เก็บเป็น hash เท่านั้น ส่งทาง header (ไม่ใส่ใน query string) หากต้องการ key ติดต่อผ่านหน้า ติดต่อเรา

Legacy endpoints

ชุดเดิม (envelope { success, data, error }) ยังใช้งานได้ แต่แนะนำให้ใช้ v1 สำหรับงานใหม่

รายการ legacy endpoint
EndpointGET /api/lottery/drawคำอธิบายสรุปผลงวดล่าสุด
EndpointGET /api/lottery/list-historyคำอธิบายผลย้อนหลังทุกงวดพร้อมรางวัล
EndpointGET /api/lottery/history/{date}คำอธิบายผลของงวดใดงวดหนึ่ง (YYYY-MM-DD)
EndpointGET /api/lottery/results?year={year}คำอธิบายผลรางวัลรายปี
EndpointGET /api/lottery/insights?window={n}คำอธิบายเลขมาแรง / เลขห่างหาย
EndpointGET /api/lottery/stats/weekdayคำอธิบายสถิติแยกตามวันในสัปดาห์

ที่มาข้อมูล: ผลรางวัลจากสำนักงานสลากกินแบ่งรัฐบาล (GLO) ผ่านฐานข้อมูลที่ตรวจสอบแล้วของ RANLOTTO

การอ้างอิง: โปรดอ้างอิง "RANLOTTO (ranlotto.com)" พร้อม URL ถาวรของงวด (เช่น https://www.ranlotto.com/lottery/2026-07-01) หรือหน้าสถิติที่เกี่ยวข้อง