Send Verification Message
Request URI
/v1/send
HTTP Method
POST
Request Format
application/json
Request Parameters
Request Parameter | Parameter Type | Required / Default | Example Value | Parameter Description | |
---|---|---|---|---|---|
service_id | str | Required | 568ff29ec61a2ee7ead4ebd1c026e128 | Service ID | |
gen_time | int | Required | 1710496502 | Current timestamp, accurate to seconds | |
signature | str | Required | 6197126a0d9ccb9e818deca9c7f16596 2df88e3a6ce2a1856fe7f42463e89d03 | Signature information, see signature method | |
user_ip | str | Required | 1.2.3.4 | User IP address | |
user_agent | str | Optional | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0 | User agent | |
channel | str | Optional, default "sms" | sms | Delivery channel, currently only supports SMS, i.e. "sms" | |
to | str | Required | +6591201234 | Recipient, currently only supports phone numbers | |
verification_code_config | object | Optional | Verification code generation parameters | ||
length | int | Optional, default 6 | 6 | Verification code length | |
expire | int | Optional, default 5 | 5 | Verification code expiration time, in minutes | |
generate_rule | int | Optional, default 1 | 1 | Verification code generation rule: 1. pure digits 2. pure letters 3. digits and letters 4. letters and special characters (_$#@*%&) | |
return_verification_code | bool | Optional, default true | true | Whether to return the verification code after calling the API | |
sms_template_id | str | Required if channel is sms | 207406 | SMS template ID, can be obtained on the dashboard |
Request Example
{
"service_id": "568ff29ec61a2ee7ead4ebd1c026e128",
"signature": "cbf7ac72f03162a486b3b418e7a032c8c085e21dc6a5f2469b141426c2001033",
"gen_time": 1710744053,
"user_ip": "1.2.3.4",
"to": "+6591201234",
"user_agent": "Go-http-client/1.1",
"sms_template_id": "207406",
"verification_code_config": {
"length": 8,
"expire": 7,
"generate_rule": 1,
"return_verification_code": true
}
}
Response Format
application/json
Response Parameters
Response Parameter | Parameter Type | Required | Parameter Description |
---|---|---|---|
request_id | str | Yes | Unique identifier of this request |
status | str | Yes | "success", "canceled" of "error", whether the request was successful |
error_code | int | Returned when status is "error" | Error code |
error_msg | str | Returned when status is "error" | Error message |
service_id | str | Returned when status is "success" | Service ID, consistent with the parameter submitted in the request |
channel | str | Returned when status is "success" | Delivery channel, currently only "sms" |
verification_code | str | Returned when request parameter verification_code_config.return_verification_code is true and status is "success" | Generated verification code according to the rules |
Response Example
Successful Example
{
"status": "success",
"channel": "sms",
"request_id": "svmxqdlxdzp6nyoxcsm7st6qjzvnrbse",
"service_id": "568ff29ec61a2ee7ead4ebd1c026e128",
"verification_code": "67557548"
}
Canceled Example
Why did you get the status 'canceled'?
This indicates that your send request has been blocked by our fraud protection system. You can adjust the appropriate protection level on the 'Fraud Protection' page under 'Security Setting'.
{
"status": "canceled",
"request_id": "8y8mr18vjykv48rond6am7surl8nwtaw",
"service_id": "0b3d9be94663520ab31fd903413e9174"
}
Failure Example
{
"status": "error",
"error_code": -50102,
"error_msg": "service not found or signature verify failed",
"request_id": "fvw0cj066cg4jegd3mwu9b8by31cidm3"
}