Skip to Content
Documentation

Text messages

Sign-in with a code texted to a phone number the account verified (TWILIO_* set), and adding one.

/phone-number/send-otp

POST
/phone-number/send-otp

Use this endpoint to send OTP to phone number

Request Body

application/json
  1. body
phoneNumber*string

Phone number to send OTP. Eg: "+1234567890"

Response Body

Success

application/json
  1. response
message?string
Example Request
curl -X POST 'https://auth.example.com/api/auth/phone-number/send-otp' \  -H 'Content-Type: application/json' \  -d '{  "phoneNumber": "string"}'
Example Response
{  "message": "string"}

/phone-number/verify

POST
/phone-number/verify

Use this endpoint to verify phone number

Request Body

application/json
  1. body
phoneNumber*string

Phone number to verify. Eg: "+1234567890"

code*string

OTP code. Eg: "123456"

disableSession?boolean

Disable session creation after verification. Eg: false

updatePhoneNumber?boolean

Check if there is a session and update the phone number. Eg: true

[key: string]?unknown

Response Body

Phone number verified successfully

application/json
  1. response
status*true

Indicates if the verification was successful

Value intrue
token?string

Session token if session is created, null if disableSession is true or no session is created

user?

User object with phone number details, null if no user is created or found

Example Request
curl -X POST 'https://auth.example.com/api/auth/phone-number/verify' \  -H 'Content-Type: application/json' \  -d '{  "phoneNumber": "string",  "code": "string",  "property1": null,  "property2": null}'
Example Response
{  "status": true,  "token": "string",  "user": {    "id": "string",    "email": "user@example.com",    "emailVerified": true,    "name": "string",    "image": "http://example.com",    "phoneNumber": "string",    "phoneNumberVerified": true,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}