ข้ามไปยังเนื้อหา

Historical draw metadata

schema, verification, sources และ prize_groups เป็น fields เพิ่มเติม โดยคง API เดิมไว้ data_quality.complete_prize_types ระบุรางวัลที่ใช้คำนวณสถิติและตรวจได้ หมายเลขเป็น string และรางวัลซ้ำแยกตาม slot; amount เป็น null เมื่อยังไม่ยืนยันยอดเงินของงวดนั้น รางวัลที่ต้องใช้กลุ่มหรือชุดตรวจจากเลขหกหลักอย่างเดียวไม่ได้

REST API

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

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

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

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

เริ่มใช้งาน API

ดาวน์โหลด Postman collection แล้ว Import ใน Postman เปลี่ยน drawDate และ number เพื่อเรียกผลย้อนหลังหรือสถิติเลข โดยไม่ต้องใช้ API key

const response = await fetch('https://api.ranlotto.com/api/public/v1/coverage');
if (!response.ok) throw new Error('HTTP ' + response.status);
const coverage = await response.json();
console.log(coverage);

อ่าน metadata ของแต่ละ response ก่อนเปรียบเทียบสถิติ: รุ่นชุดข้อมูลอ้างอิงกับจำนวนงวดที่ใช้คำนวณอาจต่างกัน กรุณาอ้างอิง RANLOTTO และลิงก์หน้าชุดข้อมูลเมื่อเผยแพร่กราฟหรือผลวิเคราะห์

Embed widget

เว็บอื่นสามารถฝังฟอร์มตรวจหวยขนาดเล็กได้ด้วย script เดียว โดย widget จะเรียก Public API v1 และลิงก์กลับมายังหน้าเครื่องมือตรวจหวยของ RANLOTTO

<script src="https://www.ranlotto.com/embed/lottery-checker.js" async></script>

Endpoints (v1)

รายการ endpoint ของ Public API v1
EndpointGET /api/public/v1/lottery/latestคำอธิบายผลงวดล่าสุดที่เผยแพร่ครบตาม schema (compatibility envelope)
EndpointGET /api/public/v1/lottery/draws?year=&limit=คำอธิบายรายการงวดล่าสุด หรือทั้งปีที่ระบุ
EndpointGET /api/public/v1/lottery/draws/{date}คำอธิบายผลของงวดที่ระบุเมื่อข้อมูลครบตาม schema; งวด historical incomplete จะดูรายละเอียดได้ที่ Data Status
EndpointGET /api/public/v1/lottery/check?number=&date=คำอธิบายตรวจเลข 2, 3 หรือ 6 หลักกับงวดที่ระบุ (compatibility envelope)
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}คำอธิบายcompatibility alias; งานใหม่ควรใช้ /lottery/number/{num}
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/result/latestคำอธิบายผลงวดล่าสุดแบบ canonical agent envelope
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/check-number?number=&date=คำอธิบายตรวจเลขกับงวดที่ระบุแบบ canonical agent envelope
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คำอธิบายเปรียบเทียบหลายเลขบนชุดข้อมูลเดียวกัน
EndpointPOST /api/public/v1/lottery/analyzeคำอธิบายวิเคราะห์ชุดข้อมูลตาม filters
EndpointPOST /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 ไปใช้งานได้ทันที

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

ตัวอย่าง response (agent)

{
  "success": true,
  "data": {
    "date": "YYYY-MM-DD",
    "state": "published",
    "result": { "first_prize": "000000", "last_two": "00" }
  },
  "facts": { "date": "YYYY-MM-DD", "state": "published" },
  "statistics": {},
  "methodology": { "description": "...", "timezone": "Asia/Bangkok", "calculation_version": "1.0.0" },
  "limitations": ["Historical frequency does not predict future draws."],
  "sources": [{ "name": "Publicly announced lottery results", "url": null }],
  "generated_at": "ISO-8601",
  "timezone": "Asia/Bangkok"
}

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

ชุดเดิมของแอปยังใช้งานได้ แต่แนะนำให้ใช้ Public API v1 และ canonical agent endpoints สำหรับงานใหม่

รายการ 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คำอธิบายสถิติแยกตามวันในสัปดาห์

อ้างอิงข้อมูลจาก RANLOTTO

เมื่อเผยแพร่ผลรางวัล กราฟ หรือบทวิเคราะห์จาก API ให้แสดงชื่อแหล่งข้อมูลใกล้เนื้อหาที่ใช้ พร้อมลิงก์เพื่อให้ผู้อ่านตรวจสอบต้นทาง คัดลอกตัวอย่าง HTML ด้านล่างไปใช้ได้

ที่มาข้อมูล: RANLOTTO · ชุดข้อมูลผลสลากย้อนหลัง

ที่มาข้อมูล: <a href="https://www.ranlotto.com/">RANLOTTO</a>
ชุดข้อมูล: <a href="https://www.ranlotto.com/datasets/lottery-results">ผลสลากย้อนหลัง</a>

ถ้าใช้ผลเฉพาะงวด ให้แนบ URL ของงวดนั้นเพิ่ม หากใช้สถิติให้ระบุ datasetVersion, sampleSize และวันที่ดึงข้อมูลตาม response จริง เพื่อให้ตรวจสอบซ้ำได้

ที่มาข้อมูล: ผลการออกรางวัลที่เผยแพร่ต่อสาธารณะ ซึ่ง RANLOTTO รวบรวมและระบุสถานะการตรวจสอบแยกตามข้อมูล ดูข้อจำกัดที่หน้า สถานะข้อมูล

ใช้ชื่อแหล่งข้อมูล RANLOTTO และ URL ถาวรของงวดหรือชุดข้อมูลเพื่อให้ผู้อ่านตรวจสอบต้นทางได้ สำหรับบริการโดยรวมใช้ https://www.ranlotto.com/ การอ้างอิงเป็นเรื่องที่มาและเงื่อนไขการใช้ข้อมูล ไม่ได้กำหนดให้ลิงก์ต้องเป็น followed เพื่อ SEO ผู้เผยแพร่เลือก rel ของลิงก์ได้ตามนโยบายของตนโดยปฏิบัติตามสิทธิ์การใช้ข้อมูล

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