All API will start with the url address:
http://api.speedsms.vn/index.php/
Or
https://api.speedsms.vn/index.php/
You should use HTTPS address to ensure the security
API access token will be attachedly send with HTTP request via HTTP Basic Authentication. Therefore, API access token will be known as an username.
For example: To call API via curl:
curl -i -u “{API access token}:x” “https://api.speedsms.vn/index.php/user/info”
To get API access token, you need to log in at https://connect.speedsms.vn, select menu “Settings”->”Profile”
curl -i -u “{Access token}” -H “Content-Type: application/json” -X POST -d ‘{“to”: “phone number”, “content”: “noi dung sms”, “app_id”: “2FA Application ID”}’ https://api.speedsms.vn/index.php/pin/create
For example: {“to”: “0912345678”, “content”: “Your verification code is: {pin_code}”, “app_id”: “1234567890”}
{ “status”: “success”, “data”: { “pin”: “PIN code that users entered”, “phone”: “user’s phone number”, “verified”: true/fale, “remainingAttempts”: the number of times that the PIN code is re-entered if the previous error is entered incorrectly } }
{ “status”: “error”, “code”: “error code”, “message”: “error description” }
curl -i -u “{Access token}” -H “Content-Type: application/json” -X POST -d ‘{“phone”: “phone number”, “app_id”: “Application id”, “pin_code”: ” PIN code entered by the user “}’ https://api.speedsms.vn/index.php/pin/verify
{ “status”: “success”, “data”: { “pin”: “PIN code that users entered”, “phone”: “user’s phone number”, “verified”: true/fale, “remainingAttempts”: the number of times that the PIN code is re-entered if the previous error is entered incorrectly } }
pin: the pin code that users entered into their app
phone: phone number receiving pin code
verified: true/false (indicates that PIN code entered is true of false)
remainingAttempts: the number of times that users are allowed to re-enter pin code if the previous error is entered incorrectly
{ “status”: “error”, “code”: “error code”, “message”: “error description” }
Download sample code for java language here
Download sample code for C# language here