Select your Region
Select Your Region
For an optimised experience, please select your most relevant region.

One Time Password SMS API

Secure your software

Introduction

Integrating with our OTP API is easy. When you use SMSGlobal’s REST API to integrate SMS capabilities into your application, you’ll save hundreds of hours compared to building OTP functionality from the ground up.

Plus, you’ll be partnering with a global leader in SMS with all of your application’s SMS needs covered by one provider offering expert support.


Overview of Features Scroll to Top ▲


How to get started Scroll to Top ▲

The following example demonstrates how to start the verification process to send a verification code to the end-user.


SMSGlobal Dotnet

This is an SDK for SMSGlobal's REST API that supports .NET applications written in C#, VB.Net, and F#.

Send OTP

This can be used for sending OTP.

var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));

var response = await client.OTP.OTPSend(new
 {
    message = "{*code*} is your SMSGlobal verification code.",
    destination = "DESTINATION-NUMBER",
});

The response object will contain OTP details such as request id, destination number such as:

{
 "requestId":"409261431691990777288109",
 "destination":"61450000000",
 "validUnitlTimestamp":"2021-02-18 11:39:07",
 "createdTimestamp":"2021-02-18 11:29:07",
 "lastEventTimestamp":"2021-02-18 11:29:08",
 "status":"Sent",
 "statuscode":200,
 "statusmessage":"OK"
}

Verify OTP

The OTP code entered by your user can be verified by either using requestId or destination number.

var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));
 
string requestid = "REQUEST-ID";
string code = "OTP-CODE";
var response = await client.OTP.OTPValidateRequest(requestid, new
{
    code = code,
});
var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));
 
string destinationid = "DESTINATION-NUMBER";
string code = "OTP-CODE";
var response = await client.OTP.OTPValidateDestination(destinationid, new
{
    code = code,
});

The response object will contain OTP details such as request id, destination number such as:

{
 "requestId":"409261431691990777288109",
 "destination":"61450000000",
 "validUnitlTimestamp":"2021-02-18 11:39:07",
 "createdTimestamp":"2021-02-18 11:29:07",
 "lastEventTimestamp":"2021-02-18 11:29:08",
 "status":"Verified",
 "statuscode":200,
 "statusmessage":"OK"
}

Cancel OTP

The OTP request can be cancelled if an OTP is not expired and verified yet. It can be done by either using requestId or destination number.

var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));
 
string requestid = "REQUEST-ID";
var response = await client.OTP.OTPCancelRequest(requestid);
var client = new Client(new Credentials("SMSGLOBAL-API-KEY", "SMSGLOBAL-SECRET-KEY"));
 
string destination = "DESTINATION-NUMBER";
var response = await client.OTP.OTPCancelDestination(destination);

The response object will contain OTP details such as request id, destination number such as:

{
 "requestId":"409261431691990777288109",
 "destination":"61450000000",
 "validUnitlTimestamp":"2021-02-18 11:39:07",
 "createdTimestamp":"2021-02-18 11:29:07",
 "lastEventTimestamp":"2021-02-18 11:29:08",
 "status":"Cancelled ",
 "statuscode":200,
 "statusmessage":"OK"
 }

REST API Endpoints Scroll to Top ▲

Authentication

The REST API uses an authentication scheme based on this OAuth 2 specification . All requests to resources (excluding the schema pages) must be accompanied by a correct Authorization header as per this specification. The header looks like this:

 Authorization: MAC id="your API key", ts="1325376000", nonce="random-string", mac="base64-encoded-hash" 


  • OTP
    /v2/otp
    /v2/otp/requestid/{id}/cancel
    /v2/otp/requestid/{id}/validate
    /v2/otp/{msisdn}/cancel
    /v2/otp/{msisdn}/validate