Request Body
The phone number that received the code
The verification code entered by the user
Response
Whether the code is valid
One of: verified, invalid, expired, max_attempts
Human-readable result message
Examples
curl -X POST https://www.unosend.co/api/v1/sms/verify/check \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"phone": "+14155551234",
"code": "123456"
}'
Response Examples
Successful Verification
{
"valid": true,
"status": "verified",
"message": "Phone number verified successfully"
}
Invalid Code
{
"valid": false,
"status": "invalid",
"message": "Invalid code. 2 attempts remaining."
}
Expired Code
{
"valid": false,
"status": "expired",
"message": "Verification code has expired"
}
Max Attempts Exceeded
{
"valid": false,
"status": "max_attempts",
"message": "Maximum verification attempts exceeded"
}
Security Features
- Rate limiting: Maximum 3 attempts per verification code
- Expiration: Codes expire after 10 minutes by default
- One-time use: Codes are invalidated after successful verification
- Automatic cleanup: Expired codes are marked as such
Best Practices
- Don’t reveal too much: Avoid telling users if the phone number exists
- Handle all statuses: Show appropriate messages for each status
- Retry flow: Allow users to request a new code if expired or max attempts
- Log attempts: Monitor for brute force attempts