{
  "openapi": "3.1.0",
  "info": {
    "title": "SMS Gateway API",
    "version": "1.31",
    "summary": "Direct bulk & transactional SMS over a simple HTTP JSON API.",
    "description": "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.\n\nIt is a standalone product, separate from the WhatsApp-centric [Omnichannel Integration API](./omnichannel.yaml). Use this API when you need plain SMS to any mobile network.\n\n## Authentication\n\nEvery 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.\n\n## High-priority (OTP) traffic\n\nFor 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`.\n\n## Status codes\n\nResponses 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.",
    "contact": {
      "name": "eCommunicate Support",
      "email": "support@ecommunicate.co.za",
      "url": "https://www.ecommunicate.co.za/"
    }
  },
  "servers": [
    {
      "url": "https://api.payless4sms.co.za",
      "description": "Production"
    },
    {
      "url": "https://api.ecommunicate.co.za",
      "description": "Production (alternate host)"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Messaging",
      "description": "Send single and bulk SMS."
    },
    {
      "name": "Tracking",
      "description": "Query delivery status and delivery receipts."
    },
    {
      "name": "Replies",
      "description": "Retrieve inbound reply messages."
    },
    {
      "name": "Scheduling",
      "description": "Schedule and cancel future SMS."
    },
    {
      "name": "Account",
      "description": "Credit balance, server time, unsubscribes, and SMSC status."
    },
    {
      "name": "Webhooks",
      "description": "Callbacks the gateway sends to your server (delivery receipts, replies, SMSC status)."
    }
  ],
  "paths": {
    "/sms/json": {
      "post": {
        "summary": "Send SMS (JSON)",
        "description": "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 the previous response. Also available over `GET /sms/json` (query parameters) for quick testing.",
        "operationId": "sendSms",
        "tags": [
          "Messaging"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OtpTokenHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendRequest"
              },
              "examples": {
                "singleRecipient": {
                  "summary": "One message to one recipient",
                  "value": {
                    "messages": [
                      {
                        "ctid": "210420160916",
                        "recipients": [
                          {
                            "to": "27821234567",
                            "identifier": "John"
                          }
                        ],
                        "messageText": "Hello from eCommunicate"
                      }
                    ]
                  }
                },
                "sameTextManyRecipients": {
                  "summary": "Same text to many recipients",
                  "value": {
                    "ctid": "210420160911",
                    "recipients": [
                      {
                        "to": "27821234567",
                        "identifier": "abc"
                      },
                      {
                        "to": "27821234568",
                        "identifier": "123"
                      }
                    ],
                    "messageText": "Hello everyone"
                  }
                },
                "withCallbacks": {
                  "summary": "With delivery-receipt and reply callbacks",
                  "value": {
                    "settings": {
                      "receiptCallBackURL": "https://your-server.com/receipts",
                      "replyCallBackURL": "https://your-server.com/replies"
                    },
                    "priority": "true",
                    "messages": [
                      {
                        "ctid": "2104201609161452",
                        "recipients": [
                          {
                            "to": "27821234567",
                            "identifier": "Andries"
                          }
                        ],
                        "messageText": "Your appointment is confirmed"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request processed. Inspect `statusCode` for the outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResponse"
                },
                "examples": {
                  "accepted": {
                    "summary": "Accepted for processing",
                    "value": {
                      "gctid": "abcd",
                      "gstid": "3e99e8d9-50bf-469d-9fd4-d6c10cf5b152",
                      "statusCode": "100",
                      "statusDescription": "MESSAGE_ACCEPTED_FOR_PROCESSING",
                      "completionTime": "2026-05-21T21:22:26+02:00"
                    }
                  },
                  "insufficientCredit": {
                    "summary": "Insufficient credit",
                    "value": {
                      "statusCode": "137",
                      "statusDescription": "Insufficient Credit",
                      "completionTime": "2026-05-21T21:22:26+02:00",
                      "eSTId": "d0e1a9e5-1ace-4c33-b4bf-79b46bed412e"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      },
      "get": {
        "x-displayName": "Send SMS (GET)",
        "summary": "Send SMS (query parameters)",
        "description": "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.",
        "operationId": "sendSmsGet",
        "tags": [
          "Messaging"
        ],
        "parameters": [
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Destination MSISDN, or a comma-separated list for several recipients.",
            "schema": {
              "type": "string",
              "example": "27821234567"
            }
          },
          {
            "name": "messageText",
            "in": "query",
            "required": true,
            "description": "URL-encoded message text. Use `%0A` for a new line.",
            "schema": {
              "type": "string",
              "example": "Hello%20from%20eCommunicate"
            }
          },
          {
            "name": "priority",
            "in": "query",
            "description": "`true` for transactional/premium routing; `false` for regular.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false",
              "example": "false"
            }
          },
          {
            "name": "dsm",
            "in": "query",
            "description": "Don't save message — stores a masked record and recipient number.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false",
              "example": "false"
            }
          },
          {
            "name": "unicode",
            "in": "query",
            "description": "Send as a Unicode (UCS-2) message.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false",
              "example": "false"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Request processed. Inspect `statusCode` for the outcome.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResponse"
                }
              }
            }
          }
        }
      }
    },
    "/sms/trackingMessageStatus": {
      "post": {
        "summary": "Track message status",
        "description": "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 final states. Rate limited to 10 queries per id in the first 10 minutes, then once per 10 minutes. Also available over `GET`.",
        "operationId": "trackingMessageStatus",
        "tags": [
          "Tracking"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrackingRequest"
              },
              "examples": {
                "byCtid": {
                  "summary": "By client tracking id",
                  "value": {
                    "ctid": "042220160238",
                    "sentDate": "2026-04-22",
                    "showfinalstatus": "true"
                  }
                },
                "byTimeRange": {
                  "summary": "By time range",
                  "value": {
                    "startDate": "2026-04-22 00:25:43",
                    "endDate": "2026-04-23 18:25:43"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tracking result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackingResponse"
                },
                "example": {
                  "gstid": "0a6a3de7-b974-42d0-af9e-9c23473b09b9",
                  "statusCode": "224",
                  "statusDescription": "REQUEST_COMPLETED",
                  "completionTime": "2026-04-03T19:06:14.000+02:00",
                  "receipts": [
                    {
                      "statusCode": "500",
                      "statusDescription": "Message Sent.",
                      "destination": "+27821234567",
                      "stid": "dd26dc95-0205-43fb-b723-f451c2ebf776",
                      "identifier": "John",
                      "sentTime": "2026-02-20T09:08:39.000+02:00"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sms/getReceiptsForRecipient": {
      "get": {
        "summary": "Get receipts for a recipient",
        "description": "Return delivery receipts for one recipient over a date range.",
        "operationId": "getReceiptsForRecipient",
        "tags": [
          "Tracking"
        ],
        "parameters": [
          {
            "name": "recipient",
            "in": "query",
            "required": true,
            "description": "Recipient MSISDN.",
            "schema": {
              "type": "string",
              "example": "27821234567"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": true,
            "description": "ISO-8601 start of range.",
            "schema": {
              "type": "string",
              "example": "2026-03-01T00:46:19Z"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": true,
            "description": "ISO-8601 end of range.",
            "schema": {
              "type": "string",
              "example": "2026-09-29T18:46:19Z"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Receipts for the recipient.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/sms/deleteScheduledSMS": {
      "post": {
        "summary": "Cancel scheduled SMS",
        "description": "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`.",
        "operationId": "deleteScheduledSMS",
        "tags": [
          "Scheduling"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteScheduledRequest"
              },
              "examples": {
                "byCtids": {
                  "summary": "By a list of client tracking ids",
                  "value": {
                    "ctids": [
                      "042220160337",
                      "042220160340"
                    ]
                  }
                },
                "all": {
                  "summary": "Delete all scheduled messages",
                  "value": {
                    "deleteall": "true"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deletion result (`508` deleted, `507` none found).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                },
                "example": {
                  "statusCode": "508",
                  "statusDescription": "SCHEDULED_MESSAGES_DELETED",
                  "completionTime": "2026-04-22T13:41:17.000+02:00"
                }
              }
            }
          }
        }
      }
    },
    "/sms/getReply": {
      "post": {
        "summary": "Get inbound replies",
        "description": "Retrieve reply messages received over a time range. Set `includeSentSms` to attach the last message sent to each replier. Also available over `GET`.",
        "operationId": "getReply",
        "tags": [
          "Replies"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplyRequest"
              },
              "example": {
                "startdate": "2026-04-18 14:48:16",
                "enddate": "2026-04-18 17:48:16",
                "includeSentSms": "true"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replies (`509` if none found).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplyResponse"
                },
                "example": {
                  "replies": [
                    {
                      "number": "27821234567",
                      "identifier": "John",
                      "messageText": "Hello testing",
                      "replyReceived": "2026-05-21T21:22:26+02:00",
                      "lastSentMessage": "Hello",
                      "timeMessageSent": "2026-05-21T20:22:26+02:00",
                      "ctid": "ccvae",
                      "replyId": "1960522"
                    }
                  ],
                  "statusCode": "001",
                  "statusDescription": "REQUEST_COMPLETED",
                  "completionTime": "2026-05-21T21:22:26+02:00"
                }
              }
            }
          }
        }
      }
    },
    "/sms/getBalance": {
      "post": {
        "summary": "Get credit balance",
        "description": "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 gateway answers HTTP `415 Unsupported Media Type` with an HTML error page. Also available over `GET`, which needs no body.",
        "operationId": "getBalance",
        "tags": [
          "Account"
        ],
        "requestBody": {
          "required": true,
          "description": "An empty JSON object. The API key in the header identifies the account.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                },
                "example": {
                  "statusCode": "001",
                  "statusDescription": "Request Completed",
                  "currentBalance": "210"
                }
              }
            }
          }
        }
      }
    },
    "/sms/getUnsubscribelist": {
      "post": {
        "summary": "Get unsubscribed numbers",
        "description": "Return numbers that have unsubscribed / been blacklisted over a date range. Recipients who reply `STOP`, `END`, `CANCEL`, `QUIT`, or `UNSUBSCRIBE` are blacklisted automatically.",
        "operationId": "getUnsubscribeList",
        "tags": [
          "Account"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DateRangeRequest"
              },
              "example": {
                "startDate": "2026-04-01",
                "endDate": "2026-04-08"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Unsubscribed numbers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unsubscribers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "string",
                            "example": "27821234567"
                          }
                        }
                      }
                    },
                    "status": {
                      "type": "string",
                      "example": "Blacklisted List"
                    }
                  }
                },
                "example": {
                  "unsubscribers": [
                    {
                      "number": "27821234567"
                    }
                  ],
                  "status": "Blacklisted List"
                }
              }
            }
          }
        }
      }
    },
    "/sms/getServerTime": {
      "post": {
        "summary": "Get server time",
        "description": "Return the gateway's current server time. Authenticated by the `X-API-Key` header; no request body is required. Also available over `GET`.",
        "operationId": "getServerTime",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "Server time.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "string",
                      "example": "001"
                    },
                    "statusDescription": {
                      "type": "string",
                      "example": "Request Completed"
                    },
                    "serverTime": {
                      "type": "string",
                      "example": "2026-10-20T13:01:25.000+02:00"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/SMS/client/setSmscStatusCallbackUrl": {
      "servers": [
        {
          "url": "https://www.payless4sms.co.za",
          "description": "API-key host"
        }
      ],
      "get": {
        "summary": "Set SMSC status webhook URL",
        "description": "Register a URL that the gateway calls with real-time SMSC connectivity events. See the [SMSC status webhook](#tag/webhooks).",
        "operationId": "setSmscStatusCallbackUrl",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "name": "callbackUrl",
            "in": "query",
            "required": true,
            "description": "URL-encoded endpoint that will receive SMSC status events.",
            "schema": {
              "type": "string",
              "example": "https%3A%2F%2Fyour-server.com%2Fsmsc-status"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Callback URL set.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "Callback URL set successfully"
                }
              }
            }
          }
        }
      }
    },
    "/SMS/client/getSmscStatus": {
      "servers": [
        {
          "url": "https://www.payless4sms.co.za",
          "description": "API-key host"
        }
      ],
      "get": {
        "summary": "Get current SMSC status",
        "description": "Return the current SMSC connectivity status.",
        "operationId": "getSmscStatus",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "Current SMSC status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "smsc": {
                      "type": "string",
                      "example": "vtel-off"
                    },
                    "status": {
                      "type": "string",
                      "example": "online 544618s"
                    },
                    "flag": {
                      "type": "string",
                      "example": "1"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "deliveryReceipt": {
      "get": {
        "summary": "Delivery receipt",
        "description": "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).",
        "operationId": "onDeliveryReceipt",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "stid",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "7491d356-0205-43fb-b723-f451c2ebf776"
            }
          },
          {
            "name": "destination",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "+27821234567"
            }
          },
          {
            "name": "smsID",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "d3f44eef-0205-43fb-b723-f451c2ebf776"
            }
          },
          {
            "name": "ctid",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "order-12345"
            }
          },
          {
            "name": "gstid",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2a987d4e-0205-43fb-b723-f451c2ebf776"
            }
          },
          {
            "name": "statusCode",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "500"
            }
          },
          {
            "name": "statusDesc",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "Message Sent."
            }
          },
          {
            "name": "senttime",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2026-10-20T10:42:08.000+02:00"
            }
          },
          {
            "name": "deliveredtime",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2026-10-20T10:42:20.000+02:00"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Acknowledged."
          }
        }
      }
    },
    "reply": {
      "post": {
        "summary": "Inbound reply",
        "description": "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.",
        "operationId": "onReply",
        "tags": [
          "Webhooks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "time": {
                    "type": "string",
                    "example": "2026-04-22T23:45:26+02:00"
                  },
                  "from": {
                    "type": "string",
                    "example": "27821234567"
                  },
                  "reply": {
                    "type": "string",
                    "example": "Yes, confirm"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged."
          }
        }
      }
    },
    "smscStatus": {
      "get": {
        "summary": "SMSC status",
        "description": "Real-time SMSC connectivity events sent to the URL registered via [Set SMSC status webhook URL](#operation/setSmscStatusCallbackUrl). Return HTTP 200.",
        "operationId": "onSmscStatus",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "smsc",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "SMSC1"
            }
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "online",
                "down"
              ],
              "example": "down"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "0"
            }
          },
          {
            "name": "timestamp",
            "in": "query",
            "description": "Unix epoch seconds.",
            "schema": {
              "type": "string",
              "example": "1711286400"
            }
          },
          {
            "name": "clientref",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "your-client-ref"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Acknowledged."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API key issued to a client or reseller, prefixed `ecomm_`. Required on every request. Generate and revoke keys from the client portal."
      }
    },
    "parameters": {
      "OtpTokenHeader": {
        "name": "otpToken",
        "in": "header",
        "required": false,
        "description": "OTP token issued by support. Routes the message to the priority queue. An invalid token yields `statusCode` `480` and standard-queue routing.",
        "schema": {
          "type": "string",
          "example": "7C84AABBCCDDEEFF"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed request or invalid parameters.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/StatusResponse"
            },
            "example": {
              "statusCode": "022",
              "statusDescription": "Invalid Parameters",
              "completionTime": "2026-05-21T21:22:26+02:00",
              "eSTId": "476f0674-b8ca-49ea-b971-0c92c784c026"
            }
          }
        }
      }
    },
    "schemas": {
      "Settings": {
        "type": "object",
        "description": "Per-batch options.",
        "properties": {
          "gctid": {
            "type": "string",
            "description": "Client global tracking id for the whole request; must be unique per day.",
            "example": "batch-2026-05-21-001"
          },
          "ctidunique": {
            "type": "boolean",
            "description": "Enforce unique `ctid` within the batch and against today's records.",
            "example": false
          },
          "scheduledSmsDate": {
            "type": "string",
            "description": "Schedule the whole batch (`YYYY-MM-DDThh:mm:ssZ`).",
            "example": "2026-05-22T09:36:26+02:00"
          },
          "receiptCallBackURL": {
            "type": "string",
            "description": "URL that receives delivery-receipt callbacks.",
            "example": "https://your-server.com/receipts"
          },
          "replyCallBackURL": {
            "type": "string",
            "description": "URL that receives inbound-reply callbacks.",
            "example": "https://your-server.com/replies"
          },
          "dsm": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "Don't save message — store a masked record only.",
            "example": "false"
          },
          "checkCreditsLater": {
            "type": "boolean",
            "description": "Defer the credit check; the batch is accepted immediately.",
            "example": false
          }
        }
      },
      "Recipient": {
        "type": "object",
        "required": [
          "to"
        ],
        "properties": {
          "to": {
            "type": "string",
            "description": "Destination MSISDN. Accepts country-code form (`27821234567`), 9-digit (`821234567`), or leading-zero (`0821234567`).",
            "example": "27821234567"
          },
          "identifier": {
            "type": "string",
            "description": "Optional label for the recipient (name or reason).",
            "example": "John"
          },
          "businessUnit": {
            "type": "string",
            "description": "Business unit for this recipient (precedence lowest).",
            "example": "sales"
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "messageText",
          "recipients"
        ],
        "properties": {
          "ctid": {
            "type": "string",
            "description": "Client tracking id for this message. Use a GUID for reliable tracking.",
            "example": "210420160916"
          },
          "messageText": {
            "type": "string",
            "description": "The message body. GSM-7 unless the request is Unicode.",
            "example": "Hello from eCommunicate"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "businessUnit": {
            "type": "string",
            "description": "Business unit for this message (precedence above recipient).",
            "example": "sales"
          },
          "scheduledSmsDate": {
            "type": "string",
            "description": "Schedule only this message (`YYYY-MM-DDThh:mm:ssZ`).",
            "example": "2026-05-22T09:36:26+02:00"
          }
        }
      },
      "SendRequest": {
        "type": "object",
        "description": "Provide **either** a `messages` array (bulk) **or** top-level `ctid`/`recipients`/`messageText` (same text to one or many). `settings` is optional and carries per-batch options.",
        "properties": {
          "settings": {
            "$ref": "#/components/schemas/Settings"
          },
          "priority": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "`true` = transactional/premium routing; `false` = regular.",
            "default": "false",
            "example": "false"
          },
          "otp": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "OTP flag. Pair with the `otpToken` header for priority delivery.",
            "example": "false"
          },
          "unicode": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "Send as a Unicode (UCS-2) message. Legacy alias `isUnicode`.",
            "example": "false"
          },
          "businessUnit": {
            "type": "string",
            "description": "Batch-level business unit (highest precedence).",
            "example": "sales"
          },
          "earliestSendTime": {
            "type": "string",
            "description": "Do not send before this time of day.",
            "example": "8:00am"
          },
          "latestSendTime": {
            "type": "string",
            "description": "Do not send after this time of day.",
            "example": "5:00pm"
          },
          "messages": {
            "type": "array",
            "description": "Bulk format. Omit when using the top-level single form.",
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "ctid": {
            "type": "string",
            "description": "Top-level client tracking id (single/same-text form).",
            "example": "210420160911"
          },
          "recipients": {
            "type": "array",
            "description": "Top-level recipients (same-text-to-many form).",
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "messageText": {
            "type": "string",
            "description": "Top-level message text (single/same-text form).",
            "example": "Hello everyone"
          }
        }
      },
      "SendResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "string",
            "description": "Outcome code. `100` = accepted, `201` = scheduled, `137` = insufficient credit.",
            "example": "100"
          },
          "statusDescription": {
            "type": "string",
            "example": "MESSAGE_ACCEPTED_FOR_PROCESSING"
          },
          "completionTime": {
            "type": "string",
            "example": "2026-05-21T21:22:26+02:00"
          },
          "gstid": {
            "type": "string",
            "description": "Global system tracking id (whole request).",
            "example": "3e99e8d9-50bf-469d-9fd4-d6c10cf5b152"
          },
          "gctid": {
            "type": "string",
            "description": "Global client tracking id, echoed if supplied.",
            "example": "abcd"
          },
          "stid": {
            "type": "string",
            "description": "System tracking id (single-message responses).",
            "example": "eff47ce1-9a88-46b2-8fd8-1f9bedc2b4e1"
          },
          "ctid": {
            "type": "string",
            "description": "Client tracking id, echoed if supplied.",
            "example": "order-12345"
          },
          "eSTId": {
            "type": "string",
            "description": "Error system tracking id; present when validation fails, else `null`.",
            "example": "null"
          },
          "acceptedMessageCount": {
            "type": "string",
            "description": "Number of messages accepted (resend/failure-recovery responses).",
            "example": "1"
          }
        }
      },
      "TrackingRequest": {
        "type": "object",
        "description": "Supply one selection filter.",
        "properties": {
          "startDate": {
            "type": "string",
            "description": "Range start (`yyyy-mm-dd hh:mm:ss`).",
            "example": "2026-04-22 00:25:43"
          },
          "endDate": {
            "type": "string",
            "description": "Range end (`yyyy-mm-dd hh:mm:ss`).",
            "example": "2026-04-23 18:25:43"
          },
          "ctid": {
            "type": "string",
            "example": "042220160238"
          },
          "stid": {
            "type": "string",
            "example": "eff47ce1-9a88-46b2-8fd8-1f9bedc2b4e1"
          },
          "gctid": {
            "type": "string",
            "example": "042220160236"
          },
          "gstid": {
            "type": "string",
            "example": "700d7d5b-0205-43fb-b723-f451c2ebf776"
          },
          "sentDate": {
            "type": "string",
            "description": "Send date for id-based lookups (`yyyy-mm-dd`).",
            "example": "2026-04-22"
          },
          "destination": {
            "type": "string",
            "example": "27821234567"
          },
          "showctid": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "example": "true"
          },
          "showfinalstatus": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "Return only Delivered/Undelivered/Rejected states.",
            "example": "true"
          },
          "isScheduledSms": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "example": "false"
          }
        }
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "string",
            "example": "500"
          },
          "statusDescription": {
            "type": "string",
            "example": "Message Sent."
          },
          "destination": {
            "type": "string",
            "example": "+27821234567"
          },
          "stid": {
            "type": "string",
            "example": "dd26dc95-0205-43fb-b723-f451c2ebf776"
          },
          "ctid": {
            "type": "string",
            "example": "order-12345"
          },
          "identifier": {
            "type": "string",
            "example": "John"
          },
          "sentTime": {
            "type": "string",
            "example": "2026-02-20T09:08:39.000+02:00"
          },
          "deliveredTime": {
            "type": "string",
            "example": "2026-02-20T09:08:45.000+02:00"
          },
          "messageText": {
            "type": "string",
            "example": "Hello from eCommunicate"
          },
          "msgcost": {
            "type": "string",
            "example": "1"
          },
          "scheduledDate": {
            "type": "string",
            "example": "2026-04-15 02:00:00.0"
          }
        }
      },
      "TrackingResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "string",
            "example": "224"
          },
          "statusDescription": {
            "type": "string",
            "example": "REQUEST_COMPLETED"
          },
          "completionTime": {
            "type": "string",
            "example": "2026-04-03T19:06:14.000+02:00"
          },
          "gstid": {
            "type": "string",
            "example": "0a6a3de7-b974-42d0-af9e-9c23473b09b9"
          },
          "gctid": {
            "type": "string",
            "example": "042220160236"
          },
          "receipts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Receipt"
            }
          }
        }
      },
      "DeleteScheduledRequest": {
        "type": "object",
        "properties": {
          "stid": {
            "type": "string",
            "example": "0a6a3de7-b974-42d0-af9e-9c23473b09b9"
          },
          "destination": {
            "type": "string",
            "example": "27821234567"
          },
          "ctid": {
            "type": "string",
            "example": "042220160337"
          },
          "ctids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "042220160337",
              "042220160340"
            ]
          },
          "startDate": {
            "type": "string",
            "example": "2026-04-22T00:45:26+02:00"
          },
          "endDate": {
            "type": "string",
            "example": "2026-04-22T23:45:26+02:00"
          },
          "deleteall": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "example": "true"
          }
        }
      },
      "ReplyRequest": {
        "type": "object",
        "properties": {
          "startdate": {
            "type": "string",
            "description": "Range start (`yyyy-mm-dd hh:mm:ss`).",
            "example": "2026-04-18 14:48:16"
          },
          "enddate": {
            "type": "string",
            "description": "Range end (`yyyy-mm-dd hh:mm:ss`).",
            "example": "2026-04-18 17:48:16"
          },
          "includeSentSms": {
            "type": "string",
            "enum": [
              "true",
              "false"
            ],
            "description": "Attach the last message sent to each replier.",
            "default": "true",
            "example": "true"
          }
        }
      },
      "Reply": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string",
            "example": "27821234567"
          },
          "identifier": {
            "type": "string",
            "example": "John"
          },
          "messageText": {
            "type": "string",
            "example": "Hello testing"
          },
          "replyReceived": {
            "type": "string",
            "example": "2026-05-21T21:22:26+02:00"
          },
          "lastSentMessage": {
            "type": "string",
            "example": "Hello"
          },
          "timeMessageSent": {
            "type": "string",
            "example": "2026-05-21T20:22:26+02:00"
          },
          "ctid": {
            "type": "string",
            "example": "order-12345"
          },
          "replyId": {
            "type": "string",
            "example": "1960522"
          }
        }
      },
      "ReplyResponse": {
        "type": "object",
        "properties": {
          "replies": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reply"
            }
          },
          "statusCode": {
            "type": "string",
            "example": "001"
          },
          "statusDescription": {
            "type": "string",
            "example": "REQUEST_COMPLETED"
          },
          "completionTime": {
            "type": "string",
            "example": "2026-05-21T21:22:26+02:00"
          }
        }
      },
      "DateRangeRequest": {
        "type": "object",
        "properties": {
          "startDate": {
            "type": "string",
            "example": "2026-04-01"
          },
          "endDate": {
            "type": "string",
            "example": "2026-04-08"
          }
        }
      },
      "BalanceResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "string",
            "example": "001"
          },
          "statusDescription": {
            "type": "string",
            "example": "Request Completed"
          },
          "currentBalance": {
            "type": "string",
            "example": "210"
          },
          "testGateway": {
            "type": "string",
            "description": "Present and `true` only for test accounts (messages are not really sent).",
            "example": "true"
          }
        }
      },
      "StatusResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "string",
            "example": "001"
          },
          "statusDescription": {
            "type": "string",
            "example": "Request Completed"
          },
          "completionTime": {
            "type": "string",
            "example": "2026-05-21T21:22:26+02:00"
          },
          "eSTId": {
            "type": "string",
            "example": "476f0674-b8ca-49ea-b971-0c92c784c026"
          }
        }
      }
    }
  }
}