Skip to main content

Send OTP API

This API is used to send the OTP to the user's mobile or email. Bridgekeeper will send OTP to the mobile number or email passed in the request.

Implementation of Send OTP via Bridgekeeper API need few prerequisites from Quintype. Please proceed with implementation once the setup is complete.

Request Attributes

Content Type : JSON

Body

ATTRIBUTETYPEDESCRIPTIONEXAMPLE
phone-numberStringPhone number of end user+919898989898
emailStringEmail of end userjohndoe@example.com
always-sendBooleanSend OTP to user even if user does not exist in Bridgekeeper.true
mediumsString[]Medium to which the OTP must be sent["phone-number"]

Send OTP flow

Below are the steps how we can use Send OTP.

Case 1: When the user is not logged in and wants to send OTP to email

User initiates a Send OTP request with a email.

  • A POST call is needed to be made to /api/auth/v1/users/send-otp with below body.
    • email email to which the user wants the OTP to be sent.

Sample CURL

curl -X POST \
http://<publisher-website-url>/api/auth/v1/users/send-otp \
-H 'Host: <publisher-host>'\
--data-raw '{"email": "jhondoe@gmail.com"}'

Case 2: When the user is not logged in and wants to send OTP to phone number.

User initiates a Send OTP request with a phone-number.

  • A POST call is needed to be made to /api/auth/v1/users/send-otp with below body.
    • phone-number phone number to which the user wants the OTP to be sent.

Sample CURL

curl -X POST \
http://<publisher-website-url>/api/auth/v1/users/send-otp \
-H 'Host: <publisher-host>'\
--data-raw '{"phone-number":"" "+919898989898"}'

Case 3: When the user is logged in(qt-auth).

User initiates a Send OTP request with just qt-auth.

  • A POST call is needed to be made to /api/auth/v1/users/send-otp with just qt-auth as cookie.

When the user just pass the qt auth without specifying the medium to send the otp, Bridgekeeper will send the otp to email as default.

Sample CURL

curl -X POST \
http://<publisher-website-url>/api/auth/v1/users/send-otp \
-H 'Cookie: tfa-auth=<tfa-auth> || qt-auth=<jwt>' \
-H 'Host: <publisher-host>'

Case 4: When the user is logged in (qt-auth) and wants to send OTP to a specific medium. User initiates a Send OTP request with just qt-auth.

  • A POST call is needed to be made to /api/auth/v1/users/send-otp with below body.
    • mediums medium to which the user wants the OTP to be sent.

When the user just pass the qt auth without specifying the medium to send the otp, Bridgekeeper will send the otp to email as default.

Sample CURL

curl -X POST \
http://<publisher-website-url>/api/auth/v1/users/send-otp \
-H 'Cookie: tfa-auth=<tfa-auth> || qt-auth=<jwt>' \
-H 'Host: <publisher-host>'
--data-raw '{"mediums":["phone-number"]}'

Case 5: When an unregistered user/new user wants to send an OTP.

User initiates a Send OTP request with a email.

  • A POST call is needed to be made to /api/auth/v1/users/send-otp with below body.
    • email email to which the user wants the OTP to be sent.
    • always-send=true email to which the user wants the OTP to be sent.

Sample CURL

curl -X POST \
http://<publisher-website-url>/api/auth/v1/users/send-otp \
-H 'Host: <publisher-host>'\
--data-raw '{"email": "jhondoe@gmail.com","always-send":true}'

Refer to Swagger API docs for more info on API usage.