เริ่มต้นใช้งาน
เริ่มต้นใช้งาน
จาก zero ถึง first request — เลือกภาษาที่ทีมคุณใช้
1. สมัครและสร้าง API key
สร้าง account ฟรี ไปที่ Dashboard > API keys แล้วกด Create ในส่วน "Create a live API key" คัดลอก key ตอนสร้าง เพราะระบบจะแสดงครั้งเดียว
สมัครฟรี →2. เรียก API ครั้งแรก
ใช้ endpoint เด่นที่สุดของเรา — Thai Calendar Day — รวมฤกษ์ 5 ระบบใน request เดียว เรียกได้ตั้งแต่แผน Free
// Bun / Node 18+ — uses the native fetch
const res = await fetch('https://api.astrom8.com/api/v3/thai/calendar/day', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ASTROM8_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
date: '2026-10-17',
timezoneOffsetMinutes: 420,
latitude: 13.7563,
longitude: 100.5018,
birth_year: 1990,
birth_day_of_week: 'mon',
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()
console.log(data.reuk.reuk_bon.class_th)3. อ่าน response
label หลักมีทั้งภาษาไทยและอังกฤษ (label_th/label_en, class_th/class_en, position_th/position_en) นำไปแสดงใน UI ได้โดยไม่ต้องทำตาราง mapping ส่วนคะแนนและวันที่เป็นค่าธรรมดา
{
"gregorian_date": "2026-10-17",
"buddhist_year": 2569,
"wan_phra": {
"is_holy_day": false,
"type": null,
"moon_phase": null
},
"pee_chong": {
"year_animal_th": "มะเมีย",
"year_animal_en": "Horse",
"personal_clash": false
},
"reuk": {
"thaksa": {
"label_th": "อุตสาหะ",
"label_en": "Utsaha",
"score": 3
},
"reuk_bon": {
"class_th": "มหัทธโนฤกษ์",
"class_en": "Mahatthano",
"score": 5,
"auspicious_for": [
"business",
"trade",
"wealth"
]
},
"dithi": {
"class_th": "ภัทรา",
"class_en": "Bhadra",
"score": 4
},
"maha_thaksa": {
"today_position": {
"position_th": "ศรี",
"position_en": "Sri",
"score": 5
}
}
}
}4. ขั้นตอนต่อไป
อ่านเรื่อง Authentication, Rate Limits, แล้วลอง endpoint อื่นในหมวดที่เกี่ยวข้องกับ use case ของคุณ