Create Verification Code

POST

https://api.sfox.com/v1/enterprise/users/send-verification/:user_id

Create an email or sms verification code for your user.


Creating a verification code will send a 6-digit numerical OTP code directly to the end user via email or SMS, according to the specified type. Collect this code from the end user and verify it by executing a Confirm Verification Code request.

Business accounts only need to verify email.

Individual accounts are required to verify email and sms. Email must be verified before requesting an sms code.

Request

Path Parameters

Name
Description

user_id required, string

Unique ID defined by you for this user that will serve as the shared identifier for this account between you and sFOX

Body Parameters

Name
Description

type required, string

Verification method. Possible values: email , sms

Example Requests

curl -X POST \
-H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
--data '{ "type": "email" }'  \
'https://api.sfox.com/v1/enterprise/users/send-verification/${user_id}'

Response

Response Fields

Name
Description

data object

Verification code information.

user_id string

The ID of the end user the code was sent to.

type string

The verification method for the code. Possible values: email , sms

email string

The email address the verification code was sent to, if type = email

phone_number string

The phone number the verification code was sent to, if type = sms

Responses

200: OK
Email verification code sent to email specified
{
    "data": {
        "user_id": "client_account_1",
        "type": "email",
        "email": "[email protected]"
    }
}
SMS verification code sent to the phone number specified
{
    "data": {
        "user_id": "client_account_1",
        "type": "sms",
        "phone_number": "+12223334444"
    }
}
422: Unprocessable Entity
Email has already been verified
{
    "error": "Email already verified"
}
Phone number has already been verified
{
    "error": "Phone already verified"
}

Last updated