My SMS Gateway REST API
Send SMS and OTP jobs from your server through a paired Android phone and its SIM card.
Authentication
Create an API key in Dashboard → API Keys and send it as a Bearer token. Keep the secret on your server only.
Authorization: Bearer msg_live_xxxxx
Send SMS
Queue a message for one paired device and SIM slot. A successful request returns HTTP 202.
POST https://api.mysmsgateway.com/v1/sms/send
Content-Type: application/json
Authorization: Bearer msg_live_xxxxx
{
"device_id": "YOUR_DEVICE_UUID",
"to": "+974XXXXXXXX",
"message": "Hello from My SMS Gateway",
"sim": 1,
"message_type": "transactional"
}Send OTP
Create a secure 6-digit OTP and send it through the selected Android gateway. Expiry can be 60–600 seconds.
POST https://api.mysmsgateway.com/v1/otp/send
Content-Type: application/json
Authorization: Bearer msg_live_xxxxx
{
"device_id": "YOUR_DEVICE_UUID",
"to": "+974XXXXXXXX",
"sim": 1,
"expiry_seconds": 300
}Verify OTP
Verify the code from your server using the OTP request ID returned by the send endpoint.
POST https://api.mysmsgateway.com/v1/otp/verify
Content-Type: application/json
Authorization: Bearer msg_live_xxxxx
{
"request_id": "OTP_REQUEST_UUID",
"code": "123456"
}OTP security
Raw OTP codes are not stored. My SMS Gateway stores a SHA-256 hash, limits verification attempts, applies expiry, rate limits repeated requests, and supersedes older pending codes for the same recipient.
Delivery webhooks
Subscribe to signed callbacks for sms.sent, sms.delivered, and sms.failed. Non-2xx responses and network failures retry automatically up to four total attempts.
Webhook delivery
X-MySMSGateway-Event: sms.delivered X-MySMSGateway-Delivery: DELIVERY_UUID X-MySMSGateway-Timestamp: 1789500000 X-MySMSGateway-Signature: sha256=... X-MySMSGateway-Attempt: 1 Retry schedule after a failed attempt: ~1 minute → ~5 minutes → ~30 minutes Maximum: 4 total attempts Verify X-MySMSGateway-Signature with HMAC-SHA256 using the whsec_ signing secret shown when the webhook is created.
OTP send response
HTTP/1.1 202 Accepted
{
"success": true,
"otp": {
"id": "2abe94d8-...",
"status": "pending",
"recipient": "+974XXXXXXXX",
"device_id": "...",
"sim_slot": 1,
"sms_job_id": "...",
"expires_at": "2026-09-11T...Z"
}
}OTP verify response
HTTP/1.1 200 OK
{
"success": true,
"verified": true,
"otp": {
"id": "2abe94d8-...",
"status": "verified",
"verified": true,
"attempts_remaining": 3
}
}