REST APIStandard SMS Gateway
OTPMall Public API
HTTP API ที่ออกแบบตาม รูปแบบมาตรฐานของอุตสาหกรรม OTP/SMS gateway ทำให้ integrator ที่เคยใช้ API gateway แบบเดียวกันสลับมาใช้บริการเราได้ทันที โดยเปลี่ยนแค่base URL และ API key.
เริ่มต้นใช้งาน
- 1สมัครสมาชิก และเติมเงินใน account ของคุณที่ otpmall.com
- 2เข้าหน้า API Keys แล้วกด Create New Key — API key จะขึ้นต้นด้วย
otp_ - 3ใช้ key เรียก endpoint
https://otpmall.com/stubs/handler_api.phpด้วย query param?api_key=...
# Quick test — getBalance
curl "https://otpmall.com/stubs/handler_api.php?api_key=otp_YOUR_KEY&action=getBalance"
# → ACCESS_BALANCE:1250.00
Base URL
https://otpmall.com/stubs/handler_api.phpAuthentication
?api_key=otp_xxxxxxxxxxxxxxxxRate limit: 30 req/min per key
Actions
GET
getBalanceEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getBalanceResponse (text)
ACCESS_BALANCE:123.45GET
getServicesListEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getServicesListResponse (json)
{
"tg": { "name": "Telegram", "image": "https://otpmall.com/icons/tg.png" },
"wa": { "name": "WhatsApp", "image": "https://otpmall.com/icons/wa.png" }
}GET
getCountriesEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getCountriesResponse (json)
{
"0": { "name": "Russia" },
"1": { "name": "Ukraine" }
}GET
getPricesEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getPrices&country=0&service=tgParameters
country— (optional) Filter by country codeservice— (optional) Filter by service code
Response (json)
{
"0": {
"tg": { "cost": 12.50, "count": 245 }
}
}GET
getNumberEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getNumber&service=tg&country=0Parameters
service— Service code (e.g., tg, wa, ig)country— Country code (e.g., 0=Russia)
Response (text)
ACCESS_NUMBER:clxyz123abc:79123456789GET
getStatusEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getStatus&id={ID}Parameters
id— activationId returned by getNumber
Response (text)
STATUS_WAIT_CODE # still waiting
STATUS_OK:1234 # SMS received, code is 1234
STATUS_CANCEL # cancelled / refundedGET
setStatusEndpoint
/stubs/handler_api.php?api_key={KEY}&action=setStatus&id={ID}&status={N}Parameters
id— activationId returned by getNumberstatus— 1=ready, 3=retry, 6=finalize/done, 8=cancel+refund
Response (text)
ACCESS_READY # status=1
ACCESS_RETRY_GET # status=3
ACCESS_ACTIVATION # status=6
ACCESS_CANCEL # status=8GET
getMailDomainsEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getMailDomains&site={SITE}Parameters
site— Target website to register for (e.g., telegram.com, openai.com)
Response (json)
{
"data": [
{ "name": "gmail.com", "cost": 3.84, "count": 88199 },
{ "name": "outlook.com", "cost": 0.33, "count": 2114 }
]
}GET
buyMailEndpoint
/stubs/handler_api.php?api_key={KEY}&action=buyMail&site={SITE}&domain={DOMAIN}Parameters
site— Target website (must be supported, see getMailDomains)domain— Mail domain to rent (e.g., gmail.com, outlook.com)
Response (text)
ACCESS_MAIL:clxyz123abc:[email protected]GET
getMailStatusEndpoint
/stubs/handler_api.php?api_key={KEY}&action=getMailStatus&id={ID}Parameters
id— mail order id returned by buyMail
Response (text)
STATUS_WAIT_CODE # waiting for mail
STATUS_OK:123456 # received, code is 123456
STATUS_CANCEL # cancelled / refundedGET
cancelMailEndpoint
/stubs/handler_api.php?api_key={KEY}&action=cancelMail&id={ID}Parameters
id— mail order id
Response (text)
ACCESS_CANCELError codes
| Code | Description |
|---|---|
| BAD_KEY | Missing, invalid, or revoked api_key |
| BAD_ACTION | Unknown or missing action parameter |
| BAD_SERVICE | Service or country code not enabled |
| BAD_STATUS | Invalid status value in setStatus |
| NO_BALANCE | User balance is insufficient for the operation |
| NO_NUMBERS | No phone numbers available for this service/country |
| NO_ACTIVATION | activationId not found or does not belong to your account |
| ERROR_RATE_LIMIT | 30 requests/minute per API key exceeded |
| ERROR_SQL | Internal server error — retry with backoff |
Migrating from another OTP/SMS gateway
ถ้า existing code ของคุณเรียก endpoint แบบ handler_api.php?action=... ของผู้ให้บริการอื่น — เปลี่ยนแค่ base URL มาที่ OTPMall และใช้ api_key ที่ออกจากเรา:
- https://<your-current-provider>/stubs/handler_api.php?api_key=OLD_KEY&action=getBalance
+ https://otpmall.com/stubs/handler_api.php?api_key=otp_xxx&action=getBalance
ราคาที่ getPrices และยอดที่ getBalance ตอบกลับเป็น THB (ราคาขายของเรา หลังคำนวณ markup และส่วนลด).
ติดต่อ / Support
หากต้องการ key สำหรับ production volume สูง ติดต่อทีมเราเพื่อยกเพดาน rate limit