Access Token
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/connect/token \
--header 'x-api-key: <api-key>' \
--header 'x-client-id: <api-key>'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
headers = {
"x-api-key": "<api-key>",
"x-client-id": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-client-id': '<api-key>'}
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/connect/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-sandbox.uqpaytech.com/api/v1/connect/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-client-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-client-id", "<api-key>")
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-sandbox.uqpaytech.com/api/v1/connect/token")
.header("x-api-key", "<api-key>")
.header("x-client-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-client-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"auth_token": "2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA",
"expired_at": 1757449854
}Authentication
Access Token
在 HTTP 请求头中指定你的 x-client-id 和 x-api-key 以请求 Access Token。返回的 auth_token 是所有其他 API 端点都必需的,必须通过 x-auth-token 请求头传递,并以 Bearer 为前缀——例如 x-auth-token: Bearer <YOUR_TOKEN_HERE>。所有业务线都要求带上 Bearer 前缀。
Access Token 在过期前可用于所有其他 API 端点,可多次使用。请以 expired_at 为准获取准确的 Token 过期时间。
auth_token 在生产环境中的有效期为 30 分钟。
各业务线的 Token 并发规则
新签发的 Token 是否会使先前的 Token 失效,取决于具体业务线:
- 多个 Token 可同时有效(新签发的 Token 不会使先前的 Token 失效)——Account Center、Card Issuance。
- 仅单个 Token 有效(新签发的 Token 会立即使先前的 Token 失效)——Global Account、Global Acquiring、Stablecoin Account。
对于仅单 Token 有效的业务线,避免多个进程并发请求新 Token——一旦某个进程刷新了 Token,其他正在运行的进程可能会开始收到身份验证错误。
POST
/
v1
/
connect
/
token
Access Token
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/connect/token \
--header 'x-api-key: <api-key>' \
--header 'x-client-id: <api-key>'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
headers = {
"x-api-key": "<api-key>",
"x-client-id": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-client-id': '<api-key>'}
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/connect/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-sandbox.uqpaytech.com/api/v1/connect/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-client-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-client-id", "<api-key>")
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-sandbox.uqpaytech.com/api/v1/connect/token")
.header("x-api-key", "<api-key>")
.header("x-client-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-client-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"auth_token": "2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA",
"expired_at": 1757449854
}
