Download as a PDF file   Print this page
fr en

Application Programming Interface (API)

Last update on May 15, 2012.

Returns : PHP & XML
Methode:
GET or POST
URL PHP : http://api.smsbox.net/api.php (Return data in PHP format)
URL XML : http://api.smsbox.net/api.xml (Return data in XML format)
URL PHP SSL : https://api.smsbox.net/api.php
URL XML SSL : https://api.smsbox.net/api.xml

Example of using of our API in PHP : http://api.smsbox.net/exemple.php
Example of form to test the API : http://api.smsbox.net/essai-api.html

How does it work ?

SMSBOX offers an API allowing you to integrate easily, our SMS sending solution into your applications seamlessly.
To send SMS via our API, You have to obtain an SMSBOX account with a minimum amount of credits. Then, you have to send to our API a HTTP request in GET or POST contening several variables.
Please note that the functions are equals in PHP or XML. Just the return from our API is different.

Example of an SMS sending through HTTP GET method (PHP):

http://api.smsbox.net/api.php?login=Username&pass=password&msg=your+message&dest=06XXXXXXXX&origine=You&mode=Expert

Interpretation : We send the variables login, pass, dest, msg, origine and mode to our API, which sends your SMS with this parameters.

List of parameters available for SMS sending

login
Username of your SMSBOX account. Needed to identify you on the API.
pass
Password of your SMSBOX account. Needed to identify you on the API.
Tip: You can encrypt your password to HASH MD5. In PHP, you can use the function md5().
dest
Your recipient phone number (See area codes list).
Information: If you want to do bulk sendings, you have just to separate them by commas. Also see below the bulk sending section.
msg
The message you want to send to your recipient(s) (160 characters per SMS).
Information: your message encoding must to be in ISO-8859-15 format.
Remark: If you type more than 160 characters, your message will be send in several SMS. Also see the udh parameter for the concatenation.
mode
Define your sending mode: mode=Expert (1 Credit/SMS) ou mode=Economique (0.8 Credit/SMS) ou mode=Multimedia (1 Credit/SMS) ou mode=Reponse (1.2 Credit/SMS).
Remark: The sender(origin) customization is not available in Expert mode. By default, the sending mode is Expert.
origine
Mandatory in Expert mode (unless default sender already configured). Sender name or number (Maximum 15 digits or 11 characters). If not filled, using of your default sender.

Tip: You can use this parameter to debug your application. When origine=debugvar the API will return the parameters configured for your SMS without really sending it.
Remark: Customising the sender (origine) is only possible in Expert mode.
IMPORTANT: First you have to create your sender in « Manage senders » section inside your Customer Area.
type
Optional. The type of message you want to send : Classic or Flash.
type=0 : classic sending, type=1 : SMS Alert (Flash)
Remark: By default the sending method is classic.
strategy
Define your message's strategy.
1
Private communication (person to person)
This strategy is made for person to person communications. Marketing SMS are forbidden through this strategy.
The privative and global blacklists are not checked.
2
Alerting message / proactive notice
This strategy is dedicated to alerts or proactive notices. Marketing SMS are forbidden through this strategy.
The privative and global blacklists are not checked.
3
Group communication (no marketing message)
This strategy is dedicated to communications without marketing subject to restricted group of users. Marketing SMS are forbidden through this strategy.
The global blacklist is not checked. However, your private blacklist is checked.
4
Marketing SMS
This strategy is made for Marketing campaigns.
Global and private blacklists are checked.
You have to give the choice to recipients to unsubscribe inside your message. More information
You must avoid to send campaigns after 9 PM, before 8 AM and on sunday & bank holiday. More information
date
Optional. If you want to delay the sending you can indicate date=DD/MM/YYYY
Remark: by default the sending is immediate.
heure
Optional. If you want to send the message at a specified hour, indicate heure=HH:MM
Remark: 24Hour-format from Paris (UTC+1). by default the sending is immediate.
id
Optional. When you add the parameter id=1, our API sends OK following the sending reference.
Example: OK 1234567890
Remark: if the SMS length exceeds 160 characters, you will obtain several references separated by commas.
callback
Optional. If you add the parameter callback=1 in your requests, you active the return function of your delivery status on your Callback URL added before in « Configuration » section inside your Customer Area.
Consult the « Callback » menu for more information.

