smsb2b.com is a high quality SMS service that enables your applications to integrate with our SMS messaging system. It offers a plain simple yet powerful and dynamic implementation.
You can use your company name as the sender name of the messages and you will receive a delivery report for each one within seconds.

 

Create an account

To start using smsb2b.com you need to sign up free of charge.
Your account is ready to use right away and 5 sms will be added to test the quality of the service.

 

IP whitelist for API calls

Using the IP whitelist for API calls is highly recommended to protect your account and data. It is by default activated for all accounts and you need either to enter your IP(s) to the list or deactivate the protection. When activated only calls coming from the whitelisted IPs are allowed. A credentials error will be returned otherwise.

 

Authentication

All API calls are authenticated the API key generated for your account. Only exception is the api/mobile/check endpoint, which is free to use without authentication (enter your mobile below to try it). You can reset the key to a new one anytime you need.

SMS API demonstration + testing

Check the SMS API demonstration as "demo" user
or enter your own username and password

 
 

This is the 3rd version of the SMS API, it is a superset of the previous versions and therefore backwards compatible with both the 2nd version and the deprecated v. 1

  • All API calls can be secured (https) or not (http)
  • All API call parameters can be passed via GET or POST
  • Default input encoding is the web standard UTF-8
  • Mobile numbers are parsed, formated and stored in MSISDN format (Mobile Station International Subscriber Directory Number)
 
 
 
 
 

api/mobile

 

The api/mobile/check endpoint is the only one that does not require authentication with an account key. It is free to use for all and very powerful. It can check tens of thousands of mobiles in a fraction of a second

 
 
 

api/mobile/check

 

Checks for valid mobile in mobile parameter and returns a mobile object or error
Εnter any mobile below and click the "test it" button to get a quick glimpse on the API

 

Accepts

ParameterValueDescription
mobile
Any string to check.
Note that it will strip away all non numeric characters, so all characters except numbers will be ignored. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
mobile{
msisdn
national
country
countryCode
gsmCode
number
mcc
mnc
cost
}
Mobile object
Mobile (international format)
Mobile (national format)

