Skip to main content
POST
/
auth
/
generate-otp
Generate OTP
curl --request POST \
  --url https://staging.api.commercengine.io/api/v1/{store_id}/storefront/auth/generate-otp \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "channel": "sms",
  "country_code": "<string>",
  "phone": "<string>",
  "otp_action": "register"
}'
{
  "message": "<string>",
  "success": true,
  "content": {
    "otp_token": "<string>",
    "otp_action": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Access token

Headers

x-debug-mode
boolean

This param is used to enable debug mode. If debug mode is enabled, the API will return OTP as well. This is only for development and testing purposes.

Body

application/json
  • GenerateOtpWithPhone
  • GenerateOtpWithEmail
channel
enum<string>
required
Available options:
sms,
whatsapp
phone
string
required

10 digit phone number without country code.

otp_action
enum<string>
required
Available options:
register,
reset-password,
verify-phone,
update-phone
country_code
string | null

Two-letter code begin with a plus sign prefix that identifies different countries. By default it will be +91 if not provided.

Response

OK

message
string
required

A descriptive message confirming the success or failure of the operation.

success
boolean
required

Indicates whether the request was successful or failure (true for success, false for failure).

content
object
required

An object containing the response content.

⌘I