OTP Verification APIs
OTP (One-Time Password) verification APIs provide a complete lifecycle management for verification code scenarios including login, registration, password reset, etc.
Use Cases
- User Registration: Verify new user phone numbers
- Login Authentication: Two-factor authentication (2FA)
- Password Reset: Verify identity before password change
- Transaction Verification: Secure payment or sensitive operations
- Account Binding: Link phone number to existing account
Workflow
- Call Send Verification Code API with user's mobile number
- System generates code, sends SMS, and returns
verifyId
- User receives SMS and enters the code in your application
- Call Verify Code API with
verifyId and user-entered code
- System validates and returns verification result
Send Verification Code API
Interface Definition
- Interface Name:
/api/sms/v1/verification/send
- HTTP Method:
POST
- Content-Type:
application/json
Request Parameters
| Parameter Name |
Type |
Required |
Description |
Example Value |
| mobile |
string |
Yes |
Recipient mobile number (E.164 format) |
+8613800138000 |
| codeLength |
number |
No |
Code length (4-8 digits, default 6) |
6 |
| expireMinutes |
number |
No |
Expiration time in minutes (default 5) |
5 |
| scene |
string |
No |
Business scenario identifier |
login |
| templateId |
number |
No |
Custom SMS template ID |
8 |
Request Example
curl -X POST 'https://api.skynoo.com/api/sms/v1/verification/send' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YXBwXzEyMzq6c2VjXzEyMzQ1Njc4OTA=' \
-d '{
"mobile": "+8613800138000",
"codeLength": 6,
"expireMinutes": 5,
"scene": "login"
}'
Response Parameters
| Parameter Name |
Type |
Description |
Example Value |
| verifyId |
string |
Verification session ID (required for verification) |
v_abc123def456 |
| expireTime |
number |
Expiration timestamp (milliseconds) |
1700000000000 |
Response Example
{
"code": "200",
"message": "Request successful",
"data": {
"verifyId": "v_abc123def456",
"expireTime": 1700000000000
}
}
Rate Limits
- Same mobile number: 60 seconds interval between sends
- Same account: 100 verification codes per hour
Verify Code API
Interface Definition
- Interface Name:
/api/sms/v1/verification/check
- HTTP Method:
POST
- Content-Type:
application/json
Request Parameters
| Parameter Name |
Type |
Required |
Description |
Example Value |
| verifyId |
string |
Yes |
Verification session ID from send response |
v_abc123def456 |
| mobile |
string |
Yes |
Mobile number (must match send request) |
+8613800138000 |
| code |
string |
Yes |
Verification code entered by user |
123456 |
Request Example
curl -X POST 'https://api.skynoo.com/api/sms/v1/verification/check' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YXBwXzEyMzq6c2VjXzEyMzQ1Njc4OTA=' \
-d '{
"verifyId": "v_abc123def456",
"mobile": "+8613800138000",
"code": "123456"
}'
Response Parameters
| Parameter Name |
Type |
Description |
Example Value |
| valid |
boolean |
Whether the code is valid |
true |
| remainingAttempts |
number |
Remaining verification attempts |
2 |
Response Examples
Success - Code Valid
{
"code": "200",
"message": "Request successful",
"data": {
"valid": true,
"remainingAttempts": 0
}
}
Success - Code Invalid
{
"code": "200",
"message": "Request successful",
"data": {
"valid": false,
"remainingAttempts": 2
}
}
Failed - Code Expired
{
"code": "400",
"message": "Verification code expired"
}
Failed - Max Attempts Reached
{
"code": "400",
"message": "Verification code exhausted"
}
Verification States
| State |
Description |
| Pending (status=0) |
Code not yet verified, within expiration time |
| Verified (status=1) |
Code successfully verified |
| Expired (status=2) |
Code expired before verification |
| Exhausted (status=3) |
Max attempts reached without successful verification |