NAV Navigation
Shell PHP JavaScript Node.JS Ruby Python Java Go

Authentication

To make successful API requests, you need a verified account on Darbird and to authorize the API calls using one of the following methods:

You can generate, retrieve and manage your API keys or Client IDs & Secrets in your Darbird dashboard under the API Clients section.

API Key VS Client ID & Secret

The main differences in using API Key instead of Client ID & Secret are:

1. Client ID does not require generating the access token and can be directly used for authorization of API requests:

Send SMS

curl -L -X POST "https://api.darbird.com/api/sms/api" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>" \
-H "X-Darbird-Token: <YOUR_API_CUSTOMER_ID>" \
-d "{
	\"to\" : \"+234XXXXXXXX\",	\"from\" : \"SENDER_ID\",	\"sms\" : \"MESSAGE\",\"unicode\" : \"1\",\"action\" : \"send-sms\"
}"
<?php
require_once('autoload.php');
$apiClient = new DarbirdClass(CUSID,AUTH_KEY,SENDERID);
try {
	$lifetime = 18800; // in second
	$response = $apiClient->sendSMS("+2340xxxxxxxxxxxx","Welcome to Darbird");
	if (!isset($response))
	{
		throw new Exception("Error sending your request");
	}
	dd($response);
} catch (Exception $e) {
	echo $e->getMessage();
}

var data = "{\n	\"to\" : \"+234XXXXXXXX\",
    \"from\" : \"SENDER_ID\",
      \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
      ,\"action\" : \"send-sms\"n}";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.darbird.com/api/sms/api");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>");
xhr.setRequestHeader("X-Darbird-Token: <YOUR_API_CUSTOMER_ID>");
xhr.send(data);
var https = require('follow-redirects').https;

var options = {
  'method': 'POST',
  'hostname': 'https://api.darbird.com/api/',
  'path': 'sms/api',
  'headers': {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>'
    'X-Darbird-Token: <YOUR_API_CUSTOMER_ID>'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\n	\"to\" : \"+234XXXXXXXX\",
  \"from\" : \"SENDER_ID\",
    \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
    ,\"action\" : \"send-sms\"n}";

req.write(postData);

req.end();
require "uri"
require "net/http"

url = URI("https://api.darbird.com/api/sms/api")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["X-Darbird-Key"] = "<YOUR_API_KEY_OR_ACCESS_TOKEN>"
request["X-Darbird-Token"] = "YOUR_API_CUSTOMER_ID"
request.body = "{\n	\"to\" : \"+234XXXXXXXX\",
  \"from\" : \"SENDER_ID\",
    \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
    ,\"action\" : \"send-sms\"n}"

response = https.request(request)
puts response.read_body

import http.client
conn = http.client.HTTPSConnection("https://api.darbird.com/api/sms/api")
payload = "{\n	\"to\" : \"+234XXXXXXXX\",
  \"from\" : \"SENDER_ID\",
    \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
    ,\"action\" : \"send-sms\"n}"
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json',
  'X-Darbird-Key': 'Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>'
  'X-Darbird-Token': 'Bearer <YOUR_API_CUSTOMER_ID>'
}
conn.request("POST", "/v1/verify/number", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n	\"to\" : \"+234XXXXXXXX\",
  \"from\" : \"SENDER_ID\",
    \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
    ,\"action\" : \"send-sms\"n}");
Request request = new Request.Builder()
  .url("https://api.darbird.com/api/sms/api")
  .method("POST", body)
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("X-Darbird-Key", "Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>") 
  .addHeader("X-Darbird-Token", "Bearer <YOUR_API_CUSTOMER_ID>") 
  .build();
Response response = client.newCall(request).execute();
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.darbird.com/api/sms/api"
  method := "POST"

  payload := strings.NewReader("{\n	\"to\" : \"+234XXXXXXXX\",
    \"from\" : \"SENDER_ID\",
      \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
      ,\"action\" : \"send-sms\"n}")

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
  }
  req.Header.Add("Accept", "application/json")
  req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Darbird-Key", "Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>")
req.Header.Add("X-Darbird-Token", "Bearer <YOUR_API_CUSTOMER_ID>")

  res, err := client.Do(req)
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)

  fmt.Println(string(body))
}

RESPONSE:

{
    "code": "ok",
    "message": "Successfully Sent",
    "balance": "xxx",
   
    
}
     

POST https://api.darbird.com/api/sms/api

Parameters

Parameter In Type Required Description
to body string Yes Phone number
from body string Yes The displayed value of who sent the message More info
sms body string Yes Your message
unicode body string Yes Option(1 for plain , 0 for

Send Voice

curl -L -X POST "https://api.darbird.com/api/sms/api" \
        -H "Accept: application/json" \
        -H "Content-Type: application/json" \
        -H "X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>" \
        -H "X-Darbird-Token: <YOUR_API_CUSTOMER_ID>" \
        -d "{
          \"to\" : \"+234XXXXXXXX\",	\"from\" : \"SENDER_ID\",	\"sms\" : \"MESSAGE\",\"unicode\" : \"1\",\"action\" : \"send-sms\"
        }"
        
<?php
        require_once('autoload.php');
        $apiClient = new DarbirdClass(CUSID,AUTH_KEY,SENDERID);
        try {
          $lifetime = 18800; // in second
          $response = $apiClient->sendSMS("+2340xxxxxxxxxxxx","Welcome to Darbird");
          if (!isset($response))
          {
            throw new Exception("Error sending your request");
          }
          dd($response);
        } catch (Exception $e) {
          echo $e->getMessage();
        }
        
        
