列出 API Key
使用系統存取權杖讀取目前帳戶的資料
中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://toapis.com 請替換為 https://toapis.cn.
驗證, 分頁及錯誤處理請參閱接入說明.
使用說明
僅讀取自有普通模型 Key 中繼資料. 清單依數字 ID 倒序, 預設排除軟刪除及 stats:read 憑證; 詳情可讀取自有軟刪除 Key. key_hint 僅含固定遮罩及末 4 位, 過短時為 null. 無限額度使用 unlimited=true, remaining_credits=null; 日/月無限制也為 null. 不回傳原始 Key 或 Webhook 密鑰. 他人及不存在的 Key 均回傳 404.
驗證
Authorizationstring請求頭必填使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 此介面不接受模型 API Key, 不需要 X-User-Id.
請求參數
limitinteger查詢預設值: 50每頁最多回傳的項目數.
限制: minimum=1; maximum=100; 預設值: 50.
cursorstring查詢原樣傳入上一頁的 next_cursor, 保留相同篩選條件. 變更條件後重新開始.
限制: maxLength=2048.
statusstring查詢API Key 狀態.
限制: enabled, disabled, expired, exhausted, deleted.
請求示例
curl --request GET \
--url 'https://toapis.com/api/v1/account/api-keys?status=enabled&limit=20' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://toapis.com/api/v1/account/api-keys",
headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
params={
"status": "enabled",
"limit": "20"
},
timeout=30,
)
response.raise_for_status()
print(response.json())const url = new URL("https://toapis.com/api/v1/account/api-keys");
url.search = new URLSearchParams({
"status": "enabled",
"limit": "20"
}).toString();
const response = await fetch(url, {
headers: { Authorization: "Bearer YOUR_SYSTEM_ACCESS_TOKEN" },
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());回應欄位
範例使用虛構資料, 並假設 credits_per_usd="100". 實際換算請以回應為準.
清單位於 data.items, 以 has_more 及 next_cursor 分頁. 最後一頁的游標為 null, 不回傳總數.
codeinteger業務狀態碼, 成功時為 0.
messagestring回應訊息, 成功時為空字串. 錯誤訊息依請求語言回傳.
dataobject本次查詢的結果物件.
data.itemsobject[]目前頁面的記錄清單, 空結果為 [].
data.items[].idstring模型 API Key 的 ID, 並非 Key 原文. 以十進位 ID 字串回傳.
data.items[].namestringAPI Key 的名稱.
data.items[].key_hintstring | null固定遮罩及 Key 末 4 位, 不回傳完整密鑰. 過短時為 null.
data.items[].statusstringAPI Key 目前狀態. 詳情可包含自有軟刪除 Key. 可選值: enabled, disabled, expired, exhausted, deleted, unknown.
data.items[].created_atstring | null建立時間. 時間格式為含時區的 RFC 3339. 無法確認或不適用時為 null.
data.items[].expires_atstring | nullKey 到期時間, 未設定時為 null. 時間格式為含時區的 RFC 3339.
data.items[].unlimitedbooleanKey 是否無限額度. 為 true 時 remaining_credits=null.
data.items[].remaining_creditsstring | null剩餘額度, 單位為 credits. API Key 無限額時為 null. 以十進位字串回傳以保留精度.
data.items[].daily_limit_creditsstring | null每日額度上限, 單位為 credits, 無限制時為 null. 以十進位字串回傳以保留精度.
data.items[].monthly_limit_creditsstring | null每月額度上限, 單位為 credits, 無限制時為 null. 以十進位字串回傳以保留精度.
data.has_moreboolean是否還有下一頁.
data.next_cursorstring | null下一頁游標, 原樣作為 cursor 傳入並保留篩選條件. 最後一頁為 null.
data.metaobject資料來源, 查詢範圍及資料口徑等中繼資料.
data.meta.scopestring查詢資料的歸屬範圍, 目前為驗證帳戶自身.
響應示例
{
"code": 0,
"message": "",
"data": {
"items": [
{
"id": "42",
"name": "Example Key",
"key_hint": "****abcd",
"status": "enabled",
"created_at": "2026-10-01T00:00:00Z",
"expires_at": null,
"unlimited": false,
"remaining_credits": "500",
"daily_limit_credits": "100",
"monthly_limit_credits": null
}
],
"has_more": false,
"next_cursor": null,
"meta": {
"scope": "self"
}
}
}