Verification

Endpoints for email and phone verification.

Email and phone verification is mandatory to access certain features.


Verification Flow

Request code

Call /request_confirmation/ specifying the type (email or phone).

Receive code

User receives a 6-digit code via SMS or email.

Verify code

Send the code to the corresponding endpoint (/verify_email/ or /verify_phone/).

Confirmation

The email_verified or phone_verified field updates to true.


Request Verification Code

Sends a verification code to user’s email or phone.

Endpoint

POST /request_confirmation/

Headers

Authorization: Bearer [ACCESS_TOKEN]
Content-Type: application/json
x-api-key: [API_KEY]

Request

Verify email
{
  "type": "email"
}

Response

200 OK
{
  "message": "Verification code sent"
}
⏱️

The code expires in 5 minutes. If it expires, request a new one.


Verify Phone

Confirms the user’s phone number.

Endpoint

POST /verify_phone/

Headers

Authorization: Bearer [ACCESS_TOKEN]
Content-Type: application/json
x-api-key: [API_KEY]

Request

request.json
{
  "code": "123456"
}

Response

200 OK
{
  "message": "Phone verified successfully"
}

The profile’s phone_verified field updates to true.


Verify Email

Confirms the user’s email address.

Endpoint

POST /verify_email/

Headers

Authorization: Bearer [ACCESS_TOKEN]
Content-Type: application/json
x-api-key: [API_KEY]

Request

request.json
{
  "code": "654321"
}

Response

200 OK
{
  "message": "Email verified successfully"
}

The profile’s email_verified field updates to true.


Verification Status

Check verification status at the GET /user/ endpoint:

Verification fields in profile
{
  "phone_verified": true,
  "email_verified": false
}

Status Indicators

StatusIconMeaning
trueSuccessfully verified
falsePending verification
💡

Tip: Verify both (email and phone) to unlock all features.


Complete Example

1. Request code for email

curl -X POST https://dev.backend.colurs.co/request_confirmation/ \
  -H "Authorization: Bearer [TOKEN]" \
  -H "x-api-key: [API_KEY]" \
  -H "Content-Type: application/json" \
  -d '{"type": "email"}'

2. User receives email

User receives an email with code 123456.

3. Verify the code

curl -X POST https://dev.backend.colurs.co/verify_email/ \
  -H "Authorization: Bearer [TOKEN]" \
  -H "x-api-key: [API_KEY]" \
  -H "Content-Type: application/json" \
  -d '{"code": "123456"}'

4. Verification complete

The email_verified field is now true.