Country prefix
Network prefix
Number of mobile
Mobile country code
Mobile network code
Cost to send 1 sms
 
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
201Failed to parse mobile to MSISDN (international format mobile number)Reproduce
205mobile parameter is emptyReproduce
<?php

  $endpoint = 'https:///mobile/check';

  $parameters = array(
      'mobile'    => '306971234567',// mobile to check
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///mobile/check?\
mobile=4412345678900"
 
 
 
 

api/key

 

Endpoint to get and reset the API key

 
 
 

api/key/get

 

Returns the API key of the account
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
username
Your username or email or mobile number. [Required]
Existing API key [key=YOUR-KEY] can be used insted of [username-password] when you want to verify the key
password
Account password. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
keyAPI key to use with all endpoints
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///key/get';

  $parameters = array(
      'username'  => 'YOUR USERNAME',
      'password'  => 'YOUR PASSWORD',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///key/get?\
username=USERNAME&\
password=PASSWORD&\
type=xml"
 
 

api/key/reset

 

Resets the API key of the account to a new one randomly generated. Can be used frequently for increased security
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
username
Your username or email or mobile number. [Required]
Existing API key [key=YOUR-KEY] can be used insted of [username-password]
password
Account password. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
keyAPI key to use with all endpoints
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///key/reset';

  $parameters = array(
      'username'  => 'YOUR USERNAME',
      'password'  => 'YOUR PASSWORD',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///key/reset?\
username=USERNAME&\
password=PASSWORD&\
type=xml"
 
 
 
 

api/sms

 

Most popular endpoints to

  • send single sms
  • send bulk sms
  • schedule sms anytime in the future
  • cancel a scheduled sms
 
 
 

api/sms/bulk

 

Performs a bulk sms submission
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
to
Mobiles of recipients separated with comma ,[Required]
text
Text of the sms to send. [Required]
from
Sender of the sms
ucs
true for Unicode or false for GSM (default)
flash
true for flash sms or false for normal (default)
timestamp
Timestamp in Unix epoch format to schedule the submission. Scheduled sms can be canceled using the api/sms/cancel endpoint
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
id{
value
...
}
sms{
smsId
msisdn
}
...
Array of id and sms objects
acceptedTotal sms accepted for submission
rejectedTotal rejected sms
balanceBalance of account
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
102Parameter to is empty
103Invalid to parameter. The api/mobile/check endpoint will validate any mobile number
104Parameter text is empty
105Not enough balance
<?php

  $endpoint = 'https:///sms/bulk';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'text'    => 'Your message',
      'from'    => 'sender',
      'to'    => '306971000000,306980000000,49172000000',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///sms/bulk?\
key=YOUR-API-KEY&\
text=your_message&\
from=sender&\
to=306971000000,306980000000,49172000000&\
type=xml"
 
 

api/sms/cancel

 

Cancels a scheduled sms. You can schedule any sms to be send in the future using the timestamp parameter of api/sms/send or similar endpoint
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
smsId
The smsId you want to cancel. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
smsIdDeleted smsId
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
107smsId parameter is empty
108Invalid smsId parameter
109Message not found
110Message already sent
111Message could not be deleted
<?php

  $endpoint = 'https:///sms/cancel';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'smsId'   => 'SMS ID',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///sms/cancel?\
key=YOUR-API-KEY&\
smsId=SMSID&\
type=xml"
 
 

api/sms/send

 

Most popular endpoint. Sends or schedules a new sms of highest priority
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
to
Mobile of recipent. [Required]
text
Text of the sms to send
from
Sender of the sms
ucs
true for Unicode or false for GSM (default)
flash
true for flash sms or false for normal (default)
timestamp
Timestamp in Unix epoch format to schedule the submission. Scheduled sms can be canceled using the api/sms/cancel endpoint
callback
Callback URL that will be called for delivery reports in real time. eg. http://myserver.com/callback?id=yourmsgid
Few parameters will be appended to the URL using GET method: msgid, status, cost, to, mcc, mnc representing respectively:
id of message, status (d or f) for delivered or failed, message cost, mobile number and network information.
The use of the callback parameter is highly encourages since it is way more efficient than polling for message statuses via api/status endpoints
The URL must be urlencoded()
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
smsIdsmsId of sms
costCost of SMS
balanceBalance of account
mccCountry code
mncNetwork code
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
102Parameter to is empty
103Invalid to parameter. The api/mobile/check endpoint will validate any mobile number
104Parameter text is empty
105Not enough balance
106Failed to queue the message
<?php

  $endpoint = 'https:///sms/send';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'text'    => 'Your message',
      'from'    => 'sender',
      'to'      => '306971000000',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///sms/send?\
key=YOUR-API-KEY&\
text=your_message&\
from=sender&\
to=306971000000&\
type=xml"
 
 
 
 

api/viber

 

Endpoints to send a Viber message and get the balance of the account

 
 
 

api/viber/send

 

Sends a Viber message with the option to fall-back to sms (if the Viber message fails)
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
to
Mobile of recipent. [Required]
text
Text of the viber to send
from
Sender-id of the viber message. You need to apply for your own Sender-id and get approved by Viber.
button_caption
The caption of the button
button_action
The redirect URL of the button
image
The URL of the image. Must be 350px x 350px.
validity
In seconds (60 to 86400 for 24 hours) the validity of the Viber message. After that the fall-back SMS is send. Default value is 86400 for 24 hours
all_devices
true to send to Smartphones and Tablets and false for Smartphones only
sms_fallback
true to send Fallback SMS if the Viber message fails to deliver
sms_text
Text of the fall-back sms
sms_from
The originator of the fall-back sms
ucs
For fall-back SMS: true for Unicode or false for GSM (default)
flash
For fall-back SMS: true for flash viber or false for normal (default)
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
idThe id of the Viber message
costThe cost of the Viber message
balanceThe balance of the account
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
501Missing to, contactId or groupId parameters
503Paramater from is not authorized. You can apply for authorization by Viber.
504The sender-id is paused. Contact us to activate it again.
505Missing text for Viber message. Buttons must follow a text
506Viber message text can be up to 1000 characters long
507Missing button_caption parameter for the caption of the button
508Missing button_action parameter
509Missing image parameter
510Invalid all_devices parameter
511Messages with image and text need also a button
512Messages without text can only have an image
513Invalid validity parameter. Valid range is from 30 (minutes) to 1440 (minutes = 24 hours)
514Invalid parameter sms_from for fall-back sms.
515Invalid parameter contactId
516Invalid parameter groupId
517Account run out of balance
518Message failed
<?php

  $endpoint = 'https:///viber/send';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'text'    => 'Your Viber message',
      'from'    => 'sender',
      'to'      => '306971000000',
      'button_caption' => 'BUTTON',
      'button_action'  => 'YOUR-URL',
      'image'          => 'IMAGE-URL',
      'validity'       => '600',
      'sms_fallback'   => true,
      'sms_from'       => 'ORIGINATOR',
      'sms_text'       => 'Your sms message',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///viber/send?\
key=YOUR-API-KEY&\
text=your_viber_message&\
from=sender&\
to=306971000000&\
button_caption=BUTTON&\
button_action=YOUR-URL&\
image=IMAGE-URL&\
validity=600&\
sms_fallback=true&\
sms_from=ORIGINATOR&\
sms_text=your_sms_message&\
type=xml"
 
 

api/viber/bulk

 

Sends Viber messages to multiple destinations with the option to fall-back to sms (if the Viber message fails)
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
to
Mobiles of recipients separated with comma , [Required]
text
Text of the viber message
from
Sender-id of the viber message. You need to apply for your own Sender-id and get approved by Viber.
button_caption
The caption of the button
button_action
The redirect URL of the button
image
The URL of the image. Must be 350px x 350px.
validity
In seconds (60 to 86400 for 24 hours) the validity of the Viber message. After that the fall-back SMS is bulk. Default value is 86400 for 24 hours
all_devices
true to send to Smartphones and Tablets and false for Smartphones only
sms_fallback
true to send Fallback SMS if the Viber message fails to deliver
sms_text
Text of the fall-back sms
sms_from
The originator of the fall-back sms
ucs
For fall-back SMS: true for Unicode or false for GSM (default)
flash
For fall-back SMS: true for flash viber or false for normal (default)
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
id{
value
...
}
messages{
id
msisdn
cost
}
...
Array of id and message objects
acceptedTotal messages accepted for submission
rejectedTotal messages rejected
balanceBalance of account
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
501Missing to, contactId or groupId parameters
503Paramater from is not authorized. You can apply for authorization by Viber.
504The sender-id is paused. Contact us to activate it again.
505Missing text for Viber message. Buttons must follow a text
506Viber message text can be up to 1000 characters long
507Missing button_caption parameter for the caption of the button
508Missing button_action parameter
509Missing image parameter
510Invalid all_devices parameter
511Messages with image and text need also a button
512Messages without text can only have an image
513Invalid validity parameter. Valid range is from 30 (minutes) to 1440 (minutes = 24 hours)
514Invalid parameter sms_from for fall-back sms.
515Invalid parameter contactId
516Invalid parameter groupId
517Account run out of balance
518Message failed
<?php

  $endpoint = 'https:///viber/bulk';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'text'    => 'Your Viber message',
      'from'    => 'sender',
      'to'      => '306971000000,306940000000,491725984200',
      'button_caption' => 'BUTTON',
      'button_action'  => 'YOUR-URL',
      'image'          => 'IMAGE-URL',
      'validity'       => '600',
      'sms_fallback'   => true,
      'sms_from'       => 'ORIGINATOR',
      'sms_text'       => 'Your sms message',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///viber/bulk?\
key=YOUR-API-KEY&\
text=your_viber_message&\
from=sender&\
to=306971000000,306940000000,491725984200&\
button_caption=BUTTON&\
button_action=YOUR-URL&\
image=IMAGE-URL&\
validity=600&\
sms_fallback=true&\
sms_from=ORIGINATOR&\
sms_text=your_sms_message&\
type=xml"
 
 

api/viber/balance

 

It returns a list of the sender ids approved by Viber and the balance of each one
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
senders{
sender{
senderId
text
balance
twoway
paused
}
}
Senders object for the sender-ids approved by Viber. Each account can handle more than 1 senders
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///viber/balance';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///viber/balance?\
key=YOUR-API-KEY&\
type=xml"
 
 
 
 

api/me

 

Account management endpoints

 
 
 

api/me/balance

 

Returns the balance of the account

Alias of api/balance/get (older API v.2)
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
balanceAccount balance
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
<?php

  $endpoint = 'https:///me/balance';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///me/balance?\
key=YOUR-API-KEY&\
type=xml"
 
 
 
 

api/2fa

 

Endpoints to send and check a 2-Factor Authentication code.

It is the same authentication methods banks are using world-wide based on the principal:

a. Something you know (username, password) and
b. Something you have (mobile)

 
 
 

api/2fa/send

 

Sends an authentication code by SMS and returns the status of that message (d for delivered, f for failed to deliver or s if no delivery report yet).

With the wait parameter you set the maximum time (in seconds) for the call to wait for delivery report.

Using the callback parameter you set the URL to be called in real time as soon as the delivery report arrives.

If both wait and callback paramters are missing then the call will wait for 10 seconds by default for the delivery report.
If the callback parameter is set, or the wait parameter is 0, the call will return immediately and if callback is set it will be called as soon as the delivery report arrives.
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
to
Mobile of recipent. [Required]
text
Text of the 2fa to send. If it contains the string %%CODE%% then this string will be replaced with a random 4-digit number
from
Sender of the 2fa
wait
Seconds to wait for delivery report
callback
Delivery report URL
ucs
true for Unicode or false for GSM (default)
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
authIdUnique id for each authentication and input parameter for the call 2fa/check
authStatusThe status of the authentication message. It can be d delivered, f failed or s sent, delivery report is still pending
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
102Parameter to is empty
103Invalid to parameter. The api/mobile/check endpoint will validate any mobile number
105Not enough balance
106Failed to queue the message
<?php

  $endpoint = 'https:///2fa/send';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'to'      => '306971000000',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///2fa/send?\
key=YOUR-API-KEY&\
to=306971000000&\
type=xml"
 
 

api/2fa/check

 

Checks if the parameter code is the right authentication code and returns ok if it is or nok if not.
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
authId
The authentication message id returned from 2fa/send. [Required]
code
Authentication code to check if valid. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
authok if authenticated or nok if not
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
300There is no authId parameter
301There is no code parameter
302No authentication message found for authId
<?php

  $endpoint = 'https:///2fa/check';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'authId'  => 'AUTH ID' ,
      'code'    => 'USER INPUT',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///2fa/check?\
key=YOUR-API-KEY&\
authId=AUTH ID&\
code=USER INPUT&\
type=xml"
 
 
 
 

api/contact

 

The api/contact/* calls allow your applications to fully manipulate the contacts of your account and those of your sub-users accounts.

 
 
 

api/contact/add

 

Adds a new contact to your contact list and returns the contactId of the inserted contact. To add this contact to a group you need to subsequently call the api/group/addContact endpoint
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
mobile
The mobile number of the contact. The mobile parser can efficiently parse almost any user input to mobile number. [Required]
name
First name of contact
surname
Last name of contact
fullname
Full name of contact
vname
First name in vocative. Useful for personalised messages
vsurname
Last name in vocative. Useful for personalised messages
birthday
Birthday of contact in YYYY-MM-DD format
nameday
Nameday of contact in YYYY-MM-DD format
custom1
Custom field 1. You may enter any data
custom1
Custom field 2. You may enter any data
custom1
Custom field 3. You may enter any data
custom1
Custom field 4. You may enter any data
custom1
Custom field 5. You may enter any data
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
contactIdThe contactId of the new contact
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
201Failed to parse mobile to MSISDN (international format mobile number)
202mobile is already associated with another contact
203mobile is in your Opt-Out list
204Could not insert contact
205No mobile parameter
<?php

  $endpoint = 'https:///contact/add';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'mobile'    => '44123456789',
      'name'      => 'Joe',
      'surname'   => 'Doe',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///contact/add?\
key=YOUR-API-KEY&\
mobile=44123456789&\
name=Joe&\
surname=Doe&\
type=xml"
 
 

api/contact/delete

 

Deletes contact from your contact list and all associations of the contact with groups
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
contactId
The contactId of the contact you want to delete. A list of all account contacts is returned from api/contact/list call. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
214contacId parameter is missing
216contactId not found in contact list
<?php

  $endpoint = 'https:///contact/delete';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'contactId' => 'CONTACT-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///contact/delete?\
key=YOUR-API-KEY&\
contactId=CONTACT-ID&\
type=xml"
 
 

api/contact/get

 

Returns a contact from your contact list and all associated groups
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
contactId
The contactId of the contact you want to get. A list of all account contacts is returned from api/contact/list call. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
contact{
contactId
mobile
name
surname
vname
vsurname
birthday
nameday
custom1
custom2
custom3
custom4
custom5
groups{
group{
groupId
name
}
}
Contact object with associated group objects
totalTotal records returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
214contacId parameter is missing
216contactId not found in contact list
<?php

  $endpoint = 'https:///contact/get';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'contactId' => 'CONTACT-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///contact/get?\
key=YOUR-API-KEY&\
contactId=CONTACT-ID&\
type=xml"
 
 

api/contact/list

 

Returns a contact list of all contacts
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
contacts{
contact{
contactId
name
mobile
cost
surname
vname
vsurname
birthday
nameday
custom1
custom2
custom3
custom4
custom5
}
}
Array of contact objects
totalTotal records returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///contact/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///contact/list?\
key=YOUR-API-KEY&\
type=xml"
 
 

api/contact/update

 

Updates a contact with new properties
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
contactId
contactId to update. [Required]
mobile
New mobile number of the contact
name
First name of contact
surname
Last name of contact
fullname
Full name of contact
vname
First name in vocative. Useful for personalised messages
vsurname
Last name in vocative. Useful for personalised messages
birthday
Birthday of contact in YYYY-MM-DD format
nameday
Nameday of contact in YYYY-MM-DD format
custom1
Custom field 1. You may enter any data
custom1
Custom field 2. You may enter any data
custom1
Custom field 3. You may enter any data
custom1
Custom field 4. You may enter any data
custom1
Custom field 5. You may enter any data
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
contactIdId of the updated contact
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
201Failed to parse mobile to MSISDN (international format mobile number)
202mobile is already associated with another contact
203mobile is in your Opt-Out list
214contacId parameter is missing
221Could not update contact
<?php

  $endpoint = 'https:///contact/udpate';

  $parameters = array(
      'key'         => 'YOUR API KEY',
      'contactId'   => 'CONTACT-ID',
      'mobile'      => '44123456789',
      'name'        => 'Joe',
      'surname'     => 'Doe',
      'type'        => 'json' // type of return format
      'type'        => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///contact/update?\
key=YOUR-API-KEY&\
contactId=CONTACT-ID&\
mobile=44123456789&\
name=Joe&\
surname=Doe&\
vname=Joe&\
vsurname=Doe&\
fullname=Joe-Doe&\
birthday=1980-12-24&\
nameday=1980-05-15&\
custom1=any-data-1\
custom2=any-data-2&\
custom3=any-data-3&\
custom4=any-data-4&\
custom5=any-data-5&\
type=xml"
 
 
 
 

api/group

 

The api/group/* calls allow your applications to fully manipulate the groups of your account and the groups of your sub-users accounts

 
 
 

api/group/add

 

Adds a new group to your group list and returns the groupId of the inserted group.
To add contacts to this group you need to subsequently call the api/group/addContact or equivalent endpoint
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
name
Group name
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
groupIdThe groupId of the new group
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
213The name parameter is missing
<?php

  $endpoint = 'https:///group/add';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'name'      => 'Group name',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/add?\
key=YOUR-API-KEY&\
name=Group-Name&\
type=xml"
 
 

api/group/addContact

 

Adds a reference of a contact to a group
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
groupId
The groupId of the group
contactId
The contactId of the contact to add to the group
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
contactGroupIdReference of the associated contact with the group
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
214contacId parameter is missing
215groupId parameter is missing
216contactId not found in contact list
217groupId not found in group list
218contactId already in groupId. Can be interpreted as success :!)
<?php

  $endpoint = 'https:///group/addContact';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'groupId'   => 'GROUP-ID',
      'contactId' => 'CONTACT-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/addContact?\
key=YOUR-API-KEY&\
groupId=GROUP-ID&\
contactId=CONTACT-ID&\
type=xml"
 
 

api/group/delete

 

Deletes a group and all associations with contacts for this group.
Note that the contacts of the group still remain in the contact list along with their references to other groups
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
groupId
The groupId of the group you want to delete. A list of all groups is returned from api/group/list call. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
215groupId parameter is missing
217groupId not found in group list
<?php

  $endpoint = 'https:///group/delete';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'groupId'   => 'GROUP-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/delete?\
key=YOUR-API-KEY&\
groupId=GROUP-ID&\
type=xml"
 
 

api/group/deleteAllContacts

 

Deletes all contact references from a group.
Note that the contacts of the group still remain in the contact list
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
groupId
The groupId of the group you want to delete. A list of all groups is returned from api/group/list call. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReprodude
215groupId parameter is missing
217groupId not found in group list
<?php

  $endpoint = 'https:///group/deleteAllContacts';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'groupId'   => 'GROUP-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/deleteAllContacts?\
key=YOUR-API-KEY&\
groupId=GROUP-ID&\
type=xml"
 
 

api/group/deleteContact

 

Deletes a contact reference from a group.
To delete a contact from the contact list and all references to groups you need to use the api/contact/delete endpoint
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
groupId
The groupId from which you want to delete a contact reference. [Required with contactId if no contactGroupId]
contactId
The contactId of the contact reference you want to delete. [Required with groupId if no contactGroupId]
contactGroupId
The contactGroupId reference of the contact you want to delete. [Required if no groupId-contactId]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
215groupId parameter is missing
217groupId not found in group list
<?php

  $endpoint = 'https:///group/deleteContact';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'groupId'   => 'GROUP-ID',
      'contactId' => 'CONTACT-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/deleteContact?\
key=YOUR-API-KEY&\
groupId=GROUP-ID&\
contactId=CONTACT-ID&\
type=xml"
 
 

api/group/get

 

Returns a group from your group list and all associated contacts
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
groupId
The groupId of the group you want to get. A list of all groups is returned from api/group/list call. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
group{
name
total
contacts{
contact{
contactId
mobile
...
}
...
}
Group object with associated contact objects
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
215groupId parameter is missing
217groupId not found in group list
<?php

  $endpoint = 'https:///group/get';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'groupId'   => 'GROUP-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/get?\
key=YOUR-API-KEY&\
groupId=GROUP-ID&\
type=xml"
 
 

api/group/list

 

Returns a list of all groups
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
groups{
group{
groupId
name
}
...
}
Array of group objects
totalTotal records returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///group/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///group/list?\
key=YOUR-API-KEY&\
type=xml"
 
 
 
 

api/history

 

Gives access to all sms sent for each account

 
 
 

api/history/group/list

 

Returns a list of all group sms
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
historyGroup{
groupId
sender
flash
unicode
timestamp
text
total
cost
sms{
smsId
contactId
to
status
cost
ttd
}
}
...
Array of historyGroup objects
totalTotal records of historyGroup returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///history/group/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///history/group/list?\
key=YOUR-API-KEY&\
type=xml"
 
 

api/history/single/list

 

Returns a list of all single sms
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
sms{
smsId
sender
to
flash
unicode
timestamp
text
cost
status
ttd
}
...
Array of sms
totalTotal records of sms returned
costTotal cost of all sms returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///history/single/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///history/single/list?\
key=YOUR-API-KEY&\
type=xml"
 
 
 
 

api/hlr

 

The api/hlr/* calls perform a real time Number Lookup providing information about number portability or/and physical geographical location of mobile numbers. HLR stands for Home Location Register.

The HLR lookup can be very useful for routing optimizations and particularly useful for authentication services.

Each call to the api/hlr/lookup costs 1/10 of an SMS

 
 
 

api/hlr/lookup

 

Accepted parameters are the API key of the account and any mobile number to query.

Each call of api/hlr/lookup costs 1/10 of an SMS and it is subtracted from the hlrBalance property of the account.

The hlrBalance of each account is initially 0.

As soon as the api/hlr/lookup is called it checkes if the hlrBalance is at least 1 and if it is 0 it converts 1 SMS from the account balance to 10 hlrBalance credits.

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
mobile
Any mobile to check.
Supports all countries and networks. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
resultResult of the query, successful if OK
descriptionResult description of the query
mccCurrent mobile country code
mncCurrent mobile network code
networkName of the network
countryCountry name
countryCodeCountry call code
portedyes if it has been ported
cctldCCTLD of country
mccInitialInitial country code
mncInitialInitial network code
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the lookup of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
105Account out of balance
201Failed to parse mobile to MSISDN (international format mobile number)
205mobile parameter is empty
<?php

  $endpoint = 'https:///hlr/lookup';

  $parameters = array(
      'key'     => 'YOUR API KEY',
      'mobile'  => '306971000000',
      'type'    => 'json' // type of return format
      'type'    => 'xml'  // type of return format
      'type'    => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///hlr/lookup?\
key=YOUR-API-KEY&\
mobile=MOBILE NUMBER&\
type=xml"
 
 
 
 

api/purchase

 

Gives access to account history of purchases

 
 
 

api/purchase/list

 

Returns a list of all purchased sms
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
purchases{
purchase{
purchaseId
timestamp
cost
sms
}
...
}
Array of purchase objects
totalTotal records of purchases returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///purchase/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///purchase/list?\
key=YOUR-API-KEY&\
type=xml"
 
 
 
 

api/status

 

Returns the statuses of your messages

 
 
 

api/status/get

 

Returns all sms whose status has been changed since last call
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
sms{
smsId
status
}
...
Array of sms ids and statuses
totalTotal records returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///status/get';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///status/get?\
key=YOUR-API-KEY&\
type=xml"
 
 

api/status/sms

 

Returns the status of a specific sms
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
smsId
SMS id to get the status. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
sms{
smsId
status
}
The status of the smsId
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///status/sms';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'smsid'     => 'SMS ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///status/sms?\
key=YOUR-API-KEY&\
smsId=SMS-ID&\
type=xml"
 
 
 
 

api/user

 

Manipulate your account and your sub-users accounts.

More endpoints coming soon:

  • api/user/delete
  • api/user/email
  • api/user/emailAll
  • api/user/get
  • api/user/password
  • api/user/sms
  • api/user/smsAll
  • api/user/update
 
 
 

api/user/add

 

Creates a new sub-account under the main user account
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Main account API key. [Required]
email
The email of the user to add. [Required]
password
The password of the account to add. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
user{
userId
balance
}
Balance of user
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentials
601User is registered
602Reached maximum users. Contact support
<?php

  $endpoint = 'https:///user/add';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'email'     => 'VALID-EMAIL',
      'password'  => 'PASSWORD',
    
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/add?\
key=YOUR-API-KEY&\
email=VALID-EMAIL&\
password=PASSWORD&\
type=xml"
 
 

api/user/list

 

Returns a list of all sub-accounts
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
user{
userId
username
email
balance
mobile
key
}
...
Array of users
totalTotal records returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
<?php

  $endpoint = 'https:///user/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/list?\
key=YOUR-API-KEY&\
type=xml"
 
 

api/user/topup

 

Adds sms to a sub-account taken from the main user account
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Main account API key from which the sms will be taken. [Required]
userId
The userId of the user to topup. [Required]
sms
How many sms to topup. [Required]
cost
The cost of the sms. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
user{
userId
balance
}
Balance of user
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
206Parameter sms is malformed
207Parameter cost is malformed
208Parameter userId is empty
209User is not found in the users list
210Removing sms from user. User has not enough balance to remove
211The main account has not enough balance
<?php

  $endpoint = 'https:///user/topup';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'userId'    => 'SUB-USER-ID',
      'sms'       => 100,
      'cost'      => 4,
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/topup?\
key=YOUR-API-KEY&\
userId=USER-ID&\
sms=100&\
cost=4&\
type=xml"
 
 
 
 

api/user/comment

 

add, delete and list endpoints to keep track of all actions of the sub-users accounts

 
 
 

api/user/comment/add

 

Adds a comment to a sub-account user
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
userId
The userId of the user. [Required]
comment
Comment to add
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
comment{
commentId
}
Comment id
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
208Parameter userId is empty
209User is not found in the users list
212No comment parameter
<?php

  $endpoint = 'https:///user/comment/add';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'userId'    => 'SUB-USER-ID',
      'comment'   => 'New comment',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/comment/add?\
key=YOUR-API-KEY&\
userId=USER-ID&\
comment=new-comment&\
type=xml"
 
 

api/user/comment/delete

 

Deletes a comment from a sub-account user
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
commentId
Comment id to delete
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
212No comment parameter
220Comment with commentId not found
<?php

  $endpoint = 'https:///user/comment/delete';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'commentId' => 'COMMENT-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/comment/delete?\
key=YOUR-API-KEY&\
commentId=COMMENT-ID&\
type=xml"
 
 

api/user/comment/list

 

Returns a list of all comments for a sub-account user
Requires IP Whitelisting

 

Accepts

ParameterValueDescription
key
Account API key. [Required]
userId
The userId of the user. [Required]
type Format of the returned result. Can be either plain text (v2), json or xml. Default is json

Returns

ValueDescription
comments{
comment{
commentId
timestamp
comment
}
...
}
Array of comments
totalTotal comments returned
statusThe status of the call. Always 1 on success or 0 on error
errorError code, 0 for no error otherwise check the list of error codes or the remarks parameter
remarksNotes on the call. Always Success or error description

Errors

ErrorDescription
101Check your credentialsReproduce
208Parameter userId is empty
209User is not found in the users list
<?php

  $endpoint = 'https:///user/comment/list';

  $parameters = array(
      'key'       => 'YOUR API KEY',
      'userId'    => 'SUB-USER-ID',
      'type'      => 'json' // type of return format
      'type'      => 'xml'  // type of return format
      'type'      => 'v2'   // type of return format
  );
//remove_circle_outline
  function call_endpoint($endpoint, $parameters){
      $c = curl_init();
      curl_setopt($c, CURLOPT_URL, $endpoint);
      curl_setopt($c, CURLOPT_POST, true);
      curl_setopt($c, CURLOPT_POSTFIELDS, $parameters);
      curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      $output =  curl_exec($c);
      curl_close($c);
      return $output;
  }

  $json = json_decode(call_endpoint($endpoint, $parameters), true);

  echo '<pre>';
  print_r($json);
  $xmldata = call_endpoint($endpoint, $parameters);

  if (function_exists('simplexml_load_string')){
    $xml = simplexml_load_string($xmldata);
  }else if (function_exists('xml_parser_create')){
    $xmlparser = xml_parser_create();
    xml_parse_into_struct($xmlparser, $xmldata, $xml);
    xml_parser_free($xmlparser);
  }

  echo '<pre>';
  print_r($xml);
  echo call_endpoint($endpoint, $parameters);

?>
curl "https:///user/comment/list?\
key=YOUR-API-KEY&\
userId=USER-ID&\
type=xml"
 
 
thank you, thank you
 
 
 
 
 

All schools in Greece can integrate their central school management system myschool.sch.gr with smsb2b.com to enable direct sms messaging from myschool system to

  • Students
  • Parents
  • Educational personel and others

Settings for myschool.sch.gr
 

In field 1. enter your account API key
You will find it once you sign in with your account

In field 2. enter the sender of the sms
Must me up to 11 latin characters without spaces