var data = "{\n	\"to\" : \"+234XXXXXXXX\",
            \"from\" : \"SENDER_ID\",
              \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
              ,\"action\" : \"send-sms\"n}";
        
        var xhr = new XMLHttpRequest();
        xhr.withCredentials = true;
        
        xhr.addEventListener("readystatechange", function() {
          if(this.readyState === 4) {
            console.log(this.responseText);
          }
        });
        
        xhr.open("POST", "https://api.darbird.com/api/sms/api");
        xhr.setRequestHeader("Accept", "application/json");
        xhr.setRequestHeader("Content-Type", "application/json");
        xhr.setRequestHeader("X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>");
        xhr.setRequestHeader("X-Darbird-Token: <YOUR_API_CUSTOMER_ID>");
        xhr.send(data);
        
var https = require('follow-redirects').https;
        
        var options = {
          'method': 'POST',
          'hostname': 'https://api.darbird.com/api/',
          'path': 'sms/api',
          'headers': {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'X-Darbird-Key: <YOUR_API_KEY_OR_ACCESS_TOKEN>'
            'X-Darbird-Token: <YOUR_API_CUSTOMER_ID>'
          },
          'maxRedirects': 20
        };
        
        var req = https.request(options, function (res) {
          var chunks = [];
        
          res.on("data", function (chunk) {
            chunks.push(chunk);
          });
        
          res.on("end", function (chunk) {
            var body = Buffer.concat(chunks);
            console.log(body.toString());
          });
        
          res.on("error", function (error) {
            console.error(error);
          });
        });
        
        var postData =  "{\n	\"to\" : \"+234XXXXXXXX\",
          \"from\" : \"SENDER_ID\",
          \"voice\" : \"1\",
            \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
            ,\"action\" : \"send-sms\"n}";
        
        req.write(postData);
        
        req.end();
        
require "uri"
        require "net/http"
        
        url = URI("https://api.darbird.com/api/sms/api")
        
        https = Net::HTTP.new(url.host, url.port);
        https.use_ssl = true
        
        request = Net::HTTP::Post.new(url)
        request["Accept"] = "application/json"
        request["Content-Type"] = "application/json"
        request["X-Darbird-Key"] = "<YOUR_API_KEY_OR_ACCESS_TOKEN>"
        request["X-Darbird-Token"] = "YOUR_API_CUSTOMER_ID"
        request.body = "{\n	\"to\" : \"+234XXXXXXXX\",
          \"from\" : \"SENDER_ID\",
          \"voice\" : \"1\",
            \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
            ,\"action\" : \"send-sms\"n}"
        
        response = https.request(request)
        puts response.read_body
        
        
import http.client
        conn = http.client.HTTPSConnection("https://api.darbird.com/api/sms/api")
        payload = "{\n	\"to\" : \"+234XXXXXXXX\",
          \"from\" : \"SENDER_ID\",
            \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
            ,\"action\" : \"send-sms\"n}"
        headers = {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
          'X-Darbird-Key': 'Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>'
          'X-Darbird-Token': 'Bearer <YOUR_API_CUSTOMER_ID>'
        }
        conn.request("POST", "/v1/verify/number", payload, headers)
        res = conn.getresponse()
        data = res.read()
        print(data.decode("utf-8"))
        
OkHttpClient client = new OkHttpClient().newBuilder()
          .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "{\n	\"to\" : \"+234XXXXXXXX\",
          \"from\" : \"SENDER_ID\",
          \"voice\" : \"1\",
            \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
            ,\"action\" : \"send-sms\"n}");
        Request request = new Request.Builder()
          .url("https://api.darbird.com/api/sms/api")
          .method("POST", body)
          .addHeader("Accept", "application/json")
          .addHeader("Content-Type", "application/json")
          .addHeader("X-Darbird-Key", "Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>") 
          .addHeader("X-Darbird-Token", "Bearer <YOUR_API_CUSTOMER_ID>") 
          .build();
        Response response = client.newCall(request).execute();
        
package main
        
        import (
          "fmt"
          "strings"
          "net/http"
          "io/ioutil"
        )
        
        func main() {
        
          url := "https://api.darbird.com/api/sms/api"
          method := "POST"
        
          payload := strings.NewReader("{\n	\"to\" : \"+234XXXXXXXX\",
            \"from\" : \"SENDER_ID\",
            \"voice\" : \"1\",
              \"sms\" : \"MESSAGE\",\"unicode\" : \"1\"
              ,\"action\" : \"send-sms\"n}")
        
          client := &http.Client {
          }
          req, err := http.NewRequest(method, url, payload)
        
          if err != nil {
            fmt.Println(err)
          }
          req.Header.Add("Accept", "application/json")
          req.Header.Add("Content-Type", "application/json")
        req.Header.Add("X-Darbird-Key", "Bearer <YOUR_API_KEY_OR_ACCESS_TOKEN>")
        req.Header.Add("X-Darbird-Token", "Bearer <YOUR_API_CUSTOMER_ID>")
        
          res, err := client.Do(req)
          defer res.Body.Close()
          body, err := ioutil.ReadAll(res.Body)
        
          fmt.Println(string(body))
        }
        

RESPONSE:

{
            "code": "ok",
            "message": "Successfully Sent",
            "balance": "xxx",
           
            
        }
             

POST https://api.darbird.com/api/sms/api

Parameters

Parameter In Type Required Description
to body string Yes Phone number
from body string Yes The displayed value of who sent the message More info
sms body string Yes Your message
unicode body string Yes Option(1 for plain , 0 for