tencent cloud

Feedback

SendSms

Last updated: 2021-05-20 16:42:01

    1. API Description

    Domain name for API request: sms.tencentcloudapi.com.

    This API is used to send SMS verification codes, notification, or marketing messages to users.

    A maximum of 3000 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    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: 2019-07-11.
    Region No String Common parameter. This parameter is not required for this API.
    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 Mainland China mobile numbers or all global mobile numbers).
    Example: +8613711112222, which has a + sign followed by 86 (country/region code) and then by 13711112222 (mobile number).
    TemplateID Yes String Template ID. You must enter the ID of an approved template, which can be viewed in the SMS Console.
    SmsSdkAppid Yes String SMS SdkAppid actually generated after an application is added in the SMS Console, such as 1400006666.
    Sign No String The content of SMS signature should be encoded in UTF-8. You must enter an approved signature, which can be viewed in the SMS Console. Note: this parameter is required for Mainland China SMS.
    TemplateParamSet.N No Array of String Template parameter. If there is no template parameter, leave this parameter blank.
    ExtendCode No String SMS code number extension, which is not activated by default. If you need to activate it, please 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 senderid for Global SMS, which is not activated by default. If you need to activate it, please contact SMS Helper for assistance. This parameter should be empty for Mainland China SMS.

    3. Output Parameters

    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.

    4. Example

    Example1 Sample request

    • To get the common request parameters SecretId and SecretKey (which will be used in the SDK too), please go to the TencentCloud API Key page.
    • Note: because of the improved security of TencentCloud API 3.0, API authentication is more complicated. You are recommended to use the Tencent Cloud SMS service with the SDK.

    Input Example

    https://sms.tencentcloudapi.com/?Action=SendSms
    &PhoneNumberSet.0=+8618511122233
    &PhoneNumberSet.1=+8618511122266
    &TemplateID=1234
    &Sign=Tencent Cloud
    &TemplateParamSet.0=12345
    &SmsSdkAppid=1400006666
    &SessionContext=test
    &<Common request parameters>

    Output Example

    {
    "Response": {
      "SendStatusSet": [
        {
          "SerialNo": "5000:104571066915705365784949619",
          "PhoneNumber": "+8618511122233",
          "Fee": 1,
          "SessionContext": "test",
          "Code": "Ok",
          "Message": "send success",
          "IsoCode": "CN"
        },
        {
          "SerialNo": "5000:104571066915705365784949619",
          "PhoneNumber": "+8618511122266",
          "Fee": 1,
          "SessionContext": "test",
          "Code": "Ok",
          "Message": "send success",
          "IsoCode": "CN"
        }
      ],
      "RequestId": "a0aabda6-cf91-4f3e-a81f-9198114a2279"
    }
    }

    5. Developer Resources

    API Explorer

    This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    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. Please contact SMS Helper for assistance.
    FailedOperation.FailResolvePacket Failed to parse the request packet. Generally, 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.
    FailedOperation.JsonParseFail Failed to parse the request packet.
    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. Generally, this is because that the recipient has unsubscribed or the carrier's blocklist was hit. You can contact SMS Helper for assistance.
    FailedOperation.SignatureIncorrectOrUnapproved The signature is in incorrect format or has not been approved. A signature can only contain 2-12 letters and digits. If the signature format is correct, please check whether it has been approved.
    FailedOperation.TemplateIncorrectOrUnapproved The template content has not been approved or does not match the content of the approved template. Please see Detailed Explanation of Error 1014.
    InternalError.OtherError Other error. Please contact SMS Helper and provide the failed mobile number for assistance.
    InternalError.RequestTimeException The request was initiated in an exceptional time. Generally, 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
    InternalError.SigFieldMissing The request packet in the backend packet does not have a Sig field or the Sig field is empty.
    InternalError.SigVerificationFail Sig check on backend 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.
    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.
    LimitExceeded.AppDailyLimit The number of SMS messages delivered on the current day exceeds the set upper limit. You can adjust the SMS frequency 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, please contact SMS Helper for assistance.
    LimitExceeded.DeliveryFrequencyLimit The SMS delivery hit the frequency limit policy. You can adjust the policy in the console. If you have other requirements, please contact SMS Helper for assistance.
    LimitExceeded.PhoneNumberCountLimit There are more than 200 mobile numbers submitted in a single call of the SMS delivery API. Please follow the requirements in API Description.
    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 frequency 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 frequency 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 frequency 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 frequency 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 here.
    UnauthorizedOperation.RequestIpNotInWhitelist The requesting IP is not in the whitelist. You have configured verification of request source IP, but the current requesting IP is not in the configured whitelist. If necessary, please contact SMS Helper for assistance.
    UnauthorizedOperation.RequestPermissionDeny You do not have permission to make the request. Please contact SMS Helper for assistance.
    UnauthorizedOperation.SdkAppidIsDisabled This sdkappid is forbidden to provide services. If necessary, please contact SMS Helper for assistance.
    UnauthorizedOperation.SerivceSuspendDueToArrears The service has been suspended due to arrears. You can log in to Tencent Cloud to top up your account.
    UnauthorizedOperation.SmsSdkAppidVerifyFail SmsSdkAppid check failed.
    UnsupportedOperation. This request is not supported.
    UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber The bulk SMS request contains both Mainland China and global mobile numbers.
    UnsupportedOperation.UnsuportedRegion SMS delivery to this region is not supported.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support