REST APIStandard SMS Gateway

OTPMall Public API

HTTP API ที่ออกแบบตาม รูปแบบมาตรฐานของอุตสาหกรรม OTP/SMS gateway ทำให้ integrator ที่เคยใช้ API gateway แบบเดียวกันสลับมาใช้บริการเราได้ทันที โดยเปลี่ยนแค่base URL และ API key.

เริ่มต้นใช้งาน

  1. 1
    สมัครสมาชิก และเติมเงินใน account ของคุณที่ otpmall.com
  2. 2
    เข้าหน้า API Keys แล้วกด Create New Key — API key จะขึ้นต้นด้วย otp_
  3. 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.php

Authentication

?api_key=otp_xxxxxxxxxxxxxxxx

Rate limit: 30 req/min per key

Actions

GETgetBalance
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=getBalance
Response (text)
ACCESS_BALANCE:123.45
GETgetServicesList
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=getServicesList
Response (json)
{ "tg": { "name": "Telegram", "image": "https://otpmall.com/icons/tg.png" }, "wa": { "name": "WhatsApp", "image": "https://otpmall.com/icons/wa.png" } }
GETgetCountries
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=getCountries
Response (json)
{ "0": { "name": "Russia" }, "1": { "name": "Ukraine" } }
GETgetPrices
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=getPrices&country=0&service=tg
Parameters
  • country— (optional) Filter by country code
  • service— (optional) Filter by service code
Response (json)
{ "0": { "tg": { "cost": 12.50, "count": 245 } } }
GETgetNumber
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=getNumber&service=tg&country=0
Parameters
  • service— Service code (e.g., tg, wa, ig)
  • country— Country code (e.g., 0=Russia)
Response (text)
ACCESS_NUMBER:clxyz123abc:79123456789
GETgetStatus
Endpoint
/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 / refunded
GETsetStatus
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=setStatus&id={ID}&status={N}
Parameters
  • id— activationId returned by getNumber
  • status— 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=8
GETgetMailDomains
Endpoint
/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 } ] }
GETbuyMail
Endpoint
/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]
GETgetMailStatus
Endpoint
/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 / refunded
GETcancelMail
Endpoint
/stubs/handler_api.php?api_key={KEY}&action=cancelMail&id={ID}
Parameters
  • id— mail order id
Response (text)
ACCESS_CANCEL

Error codes

CodeDescription
BAD_KEYMissing, invalid, or revoked api_key
BAD_ACTIONUnknown or missing action parameter
BAD_SERVICEService or country code not enabled
BAD_STATUSInvalid status value in setStatus
NO_BALANCEUser balance is insufficient for the operation
NO_NUMBERSNo phone numbers available for this service/country
NO_ACTIVATIONactivationId not found or does not belong to your account
ERROR_RATE_LIMIT30 requests/minute per API key exceeded
ERROR_SQLInternal 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