Hello, API!

Create your own application and make it smart

Be creative

Use our API to create awesome results, we are committed to your success.

Our API is yours

We are always ready to make things easier for you. We listen to you and your feedback is always welcome.


Developer key

A developer key (or API key) is used to identify you as a developer or a company developing apps. The developer key is required to generate access tokens.

Generate your developer key »

Endpoint

All requests should be sent to the secure URL: https://smshare.fr/…

We keep the unsecured URL http://smshare.fr/ in case you have difficulties getting started. You should never use this one in production.


Get an access token

Each API call must be accompanied with the access token.

To generate access token, you need the login and password of the user owning the Android device.

Keep this access token secure. Save it and use it for all your requests.

URL

/api/v2/access-token

Method

POST

URL Params

None

Data Params

Send a request body containing the following fields:

  • login
  • password
  • apiKey
  • appName

Success Response

  • Code: 200 OK
  • Body: {"accessToken" : "123abc…"}

Error Response

  • Code: 400 BAD REQUEST

Examples

Request headers

Content-Type: application/json

Request body

{
    "login"   : "john",
    "password": "kerry",
    "apiKey"  : "7d861ea2-ae25-4a38-b6ba-9214df02529b",
    "appName" : "myapp"
}

Response body

{
    token: "ae889ef6-586e-4e85-987d-462c90e450a5"
}
$postData = json_encode(array(
    'login'    => "james",
    'password' => "pass1234",
    'apiKey'   => "7d861ea2-ae25-4a38-b6ba-9214df02529b",
    'appName'  => "myapp"
));

$ch = curl_init("https://smshare.fr/api/v2/access-token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
 
$reply = curl_exec($ch);

error_log("status code: " . curl_getinfo($ch, CURLINFO_HTTP_CODE));
error_log(curl_error($ch));    //error
error_log($reply);             //success

curl_close($ch);
Javascript code example will soon be available

Send SMS

Send one or multiple SMS?

If you are sending the same text to multiple destinations, your request should contain one SMS with comma separated destionations.

In the other hand, if you are sending bulk SMS where SMS bodies are not the same, then your request should contain SMS list

URL

/api/v2/sms/bulk

Method

POST

URL Params

None

Data Params

Send a request body containing the following fields:

  • accessToken: String
  • gateway: String gateway uuid
  • smsBeans: Array Each smsBean has the following fields:
    • destination (required)
    • message (required)
    • scheduleTimestamp (optional): Send SMS at future date in milliseconds since epoch (Epoch is number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
      Example:

      To send SMS at Sat, 10 Oct 2099 14:55:43 GMT ; use: 4095327343000

    • gti (optional): Gateway Template ID. In India for example where DLT ID is required, you can put the template ID, for example: 1234ABCD...

Success Response

  • Code: 201 CREATED

Error Response

  • Code: 401 UNAUTHORIZED

Examples

Request headers

Content-Type: application/json

Request body

{
    "accessToken":"14c00ab9-ff0b-481a-a331-6129fc3b1d7a",
    "gateway":"999999-ff0b-481a-a331-44444",
    "smsBeans"   :[
        {
            "destination": "12334566",
            "message"    : "Hello world!"
        }
    ]
}
$sms = array('destination' => '0617841532', 'message' => 'Hello world');

$postData = json_encode(array(
    'accessToken' => "9c2c7523-5285-44db-895d-7ce82997af78",
    'smsBeans'    => array($sms)
));

$ch = curl_init("https://smshare.fr/api/v2/sms/bulk");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
 
$reply = curl_exec($ch);

error_log("status code: " . curl_getinfo($ch, CURLINFO_HTTP_CODE));
error_log(curl_error($ch));    //error
error_log($reply);             //success

curl_close($ch);
Javascript code example will soon be available