In order to send a Standard Rate SMS, you must POST your query to the following URL:
http(s)://api.onesixty.co.uk/rest/v2/messages/create

Parameters Type Information
username
(required)
String Your OneSixty username.
api_key
(required)
String Your API key. This is different from your password.
to
(required)
String Please provide a (string) comma separated list of (up to 10) recipients (no spaces).
 
An international format is required for all recipients. Do not use the plus sign (+). For example: 44712345678
message
(required)
String (160)
 
String (459)
Route 9 only
The following characters (ISO-8859-15) are allowed on route 2 (including newlines):
@£$¥èéùìòÇØøÅå_^{}[~]€ÆæßÉ !"#%&'()*+,-./0-9:;<=>?A-Za-z
 
For all other routes, the full GSM character set is allowed (including newlines):
@£$¥èéùìòÇØøÅåΔ_ΦΓΛΩΠΨΣΘΞ^{}[~]|€ÆæßÉ !"#¤%&'()*+,-./0-9:;<=>?¡A-ZÄÖÑܧ¿a-zäöñüà
 
Please make sure your characters are UTF-8 encoded. The following may help: utf8_encode()
type
(required)
String Please set the type to: sms
sender_id
(required)
String (11)
String (15)
The following characters are allowed on route 9:
0-9A-Za-z '-
 
For all other routes, alphanumeric only (beginning with a letter):
0-9A-Za-z
 
If the sender ID contains numbers only, the maximum length is 15. Otherwise it is 11. Short code sender IDs are only permitted on route 9. On route 3, sender IDs will get stripped and replaced with a UK long number.
route
(required)
Integer Please use the route number specified by your account manager.
do_hlr
(optional)
Integer Please set to 1 if you would like to use our HLR checker.

The response format is currently JSON. You will receive an array in which the first element is either integer 0 (fail) or integer 1 (success). The second element is a string message and the third element (if successful) is a string submission reference. Here are some sample responses:

[
	0,
	"You have insufficient credits remaining."
]
[
	1,
	"Your message has been sent successfully.",
	"640ab2bae07bedc4c163f679a746f7ab7fb5d1fa"
]

If you are using the do_hlr=1 parameter, please expect up to 4 extra elements:

[
	1,
	"Your message has been sent successfully.",
	"640ab2bae07bedc4c163f679a746f7ab7fb5d1fa",
	0.0299,		/* SMS cost */
	0.0100,		/* HLR cost, can be 0.00 if we are using a cached result */
	0|1|2		/* 0 = Dead | 1 = Live | 2 = Unknown */
	23410		/* Only present is the above element is 1 (Live). This is the MCCMNC */
]

If a number comes back as Unknown or Dead, you will receive an Unknown or Stopped delivery report (respectively), rather than a Not Delivered delivery report.

For batch sends, please use the following URL:
http(s)://api2.onesixty.co.uk/rest/v2/messages/batch

Batch sends allow you to send an array of (up to 1,000) objects in one POST, each containing a Destination and Content and optional Network (for Premium Rate SMS). Batch sends must be enabled on a per account basis and are designed for high volumes on routes 2 and 3. Batch sends support concatenated SMS on route 2 only (up to 3 parts of of 153 characters each).

Our batch send URL accepts a JSON payload (see below for Standard Rate SMS) with a header content-type of: application/json

{
	"ApiKey": "5d838ca124087a7d25a3cbf0d240157553083bb8",
	"Messages": [
		{
			"Content": "This is message #1",
			"Destination": "447712345678"
		},
		{
			"Content": "This is message #2",
			"Destination": "447712345679"
		}
	],
	"Route": "2",
	"SenderID": "Alert",
	"Type": "sms",
	"Username": "MyUsername"
}

For Premium Rate SMS (which must be enabled on your account), please see below (paying particular attention to the Network elements) and the route number which is the amount you wish to bill (in pence).

