Skip to main content
The Email with OTP authentication allows your client to authenticate using OTP method. The endpoints are pre-built and are easy to manage your authentication flow and users. To get your {auth_base_url}, check it out here - Get started with base url.
Note : APP-KEY to be passed in Headers can be obtained from the settings in the project dashboard
Sending Email OTP - Currently, we don’t support additional custom SMTP configuration. We send emails from our SMTP server. No configuration is needed for email setup

1. Signup API

This endpoints allows you to create a new user using the email address and otp method.

Endpoint

POST
{auth_base_url}/email-otp-signup
APP-KEY
string
required
App key of the particular project
POST the data in the application/json format.
email
string
required
Email address of the user
The response with 201 CREATED status code represents that user is created and the OTP is sent to the email address
user_id
string
User Id of the new created user
email
string
Email address of the user

Example

Request
POST https://authn.zeromagic.cloud/auth/353d1499ab5149e194a53cf0f6c837f4/development/email-otp-signup 
HTTP/1.1
APP-KEY : ldM6yPAAE3PRTZbHXrjqGGzZY2Yjm7GwjAyjbNqWH48

{
    "email":"[email protected]"
}
Response
HTTP/1.1 
201 CREATED

{
    "user_id": "1",
    "email":"[email protected]"
}

2. Login API

This endpoints allows you to login a user using the email and otp method.
POST
{auth_base_url}/email-otp-login
APP-KEY
string
required
App key of the particular project
POST the data in the application/json format.
email
string
required
Email address of the user
The response with 200 OK status code represents that the OTP is sent to the email address
user_id
string
User Id of the user
email
string
Email address of the user

Example

Request
POST https://authn.zeromagic.cloud/auth/353d1499ab5149e194a53cf0f6c837f4/development/email-otp-login 
HTTP/1.1
APP-KEY : ldM6yPAAE3PRTZbHXrjqGGzZY2Yjm7GwjAyjbNqWH48

{
    "email":"[email protected]"
}
Response
HTTP/1.1 
200 OK

{
    "user_id": "1",
    "email":"[email protected]"
}

3. Verify OTP API

This endpoints allows you to verify the otp of the respective email address.
POST
{auth_base_url}/email-otp-verify
APP-KEY
string
required
App key of the particular project
POST the data in the application/json format.
email
string
required
Email address of the user
otp_code
integer
required
Otp sent to the email address
user_id
string
User Id of the user
email
string
Email address of the user
access_token
string
JWT access token is returned
token_type
string
Value is bearer
expires_in
string
Currently no expiry time for token, Returns null

Example

Request
POST https://authn.zeromagic.cloud/auth/353d1499ab5149e194a53cf0f6c837f4/development/email-otp-verify 
HTTP/1.1
APP-KEY : ldM6yPAAE3PRTZbHXrjqGGzZY2Yjm7GwjAyjbNqWH48

{
    "email":"[email protected]"
    "otp_code" : 1234
}
Response
HTTP/1.1 
200 OK

{
   "user_id": "1",
   "email":"[email protected]"
   "access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTIzNDU2Nzg5LCJuYW1lIjoiSm9zZXBoIn0.OpOSSw7e485LOP5PrzScxHb7SR6sAOMRckfFwi4rp7o",
   "token_type" :"bearer",
   "expires_in" : null
}