# SMS Gateway API

The eCommunicate **SMS Gateway** (Payless4SMS) is a direct HTTP/JSON API for sending single and bulk SMS, tracking delivery, receiving replies and delivery receipts, scheduling messages, and managing your credit balance.
It is a standalone product, separate from the WhatsApp-centric [Omnichannel Integration API](/apis/omnichannel). Use this API when you need plain SMS to any mobile network.
## Authentication
Every request is authenticated with an **API key**: send an `X-API-Key: ecomm_...` header. Generate and revoke keys from the client portal (**API Keys**). Always use HTTPS so the key is never sent in the clear.
## High-priority (OTP) traffic
For one-time-pin traffic that must deliver in 5–10 seconds, request an OTP token from support and send it as an `otpToken` header. Valid tokens are routed to a dedicated priority queue with automatic backup-gateway fallback. If the response `statusCode` is `502`, resend via your backup gateway until it returns to `100`.
## Status codes
Responses carry a string `statusCode` and `statusDescription`. Common values: `001` Request Completed · `021` Authentication Failed · `022` Invalid Parameters · `023` Missing Parameters · `100` Accepted For Processing · `126` Blacklisted Destination · `128` Invalid Destination · `129` Duplicate Destination · `136` Batch Size Exceeded (max 1000 recipients) · `137` Insufficient Credits · `201` Batch Scheduled · `500` Message Sent · `501` Queued At MNO · `600` Delivery Success · `620` Failed In Delivery. The gateway sometimes returns equivalent alternates (e.g. Invalid Destination `128`/`226`), so treat `statusCode` as an opaque string.

Direct bulk & transactional SMS over a simple HTTP JSON API.

Version: 1.31

## Servers

Production
```
https://api.payless4sms.co.za
```

Production (alternate host)
```
https://api.ecommunicate.co.za
```

## Security

### ApiKeyAuth

API key issued to a client or reseller, prefixed `ecomm_`. Required on every request. Generate and revoke keys from the client portal.

Type: apiKey
In: header
Name: X-API-Key

## Download OpenAPI description

 - [SMS Gateway API](https://docs.ecommunicate.co.za/_bundle/apis/sms.yaml)

## Messaging

 - [POST /sms/json](https://docs.ecommunicate.co.za/apis/sms/messaging/sendsms.md): Send a single message, the same message to many recipients, or many messages to many recipients. Keep each request to a maximum of **1000** recipients and send the next request only after receiving th
 - [GET /sms/json](https://docs.ecommunicate.co.za/apis/sms/messaging/sendsmsget.md): A convenience form for quick testing. Send the same text to one or more destinations (comma-separated `to`). POST is recommended for production — it is not length-limited.
## Tracking

 - [POST /sms/trackingMessageStatus](https://docs.ecommunicate.co.za/apis/sms/tracking/trackingmessagestatus.md): Query delivery status and receipts. Filter by time range (`startDate`/`endDate`), by `ctid` + `sentDate`, by `stid`, or by the global ids `gctid`/`gstid`. Add `showfinalstatus=true` to return only fin
 - [GET /sms/getReceiptsForRecipient](https://docs.ecommunicate.co.za/apis/sms/tracking/getreceiptsforrecipient.md): Return delivery receipts for one recipient over a date range.
## Replies

 - [POST /sms/getReply](https://docs.ecommunicate.co.za/apis/sms/replies/getreply.md): Retrieve reply messages received over a time range. Set `includeSentSms` to attach the last message sent to each replier. Also available over `GET`.
## Scheduling

 - [POST /sms/deleteScheduledSMS](https://docs.ecommunicate.co.za/apis/sms/scheduling/deletescheduledsms.md): Delete scheduled (not-yet-sent) messages by `stid` + `destination`, by `ctid`, by a `ctids` array, by time range (`startDate`/`endDate`), or all of them with `deleteall`. Also available over `GET`.
## Account

 - [POST /sms/getBalance](https://docs.ecommunicate.co.za/apis/sms/account/getbalance.md): Return the current credit balance. Authenticated by the `X-API-Key` header. A `POST` must still carry a JSON body: send an empty object (`{}`) with `Content-Type: application/json`. Without it the gat
 - [POST /sms/getUnsubscribelist](https://docs.ecommunicate.co.za/apis/sms/account/getunsubscribelist.md): Return numbers that have unsubscribed / been blacklisted over a date range. Recipients who reply `STOP`, `END`, `CANCEL`, `QUIT`, or `UNSUBSCRIBE` are blacklisted automatically.
 - [POST /sms/getServerTime](https://docs.ecommunicate.co.za/apis/sms/account/getservertime.md): Return the gateway's current server time. Authenticated by the `X-API-Key` header; no request body is required. Also available over `GET`.
 - [GET /SMS/client/setSmscStatusCallbackUrl](https://docs.ecommunicate.co.za/apis/sms/account/setsmscstatuscallbackurl.md): Register a URL that the gateway calls with real-time SMSC connectivity events. See the [SMSC status webhook](#tag/webhooks).
 - [GET /SMS/client/getSmscStatus](https://docs.ecommunicate.co.za/apis/sms/account/getsmscstatus.md): Return the current SMSC connectivity status.
## Webhooks

 - [GET deliveryReceipt](https://docs.ecommunicate.co.za/apis/sms/webhooks/ondeliveryreceipt.md): When a `receiptCallBackURL` is configured, the gateway performs an HTTP GET to it as delivery status changes. Return HTTP 200. Undelivered callbacks are retried for up to 24 hours (2m, 4m, 8m … 1440m)
 - [POST reply](https://docs.ecommunicate.co.za/apis/sms/webhooks/onreply.md): When a `replyCallBackURL` is configured, the gateway forwards inbound replies. This shows the POST form; a GET form (`?gstid=&ctid=&date=&from=&message=`) is also supported. Return HTTP 200.
 - [GET smscStatus](https://docs.ecommunicate.co.za/apis/sms/webhooks/onsmscstatus.md): Real-time SMSC connectivity events sent to the URL registered via [Set SMSC status webhook URL](#operation/setSmscStatusCallbackUrl). Return HTTP 200.
