What You Can Do with the SMS API FR

Our SMS Service API provides you with the tools to send SMS messages, check their delivery status, and cost. Whether you’re developing a communication platform, a notification system, or simply want to reach your users via SMS, our API has you covered.

The SMS API leverages the HTTP protocol, which is very popular and supported by a vast majority of applications and programming languages. This makes it seamless to integrate our API into your existing systems and projects.

With our API, you can harness the power of HTTP to make secure requests and receive structured responses, allowing you to send SMS messages efficiently, track their delivery, and manage your messaging expenses.

Whether you’re an experienced developer or just getting started, our SMS API’s simplicity and compatibility with HTTP will help you achieve your communication goals effectively.

How to Get Access to SMS API

To access our SMS API, you’ll need an authentication token. Please contact our sales team to obtain your unique client token. This token will ensure secure and authorized access to our API endpoints.

How to Send an SMS

Sending an SMS is easy with our API. You’ll need to make an HTTP POST or GET request to the /sms/send endpoint. Include the sender’s and receiver’s phone numbers, the message text, and the data coding scheme of the message (GSM, UCS or SMS). Remember to include your authentication token obtained from our sales team. Here’s a basic example using cURL, Java, nodeJS and PHP:

  • cURL
curl -X POST "https://atlascommunications-api.com/sms/send" \
    -H "Content-Type: application/json" \
    -d '{
      "auth": "your-auth-token-from-support",
      "sender": "+1234567890",
      "receiver": "+9876543210",
      "text": "Hello from SMS API!",
      "dcs": "SMS"
    }'
    
  • Java
OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, """
         {
             "data": {
                 "auth": "your-auth-token-from-support",
                 "sender": "+1234567890",
                 "receiver": "+9876543210",
                 "text": "Hello from SMS API!",
                 "dcs": "SMS"             
             }
         }
     """);
    Request request = new Request.Builder()
      .url("https://atlascommunications-api.com/sms/send")
      .method("POST", body)
      .addHeader("Content-Type", "application/json")
      .build();
    Response response = client.newCall(request).execute();
    
  • NodeJS
var axios = require('axios');
    var data = JSON.stringify({
      "data": {
         "auth": "your-auth-token-from-support",
         "sender": "+1234567890",
         "receiver": "+9876543210",
         "text": "Hello from SMS API!",
         "dcs": "SMS"   
      }
    });
    
    var config = {
      method: 'post',
      url: 'https://atlascommunications-api.com/sms/send',
      headers: { 
        'Content-Type': 'application/json'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
  • PHP
<?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, [
      CURLOPT_URL => 'https://atlascommunications-api.com/sms/send',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS =>'{
        "data": {
             "auth": "your-auth-token-from-support",
             "sender": "+1234567890",
             "receiver": "+9876543210",
             "text": "Hello from SMS API!",
             "dcs": "SMS" 
        }
    }',
      CURLOPT_HTTPHEADER => [   
        'Content-Type: application/json'
      ],
    ]);
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;
    
    ?>
    

Required Fields For Sending Messages

  • auth: The unique client token issued by support.
  • sender: The sender of the message
  • receiver: The number of the recipient
  • text: The text of the message encoded in UTF-8
  • dcs: The message coding; GSM for GSM messages, UCS for Unicode messages or SMS for non encoded messages.

When you successfully send an SMS using the API, you’ll receive a response with the following fields:

  • msgId: The unique message ID associated with the sent SMS. This ID can be used to track and identify the message.
  • numParts: The number of message parts the SMS was divided into, if applicable. Long messages can be split into multiple parts for delivery.
  • totalCost: The total cost of sending the SMS, taking into account all its parts and any associated charges.
  • clientBalance: Your current client balance after deducting the cost of sending the SMS.

Here’s a sample response in JSON format:

{
      "msgId": "abc123",
      "numParts": 1,
      "totalCost": 0.25,
      "clientBalance": 50.75
    }
    

How to Check If an SMS Got Delivered

Checking the delivery status of an SMS is crucial for maintaining effective communication. To do this, make a GET request to the /sms/dlr endpoint. Include your authentication token obtained from our support team and the message ID you want to check. You’ll receive information about whether the message was delivered, along with relevant timestamps.

curl "https://atlascommunications-api.com/sms/dlr?auth=your-auth-token-from-support&messageId=your-message-id"
    

The response from the API will include the following fields:

  • msgId: The unique message ID associated with the SMS.
  • event: The delivery event, indicating whether the message was delivered.
  • numParts: The number of message parts.
  • sendTime: The timestamp when the SMS was sent.
  • dlrTime: The timestamp when the delivery status was recorded.

Here’s a sample response in JSON format:

{
      "msgId": "abc123",
      "event": "delivered",
      "numParts": 1,
      "sendTime": "2023-08-12T14:00:00Z",
      "dlrTime": "2023-08-12T15:30:00Z"
    }
    

How to Check the Cost of SMS

The cost associated with sending the SMS message is given in the response. The cost of sending an SMS is influenced by several factors, including; the receiver’s phone number, the content and length of the message. Longer messages may be split into multiple parts, affecting the overall cost.

Our API provides transparency by including the totalCost field in the response when you send an SMS. This field represents the total cost of sending the SMS, considering all its parts and any applicable charges.

When calculating the cost, keep in mind the following factors:

  • Receiver’s Phone Number: The cost of sending an SMS can differ based on the destination of the message. International numbers or premium-rate numbers may incur higher charges.

  • Message Content: Some characters or encoding schemes can affect the size of the message. Longer messages that exceed the standard character limit might be split into multiple parts, each incurring a separate charge.

By using the totalCost field in the API response, you can keep track of the cost associated with your SMS communications. This way, you can make informed decisions and effectively manage your messaging expenses.

Resources for Developers

Whether you’re a seasoned developer or just starting out, we’re here to support you in integrating and utilizing our SMS API effectively.

Our API offers developer-friendly features:

  • OpenAPI Foundation: Our API’s foundation on the OpenAPI specification ensures clear and standardized documentation, making it easier for you to understand and use our API.

  • Client SDKs: We provide client SDKs for various programming languages, abstracting away HTTP details and simplifying API calls.

  • Comprehensive Documentation: Our API documentation includes detailed explanations, examples, and descriptions of response fields, enabling quick integration.

  • Code Examples: Find code snippets in various programming languages, demonstrating API interaction using HTTP requests or our provided SDKs.