SendSmsVerifyCode
Sends an SMS verification code.
Operation description
Due to recent stricter control over SMS signatures by carriers, custom signatures may fail to be delivered. Use the complimentary SMS signatures and templates provided in the Phone Number Verification Service console for SMS verification. Complimentary signatures must be used with complimentary templates.
Before calling this operation, make sure that you fully understand the billing methods and pricing of Phone Number Verification Service. The SMS verification service charges only SMS sending fees (billed based on the carrier receipt status. No fee is charged if the SMS is submitted successfully but the carrier receipt fails). The verification service is free of charge.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dypns:SendSmsVerifyCode |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SchemeName |
string |
No |
The scheme name. If you leave this parameter empty, the default scheme is used. The name can be up to 20 characters in length. |
Test scheme |
| CountryCode |
string |
No |
The country code of the phone number. Default value: 86. Currently, only domestic phone numbers are supported. |
86 |
| PhoneNumber |
string |
Yes |
The phone number of the SMS recipient. |
130****0000 |
| SignName |
string |
Yes |
The signature name. Custom signatures are not supported. Use a complimentary signature provided by the system. You can select the signature to be delivered on the Complimentary Signature Configuration page. |
Hengchuanglianzhong |
| TemplateCode |
string |
Yes |
The code of the SMS template. If you select a complimentary signature for the SignName parameter, you must use a complimentary template to send the SMS. You can select a template that suits your business scenario on the Complimentary Template Configuration page. |
100001 |
| TemplateParam |
string |
Yes |
The SMS template parameters. You can specify the verification code in two ways:
Example: If the template content is "Your verification code is ${code}, which is valid for ${min} minutes. Do not disclose it to others.". Important Replace code in the preceding example with the actual parameter name in your applied verification code template.
Note
Note
|
{"code":"##code##","min":"5"} |
| SmsUpExtendCode |
string |
No |
The extension code for upstream SMS messages. Upstream SMS messages are sent to communication service providers to subscribe to services, perform queries, or handle business. These messages are charged based on the standard SMS rates of carriers. Note
The extension code is automatically generated by the system when the signature is created and cannot be manually specified. Ignore this parameter unless you have special requirements. To use this parameter, contact your account manager. |
1213123 |
| OutId |
string |
No |
The external serial number. |
External serial number (pass-through) |
| CodeLength |
integer |
No |
The length of the verification code. Valid values: 4 to 8. Default value: 4. |
4 |
| ValidTime |
integer |
No |
The validity period of the verification code. Unit: seconds. Default value: 300. |
300 |
| DuplicatePolicy |
integer |
No |
The verification rule that specifies how to handle the old verification code when a new verification code is sent to the same phone number in the same scenario within the validity period. Valid values:
Valid values:
|
1 |
| Interval |
integer |
No |
The time interval at which a verification code can be sent. Unit: seconds. This parameter is used for frequency control. Default value: 60. |
60 |
| CodeType |
integer |
No |
The type of the generated verification code. This parameter is required when a placeholder is passed in the TemplateParam parameter. The system generates the verification code based on the specified rule. Valid values:
Valid values:
|
1 |
| ReturnVerifyCode |
boolean |
No |
Specifies whether to return the verification code. Valid values:
|
true |
| AutoRetry |
integer |
No |
Specifies whether to automatically replace the signature and retry sending the SMS. This feature is enabled by default. Valid values:
|
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| AccessDeniedDetail |
string |
The details of the access denial. |
None |
| Message |
string |
The description of the status code. |
Success |
| RequestId |
string |
The request ID. |
CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47 |
| Model |
object |
The request result data. |
|
| VerifyCode |
string |
The verification code. |
4232 |
| RequestId |
string |
The request ID. |
a3671ccf-0102-4c8e-8797-a3678e091d09 |
| OutId |
string |
The external serial number. |
1231231313 |
| BizId |
string |
The business ID. |
112231421412414124123^4 |
| Code |
string |
The request status code. A value of OK indicates that the request is successful. For other error codes, refer to List of return codes. |
OK |
| Success |
boolean |
Indicates whether the request is successful. Valid values:
|
true |
Examples
Success response
JSON format
{
"AccessDeniedDetail": "None",
"Message": "OK",
"RequestId": "CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47",
"Model": {
"VerifyCode": "4232",
"RequestId": "a3671ccf-0102-4c8e-8797-a3678e091d09",
"OutId": "1231231313",
"BizId": "112231421412414124123^4"
},
"Code": "OK",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MOBILE_NUMBER_ILLEGAL | The mobile number is illegal. | Phone number format error |
| 400 | BUSINESS_LIMIT_CONTROL | The number has exceeded the limit for the day. | Trigger number day flow control |
| 400 | FREQUENCY_FAIL | Check frequency fail. | Frequency control check failed |
| 400 | INVALID_PARAMETERS | parameter is not valid. | Illegal parameter |
| 400 | FUNCTION_NOT_OPENED | You have not opened this function. | Converged authentication function is not activated |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.