ZPK SMS
API to send SMS text messages to mobile devices. More than 50 countries
ZPK's SMS API is faster than other competitors, supports delivery to more countries, and has the lowest price per SMS from the first request.
API connection
Server and protocols involved.
Server: | https://zpk.systems |
---|---|
Scheme: | HTTPS, secure connections only. |
Protocol: |
JSON recommended
Sending a JSON in the request body, and specifying a Content-Type: application/json header in the request Files should be sent encoded as a base64 string. Form-Data not recommended
Format used in web forms, not recommended. When sending a form_data request you can send all the fields separately. However if the request is very large we recommend that you send the content of the request in a single text field called _json (with an underscore). This special parameter will be processed by our backend as if it were a regular JSON request. |
The server to send the requests to is https://zpk.systems, using a secure HTTPS connection.
The recommended communication type is JSON, in which case we will specify in the connection a Content-Type: application/json, and we will send the request body as a valid JSON string.
Sending
You can send one or multiple SMS with a single JSON request to the sending endpoint.
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
||||||||||||
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
||||||||||||
messages |
array required Max: 1000 An array containing one or more SMS messages to send.
|
||||||||||||
concatenate |
boolean optional If this value is set to true, messages that exceed the maximum text length will be sent as several concatenated SMS. |
||||||||||||
encoding |
string opcional The SMS character encoding. By default GSM7 will be used, which allows a sending of 160 characters without accents or special characters such as emojis. The other option available is UCS2, which will decrease the maximum length of sms to 70 characters but allows you to use special characters. |
||||||||||||
callback_url |
string optional A notification URL, where ZPK Systems will report the delivery status of the text message. The notification URL receives a list of up to 1000 items, your server should respond with a 200 response code. If your server does not respond with a 200 code due to technical problems, our servers will retry this communication every 30 minutes, for a maximum of 72 hours. |
Server response
The server will return a JSON, with a boolean success if the send request was processed successfully.
Additionally, in the JSON, the list of SMS sent will be returned, with a success parameter indicating whether that particular message could be processed or not.
Each message also has an sms_id code that identifies that specific SMS. This code is used later in sending status reports.
As in the rest of the requests to ZPK Systems APIS, a cost parameter is provided indicating the total cost of the request to the API
Example of response with correct submission.
{
"success": true,
"messages": [
{
"from": "Sender Here",
"phone": "+34 000000",
"message": "The message",
"success": true,
"sms_id": "f205d6e838ec4110992a4a871a74d279"
}
],
"cost": 0.02485
}
Example answer with some incorrect messages.
Example with a successful request, which however contained one incorrect destination number.
{
"success": true,
"messages": [
{
"from": "Sender here",
"phone": "+34 000000",
"message": "The message",
"success": true,
"sms_id": "f205d6e838ec4110992a4a871a74d279"
},
{
"from": "Sender here",
"phone": "NotValidPhone",
"message": "El mensaje a enviar...",
"success": false,
"sms_id": "",
"error_id": "INVALID_DESTINATION",
"error_msg": "SMS parameter 'to' must be a number in international format, between 7 and 15 digits."
}
],
"cost": 0.02485
}
Example response with general error
{
"success": false,
"errors": [
{
"id": "INVALID_PARAMETER",
"message": "Messages array is empty.",
"on": "messages"
}
]
}
Prices endpoint
The prices of sending an SMS to different countries can be consulted in this endpoint.
We can optionally filter prices by ISO2 country code, or by phone number extension.
Parámetro | Descripción |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
country_code |
string optional If this optional parameter is provided, only the rates whose destination country matches will be returned. It must be an ISO 2 code, for example 'es' for Spain, or 'us' for the United States. |
prefix |
string optional If this optional parameter is provided, only the rates whose international prefix matches will be returned. |
If neither country_code nor prefix is specified, all available rates will be returned.
Response JSON
{
"success": true,
"prices": [
{
"country_code": "AB",
"prefix": "7",
"network_name": "Other",
"price": 0.0652
},
{
"country_code": "AB",
"prefix": "7",
"network_name": "Aquafon",
"price": 0.0652
},
{
"mas tarifas": "...."
}
],
"cost": 0.02485
}
Callback reports
Requesting callback
If the callback_url parameter is established when making a sending request, ZPK will send a status report to the url of the server indicating the status of sending SMS when it has information from the operator.
This response may take anywhere from a few seconds to 48 hours, depending on the destination operator.
First we specify the callback url at the time of requesting the sending of messages.
{
"application_id": "app234234",
"api_key": "DSFJnn3JLdfdfs",
"callback_url": "https://miservidor.com/zpk_sms_callback",
"messages":[
{
"from": "TEST",
"phone": "600568046",
"message": "Test de envío con callback"
}
]
}
Receiving callbacks
When the SMS is delivered or rejected by the operator, ZPK will send a JSON notification to your server containing an array of delivery statuses.
[
{
"sms_id":"537b7194d5804ad9b1afead36f3d5e16",
"from":"YourName",
"phone":"+34600000000",
"message":"message to send",
"generated_at":"2023-07-16 06:59:49",
"status":"delivered",
"delivered_at":"2023-07-16 06:59:59"
}
]
Parameter | Description |
---|---|
sms_id | A unique identifier of the SMS sent |
from | The origin that you specified in the 'from' field when requesting to send a message. |
phone | The recipient's phone number |
message | The text of the message you requested to send. |
generated_at | The date the message was requested to be sent. |
status |
The current status of the message, which can be:
|
delivered_at | The date the text message was delivered to the destination device |
Your server should respond with an HTTP/200 code, any other code will be interpreted as a temporary error on your server, and ZPK will retry the notification every 25 minutes for up to 56 hours.
Pricing table
This API is billed on demand, and you will only pay based on the number of SMS sent. There are no volume discounts because our API has the best price from the first SMS.
Country | Price |
---|---|
Spain | 0,0495 € |
France | 0,0724 € |
United States | 0,0220 € |
Abkhazia | 0,1300 € |
Afghanistan | 0,1993 € |
Albania | 0,0594 € |
Algeria | 0,1495 € |
American Samoa | 0,0761 € |
Andorra | 0,0997 € |
Angola | 0,0592 € |
Anguilla | 0,1495 € |
Antigua And Barbuda | 0,0997 € |
Argentina | 0,0682 € |
Armenia | 0,1495 € |
Aruba | 0,1132 € |
Australia | 0,1081 € |
Austria | 0,0869 € |
Azerbaijan | 0,2492 € |
Bahrain | 0,0440 € |
Bangladesh | 0,1993 € |
Barbados | 0,1495 € |
Belarus | 0,1993 € |
Belgium | 0,0748 € |
Belize | 0,1495 € |
Benin | 0,1495 € |
Bermuda | 0,1993 € |
Bhutan | 0,2492 € |
Bolivia | 0,0997 € |
Bosnia and Herzegovina | 0,0835 € |
Botswana | 0,0637 € |
Brazil | 0,0306 € |
Brunei | 0,0264 € |
Bulgaria | 0,1495 € |
Burkina Faso | 0,0997 € |
Burundi | 0,1495 € |
Cambodia | 0,1495 € |
Cameroon | 0,1495 € |
Canada | 0,0373 € |
Cape Verde | 0,0997 € |
Cayman Islands | 0,1495 € |
Central African Republic | 0,0391 € |
Chad | 0,2492 € |
Chile | 0,0151 € |
China | 0,0571 € |
Colombia | 0,0148 € |
Comoros | 0,1495 € |
Congo | 0,1495 € |
Cook Islands | 0,0352 € |
Costa Rica | 0,0395 € |
Cote D'Ivoire (Ivory Coast) | 0,1993 € |
Croatia | 0,0666 € |
Cuba | 0,0861 € |
Curaçao | 0,0797 € |
Cyprus | 0,0151 € |
Czech Republic | 0,0598 € |
Democratic Republic of the Congo | 0,1495 € |
Denmark | 0,0532 € |
Djibouti | 0,1275 € |
Dominica | 0,1495 € |
Dominican Republic | 0,0512 € |
East Timor | 0,1356 € |
Ecuador | 0,1933 € |
Egypt | 0,1495 € |
El Salvador | 0,2374 € |
Equatorial Guinea | 0,1069 € |
Eritrea | 0,0997 € |
Estonia | 0,0454 € |
Ethiopia | 0,1993 € |
Falkland Islands | 0,0209 € |
Faroe Islands | 0,0616 € |
Fiji Islands | 0,1906 € |
Finland | 0,1165 € |
French Polynesia | 0,0997 € |
Gabon | 0,1495 € |
Gambia The | 0,1495 € |
Georgia | 0,1495 € |
Germany | 0,1078 € |
Ghana | 0,0997 € |
Gibraltar | 0,1026 € |
Greece | 0,0626 € |
Greenland | 0,0267 € |
Grenada | 0,1495 € |
Guadeloupe | 0,1336 € |
Guatemala | 0,0997 € |
Guinea | 0,1495 € |
Guinea-Bissau | 0,1303 € |
Guyana | 0,0997 € |
Haiti | 0,1495 € |
Honduras | 0,0913 € |
Hong Kong S.A.R. | 0,0817 € |
Hungary | 0,1302 € |
Iceland | 0,0859 € |
India | 0,0879 € |
Indonesia | 0,2492 € |
International Networks | 0,0732 € |
Iran | 0,1993 € |
Iraq | 0,1495 € |
Ireland | 0,0596 € |
Israel | 0,1495 € |
Italy | 0,0627 € |
Jamaica | 0,1495 € |
Japan | 0,0692 € |
Jordan | 0,1495 € |
Kazakhstan | 0,1993 € |
Kenya | 0,1583 € |
Kiribati | 0,1495 € |
Kuwait | 0,1495 € |
Kyrgyzstan | 0,1993 € |
Laos | 0,0528 € |
Latvia | 0,0390 € |
Lebanon | 0,0997 € |
Lesotho | 0,0706 € |
Liberia | 0,0997 € |
Libya | 0,2492 € |
Liechtenstein | 0,0277 € |
Lithuania | 0,0523 € |
Luxembourg | 0,0439 € |
Macau S.A.R. | 0,0937 € |
Macedonia | 0,0200 € |
Madagascar | 0,1495 € |
Malawi | 0,1495 € |
Malaysia | 0,0826 € |
Maldives | 0,0612 € |
Mali | 0,0997 € |
Malta | 0,0904 € |
Marshall Islands | 0,1710 € |
Mauritania | 0,1495 € |
Mauritius | 0,0997 € |
Mexico | 0,0246 € |
Moldova | 0,1583 € |
Monaco | 0,0719 € |
Mongolia | 0,0462 € |
Montenegro | 0,0568 € |
Montserrat | 0,0265 € |
Morocco | 0,1993 € |
Mozambique | 0,0541 € |
Myanmar | 0,1993 € |
Namibia | 0,0549 € |
Nauru | 0,2053 € |
Nepal | 0,1495 € |
Netherlands | 0,0989 € |
New Caledonia | 0,0987 € |
New Zealand | 0,1625 € |
Nicaragua | 0,0859 € |
Niger | 0,1495 € |
Nigeria | 0,1495 € |
Norway | 0,0673 € |
Oman | 0,0997 € |
Pakistan | 0,1993 € |
Palau | 0,1041 € |
Palestinian Territory Occupied | 0,2990 € |
Panama | 0,0997 € |
Papua new Guinea | 0,1672 € |
Paraguay | 0,0297 € |
Peru | 0,0452 € |
Philippines | 0,0997 € |
Poland | 0,0223 € |
Portugal | 0,0242 € |
Puerto Rico | 0,0247 € |
Qatar | 0,0549 € |
Reunion | 0,2022 € |
Romania | 0,1002 € |
Russia | 0,3986 € |
Rwanda | 0,1055 € |
Saint Kitts And Nevis | 0,1495 € |
Saint Lucia | 0,1495 € |
Saint Pierre and Miquelon | 0,1495 € |
Saint Vincent And The Grenadines | 0,1495 € |
Samoa | 0,0997 € |
San Marino | 0,0840 € |
Sao Tome and Principe | 0,0989 € |
Saudi Arabia | 0,0997 € |
Senegal | 0,1236 € |
Serbia | 0,1859 € |
Seychelles | 0,0385 € |
Sierra Leone | 0,1568 € |
Singapore | 0,0505 € |
Slovakia | 0,0518 € |
Slovenia | 0,0997 € |
Solomon Islands | 0,0342 € |
Somalia | 0,1495 € |
South Africa | 0,0125 € |
South Korea | 0,0693 € |
South Sudan | 0,0586 € |
Sri Lanka | 0,2492 € |
Sudan | 0,1993 € |
Suriname | 0,1514 € |
Swaziland | 0,0982 € |
Sweden | 0,0615 € |
Switzerland | 0,0333 € |
Syria | 0,1993 € |
Taiwan | 0,0664 € |
Tajikistan | 0,1993 € |
Tanzania | 0,1495 € |
Thailand | 0,0262 € |
The Bahamas | 0,0611 € |
Togo | 0,1447 € |
Tonga | 0,0616 € |
Trinidad And Tobago | 0,0997 € |
Tunisia | 0,0997 € |
Turkey | 0,0087 € |
Turkmenistan | 0,1495 € |
Turks And Caicos Islands | 0,1495 € |
Uganda | 0,1495 € |
Ukraine | 0,1993 € |
United Arab Emirates | 0,0997 € |
United Kingdom | 0,0407 € |
Uruguay | 0,1000 € |
Uzbekistan | 0,2492 € |
Vanuatu | 0,1495 € |
Venezuela | 0,0977 € |
Vietnam | 0,1495 € |
Virgin Islands (British) | 0,1495 € |
Yemen | 0,1993 € |
Zambia | 0,1495 € |
Zimbabwe | 0,1182 € |
PHP SDK
SDK in PHP to send text messages.
ZPK-PHP is an open source composer-installable library that will allow you to integrate our APIs into your PHP project with minimal effort.
Installation
composer require zpksystems/phpzpk
Example request
<?php
$smsRequest = new zpkSMS( new zpkApplication('appid','key') );
// Add SMS
$sms = new ZpkSms('+34600000000');
$sms->setMessage("Test SMS message");
$smsRequest->addSMS($sms);
// Add SMS with custom reference
$sms = new ZpkSms('+34600000000');
$sms->setMessage("Test SMS message");
$sms->setReference('my-reference');
$smsRequest->addSMS($sms);
// Send
$smsRequest->send();