Search the docs or ask a question...

API Reference

Update time: 2024/07/11 16:08:38

SMS APIs rate limit

  • The SMS service is billed based on pay-as-you-go mode. For more information, contact a customer consultant from NetEase CommsEase.
  • The verification code messages support Chinese and English templates. You can contact a customer consultant for how to use custom templates.
  • The recipient's mobile phone number can receive 10 verification code messages per day by default.
  • For the same recipient's mobile phone number, a maximum of 3 identical text messages can be received within one minute limit.
  • For the same recipient's mobile phone number, a maximum of 5 identical text messages are received within one day.
  • The validity period of a verification code is 10 minutes by default. If you want to modify the setting, you can edit the setting in the SMS configuration. The unit is seconds, and the maximum validity period is 120 minutes.
  • If a mobile phone number has 10 consecutive verification errors using a verification code, the verification code will become invalid immediately, and developers must be informed of the current number of errors when the verification error returns.
  • To send test a mobile phone number for verification code messages, the cumulative number of 10,000 times per day will be regarded as a malicious attack, and the AppKey of the project for the verification code service will be suspended. If this happens, contact the customer consultant.
  • CommsEase has The CommsEase SMS channels are divided into the verification code message channel, notification message channel, and marketing message channel. When calling the API to send a verification code message, you can also call the verifying verification code API at the same time to verify the verification code. If You only want to send messages, call the sending template messages API.

Sending verification code messages or audio verification code messages

Request URL

HTTPPOST https://api.netease.im/sms/sendcode.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

API description

Sends SMS verification code messages to specified mobile phone numbers.

Parameters

ParameterTypeRequiredDescription
mobileStringYesRecipient phone number. A global phone number requires a country code. For example,+1-xxxxxxxxxx for phone numbers in the USA or region code,+852-xxxxxxxx for numbers from Hong Kong.
templateid int NoTemplate ID. If the parameter is unspecified, the default template will be used.
codeLen int NoVerification code length between 4 and 10 characters long. The default value is set to 4
authCode String NoCustom verification code between 4 and 10 digits or letters.
If this parameter is specified, the codeLenParameter becomes invalid.
needUp Boolean NoSpecify whether SMS replies are supported. true: supported. false: not supported.
Note: To activate the SMS replies service, set this parameter to true.

Curl request example

cURLcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803****" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Nonce: 4tgggergigwow323t23t" -H "Content-Type: application/x-www-form-urlencoded" -d 'mobile=13812345678' 'https://api.netease.im/sms/sendcode.action'

Response

The data returned by HTTP responses is in JSON format.

If the request is successful, relevant information will be returned. The msg field represents the sendid and the obj field represents the verification code.

JSON"Content-Type": "application/json; charset=utf-8"
{
  "code": 200,
  "msg": "88",
  "obj": "1908"
}

Response status codes

200, 315, 403, 414, 416, and 500.

For more information about codes, see Status codes.

Verifying verification codes

Request URL

HTTPPOST https://api.netease.im/sms/verifycode.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

API description

Verifies if the verification code of a specified mobile phone number is valid.

Parameters

ParameterTypeRequiredDescription
mobileStringYesRecipient phone number. A global phone number requires a country code. For example,+1-xxxxxxxxxx for phone numbers in the USA or region code,+852-xxxxxxxx for numbers from Hong Kong.
codeStringYesVerification code

Curl request example

cURLcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803****" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Nonce: 4tgggergigwow323t23t" -H "Content-Type: application/x-www-form-urlencoded" -d 'mobile=13812345678&code=1234' 'https://api.netease.im/sms/verifycode.action'

Response

The data returned by HTTP responses is in JSON format.

JSON"Content-Type": "application/json; charset=utf-8"
{
  "code":200
}

Response status codes

200, 301, 315, 403, 404, 413, 414, and 500.

For more information about codes, see Status codes.

Sending notification and marketing messages

Request URL

HTTPPOST https://api.netease.im/sms/sendtemplate.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

API description

Sends messages with a predefined content format to specified mobile phone numbers. The content of an SMS message consists of templates and variables.

Parameters

