Domain name for API request: sms.tencentcloudapi.com.
This API is used to send SMS verification codes, notification, or marketing messages to users.
- Note: Because of the improved security of TencentCloud API 3.0, API authentication is more complicated. We recommend you use the Tencent Cloud SMS service with the SDK.
- Note: You can run this API directly in API 3.0 Explorer, which eliminates the signature calculation steps. After it is executed successfully, API Explorer can automatically generate SDK code samples.
- Note: This API is currently on the 2021-01-11 version. If you are still using the 2019-07-11 version, we recommend you use this latest version. For version differences, see Version description.
A maximum of 3000 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
This document describes the parameters for Signature V1. It's recommended to use the V3 signature, which provides higher security. Note that for Signature V3, the common parameters need to be placed in the HTTP Header. See details.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common parameter. The value used for this API: SendSms. |
Version | Yes | String | Common parameter. The value used for this API: 2021-01-11. |
Region | Yes | String | Common parameter. For more information, please see the list of regions supported by the product. |
PhoneNumberSet.N | Yes | Array of String | Target mobile number in the E.164 standard in the format of +[country/region code][mobile number]. Up to 200 mobile numbers are supported in one request (which should be all Chinese mainland mobile numbers or all global mobile numbers). For example, +8613711112222, which has a + sign followed by 86 (country/region code) and then by 13711112222 (mobile number). |
SmsSdkAppId | Yes | String | The SMS SdkAppId generated after an application is added in the SMS console, such as 1400006666. |
TemplateId | Yes | String | Template ID. You must enter the ID of an approved template, which can be viewed on the Chinese Mainland SMS or Global SMS body template management page. If you need to send SMS messages to global mobile numbers, you can only use a Global SMS template. |
SignName | No | String | Content of the SMS signature, which should be encoded in UTF-8. You must enter an approved signature, such as Tencent Cloud. The signature information can be viewed on the Chinese Mainland SMS or Global SMS signature management page.
|
TemplateParamSet.N | No | Array of String | Template parameter. If there is no template parameter, leave this field empty.
|
ExtendCode | No | String | SMS code number extension, which is not activated by default. If you need to activate it, you can contact SMS Helper. |
SessionContext | No | String | User session content, which can carry context information such as user-side ID and will be returned as-is by the server. |
SenderId | No | String | This parameter is not required for Chinese Mainland SMS. For Global SMS, if you have applied for a separate SenderId , this parameter is required. By default, the public SenderId is used, in which case you don't need to enter this parameter.Note: if your monthly usage reaches the specified threshold, you can apply for an independent SenderId . For more information, contact SMS Helper. |
Parameter Name | Type | Description |
---|---|---|
SendStatusSet | Array of SendStatus | SMS delivery status. |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: sms.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: SendSms
<Common request parameters>
{
"PhoneNumberSet": [
"+8618511122266",
"+8618511122233"
],
"SmsSdkAppId": "1400006666",
"SignName": "Tencent Cloud",
"TemplateId": "1234",
"TemplateParamSet": [
"12345"
],
"SessionContext": "test"
}
{
"Response": {
"SendStatusSet": [
{
"SerialNo": "5000:1045710669157053657849499619",
"PhoneNumber": "+8618511122233",
"Fee": 1,
"SessionContext": "test",
"Code": "Ok",
"Message": "send success",
"IsoCode": "CN"
},
{
"SerialNo": "5000:1045710669157053657849499718",
"PhoneNumber": "+8618511122266",
"Fee": 1,
"SessionContext": "test",
"Code": "Ok",
"Message": "send success",
"IsoCode": "CN"
}
],
"RequestId": "a0aabda6-cf91-4f3e-a81f-9198114a2279"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation.ContainSensitiveWord | The SMS message contains sensitive words. You can contact SMS Helper for assistance. |
FailedOperation.FailResolvePacket | Failed to parse the request packet. Usually, this is because that the API specification was not followed. Please see Detailed Explanation of Request Body Parsing Error 1004. |
FailedOperation.InsufficientBalanceInSmsPackage | The package balance is insufficient. Please purchase an SMS package. |
FailedOperation.JsonParseFail | Failed to parse the request body. |
FailedOperation.MarketingSendTimeConstraint | Marketing SMS messages can only be sent between 8:00 and 22:00 in order not to disturb recipients. |
FailedOperation.PhoneNumberInBlacklist | The mobile number is in the blocklist. Usually, this is because that the user unsubscribed or the carrier's blocklist was hit. You can contact SMS Helper for assistance. |
FailedOperation.SignatureIncorrectOrUnapproved | The signature is not approved or in an incorrect format. (1) Log in to the SMS console and check whether the signature has been approved; (2) Check whether the signature is in compliance with the format specification, that is, it can contain 2–12 letters and digits. If you have any questions, contact SMS Helper for assistance. |
FailedOperation.TemplateIncorrectOrUnapproved | The template is not approved or in wrong format. (1) Log in to the SMS console and check whether the template has been approved; (2) Check whether the template is in compliance with the format specification. If you have any questions, you can contact SMS Helper for assistance. |
InternalError.OtherError | Other error. You can contact SMS Helper and provide the failed mobile number for assistance. |
InternalError.RequestTimeException | The request was initiated in an exceptional time. Usually, this is because that the difference between your server time and Tencent Cloud server time exceeds 10 minutes. Please check whether the server time and the time field in the API are correct. |
InternalError.RestApiInterfaceNotExist | This RESTful API does not exist. Please check the RESTful API description. |
InternalError.SendAndRecvFail | The API timed out or SMS packet sending/receiving timed out. You need to check whether your network jitters or contact SMS Helper for assistance. |
InternalError.SigFieldMissing | The request body in the backend body does not have a Sig field or the Sig field is empty. |
InternalError.SigVerificationFail | Backend check of Sig failed. |
InternalError.Timeout | The request to deliver an SMS message timed out. Please see Detailed Explanation of Error 60008. |
InternalError.UnknownError | Unknown error. |
InvalidParameterValue.ContentLengthLimit | The content of the requested SMS message is too long. For message length calculation rule, please see Mainland China SMS Length Calculation Rule. |
InvalidParameterValue.IncorrectPhoneNumber | The format of the mobile number is incorrect, Please see Detailed Explanation of Error 1016. |
InvalidParameterValue.ProhibitedUseUrlInTemplateParameter | URLs are not allowed in template variables. |
InvalidParameterValue.SdkAppIdNotExist | The SdkAppId does not exist. |
InvalidParameterValue.TemplateParameterFormatError | The parameter format of the verification code template is incorrect. For a verification code template, only 0–6 digits can be passed in as the template variable. |
InvalidParameterValue.TemplateParameterLengthLimit | There are more than 12 characters in a single template variable. There is no upper limit of variable characters for enterprise users. You can change your account identity type to enterprise as instructed here. The limit change will take effect in about one hour. |
LimitExceeded.AppCountryOrRegionDailyLimit | The number of SMS messages delivered on the current day for the specified country/region exceeds the configured upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.AppCountryOrRegionInBlacklist | The specified country/region for the SMS message is in the blocklist. You can adjust the SMS delivery limit policy in the console. |
LimitExceeded.AppDailyLimit | The number of SMS messages delivered on the current day exceeds the set upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.AppGlobalDailyLimit | The number of Global SMS messages delivered on the current day exceeds the configured upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.AppMainlandChinaDailyLimit | The number of Chinese Mainland SMS messages delivered on the current day exceeds the configured upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.DailyLimit | The number of SMS messages delivered on the current day exceeds the set upper limit (for Global SMS). If you want to adjust the limit, you can contact SMS Helper for assistance. |
LimitExceeded.DeliveryFrequencyLimit | The SMS delivery hits the delivery rate limit policy. You can adjust the policy in the console. If you have other requirements, you can contact SMS Helper for assistance. |
LimitExceeded.PhoneNumberCountLimit | The number of mobile numbers you query at a time exceeds 200. Please refer to the input parameter PhoneNumberSet . |
LimitExceeded.PhoneNumberDailyLimit | The number of SMS messages delivered to a single mobile number on the current day exceeds the set upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.PhoneNumberOneHourLimit | The number of SMS messages delivered to a single mobile number within 1 hour exceeds the set upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.PhoneNumberSameContentDailyLimit | The number of identical SMS messages delivered to a single mobile number exceeds the set upper limit. You can adjust the SMS delivery rate limit policy in the console. |
LimitExceeded.PhoneNumberThirtySecondLimit | The number of SMS messages delivered to a single mobile number within 30 seconds exceeds the set upper limit. You can adjust the SMS delivery rate limit policy in the console |
MissingParameter.EmptyPhoneNumberSet | The list of mobile numbers passed in is empty. Please check whether numbers are present in your parameters. |
UnauthorizedOperation.IndividualUserMarketingSmsPermissionDeny | Individual users do not have permission to send marketing SMS messages. Please see Differences in Rights. |
UnauthorizedOperation.RequestIpNotInWhitelist | The requesting IP is not in the allowlist. You have configured the verification of request source IP, but the current requesting IP is not in the configured allowlist. If necessary, you can contact SMS Helper. |
UnauthorizedOperation.RequestPermissionDeny | The request does not have permission. You can contact SMS Helper. |
UnauthorizedOperation.SdkAppIdIsDisabled | This SdkAppId is forbidden to provide services. If necessary, you can contact SMS Helper. |
UnauthorizedOperation.SerivceSuspendDueToArrears | The service has been suspended due to overdue payments. You can log in to Tencent Cloud to make the payments. |
UnauthorizedOperation.SmsSdkAppIdVerifyFail | Failed to verify SmsSdkAppId . Please check whether SmsSdkAppId is under the account associated with the TencentCloud API key. |
UnsupportedOperation. | The request is not supported. |
UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber | The group message request contains both Chinese mainland numbers and international numbers. Please check: (1) whether the message is sent to international numbers with a Chinese mainland signature or template; (2) whether the message is sent to Chinese mainland numbers with an international signature or template. |
UnsupportedOperation.UnsuportedRegion | SMS delivery to this region is not supported. |
本页内容是否解决了您的问题?