SendBatchSms

更新时间:
复制 MD 格式

This operation sends messages to different phone numbers using a single template, with different signatures and template variables for each recipient.

Operation description

Basic information

  • You can send messages to a maximum of 100 phone numbers in a single call.

  • The global endpoint is dysmsapi.aliyuncs.com. For a list of region-specific endpoints, see Endpoints.

API calls

Usage notes

  • For domestic SMS, we recommend setting the timeout period to 1 second or longer. If a timeout occurs, check the delivery receipt status before you retry the request. For more information about timeout and retry settings, see timeout mechanism and retry mechanism.

  • This operation does not support idempotence for domestic SMS, international SMS, or Multimedia Messaging Service (MMS) messages. You must implement your own idempotence controls to prevent duplicate operations caused by multiple retries.

  • This is a billable operation. For domestic SMS, you are charged based on the delivery receipt status from the carrier. You are not charged for messages that are successfully submitted but fail carrier delivery. For more information, see Billing overview.
    Warning Batch message delivery may be delayed due to system capacity limits. For time-sensitive messages, such as verification codes or alert notifications, use the SendSms operation to send messages individually.

QPS limit

The Queries Per Second (QPS) limit for a single user is 5,000. Calls that exceed this limit are throttled. Plan your usage accordingly.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dysms:SendBatchSms

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

PhoneNumberJson

string

Yes

The recipient phone numbers. Format:

  • For domestic SMS: Phone numbers with or without a country code such as +, +86, 0086, or 86. Example: 1590000****.

  • For international SMS: The country code followed by the phone number. Example: 852000012****.

Note

For time-sensitive messages like verification codes, use the SendSms operation to send messages individually.

["1590000****","1350000****"]

SignNameJson

string

Yes

The signature names. The number of signatures must match the number of phone numbers.

You can call the QuerySmsSignList operation or check the Short Message Service console to find approved signatures. You must use an approved signature.

Note
  • The system uses the selected signature to send SMS messages.

["阿里云","阿里巴巴"]

TemplateCode

string

Yes

The message template code. You cannot use templates for domestic SMS and international SMS interchangeably.

You can call the QuerySmsTemplateList operation or check the Short Message Service console to find approved template codes. You must use an approved template code.

SMS_15255****

TemplateParamJson

string

No

The actual values for the template variables. This parameter is required if the template contains variables.

Note
  • The number of template variable sets must match the number of phone numbers and signatures. The elements in the PhoneNumberJson, SignNameJson, and TemplateParamJson arrays must correspond by index to ensure each message is sent with the correct signature and variable values.

  • If you need to include a line break in the JSON string, follow the standard JSON format.

[{"name":"TemplateParamJson"},{"name":"TemplateParamJson"}]

SmsUpExtendCodeJson

string

No

A JSON array of MO SMS extension codes.

Note

You can leave this parameter empty if you have no special requirements.

["90999","90998"]

OutId

string

No

An external business ID. It must be a string of fewer than 256 characters.

Note

You can leave this parameter empty if you have no special requirements.

abcdefg

Response elements

Element

Type

Description

Example

object

Code

string

The request status code.

  • A value of OK indicates a successful request.

  • For a list of other error codes, see Error codes.

OK

Message

string

The description of the request status.

OK

BizId

string

The delivery receipt ID.

9006197469364984400

RequestId

string

The request ID.

F655A8D5-B967-440B-8683-DAD6FF8D230E

Examples

Success response

JSON format

{
  "Code": "OK",
  "Message": "OK",
  "BizId": "9006197469364984400",
  "RequestId": "F655A8D5-B967-440B-8683-DAD6FF8D230E"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.