API Documentation

Send Verification Code API

Used to send SMS. Requires user's api_key, recipient phone number and SMS content. After the request, you will get an ID for this sending, which can be used to query the SMS sending status.

API URL:https://api.haosms.net/extra_api/otp_msg
Request Method:POST/GET

Parameter Description:

Parameter NameTypeRequiredDescription
api_keyStringYesUser's unique identifier
phoneStringYesPhone number to receive verification code. Format: 1324638088. Do not add 0086, +86 format not accepted
contentStringYesVerification code. Can only contain numbers and English letters, maximum length 6 characters
platformStringYesChannel for sending verification code. For example: China OTP Channel 2, China OTP Channel 1
tmp_idStringNoTemplate ID for verification code message (if not provided, system default OTP template will be used)

Template Description (tmp_id):

  • Default (no value needed):Verification code: XXXX, please enter and verify! Do not disclose the verification code to anyone. Note: The verification code is valid for 1 hour, and will expire after that.
  • 1:Verification code: XXXX, you are modifying your profile and need verification! Do not disclose the verification code to anyone.
  • 2:Verification code: XXXX, please enter and verify! Do not disclose the verification code to anyone.
  • 3:Verification code: XXXX, you are changing questions and answers and need verification! Do not disclose the verification code to anyone.
  • 4:Verification code: XXXX, you are updating your password and need verification! Do not disclose the verification code to anyone.

Response:

Sample:

{
    "msg": "a42739630dbe4daa8d4f5f6a530a35bc",
    "result": "成功",
    "code": "",
    "data": null,
    "datas": [],
    "name": "extra_api.otp_msg",
    "request_id": ""
}
  • msg:
    • On success: Returns specific task ID (string format)
    • On failure: Returns error message
  • result:
    • On success: Returns "成功" (success)
    • On failure: Returns "失败" (failure)
  • code: Return code, usually empty string
  • data: Return data, usually null
  • datas: Data array, usually empty array
  • name: API name, fixed as "extra_api.otp_msg"
  • request_id: Request ID, usually empty string

Request Example:

https://api.haosms.net/extra_api/otp_msg/?api_key=kknft3xxxx&content=123212&phone=155xxxx827&platform=%E9%AA%8C%E8%AF%81%E7%A0%81%E9%80%9A%E9%81%931

Query Balance API

Used to query account balance. Requires user's api_key, and returns current account balance information after the request.

API URL:https://api.haosms.net/user/s_balance
Request Method:GET/POST

Parameter Description:

Parameter NameTypeRequiredDescription
api_keyStringYesUser's unique identifier

Response:

Sample:

{
    "msg": "",
    "result": "True",
    "code": "",
    "data": {
        "balance": 0
    },
    "datas": [],
    "name": "",
    "request_id": ""
}
  • msg: Return message, empty string on success
  • result:
    • On success: Returns "True"
    • On failure: Returns "False"
  • code: Return code, empty string on success
  • data: Return data object
    • balance: Account balance (number type)
  • datas: Data array, usually empty array
  • name: API name, usually empty string
  • request_id: Request ID, usually empty string

Request Example:

https://api.haosms.net/user/s_balance?api_key=yourApiKey