ANTS API SPECIFICATION
English v1.0.0
English v1.0.0
  • INTRODUCTION
  • ACCOUNT
  • SMS
    • Send Message
    • Callback Delivery Report
    • Message Logs
    • Preview Message
    • Sender List
    • Status and Error codes
  • OTP (One Time Password)
  • SMS 2 WAY Interactive
Powered by GitBook
On this page
  • Request OTP
  • Sequence Diagram
  • ResendOTP
  • Sequence Diagram
  • Verify OTP
  • Sequence Diagram
  • Response Status
  • Status Code
  • The response status will look link
  • Status Code

Was this helpful?

OTP (One Time Password)

It is a pin or dynamic password, is a password that is valid for only one login session or transaction, on a computer system or other digital device.

PreviousStatus and Error codesNextSMS 2 WAY Interactive

Last updated 4 years ago

Was this helpful?

One-Time Passwords help growing startups and agile enterprises enhance customer experience and realize new business outcomes at scale. With the most comprehensive suite of communication channels, a global platform, and expert support, you can abstract the complexity of communications and innovate faster.

Request OTP

It is part of ANTS account security offerings, the OTP API makes it simple to add user verification to various application and use cases. It supports codes sent via SMS.

Sequence Diagram

You can start creating HTTP request as this following:

Name

Description

HTTP Request (URL)

HTTP Headers

Content-Type: application/json

Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

HTTP Methods

POST

Request body should be indicated with these following parameters

Parameters

type

description

otcId

String

OTP to verify log in and view OTP application configuration

mobile

String

The destination phone number for your SMS message

notifyUrl

(optional)

String

Example: notifyUrl=https//www.example.com

notifyContentType

(optional)

String

Preferred Delivery report content type of delivery report to application/json Example: notifyContentType=application/json

callbackData

(optional)

String

Specifies the value to return. When specified, notifyUrl will also return this callbackData.

Request JSON

{
 	"otcId": "0DC8E7AD-0168-440C-AF10-BF556B164D83",
 	"mobile": "66123456789",
  "notifyUrl": "https://testSendOTP",
  "notifyContentType": "application/json",
  "callbackData":"OTP Data"
}

OTP Response

Parameters

type

description

otcId

String

OTP to verify log in and view OTP application configuration

otpId

String

The ID that uniquely identifies the sent OTP message.

referenceCode

String

The reference Code

status

Object

Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.

message

String

Name of response status

description

String

Description of response status

The response will look like:

{
    	"otcId": "0DC8E7AD-0168-440C-AF10-BF556B164D83",
    	"otpId": "0c342e74-a9c7-4bbd-8da4-b36a49bbc0d6",
    	"referenceCode": "IpA6k",    	
    	"success": {
        		"message": "success",
        		"description": ""
    	}
}

ResendOTP

It is part of ANTS account security offerings, the OTP API makes it simple to add user verification to various application and use cases. It supports codes sent via SMS again.

Sequence Diagram

You can start creating HTTP request as this following:

Name

Description

HTTP Request (URL)

HTTP Headers

Content-Type: application/json

Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

HTTP Methods

POST

Request body should be indicated with these following parameters

Parameters

type

description

otcId

String

OTP to verify log in and view OTP application configuration

Request JSON

{
 	"otcId": "0DC8E7AD-0168-440C-AF10-BF556B164D83",
}

Response

Parameters

type

description

otcId

String

OTP to verify log in and view OTP application configuration

otpId

String

The ID that uniquely identifies the sent OTP message.

referenceCode

String

The reference Code

status

Object

Indicates whether the message is successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.

message

String

Name of response status

description

String

Description of response status

The response will look like:

{
    	"otcId": "0DC8E7AD-0168-440C-AF10-BF556B164D83",
    	"otpId": "0c342e74-a9c7-4bbd-8da4-b36a49bbc0d6",
    	"referenceCode": "IpA6k",    	
    	"success": {
        		"message": "success",
        		"description": ""
    	}
}

Verify OTP

Use to verify set of password and verify owner of the account.

Sequence Diagram

You can start using HTTP request as following details:

Name

Description

HTTP Request (URL)

HTTP Headers

Content-Type: application/json

Authorization: (Basic Auth) Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

HTTP Methods

POST

Request body should be indicated with these following parameter

Parameters

type

description

otpId

String

The OTP ID which uniquely identifies the request

otpCode

String

OTP code

The request JSON will look like:

{
    "otpId": "0c342e74-a9c7-4bbd-8da4-b36a49bbc0d6",
   	"otpCode": "79895"
    "notifyUrl": "https://testSendOTP",
    "notifyContentType": "application/json",
    "callbackData":"OTP Data"
}

OTP Response

Parameters

type

description

otpId

String

The ID which uniquely identifies the OTP request

result

Boolean

The result of OTP confirmation

isErrorCount

Boolean

The result of inputting the wrong OTP.

isExprCode

Boolean

The result of inputting the OTP when time is expired.

The response will look like:

{
    	"otpId": "0c342e74-a9c7-4bbd-8da4-b36a49bbc0d6",
    	"result": true,
    	" isErrorCount": false,
    	"isExprCode": false
}

Response Status

While using our API you may encounter certain status and error codes that you need to understand or troubleshoot.

Each code with the descriptions will guild you to take action steps you need to take in case you are looking for a resolution of the problem.

Status Code

Beside HTTP status code standard, there will be also API response status.

The response status will look link

{
	  "error": {
		"message": "Invalid OTP Config",
		"description": ""
             }
}

Status Code

Code

Message EN

Message TH

0000

Success

สำเร็จ

9999

Exception

ผิดพลาด

9998

Authentication failed

username or password ผิดพลาด

9996

Bad Request

คำสั่งไม่ถูกต้อง

9995

Credit not enough

เครดิตหมด

0301

Invalid OTP Config

ตั้งค่า OTP ไม่ถูกต้อง

0302

Number Prefix Missing

ไม่มีคำนำหน้า

0303

No Data Available OTP

ไม่พบข้อมูล OTP

0304

Over Limit Usage

กรอกข้อมูลเกินจำนวนครั้งที่กำหนด

0305

OTP Code Expired

OTP Code หมดอายุ

0306

OTP Code Confirmed

OTP Code ยืนยันตัวตนไปแล้ว

0307

Invalid Number

หมายเลขไม่ถูกต้อง

Defending URL on callback server to get Delivery report according to link

https://api-service.ants.co.th/otp/requestOTP
Send Callback
https://api-service.ants.co.th/otp/resendOTP
https://api-service.ants.co.th/otp/verifyOTP
Sequence Diagram (API RequestOTP)
Sequence Diagram (API VerifyOTP)