列出 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 与不存在的 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 位, 不返回完整密钥. Key 过短时为 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"
}
}
}