📡 UsunX API Documentation

REST API สำหรับดึงข้อมูลราคากีฬาแบบ Real-time — ใช้ได้เลยทันที ไม่ต้องลงทะเบียน

✅ Free Access — ไม่ต้อง API Key
🔄 Auto-refresh ทุก 15 วินาที
🌐 JSON Response

Base URL

https://usunx.com

🚀 Quick Start — ใช้ได้เลย!

cURL:

curl https://usunx.com/api/v1/odds

JavaScript (fetch):

const res = await fetch("https://usunx.com/api/v1/odds");
const data = await res.json();
console.log(data.count, "events");
console.log(data.data[0]); // first event

Python:

import requests

res = requests.get("https://usunx.com/api/v1/odds")
data = res.json()
print(f"{data['count']} events")
for event in data['data'][:5]:
    print(f"{event['homeTeam']} vs {event['awayTeam']}")

📋 Endpoints

⚡ Rate Limits & Notes

  • • ไม่จำกัดจำนวน request (Fair use policy)
  • • ข้อมูลอัปเดตทุก 15 วินาที
  • • Response format: JSON (UTF-8)
  • • CORS: เปิดให้ทุก origin
  • • Timeout: 30 วินาที

🔔 Push API — ส่งราคาเข้าระบบ

ใช้ POST /api/v1/odds/push เพื่อส่งราคาจากแหล่งข้อมูลภายนอกเข้าระบบ UsunX ราคาที่ push เข้ามาจะแสดงในหน้า Odds ทันที

curl -X POST https://usunx.com/api/v1/odds/push \
  -H "Content-Type: application/json" \
  -d '{
    "events": [{
      "eventId": "my_event_001",
      "sportKey": "soccer",
      "league": "Thai League 1",
      "homeTeam": "บุรีรัมย์ ยูไนเต็ด",
      "awayTeam": "เมืองทอง ยูไนเต็ด",
      "commenceTime": "2026-05-01T18:00:00Z",
      "status": "upcoming",
      "oddsData": {
        "ftHdp": { "home": 1.85, "away": 2.05, "line": -1.0 },
        "ftOu": { "over": 1.90, "under": 1.95, "line": 2.5 },
        "ft1x2": { "home": 2.10, "draw": 3.40, "away": 3.50 }
      }
    }]
  }'