Get a Free WhatsApp Business Account – Includes Onboarding, API Access & Sandbox. Apply Now!

Getting Started With 2FA API

Authkey uses reliable and robust messaging services through REST API requests. Our entire suite meets enterprise quality benchmarks for seamless 2FA verification implementation.

Implemented Two factor Authentication Logic

  • Rest Messaging API to deliver the secure OTP.
  • Received OTP & response LogID verification API.

Rest Messaging API: Sending OTP

2FA Messaging API URL:

https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&country_code=CountryCode&sid=1234

Parameters:

AUTHKEY: account auth key. Find.

RecepientMobile: Mobile number at which otp will deliver.

CountryCode: For india 91.

SID: Template message SID Find.

Message template for the 2fa OTP

The message template must have a variable {#2fa#}

Note: A system generated OTP will be passed in a variable field.

Example:

"Your one time otp is {#2fa#} . Please do not share code with anyone."

Implementing Received OTP & response LogID verification

When an above-mentioned 2fa messaging api is triggered, a response logID is generated. LogID is a response corresponding to a unique OTP session id.

Sample response:


                                        {
                                            "LogID": "28bf7375bb54540ba03a4eb873d4da44", 
                                            "Message": "Submitted Successfully"
                                        }
                                    
https://console.authkey.io/restapi/2fa_verify.php?authkey=AUTHKEY&channel=SMS/VOICE/EMAIL&otp=OTP VALUE ENTERED BY CUSTOMER&logid=LogID GENERATED ON REQUEST API

Parameters:

AUTH KEY: account AUTH KEY

SMS/VOICE/EMAIL: preferred channel

OTP VALUE ENTERED BY CUSTOMER: Received OTP code

LogID GENERATED ON REQUEST API: response logID

Verification API response:


                                        {
                                            "status":true,
                                            "message":"Valid OTP"
                                        }
                                    

If the response obtained from our API indicates "Valid OTP," you may update the user's status as verified in your database. Otherwise, please prompt the user to resend OTP.

How to use the 2FA API?

Feel free to reach us at hello@authkey.io for assistance.