DEVELOPER

API Docs

เอกสารเรียกผลหวย เงื่อนไขเปิด–ปิด และ sync สำหรับนำไปใช้ต่อ

BASE

https://thailottoapi.comhttps://thailottoapi.baagame-com.workers.devContent-Type: application/json

ภาพรวม

Endpoints

สถานะผลหวย

status

success

มีเลขออกแล้ว

pending

ถึงวันหวยแล้ว แต่ยังไม่ออกเลข

close

วันนั้นปิดรับ / ไม่ใช่งวด

หมวด categories

ค่าที่ใช้บ่อย

categoryความหมาย
lottothaihotหวยยอดฮิตประเทศไทย (รวม LPP ลาวพัฒนาพิเศษ)
lottoforeignหวยต่างประเทศ
maekhongหวยแม่โขง (จาก LAOLOTTO)
liwหวย LIW ทุก 15 นาที (จาก liwlottery.com)
stockหวยหุ้นต่างประเทศ

GET /api/results

ผลหวยตามวันที่

ดึงผลหวยทุกหมวดของวันที่เลือก รวมแม่โขงและ LIW

Query parameters

ชื่อจำเป็นตัวอย่างรายละเอียด
dateไม่2026-08-21รูปแบบ YYYY-MM-DD (ค่าเริ่มต้น = วันนี้ เวลาไทย)
syncไม่1บังคับดึงใหม่จากต้นทางทันที

ตัวอย่าง URL

ฟิลด์สำคัญ

ฟิลด์รายละเอียด
keyรหัสหวย เช่น thailotto, mkn, liw#1915
labelชื่อแสดง
statussuccess | pending | close
statusMessageข้อความสถานะเมื่อยังไม่มีเลข
drawDate / drawDateDisplayวันงวด / รูปแบบ DD.MM.YYYY
result / top3 / bottom2 / bottom3เลขที่ออก (string)
dataresultวัตถุดิบ รวม result_image / result_video ของ LIW
scheduleเวลาเปิด–ปิดรับ
iconURL ไอคอน

ตัวอย่าง response

{
  "ok": true,
  "date": "2026-08-21",
  "count": 83,
  "categories": {
    "lottothaihot": { "title": "...", "columns": "thai", "items": [ /* ... */ ] },
    "lottoforeign": { "title": "...", "items": [ /* ... */ ] },
    "maekhong": { "title": "ผลหวยแม่โขง", "items": [ /* ... */ ] },
    "liw": { "title": "ผลหวย LIW", "items": [ /* ... */ ] },
    "stock": { "title": "...", "items": [ /* ... */ ] }
  }
}

GET /api/schedules

เงื่อนไขเปิด–ปิด / ออกผล

ตารางเวลาและรายละเอียดของแต่ละหวย ไม่ผูกกับวันที่

Query parameters

ชื่อจำเป็นตัวอย่างรายละเอียด
keyไม่malaylottoดึงหวยเดียว
categoryไม่stockกรองหมวด: lottothaihot | lottoforeign | maekhong | liw | stock

ตัวอย่าง URL

ฟิลด์สำคัญ

ฟิลด์รายละเอียด
key / labelรหัสและชื่อหวย
openDetail / closeDetailข้อความเปิดรับ / ปิดรับ
resultApproxเวลาออกผลโดยประมาณ
drawRuleเงื่อนไขวันที่มีผล
statusGuideความหมาย success / pending / close
notesหมายเหตุเพิ่มเติม

ตัวอย่าง response

{
  "ok": true,
  "count": 36,
  "guide": {
    "success": "มีผลแล้ว",
    "pending": "ถึงวันหวยแล้ว แต่ยังไม่ออกเลข",
    "close": "วันนั้นไม่เปิดรับ / ไม่ใช่งวด"
  },
  "categories": { /* จัดกลุ่มตามหมวด */ },
  "items": [ /* รายการหวย */ ]
}

POST /api/sync

บังคับซิงก์ผลเข้าฐานข้อมูล

สำหรับระบบภายใน — ต้องส่ง header ความลับ

endpoint นี้ต้องมีรหัสลับ — ไม่เปิดสาธารณะ

ตัวอย่าง URL

ฟิลด์สำคัญ

ฟิลด์รายละเอียด
Headerx-sync-secret: <SYNC_SECRET>
Body JSON{ "date": "2026-08-21" } (ไม่ส่ง = วันนี้)

ตัวอย่าง response

{
  "ok": true,
  "queryDate": "2026-08-21",
  "saved": 90,
  "successCount": 70
}

curl

ตัวอย่างเรียกใช้

# ผลวันนี้
curl "https://thailottoapi.com/api/results"

# ผลวันที่กำหนด
curl "https://thailottoapi.com/api/results?date=2026-08-21"

# เงื่อนไขหวยทั้งหมด
curl "https://thailottoapi.com/api/schedules"

# เงื่อนไขหวยเดียว
curl "https://thailottoapi.com/api/schedules?key=mkn"

# บังคับ sync (ต้องมี secret)
curl -X POST "https://thailottoapi.com/api/sync" \
  -H "content-type: application/json" \
  -H "x-sync-secret: YOUR_SECRET" \
  -d '{"date":"2026-08-21"}'