Get a Free WhatsApp Business Account – Includes Onboarding, API Access & Sandbox. Apply Now!
Authkey.io's GET APIs are exclusively served over HTTPS. This ensures that all data transmitted between your application and Authkey.io's servers is encrypted and protected.
Sample API CodesSMS API DocumentationSending SMS using Authkey APIs is a breeze and lightning fast. You can simply pass the message body, message sender, mobile number & authkey in the API request to send sms instantly.
*For Users in India, due to DLT rules, you can setup your Principle Entity id & DLT Template id in the authkey portal by uploading DLT template CSV file or entering the DLT details one-by-one in the DLT Setup menu. Alternately, you can skip the DLT Setup and directly pass the entity & template ids in the API request itself:
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sms=Hello, your OTP is 1234&sender=SENDERID&pe_id=ENTITY_ID&template_id=DLT_TEMPLATE_ID
*Note : If message content is Unicode kindly add parameter &is_unicode=1
You can also create templates in the authkey portal and use the template id in the API request. Templates are necessary when you need dynamic contents in your message text. For example, to send an OTP message, you can create a template as below:
Dear {#name#} , your otp is {#otp#} Authkey automatically adds your template dynamic values as API parameters and you can use them to change the content delivered to each recepient.
Example usage for above template, assuming template id generated is 1001
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sid=1001&name=Twinkle&otp=1234
Here, 'name' and 'otp' parameters are auto-added to the API and their values shall be replaced in the template body {...}
You can also create Voice and Email templates and use them in the above API for parallel or fallback usages.
If you wish to send both voice call and sms message to the recepientmobile, you can do that using below API:
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sms=Hello, your OTP is 1234&sender=SENDERID&voice=Hello, your otp is 1234
*Note : If message content is Unicode kindly add parameter &is_unicode=1
If you wish to trigger fallback only if sms delivery fails, you can do that by using below API:
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sms=Hello, your OTP is 1234&sender=SENDERID&fb1voice=Hello, your otp is 1234
*Note : If message content is Unicode kindly add parameter &is_unicode=1
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sms=Hello, your OTP is 1234&sender=SENDERID
Events are combinations of templates which you can create on the Authkey portal. Event definitions will include parallel sendings, fallback channels and setting up of requiredness of dynamic parameters in the chosen templates. Once created, you will have an event-id, which can be used to trigger the event using below API:
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&eid=EventId
Event APIs are generally shorter than all other APIs and can include parallel as well as fallback mechanisms on all the three channels.
All the dynamic content of the templates in an event shall be added automatically as API parameters and can be used to replace the dynamic values.
*Multiple templates with same dynamic values will be considered a single value.
While creating an event, you will get an option to choose which dynamic values are mandatory in the API request.
SMS: Dear {#name#} , your otp is {#otp#}
Voice: Thank you for showing interest, your otp is {#otp#}
If we create an event using above three templates, the dynamic values shall be: name, otp & company Corresponding API request shall be:
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&email=RecepientEmail&country_code=CountryCode&eid=EventId&name=Ashish&otp=1234&company=Datagen
https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sms=Hello, your OTP is 1234&sender=SENDERID&pe_id=ENTITY_ID&template_id=DLT_TEMPLATE_ID
authkey | AUTHKEY |
mobile | RecepientMobile |
country_code | CountryCode |
sms | Hello, your OTP is 1234 |
sender | SENDERID |
pe_id | ENTITY_ID |
template_id | DLT_TEMPLATE_ID |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://console.authkey.io/restapi/requestjson.php',
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 =>' {
"country_code": "91",
"mobile": "xxxxx",
"sid": "**"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic <Api_Key>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
https://console.authkey.io/restapi/requestjson.php
send sms using sms template id created on authkey
Content-Type | application/json |
Authorization | Basic <Api_Key> = Your authkey portal authkey |
{ "country_code": "91", "mobile": "xxxxx", "sid": "**" }
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://console.authkey.io/restapi/requestjson.php',
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 =>' {
"country_code": "91",
"mobile": "xxxxx",
"sid": "**"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic <Api_Key>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
https://console.authkey.io/restapi/requestjson.php
send sms using full content that you want to send . content should be approved on dlt platform
Content-Type | application/json |
Authorization | Basic <Api_Key> = Your authkey portal authkey |
{ "country_code": "91", "mobile": "xxxxx", "sid": "**" }
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://console.authkey.io/restapi/requestjson.php',
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 =>' {
"country_code": "91",
"mobile": "xxxxx",
"sender": "**",
"pe_id":"****",
"template_id":"******"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Basic <Api_Key>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;