Our platform will call your script through the GET method each time your delivery status will be updated, (See the Delivery status list):
http://your-callback-url.ext/your-script.php?numero=33612345678&reference=123456789&accuse=0
udh
Optional. When you add the parameter udh=1, and if your message contains more than 160 characters, the SMS received will be concatened in one display.
Remark: This option limits the message length for one SMS to 153 characters.

SENDING REPORT & ERROR MESSAGES

If a value is missing or incorrect, if you don't have enough credit or if your SMS has been sent successfully, you will be alerted via a text code displaying your sending status. See below, the differents return codes:

OK
The message has been accepted by our platform.
The return code could provide you your sending reference if you have indicated the parameter id=1 in your request.
ERROR 01
Parameters are missing. Verify the arguments of your request.
ERROR 02
Wrong Identifiers, account banned or IP address restricted. Verify your login & password or go to the section « API Security » in your Customer Area.
ERROR 03
No credit or insufficient. Reload your account by buying SMS Credits.
ERROR 04
The recipient phone number is incorrect. Verify the number in your request.
ERROR 05
Internal application error. Try again later.
ERROR
Sending has failed for another reason (Phone number in blacklist, operator unavailable, coutry uncovered, ...)

Callback

Your Callback URLs have to be setted up before in your Customer Area on the « Configuration » menu.

The Callback requests are made via HTTP GET method.
Your Callback script must only return a HTTP 200 status and the word OK.
If your system is not be able to answer correctly to our request, or if you return the word ERROR or a different HTTP status from 200, we will retry the request each 15 minutes during a maximum period of 12 hours.

Consult the « Security » menu below to obtain the IP addresses for the incoming Callbacks.

Security

In order to secure your sendings, you have differents options:
- You can encrypt your password (variable pass) in HASH MD5.
- You can use https:// (secure SSL connection) instead of http://
- You can specify the IP addresses allowed on your API from your Customer Area section « API Security ».
By using this 3 solutions together, you will obtain an optimum security.

If you use a firewall, you must authorize the following IP adresses :
  • 91.121.50.248 (api.smsbox.fr & Callbacks)
  • 87.98.249.130 (api.smsbox.net)
Important : From 25st of May 2012, IP addresses change to the following :
  • 37.59.198.135 & 178.33.185.51 (Callbacks)
  • 37.59.198.132 & 178.33.185.48 (api.smsbox.fr)
  • 37.59.198.144 & 37.59.198.145 (api.smsbox.net)

Multimedia SMS sending

Sending of binary message :


http://api.smsbox.net/api.php?login=you&pass=password&mode=multimedia&dest=33600000000&type=bin&data_udh=06050423F40000&data=7475206573206269656E206375726965757820746F6920646973206D6F69203A290D0A

The UDH (in the variable data_udh) and the content (variable data) must be filled in hexadecimal by peer (example : the new line character \n will be replaced by 0A and not A). no : or % to separate. The maximum size of the two variables data_udh & data added can't exceed 140 bytes per SMS.

Examples of UDH:
0605040B8423F0 - SMS Wap-Push (SI)
06050423F40000 - SMS vCard
06050423F50000 - SMS vCalendar

Sending preformatted Wap-Push messages:

