An SMS template contains the content of a text message, which includes the message body and variables. You can request templates for different message types, such as verification codes, notifications, or promotional messages. You can send text messages only after the template is reviewed and approved.
This API has been deprecated. We recommend migrating to Dysmsapi(2017-05-25) - CreateSmsTemplate for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.
Operation description
-
Alibaba Cloud has updated its template-related APIs to comply with the regulations of the Ministry of Industry and Information Technology (MIIT) and carrier requirements. To improve the efficiency and success rate of template reviews, use the new CreateSmsTemplate - Request an SMS template API.
-
You can submit up to 100 SMS template requests per day by calling this API. You must wait at least 30 seconds between each request. If you request SMS templates in the console, the number of submissions is unlimited.
-
Information about templates requested by calling the API is synchronized with the Short Message Service console. For more information about how to manage templates in the console, see SMS templates.
-
After you submit a template request, you can call the QuerySmsTemplate operation to query the review status and details of the template. You can also configure message receipts to obtain the review status from the TemplateSmsReport message.
-
Templates for text messages sent to mainland China are not interchangeable with templates for International SMS messages. Request templates based on your business scenario.
-
Only enterprise users can request templates for promotional messages and International SMS messages. For more information about the differences between individual and enterprise users, see Usage notes.
QPS limit
The queries per second (QPS) limit for a single user is 1,000 calls per second. If you exceed this limit, API calls are throttled, which may affect your business. Call this API at a reasonable rate.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dysms:AddSmsTemplate |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| TemplateType |
integer |
Yes |
The type of the text message. Valid values:
Note
Only enterprise users can request templates for promotional messages and International SMS messages. For more information about the differences between individual and enterprise users, see Usage notes. |
1 |
| TemplateName |
string |
Yes |
The name of the template. The name can be up to 30 characters in length. |
Aliyun Test |
| TemplateContent |
string |
Yes |
The content of the template. The content can be up to 500 characters in length. The template content and variables must comply with the SMS template specifications. Otherwise, the template fails the review. You can also view common sample templates on the Request Template page. Using sample templates can improve the efficiency and success rate of reviews. For more information about variable specifications, see Variable specifications for the TemplateContent parameter. |
You are applying for mobile registration. The verification code is: ${code}, valid for 5 minutes! |
| Remark |
string |
Yes |
The description of the SMS template request. The description can be up to 100 characters in length. This information is used for template review. A detailed description helps reviewers understand your business scenario and improves review efficiency. Follow these guidelines:
|
Apply for a template to send verification codes. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The request status code.
|
OK |
| Message |
string |
The description of the status code. |
OK |
| RequestId |
string |
The request ID. |
F655A8D5-B967-440B-8683-DAD6FF8DE990 |
| TemplateCode |
string |
The code of the SMS template. After you submit a template request, you can use the template code to call the QuerySmsTemplate operation and query the review details. You can also configure message receipts and obtain the review status of the template from the TemplateSmsReport message. |
SMS_15255**** |
Examples
Success response
JSON format
{
"Code": "OK",
"Message": "OK",
"RequestId": "F655A8D5-B967-440B-8683-DAD6FF8DE990",
"TemplateCode": "SMS_15255****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | TemplateParameterCountIllegal | The verification code template only supports 1 verification code as a variable | Verification code templates support only one variable, which must be a verification code. |
See for a complete list.
Release notes
See Release Notes for a complete list.