Sends an SMS verification code.
Operation description
Carriers recently tightened controls on SMS signatures. Your custom signature may fail to deliver. Use the SMS signature and template provided by the Phone Number Verification Service console for SMS authentication. System-provided signatures must be used with system-provided templates.
Before using this API, understand the billing model and pricing of the Phone Number Verification Service. SMS authentication charges only for successfully delivered messages (billed based on carrier receipt status. There is no charge if the message is submitted but the carrier reports failure). The verification service itself is free.
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 |
Scheme name. If not specified, defaults to "default scheme". Maximum length is 20 characters. |
测试方案 |
| CountryCode |
string |
No |
Country code for the phone number. Default is 86. Currently, only domestic numbers are supported. |
86 |
| PhoneNumber |
string |
Yes |
Recipient's mobile phone number. |
130****0000 |
| SignName |
string |
Yes |
Signature name. Custom signatures are not supported. Use a system-provided signature. Select a signature to use on the System Signature Configuration page. |
速通互联验证码 |
| TemplateCode |
string |
Yes |
SMS template code. When using a system-provided signature in the |
100001 |
| TemplateParam |
string |
Yes |
Template parameters. You can specify the verification code in two ways:
Example: If the template content is: "Your Captcha is ${code}. It is valid for ${min} minutes. Do not share it with others." Important Replace `code` in the preceding text with the parameter name from your requested Captcha template.
Note
Note
|
{"code":"##code##","min":"5"} |
| SmsUpExtendCode |
string |
No |
Uplink SMS extension code. Uplink SMS refers to messages sent to your carrier for services such as queries or transactions. Charges apply based on standard carrier SMS rates. Note
The extension code is automatically generated when you create a signature. You cannot specify your own. Ignore this field unless you have a specific need. Contact your account manager if you require this feature. |
1213123 |
| OutId |
string |
No |
External transaction ID. |
外部流水号(透传) |
| CodeLength |
integer |
No |
Verification code length. Supports 4 to 8 digits. Default is 4. |
4 |
| ValidTime |
integer |
No |
Verification code validity period in seconds. Default is 300 seconds. |
300 |
| DuplicatePolicy |
integer |
No |
Verification policy for handling repeated requests to the same number within the same scenario during the validity period.
Valid values:
|
1 |
| Interval |
integer |
No |
Minimum interval between sending verification codes, in seconds. Used for rate limiting. Default is 60 seconds. |
60 |
| CodeType |
integer |
No |
Type of verification code to generate. Required when TemplateParam uses a placeholder. The system generates the code based on this rule. Values:
Valid values:
|
1 |
| ReturnVerifyCode |
boolean |
No |
Whether to return the verification code in the response. Values:
|
true |
| AutoRetry |
integer |
No |
Whether to automatically retry with a different signature (enabled by default). Values:
|
是否自动重试 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| AccessDeniedDetail |
string |
Details of access denial. |
无 |
| Message |
string |
Description of the status code. |
成功 |
| RequestId |
string |
Request ID. |
CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47 |
| Model |
object |
Response data. |
|
| VerifyCode |
string |
Verification code. |
4232 |
| RequestId |
string |
Request ID. |
a3671ccf-0102-4c8e-8797-a3678e091d09 |
| OutId |
string |
External transaction ID. |
1231231313 |
| BizId |
string |
Business ID. |
112231421412414124123^4 |
| Code |
string |
Request status code. "OK" indicates success. For other error codes, see Return code list. |
OK |
| Success |
boolean |
Whether the request succeeded.
|
true |
Examples
Success response
JSON format
{
"AccessDeniedDetail": "无",
"Message": "成功 ",
"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.