Skip to content

Send OTP to user's email or phone number.

POST
/otp

The OTP will be used to verify user before doing some activities like: sign up, sign in, change phone, reset password, etc.

Flow:

  1. Validate request.
    - otpType and identifier are required.
    - otpType should be a valid one(login, change_phone, reset_password, sign_up).
    - identifier should be a valid email or phone number.
  2. Validate based on otpType
    - login, reset_password: query user by identifier, user should exists and have valid user status(not blocked/paused).
    - change_phone, sign_up: query user by identifier, user should not exists. if exist error phone already registered.
  3. Set OTP code to cache.
  4. Send OTP code to user’s email or phone number(based on identifier).

SendOTPRequest

object
identifier

Email or phone number

string
+6282243350992
otpType

Login | change_phone | reset_password | sign_up

string
Allowed values: login reset_password change_phone sign_up payment_method_add payment_method_select payment_method_delete
login

No Content

Bad request

object
error
string
some meaningful error message

Internal server error

object
error
string
some meaningful error message