APIKey管理
curl --request GET \
--url https://api.tickdb.ai/v1/apikeys/subscriptions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/apikeys/subscriptions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/apikeys/subscriptions', 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.tickdb.ai/v1/apikeys/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <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.tickdb.ai/v1/apikeys/subscriptions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/apikeys/subscriptions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/apikeys/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"server_time": "2023-11-07T05:31:56Z",
"total": 1,
"api_keys": [
{
"key_prefix": "<string>",
"name": "<string>",
"plan": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"remaining_seconds": 1,
"created_at": "2023-11-07T05:31:56Z"
}
]
},
"message": "<string>"
}其他介面
APIKey管理
無需登入官網,即可查詢 API Key 的到期情況,方便定時檢查和設定提醒。
GET
/
v1
/
apikeys
/
subscriptions
APIKey管理
curl --request GET \
--url https://api.tickdb.ai/v1/apikeys/subscriptions \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/apikeys/subscriptions"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/apikeys/subscriptions', 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.tickdb.ai/v1/apikeys/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <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.tickdb.ai/v1/apikeys/subscriptions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/apikeys/subscriptions")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/apikeys/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"server_time": "2023-11-07T05:31:56Z",
"total": 1,
"api_keys": [
{
"key_prefix": "<string>",
"name": "<string>",
"plan": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"remaining_seconds": 1,
"created_at": "2023-11-07T05:31:56Z"
}
]
},
"message": "<string>"
}套餐權限
| 套餐 | 可用 |
|---|---|
| 免費版 | ✅ |
| 基礎版 | ✅ |
| 專業版 | ✅ |
| 全量套餐(A 股、港股、美股) | ✅ |
| 企業版 | ✅ |
請求參數
此介面不需要查詢參數。請求示例
curl -H "X-API-Key: YOUR_API_KEY" \
"https://api.tickdb.ai/v1/apikeys/subscriptions"
返回欄位說明
以下列出data 中的欄位;外層 code=0 表示成功。
| 欄位 | 說明 |
|---|---|
| server_time | 本次查詢的伺服器時間,包含時區的日期時間字串。 |
| total | 返回的 API Key 數量。 |
| api_keys | 帳戶名下的 API Key 列表。 |
| └─ key_prefix | API Key 前綴,用於辨認 Key;不是完整密鑰。 |
| └─ name | API Key 名稱。 |
| └─ plan | 該 Key 對應的方案識別碼。 |
| └─ status | Key 狀態:active(有效)、expired(已過期)、suspended(已暫停)、revoked(已撤銷)。 |
| └─ expires_at | 到期時間;未設定到期時間時為 null。 |
| └─ remaining_seconds | 距離到期的剩餘秒數;已到期時為 0,未設定到期時間時為 null。 |
| └─ created_at | API Key 建立時間。 |
