Skip to main content

Send SMS

SMS is sent synchronously via /api/json.php (immediate gateway response with msg_id per message).

Asynchronous sending is also available at /v1/json (request is queued).


Synchronous sending

Example of request to send SMS message to the specified number.

URI: /api/json.php

All requests to API are sent in JSON format using the POST method.

Header parameters

Requests must contain header Content-Type: application/json, otherwise, the request will be considered invalid even if it has valid JSON.

Request example

{
"auth": "bb56a4369eb19***cfec6d1776bd25",
"data": [
{
"type": "sms",
"id": 100500,
"phone": 380971234567,
"sms_signature": "SMSTest",
"sms_message": "Message text to be sent via SMS",
"sms_lifetime": 172800,
"short_link": true,
"unsubscribe_link": true,
"hook": "https://example.org/webhook/url.php"
}
]
}

Response examples

HTTP Status Code: 200
Content Type: JSON application/json

{
"success": true,
"data": [
{
"success": true,
"data": {
"id": 100500,
"msg_id": 123456789,
"data": 1,
"parts": 1
}
}
]
}

Asynchronous sending

Use the async JSON API when you need to accept large batches without waiting for each message to be processed by the gateway. The request body format is the same as for synchronous sending: auth and a non-empty data array with objects where type is sms.

URI: /v1/json

Example of a successful response:

{
"request_id": "cf-ray-1234567890-ABC",
"success": true
}

Per-message msg_id values are not returned in this response. Use request_id, webhook via the hook, or message status for delivery results

HTTP error codes:

CodeDescription
400Invalid JSON or empty/invalid data array
401Missing or invalid auth
405Method other than POST
413Request body too large
415Missing or invalid Content-Type (must be application/json)
503Queue unavailable