DID号码进行短信下行V2 - nxtele/http-api-document GitHub Wiki

简要描述:

  • 通过DID号码进行短信下行(V2版本)

请求方式:

  • URL:https://api2.nxcloud.com/didsms/mtsend
  • Method:POST
  • Content-Type:application/json
  • 需要鉴权:

额外说明:

  • 客户的短信上行推送地址同时会作为本接口的回执推送地址

鉴权机制

鉴权规则请参考地址:API接口调用约定

请求参数说明

header参数:

参数名 类型 必选 示例值 说明
accessKey String fme2na3kdi3ki 用户身份标识
ts String 1655710885431 当前请求的时间戳(单位是毫秒),牛信服务端允许用户端请求最大时间误差为60秒
bizType String 4 did业务类型,取固定值“4”
action String mtsend aid业务操作,取固定值“mtsend”
sign String 6e9506557d1f289501d333ee2c365826 API入参参数签名,签名算法

body参数

参数名 必选 类型 说明
sender string DID号码(国码+手机号,比如:8615088888888)
phone string 短信被叫号码(国码+手机号,比如:8615088888888)目前仅支持单个手机号码下行
content string 发送的短信内容

请求示例

curl --location --request POST 'https://api2.nxcloud.com/didsms/mtsend' \
--header 'accesskey: kGp5uFHN' \
--header 'action: mtsend' \
--header 'biztype: 4' \
--header 'ts: 1655710885431' \
--header 'sign: 6e9506557d1f289501d333ee2c365826' \
--header 'Content-Type: application/json' \
--data-raw '{
    "sender": "8615088888888",
    "phone": "8618637616887",
    "content": "这是一条测试短信"
}'

返回参数说明

参数名 类型 说明
message string 请求提示
data string 系统返回的数据
code string 错误码
messageId string 消息id

返回成功示例

{
   "code":0,
   "message":"Success",
   "data":{
      "messageId":"fdgrthtyjujukiulkil646kli6465ilul"
   }
}

返回失败示例

{
   "code":-1,
   "message":"Failure"
}

备注

业务错误代码

code 说明
0 Success
-1 Failure
1001 Authentication failed (missing public parameters)
1002 Authentication failed (parameter error)
1003 Authentication failed (invalid signature)
1004 Authentication failed (timestamp expired)
1005 Authentication failed (insufficient authority)
9006 Phone number parsing error
9007 Unable to find country configuration
1100 Customer does not exist / Status is unavailable
1102 Insufficient balance
12001 Message content length beyond the limit 1000
12002 The number does not belong to you
12004 Could not find the quote for the DID down SMS with the number not found
12005 Could not find the quote for the DID down SMS with the vendor not found
12007 Not find the phone number in the customer number
12008 Did customer number status exception