Cấp access token và refresh token
curl --request POST \
--url https://api.ssi.com.vn/api/v3/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"apiSecret": "<string>",
"otp": "<string>",
"transactionId": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/auth/token"
payload = {
"apiKey": "<string>",
"apiSecret": "<string>",
"otp": "<string>",
"transactionId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
apiKey: '<string>',
apiSecret: '<string>',
otp: '<string>',
transactionId: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ssi.com.vn/api/v3/auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '<string>',
'apiSecret' => '<string>',
'otp' => '<string>',
'transactionId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ssi.com.vn/api/v3/auth/token"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ssi.com.vn/api/v3/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tokenType": "Bearer",
"accessToken": "eyJhb...",
"expiresAt": 1787238584,
"refreshToken": "eyJhb...",
"refreshExpiresAt": 1787266484
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}Xác thực
Cấp access token và refresh token
Xác thực apiKey/apiSecret để lấy access token và refresh token (kèm thông tin hết hạn).
POST
/
api
/
v3
/
auth
/
token
Cấp access token và refresh token
curl --request POST \
--url https://api.ssi.com.vn/api/v3/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"apiSecret": "<string>",
"otp": "<string>",
"transactionId": "<string>"
}
'import requests
url = "https://api.ssi.com.vn/api/v3/auth/token"
payload = {
"apiKey": "<string>",
"apiSecret": "<string>",
"otp": "<string>",
"transactionId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
apiKey: '<string>',
apiSecret: '<string>',
otp: '<string>',
transactionId: '<string>'
})
};
fetch('https://api.ssi.com.vn/api/v3/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ssi.com.vn/api/v3/auth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apiKey' => '<string>',
'apiSecret' => '<string>',
'otp' => '<string>',
'transactionId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ssi.com.vn/api/v3/auth/token"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ssi.com.vn/api/v3/auth/token")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ssi.com.vn/api/v3/auth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiKey\": \"<string>\",\n \"apiSecret\": \"<string>\",\n \"otp\": \"<string>\",\n \"transactionId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tokenType": "Bearer",
"accessToken": "eyJhb...",
"expiresAt": 1787238584,
"refreshToken": "eyJhb...",
"refreshExpiresAt": 1787266484
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}{
"code": "<string>",
"msg": "<string>"
}Nội dung
application/json
API key do SSI/FastConnect cấp cho ứng dụng.
API secret tương ứng với apiKey.
Mã OTP (SMS OTP hoặc SmartOTP) cần phải có nếu bạn muốn token cấp ra có quyền thực hiện giao dịch. Trường hợp chỉ sử dụng để truy vấn dữ liệu (data, query trading) thì không cần truyền OTP.
Mã transaction trả về từ API auth/requestOtp khi tài khoản dùng 2FA loại SmartOTP và đã kích hoạt luồng phê duyệt qua ứng dụng iBoard.
Phản hồi
Thành công.
Loại token.
Ví dụ:
"Bearer"
Access token dùng để gọi API.
Thời điểm access token hết hạn.
Refresh token dùng để làm mới access token.
Thời điểm refresh token hết hạn.