Query params: q (search), geography_id (1-6)
GET /provinces?q=กรุง
{
"count": 1,
"data": [{
"id": 1,
"name_th": "กรุงเทพมหานคร",
"name_en": "Bangkok",
"geography_id": 2
}]
}
Required: province_id. Optional: q
GET /districts?province_id=1
{
"province": {"name_th": "กรุงเทพมหานคร", "name_en": "Bangkok"},
"count": 50,
"data": [{"id": 1001, "name_th": "เขตพระนคร", ...}]
}
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/10200
{
"zip_code": "10200",
"count": 12,
"data": [{
"subdistrict": {"name_th": "พระบรมมหาราชวัง"},
"district": {"name_th": "เขตพระนคร"},
"province": {"name_th": "กรุงเทพมหานคร"}
}, ...]
}
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
}]
}
Validates 13-digit Thai ID checksum (Luhn-like algorithm)
GET /validate/thai-id/1234567890121
{"valid": true, "id": "1234567890121", "checksum_digit": 1, "expected_checksum": 1}
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"
}
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..."
}
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)