http://api.smsbox.net/api.php?login=you&pass=password&mode=multimedia&dest=33600000000&type=push&duree=7&msg=message&url=http://www.site.com
Variables:
- duree: Validity duration of Push message (in days, 7 days by default)
- msg: Push Message (max. 80 characters)
- URL : URL of Wap-Push content (Currently rewrited in http://smsb.fr/xxx)

Sending preformatted vCard messages:

http://api.smsbox.net/api.php?login=you&pass=password&mode=multimedia&dest=33600000000&type=vcard&vtype=TEL;CELL&vnom=Toto&vdata=0600000000

Variables:
- vtype: data type
  • TEL;CELL => mobile phone number
  • TEL;CELL;WORK => Business Mobile phone number
  • TEL;VOICE;HOME => Home phone number
  • TEL;VOICE;WORK => Business Home phone number
  • TEL;FAX => Fax Number
  • EMAIL => E-mail address
  • URL => Website
- vnom : Contact name (max. 30 characters)
- vdata : Value (max. 50 characters)

Sending preformatted vCalendar messages:

http://api.smsbox.net/api.php?login=you&pass=password&mode=multimedia&dest=33600000000&type=vcalendar&vdate=31/03/2008&vheure=09:00&vmessage=message

Variables:
- vdate : format DD/MM/YYYY
- vheure : format HH:MM
- vmessage : Reminder message (max. 27 characters)

HLR Lookup

This service enables you to test the phone number validity and obtain its operator (even if the number has been ported) by sending a "HLR Lookup" request to the mobile network. The cost is 0.3 SMS Credit per tested number.
Consult the specific cover for this service..

You can call the API in this way:
http://api.smsbox.net/api.php?login=you&pass=password&action=hlr&dest=33600000000
Possibles return: Same as SMS sending.

You can test sevral numbers separating them by commas. In the limit of 100 numbers per request.

To receive the number status and the operator MNC you have to define your Callback URL before in the « Configuration » menu in your Customer Area.
Consult the « Callback » menu for more information.

The return on your Callback URL will be done like this:
http://votre-url-de-callback.ext/votre-script.php?numero=W&reference=X&accuse=Y&mnc=Z&libelle=A

Legend:
W - Tested number
X - Request reference
Y - Number status (2 digits) :

60 - OK
61 - Absent subscriber
62 - Unexisted subscriber
69 - Error

Z - Operator MCC+MNC (Mobile Network Code) of the number (empty if Y different of 60). For example SFR France : 20810
A - Operator name wording (if referenced in our database)

Functions available

Our API contains many functions enabling you to make actions whitout connection to your Customer Area.
For each action available in the API, you need to fill the parameters login & pass.

Sending to a defined group

Request : ...&action=envoigroupe&msg=message&groupe=123&origine=You&mode=Expert
Information : 123 correspond to the group ID you need to send the message. You will find this ID in the groups list display below. The parameter dest becomes optional with this function.
Return from API : See above the possibles return table.

Customised sending

This method enables you to customise your message for each recipient via some variables.

To create a customised sending you have to specify the parameter personnalise=1 in your request.

The variables has to be setted just after the related number in the parameter dest. For example:
dest=number;variable1;variable2,number;variable1;variable2,number;variable1;variable2

Inside your message (parameter msg), it will appear like this :
- %0% is replaced by the number (for example : 0612345678)
- %1% is replaced by the value of variable1
- %2% is replaced by the value of variable2
You can use 10 variables at maximum (phone number included, from 0 to 9).

Request example :
http://api.smsbox.net/api.php?login=you&pass=password&dest=0600000000;Jean;vehicule,0612345678;Paul;scooter&msg=Hello+%1%,+your+%2%+is+ready.&mode=economique&personnalise=1

This example will send the following message to this recipients:
- To 0600000000 : Hello Jean, your vehicule is ready.
- To 0612345678 : Hello Paul, your vehicule is ready.

Sub accounts creation

Request: ...&action=utilisateur&do=add&pseudo=pseudo&mdp=password&nolimit=yes
Information : the parameter nolimit is optional and can take the value yes or no. See below the option « No-limit ».
Maximum : 500 sub accounts per main account.
Return from API : OK or ERROR.

Credit management


Verify your SMS Credit

Request: ...&action=credit
Return from API: CREDIT 22
Traduction: You have got 22 SMS Credit on your account.

Manage the sub account credit

Request: ...&action=credit&to=subaccount&credit=123
Traduction: This request will add 123 credits to the sub-account subaccount (in the limit of the stock available on the main account).
Information: The parameter credit (here equal to 123) may be positive or negative.
Tip: We have a option to enable you to send SMS via the API from your sub accountswithout give it some credits, the credit could be take from your main account directly. See below the option « No-limit ».
Return from API: OK or ERROR

Option « No-limit »

During the edition of your sub-accounts you can allocate some SMS Credit (taken automatically from your main account), either use the option « No-limit » which enables you to use the credit from your main account directly on your sub-accounts.
To activate this option on one of your sub-accounts, go to the section Manage users in your Customer Area.

Default sender


Retrieve the default sender value

Request: ...&action=emetteur
Return from API: The default sender value configured in your Customer Area.

List your available senders (new)

Request: ...&action=emetteur&do=list
Return from API: The list (separated by line feed) of your available senders, declared before in your Customer Area.

Edit the default sender value

Request: ...&action=emetteur&do=set&emetteur=value
Return from API: The sender value defined or ERROR.

Address Book : Contacts management


Display all the contacts

Request: ...&action=contacts
Return from API: ID;nom;numéro

Add a contact:

Request: ...&action=contacts&do=add&nom=Paul&num=06XXXXXXXX
Return from API: OK or ERROR

Edit a contact:

Request: ...&action=contacts&do=edit&id=123&nom=Paul&num=06XXXXXXXX
Information : 123 corresponds to the contact ID to edit
Return from API: OK or ERROR

Delete a contact:

Request: ...&action=contacts&do=del&id=123
Information : 123 corresponds to the contact ID to delete
Return from API: OK or ERROR

Carnet d'adresses : Gestion de mes groupes


Display all the groups

Request: ...&action=groupes
Return from API: ID;groupname;06XXXXXXXX,34XXXXXXXX,32XXXXXXXX

Add a group

Request: ...&action=groupes&do=add&nom=groupname&num=06XXXXXXXX,34XXXXXXXX,32XXXXXXXX
Return from API: OK ou ERROR

Edit a group

Request: ...&action=groupes&do=edit&id=123&nom=newname&num=06XXXXXXXX,34XXXXXXXX,32XXXXXXXX
Information: 123 corresponds to the group ID to edit.
Return from API: OK ou ERROR

Add numbers in a group

Request: ...&action=groupes&do=add_numbers&id=123&num=06XXXXXXXX,34XXXXXXXX,32XXXXXXXX
Information: 123 corresponds to the group ID where you want to insert new numbers.
Return from API: OK ou ERROR

Delete a group

Request: ...&action=groupes&do=del&id=123
Information: 123 corresponds to the group ID to delete.
Return from API: OK ou ERROR

History of my sent SMS


Number of records available in my history

Request: ...&action=historique
Return from API: HISTORIQUE 123
Traduction: There are 123 SMS in your Customer Area history.
Display history
Request: ...&action=historique&from=10&nb=20
Information: This request will display 20 records from the last 10th sent messages (records from 10 to 10+20). In the case above, to display the records, we will use from=0&nb=123..
Return from API: 20/10/2007 18:15:00;336XXXXXXXX;emetteur;0;1;0
Tip: To obtain a column contening your sendings references, add the parameter showref=1 in your request.
Traduction: Each column is separated by a semicolon :
- Time & date (UTC+1)
- The sending reference (ssi showref=1 specified in the request)
- Recipient phone number
- the sender (Empty if economic sending)
- Sending type (0 = Classic, 1 = Flash et 2 = other)
- sending method ( 0 = SMS in waiting list (delayed) and 1 = SMS delivered to the operator - not used anymore )
- The status "Return receipt" of SMS:


-3 => Reimbursed
-2 => Waiting status
-1 => Unknown status
0 => Message received
1 => Delivery failure
2 => Message rejected
3 => Recipient mobile inactive
4 => Recipient mobile is not responding
5 => Error during data reception
6 => Destination mobile saturated
7 => Unknown destination phone number
8 => Non-routable message
9 => Message transmitted
10 => Message sent
11 => Sending in progress
12 => Query sent
To know the description of the differents return receipt status Click-here


Retrieve the history from day to day

Request: ...&action=historique&date_from=2007-11-01&date_to=2007-11-31
Information: Dates format YYYY-MM-DD.
Return from API: See above.

Retrieve hystory from a specific message

Request: ...&action=historique&id=12345
Information: 12345 correspond to the SMS reference to extract. You can retrieve this one by adding the parameter id=1 in your request.
Return from API: See above.

Display of postponed SMS


Number of SMS in waiting list

Request: ...&action=differes
Return from API: DIFFERES 123
Traduction: There are 123 SMS in your waiting list.

Display the SMS in waiting list

Request: ...&action=differes&from=10&nb=20&showref=1
Information: This request will display 20 records from the 10th message to send (records from 10 to 10+20). In the case above, to display all the records, we use from=0&nb=123. The parameter showref enables you to add a column contening the sending reference. The display is sorted in ascending order on the sent date.
Return from API: 123;XXXXXXXXX;336XXXXXXXX;sender;0;20/10/2008 18:15:00;a message
Traduction: Each column is separated by a semicolon :
- delayed SMS ID (auto-incremented)
- Sending reference (only if the parameter showref is defined)
- Recipient(s) numbers (separated by commas)
- Sender
- Sending type(0 = Classic, 1 = Flash et 2 = Other)
- Planned date & time of sending (UTC+1)
- Message to send(some characters are url-encoded : <, > and \n)

Cancel a delayed sending

Request: ...&action=differes&do=del&id=123
Information: 123 correspond to the auto-incremented ID of sending to cancel. Your account will be reimbursed automatically of credits used for this sending.
Tip: You can cancel a delayed sending with his reference (Identifier returned during the sending if id=1). Use the parameter ref=XXXXXXXXX instead of id=123.
Return from API: OK or ERROR
Powered by SMSBOX.