🇹🇭 Thai Utility API

Address Lookup • Thai ID Validation • Phone Validation • PromptPay QR
77
Provinces
930
Districts
7,452
Subdistricts
6
API Endpoints

🔗 API Endpoints

GET/provincesList all 77 provinces

Query params: q (search), geography_id (1-6)

GET /provinces?q=กรุง

{
  "count": 1,
  "data": [{
    "id": 1,
    "name_th": "กรุงเทพมหานคร",
    "name_en": "Bangkok",
    "geography_id": 2
  }]
}
GET/districtsDistricts by province

Required: province_id. Optional: q

GET /districts?province_id=1

{
  "province": {"name_th": "กรุงเทพมหานคร", "name_en": "Bangkok"},
  "count": 50,
  "data": [{"id": 1001, "name_th": "เขตพระนคร", ...}]
}
GET/subdistrictsSubdistricts by district

Required: district_id. Optional: q

GET /subdistricts?district_id=1001

{
  "district": {"name_th": "เขตพระนคร"},
  "province": {"name_th": "กรุงเทพมหานคร"},
  "count": 12,
  "data": [{"id": 100101, "name_th": "พระบรมมหาราชวัง", "zip_code": 10200, ...}]
}
GET/zipcode/:codeLookup by zip code
GET /zipcode/10200

{
  "zip_code": "10200",
  "count": 12,
  "data": [{
    "subdistrict": {"name_th": "พระบรมมหาราชวัง"},
    "district": {"name_th": "เขตพระนคร"},
    "province": {"name_th": "กรุงเทพมหานคร"}
  }, ...]
}
GET/searchSearch across all levels

Required: q (min 2 chars). Returns up to 20 results.

GET /search?q=บางรัก

{
  "query": "บางรัก",
  "count": 5,
  "data": [{
    "subdistrict": {"name_th": "บางรัก"},
    "district": {"name_th": "เขตบางรัก"},
    "province": {"name_th": "กรุงเทพมหานคร"},
    "zip_code": 10500
  }]
}
GET/validate/thai-id/:idValidate Thai National ID

Validates 13-digit Thai ID checksum (Luhn-like algorithm)

GET /validate/thai-id/1234567890121

{"valid": true, "id": "1234567890121", "checksum_digit": 1, "expected_checksum": 1}
GET/validate/phone/:numberValidate Thai phone number

Accepts formats: 0812345678, +66812345678, 066-812-3456

GET /validate/phone/0812345678

{
  "valid": true,
  "normalized": "0812345678",
  "formatted": "081-234-5678",
  "type": "mobile",
  "carrier": "AIS/TrueMove/DTAC",
  "international": "+66812345678"
}
POST/promptpay/qrGenerate PromptPay QR Code

Body: {"target": "0812345678", "amount": 100, "format": "png"}

Format: png (base64), svg, text (payload only)

Also available as GET: /promptpay/qr?target=0812345678&amount=100 (returns PNG image)

POST /promptpay/qr
{"target": "0812345678", "amount": 100}

{
  "payload": "00020101021229370016A000000677...",
  "target": "0812345678",
  "amount": 100,
  "qr_base64": "iVBORw0KGgo..."
}

🧪 Live Demo

Try it now

🔑 Authentication

Add X-Api-Key header to all requests (except / and /health).

curl -H "X-Api-Key: YOUR_KEY" https://hubaiasia.com/thai-api/provinces

Demo key for testing: demo-key-thai-api (100 requests/day, 5/min)

💰 Pricing

Free

$0
  • 100 requests/day
  • 5 requests/min
  • All endpoints

Pro

$14.99/mo
  • 5,000 requests/day
  • 60 requests/min
  • Dedicated support

Ultra

$29.99/mo
  • 20,000 requests/day
  • 120 requests/min
  • SLA guarantee

📦 Use Cases