1. Home
  2. Docs
  3. Developers
  4. Technical Platform
  5. Request to send SMS

Request to send SMS

Every request made must include in the header of the http request the client authentication. For this purpose it is used the basic access authentication of HTTP.

Combining the string “user:password” and encoding it within base64 construct the authorization header. To this chain is prefixed the “Basic Authorization” chain.

For example, for the user “myuser” and the password “mypass”, the resulting header would be: Authorization: Basic bWl1c2VyOm1pcGFzcw==

The available configuration options, the URL that should be called, and the parameters supported will be detailed below.

To create the URL, the client must make a POST call to the following address:

JSON request:

Example of basic request: {“to”:[“34666555444″],”text”: “text message”,”from”:”msg”}

Possible parameters:

textMessage of the text.At most you can have 160 characters if you do not specify that the message is multi- part (see ‘parts’ parameter). The text must be encoded in UTF-8.
toMobile phone number of the message recipient.You must include the prefix (e.g.: In Spain 34666666666). This field allows you to specify multiple recipients; this requires include all recipients into an array.
fromText Sender.Documentación integración REST
his label will consist of 15 numbers or 11 alphanumeric.
coding (optional)Los posibles valores son “gsm”, “gsm-pt” y “utf-16”.El valor por defecto es “gsm”. The maximum number of characters for normal messages is 160 for the GSM7 encoding, 155 for the GSM-PT encoding and 70 for the UCS2 encoding (UTF16). The maximum number of characters for concatenated messages is 155 for the GSM7 encoding, 149 for the GSM-PT encoding and 67 for the UCS2 encoding (UTF16).
fSend (optional)Date and time the message was sent.If you need to send scheduled messages, the date can be specified in the format YYYYmmddHHiiss (eg: 20130215142000 would be February 15th, 2013 at 14:20 UTC). The date must be specified in UTC time (GMT + 0). Shipments can not be scheduled later than 30 days. In case of an immediate sending, this parameter does not have to be specified.
fExp (optional)Message expiration date in UTC.The date must be specified in UTC time (GMT + 0). Format YYYYmmddHHiiss. E.g. 20130215142000 would be 15 February 2013 at 14:20:00.
parts (optional)Indicates the maximum number of parts in which the message to be sent will be divided.This variable is set to 1 by default, so if it is not modified and a message over 160 characters for encoding 0 is sent, the message will fail. Keep in mind that concatenated messages can only be 153 characters per party and each part is billed as one sending. The server will only use the minimum necessary parts for sending text even if the specified number of parts is bigger than necessary. If the number of parts is less than that required for sending the text, the sending will fail with error 105.
trsec (optional)Boolean type.With the “false” value the server does not change any character in the message; this is the default value. With the value “true”, server handles to modify the common invalid characters in GSM7 to valid characters with the following translation table: “á”=>”a”, “í”=>”i”, “ó”=>”o”, “ú”=>”u”, “ç”=>”Ç”, “Á”=>”A”, “Í”=>”I”, “Ó”=>”O”, “Ú”=>”U”, “À”=>”A”, “È”=>”E”, “Ì”=>”I”, “Ò”=>”O”, “Ù”=>”U”, “o”=>””, “a”=>””, “Õ”=>”O”, “õ”=>”o”, “â”=>”a”, “ê”=>”e”, “î”=>”i”, “ô”=>”o”, “û”=>”u”, “”=>”A”, “Ê”=>”E”, “Δ=>”I”, “Ô”=>”O”, “Û”=>”U”, “ã”=>”a”, “Ô=>”A”.
reference (optionalSending reference.If not specified, a reference will be generated automatically each month with the following nomenclature: API_SMS_yyyy_mm where yyyy is the current year and mm the current month.
tags (optional)
Tags array.Eg: [“tag1″,”tag2”].
availableTimes (optional)
It indicates the times in which the calls will be made.
Json objects are defined in the form: [{“day”: 1, “from”: “09:00”, “to”: “12:00”}]. day (optional): a day of the range between Monday to Sunday is indicated, it must be a number between 1 and 7.. If not specified, the range will apply to all days of the week. from: time that defines the start of the time range in UTC 24 hour format. to: time that defines the end of the time range in UTC 24 hours format.

Include unsubscribe URL:

To generate an unsubscribe URL you must add: {UNSUB_URL} inside the message.

Example of CURL request:

curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Basic bWl1c2VyOm1pcGFzcw==" \
-d "{\"to\":[\"34666555444\"],\"text\":\"text message\",\"from\":\"msg\"}" \

Example of PHP request:

$post['to'] = array('34666555444'); $post['text'] = "text message"; $post['from'] = "msg";
$user ="miuser";
$password = 'mipass'; $ch = curl_init();
curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, curl_setopt($ch, array(
"Accept: application/json",
"Authorization: Basic ".base64_encode($user.":".$password))); $result = curl_exec ($ch);

The password (password) and the client code (username) will be provided by the company. It should be mentioned that in order to increase system security, the client must specify the IP from where it will connect, only sending from the IP specified by the client will be allowed.

Was this article helpful to you? Yes No

How can we help?