{
	"ApiKey": "5d838ca124087a7d25a3cbf0d240157553083bb8",
	"Messages": [
		{
			"Content": "This is message #1",
			"Destination": "447712345678",
			"Network": "VODAFONEUK"
		},
		{
			"Content": "This is message #2",
			"Destination": "447712345679",
			"Network": "ORANGEUK"
		}
	],
	"Route": "150p",
	"SenderID": "Alert",
	"Type": "sms",
	"Username": "MyUsername"
}

The following network IDs are supported: THREEUK, BTCELLNETUK (O2), ORANGEUK, TMOBILEUK, VODAFONEUK

The following tariffs are supported: 150p

For Premium Rate SMS, the Sender ID will be stripped and replaced with a UK short code. You are allowed to send up to 20 messages to each recipient, per day.

If you have a keyword on our UK short code (88860), we will pass you the network parameter with each inbound SMS. If you have opt-in data elsewhere, we would recommend that you use our HLR API to find out the current network and pass that to the API call.

The response format is currently JSON. You will receive an array in which the first element is either integer 0 (fail) or integer 1 (success). The second element is a string message and the third element (if successful) will be a multi-dimensional array and the format will be as follows:

[
  1,
  "Your message has been sent successfully.",
  [
    [
      1,
      "447712345678",
      "47cca229f33afb550cf01394e0f0241ad9ea714d",
      "2011-11-27 20:23:30.54598200"
    ],
    [
      1,
      "447712345679",
      "7befed4863bce4f0c96138323461d0df1235bde5",
      "2011-11-27 20:23:30.57577000"
    ]
  ]
]

Each array will contain 4 elements. The first element is either integer 0 (fail) or integer 1 (success). The second element is a string recipient. The third element is a string submission reference. The fourth element is a string timestamp (GMT) with microseconds.

You can use the json_decode() function in PHP to convert this string into a PHP variable.

Sample code for one-off messages

<?php
    
function send_sms($params)
    {
        
$options = array(
            
CURLOPT_HEADER => FALSE,
            
CURLOPT_POST => TRUE,
            
CURLOPT_POSTFIELDS => $params,
            
CURLOPT_RETURNTRANSFER => TRUE
        
);

        
$ch curl_init('http://api.onesixty.co.uk/rest/v2/messages/create');

        if (
$ch)
        {
            if (
curl_setopt_array($ch$options))
            {
                
$response curl_exec($ch);

                if (
$response)
                {
                    
$result json_decode($response);

                    if ( ! empty(
$result))
                    {
                        if (
is_array($result) && isset($result[0]))
                        {
                            if (
$result[0] > && isset($result[2]))
                            {
                                
//add_to_log("Success: {$result[2]}");
                            
}
                            else
                            {
                                
//add_to_log("Error: {$result[1]}");
                            
}

                            return (bool)
$result[0];
                        }
                    }
                }
            }

            
curl_close($ch);
        }

        return 
FALSE;
    }

    
// Send one message to one recipient
    
$params http_build_query(array(
        
'username' => 'MyUsername',
        
'api_key' => '47acd2028cf81b5da88ddeedb2aea4eca4b71fbd',
        
'to' => '447123456789',
        
'message' => 'Testing 123.',
        
'type' => 'sms',
        
'sender_id' => 'YourBiz',
        
'route' => 2
    
));

    if (
send_sms($params))
    {
        echo 
'Message sent successfully...';
    }

    
// Send one message to multiple recipients
    
$params http_build_query(array(
        
'username' => 'MyUsername',
        
'api_key' => '47acd2028cf81b5da88ddeedb2aea4eca4b71fbd',
        
'to' => '447123456789,447123456780'// Notice the comma separated recipients
        
'message' => 'Testing 123.',
        
'type' => 'sms',
        
'sender_id' => 'YourBiz',
        
'route' => 2
    
));

    if (
send_sms($params))
    {
        echo 
'Message sent successfully...';
    }
?>

Pricing

Get started by visiting the store.

POA for 100,000+ SMS text messages.

Clear SMS pricing

SMS text messages from just 2.99p. Lower prices available for an agreeable monthly quota.

Speak to a real person

(01323) 800 160

One direct number for all enquiries - sales and support.

Monday - Friday, 10am to 6pm.

Screenshot 2 Screenshot 3