Sending Single SMS


HTTP Header:


Accept: application/json;charset=utf-8;
Content-Type:application/x-www-form-urlencoded;charset=utf-8;


URL: https://sms.yunpian.com/v2/sms/single_send.json


Anti-bombing rule restrictions

When sending verification code SMS to the same mobile phone

  1. Only one SMS can be sent every 30 seconds.
  2. A maximum of 3 SMS can be sent per hour.
  3. A maximum of 10 SMS can be sent in 24 hours.

This rule is enabled by default. You can turn it off in Settings->System->Anti-Bombing Rules from Yunpian Dashboard


Anti-harassment rule restrictions


When sending the same SMS content to the same mobile phone

  1. A maximum of 1 messages can be sent every 30 seconds
  2. A maximum of 3 messages can be sent every 5 minutes

This is a restriction from China Operator and cannot be turned off


Request:


Method: POST


Request Parameter:

PARAMETER

TYPE

REQUIRED

DESCRIPTION

EXAMPLE

apikey

string

Yes

APIKEY is credentials you can find on the "Account Dashboard" page. It is the string of 32-bit characters.

9b11127a9701975c
734b8aee81ee3526

mobile

string

Yes

The destination phone, we only support single send. International SMS:The international mobile number must contain the country code. Format with a "+" and country code. Please encode"+"with urlencode.

15205201314 or urlencode("+93701234567")

text

string

Yes

The text of the message you want to send, limited to 500 words. It should be audited by our customer service team first.

【Yunpian】Your Verify Code is 12345.

extend

string

No

SMS extend Number. Please contact with our customer service team if necessary.

001

uid

string

No

The SMS ID in your application. It is created by yourself.

10001

callback_url

string

No

After SMS sending, the status report will be pushed to this address (the status is returned by carrier). If the push address is fixed, it is recommended to make the batch setting in "Data Push and Get". If address has been set in the "Data Push and Get" and the HTTP requests also contains this parameter, it will be based on the URL in the HTTP requests.

http://yourreceiveurl_address

register

boolean

No

If pass"true", it will be considered as the verification code SMS which is used for registration. This data will be included in the statistic registration success rate. Please contact with customer service team if necessary.

true

mobile_stat

boolean

No

Static who click the url.

true


Parameter Description:


mobile_stat


If you want to know who click the Yunpian’s short url, please follow the below steps:


  1. Please generate Yunpian’s short url. You can refer to Get Short Link Statistics.
  1. Use ‘Sending SMS’ or ’Sending Batch SMS’ API to send the SMS. Please pass ’true’ for this parameter. We will customize the short url for each SMS. It means the short url are different for each SMS.
  1. You can find the specific statistics in the Yunpian backend.


java Request examples


/*
* Sending SMS
* @param apikey
* @param text
* @param mobile
* @return json
*/

public static String singleSend(String apikey, String text, String mobile) {
    Map<String, String> params = new HashMap<String, String>();
    params.put("apikey", apikey);
    params.put("text", text);
    params.put("mobile", mobile);
    return post("https://sms.yunpian.com/v2/sms/single_send.json", params);
}


php Request examples


/**Sending SMS

* @param apikey

* @param text

* @param mobile

* @return json

*/

public function singleSend($apikey, $text, $mobile) {
        $param = [
                'apikey' => $apikey,
                'mobile' => $mobile,
                'text' => $text,
                ];
    return post("https://sms.yunpian.com/v2/sms/single_send.json", params);
}


cURL Request examples


#Sending SMS

# @param apikey

# @param text

# @param mobile

# @return json

curl -X "POST" "https://sms.yunpian.com/v2/sms/single_send.json" \
  -H "content-type: application/x-www-form-urlencoded" \
  -d "apikey=4d6cxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -d "mobile=158xxxxxxxx" \
  -d "text=【云片网】您的验证码是1234"


SDK Download


We provide SDKs to allow you to access with Yunpian APIs quickly according to your languages.


Response:


JSON Representations:


{
  "code": 0,
  "msg": "发送成功",
  "count": 1,
  "fee": 0.05,
  "unit": "RMB",
  "mobile": "13012312312",
  "sid": 16741236146
}


Response Parameter:

PARAMETER

TYPE

DESCRIPION

EXAMPLE

code

integer

The status code of the SMS. SMS delivery information is reflected in message status. The possible values can be found in the" Return Code Description".

0

msg

string

The detailed status of the SMS. SMS delivery information is reflected in message status. The possible values can be found in the" Return Code Description".

"发送成功"

count

integer

SMS count

1

fee

double

Deduction Amount. One SMS can support 70 words. If the SMS is more than 70 words, will separate it per 67 words .

0.05

unit

string

Unit

"RMB"

mobile

string

Mobile number

"13200000000"

sid

long(64 bit)

SMS id

16741236146