ParameterTypeRequiredDescription
templateidintYesTemplate ID, provided by account managers after the template is configured in the CommsEase console.
mobilesStringYesList of recipient phone numbers in JSONArray. For example, ["186xxxxxxxx","186xxxxxxxx"]. A maximum of 100 phone numbers are allowed.
Recipient phone number. A global phone number requires a country code. For example, +1-xxxxxxxxxx for phone numbers in the USA or region code,+852-xxxxxxxx for numbers from Hong Kong.
paramsStringIf a template contains variables, the paramter is required.SMS variable list, used in templates in JSONArray format. Each variable cannot exceed 30 characters in length. For example, `["xxx","yyy"]`. If a template does not contain variables, this parameter is not required, and the content of the SMS text will be displayed.
needUp Boolean NoSpecify whether SMS replies are supported. `true`: supported. `false`: not supported
Note: To activate the SMS replies service, set this parameter to true.

Curl request example

cURLcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803****" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Nonce: 4tgggergigwow323t23t" -H "charset: utf-8" -H "Content-Type: application/x-www-form-urlencoded" -d 'templateid=1007&mobiles=["13812345678"]&params=["hello"]' 'https://api.netease.im/sms/sendtemplate.action'

Response

The data returned by HTTP responses is in JSON format.

If the request is successful, the sendid (long) will be returned in the obj field and used to query the delivery result.

JSON"Content-Type": "application/json; charset=utf-8"
{
  "code":200,
  "msg":"sendid",
  "obj":123
}

Response status codes

200, 315, 403, 413, 414, and 500.

For more information about codes, see Status codes.

Sending video messages

Request URL

HTTPPOST https://api.netease.im/sms-new-api/video/template/send HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

API description

Sends video messages with a predefined content format to specified mobile phone numbers. The content of a message consists of text and multimedia.

Parameters

ParameterTypeRequiredDescription
templateIdlongYesTemplate ID(approve video SMS template ID)
mobilesStringYesList of recipient phone numbers in JSONArray. For example, ["186xxxxxxxx","186xxxxxxxx"]. A maximum of 100 phone numbers are allowed.
Only mobile phone numbers operated by carriers in China are supported.
paramsStringIf a template contains variables, the paramter is required.The template parameters, in JSONObject format, such as {"name":"CommsEase","age":6}, where "name" and "age" correspond to parameters #{name} and #{age} in the video template.

Curl request example

cURLcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803****" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Nonce: 4tgggergigwow323t23t" -H "charset: utf-8" -H "Content-Type: application/x-www-form-urlencoded" -d 'templateId=1007&mobiles=["13812345678"]' 'https://api.netease.im/sms-new-api/video/template/send'

Response

The data returned by HTTP responses is in JSON format.

If the request is successful, the sendid (long) will be returned in the obj field and used to query the delivery result.

JSON"Content-Type": "application/json; charset=utf-8"
{
  "code":200,
  "msg":"sendid",
  "obj":123
}

Response codes

200, 315, 403, 413, 414, and 500.

For more information about codes, see Status codes.

Querying the status of notification and marketing messages

Request URL

HTTPPOST https://api.netease.im/sms/querystatus.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

API description

Queries the result of message delivery based on the sendid returned in the sendtemplate.action.

Parameters

ParameterTypeRequiredDescription
sendidlongYesSMS message ID

Curl request example

cURLcurl -X POST -H "AppKey: go9dnk49bkd9jd9vmel1kglw0803****" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf3e6f7316fcc55583f86" -H "Nonce: 4tgggergigwow323t23t" -H "charset: utf-8" -H "Content-Type: application/x-www-form-urlencoded" -d 'sendid=1' 'https://api.netease.im/sms/querystatus.action'

Response

The data returned by HTTP responses is in JSON format.

JSONArray returned in the obj field in the following format (status values, 0:not sent, 1:success (submission over channel succeeded), 2: failure (submission over channel failed), 3:anti-spam):

JSON"Content-Type": "application/json; charset=utf-8"
{
  "code": 200,
  "obj": [
    {
      "status": 1,
      "mobile": "13812341234",
      "updatetime": 1471234567812
    }
  ]
}

Response status codes

200, 315, 403, 404, 413, 414, and 500.

For more information about codes, see Status codes.

Was this page helpful?
Yes
No
  • SMS APIs rate limit
  • Sending verification code messages or audio verification code messages
  • Request URL
  • API description
  • Parameters
  • Curl request example
  • Response
  • Response status codes
  • Verifying verification codes
  • Request URL
  • API description
  • Parameters
  • Curl request example
  • Response
  • Response status codes
  • Sending notification and marketing messages
  • Request URL
  • API description
  • Parameters
  • Curl request example
  • Response
  • Response status codes
  • Sending video messages
  • Request URL
  • API description
  • Parameters
  • Curl request example
  • Response
  • Response codes
  • Querying the status of notification and marketing messages
  • Request URL
  • API description
  • Parameters
  • Curl request example
  • Response
  • Response status codes