REST API v1.0.0 สำหรับนักพัฒนาและเชื่อมต่อภายนอก
ยินดีต้อนรับสู่ระบบนักพัฒนาของ ThaiProMax คุณสามารถใช้ REST API ของเราเพื่อเชื่อมต่อบริการตรวจสอบข้อมูลและส่งเจเนอเรตข้อมูล AI จากระบบงานของคุณเองได้โดยตรงผ่านระบบ HTTP
การเรียกใช้งาน API ทุก Request จะต้องแนบ API Key ที่สร้างจากหน้าแดชบอร์ด "API Key" โดยส่งผ่าน HTTP Request Header ในรูปแบบ Bearer Token ดังนี้:
ใช้เพื่อตรวจสอบประเภทแผนสมัครสมาชิก ยอดพ๊อยต์รายเดือน และเครดิตสะสมในกระเป๋าเงินของคุณ
/api/v1/me
ตัวอย่างคำตอบรับกลับจากระบบ (JSON Response):
{
"subscription": {
"plan": "premium",
"planName": "Premium Plan",
"status": "active",
"billingCycle": "monthly",
"periodStart": "2026-06-01T00:00:00.000Z",
"periodEnd": "2026-07-01T00:00:00.000Z",
"pointsRemaining": 42500,
"pointsLimit": 44000,
"pointsUsed": 1500
},
"wallet": {
"credits": 5000
}
}
ส่งคำสั่งเจเนอเรตตามประเภทบริการ (หักเครดิตหรือพ๊อยต์ตามโครงสร้างที่จำแนกไว้)
/api/v1/generate?capabilityKey=gen_light
| ตัวแปร | ประเภท | คำอธิบาย |
|---|---|---|
capabilityKey |
String (บังคับ) | ระบุคีย์ความสามารถ: gen_light (10 Credits) หรือ gen_heavy (1,000 Credits) |
ตัวอย่างคำตอบรับกลับจากระบบ (JSON Response):
{
"ok": true,
"newValue": 42,
"capabilityKey": "gen_light",
"costCredits": 10,
"source": "points",
"newCredits": null,
"newPoints": 42490
}
curl -X GET "https://example.com/api/v1/generate?capabilityKey=gen_light" \
-H "Authorization: Bearer your_api_key_here"
const apiKey = 'your_api_key_here';
const url = 'https://example.com/api/v1/generate?capabilityKey=gen_light';
fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
import requests
api_key = "your_api_key_here"
url = "https://example.com/api/v1/me"
headers = {
"Authorization": f"Bearer {api_key}",
"Accept": "application/json"
}
response = requests.get(url, headers=headers)
print(response.json())