列出当前账户已签发的全部 API 凭证(Credential)——也就是调用 https://api.acedata.cloud/** 业务接口时用的 32 位 Token。
ℹ️ 本接口属于 AceDataCloud 平台管理 API,统一前缀 https://platform.acedata.cloud/api/v1/。完整接口索引见获取 AceDataCloud 平台文档列表。
API 凭证 vs 账户令牌
新手最容易混淆——再强调一次:
| 维度 |
API 凭证(本文档) |
账户令牌(Account Token) |
| 用途 |
调 业务接口 https://api.acedata.cloud/** |
调 管理接口 https://platform.acedata.cloud/** |
| 格式 |
32 位十六进制 |
platform-v1- + 64 位十六进制(共 76 字符) |
| 数量 |
每个 Application 可发多枚 |
通常 1-2 枚 |
| 失效条件 |
可设额度上限 / 过期时间 / 绑定 IP |
主动删除时才失效 |
详见管理 AceDataCloud 平台账户令牌。
接口概览
| 项 |
内容 |
| 方法 |
GET |
| URL |
https://platform.acedata.cloud/api/v1/credentials/ |
| 鉴权 |
✅ 需要账户令牌 |
鉴权说明(如何获取账户令牌)
请求头:
1
|
Authorization: Bearer platform-v1-92eb****629c
|
获取方式:登录 AceDataCloud 平台 → Account Token 控制台 → 点击「创建」按钮。详见管理 AceDataCloud 平台账户令牌。
必传查询参数
⚠️ 必须带 ?user_id=<your_user_id>。列表接口逐对象做权限校验,没传时第一个非己对象就会返回 403 permission_denied。
获取 user_id:打开 https://auth.acedata.cloud/user/profile。
查询参数
| 参数 |
类型 |
必填 |
默认 |
说明 |
user_id |
UUID |
✅ |
— |
当前账户用户 ID |
application_id |
UUID |
否 |
— |
按 Application 过滤 |
service_id |
UUID |
否 |
— |
按服务过滤 |
disabled |
boolean |
否 |
— |
true 只看被禁用的,false 只看启用的 |
expired |
boolean |
否 |
— |
true 只看已过期的 |
limit |
integer |
否 |
10 |
每页条数 |
offset |
integer |
否 |
0 |
偏移 |
ordering |
string |
否 |
— |
排序字段,前缀 - 倒序。常用 -created_at、-used_at |
请求示例
cURL
1 2 3 4
|
USER_ID=89518d07-5560-4b05-92c1-667f3ddf6a4b curl "https://platform.acedata.cloud/api/v1/credentials/?user_id=${USER_ID}&limit=20" \ -H 'accept: application/json' \ -H 'authorization: Bearer platform-v1-92eb****629c'
|
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
import requests
PLATFORM_TOKEN = "platform-v1-92eb****629c" USER_ID = "89518d07-5560-4b05-92c1-667f3ddf6a4b"
resp = requests.get( "https://platform.acedata.cloud/api/v1/credentials/", headers={ "accept": "application/json", "authorization": f"Bearer {PLATFORM_TOKEN}", }, params={"user_id": USER_ID, "limit": 100}, timeout=10, ) data = resp.json() print(f"共 {data['count']} 枚凭证") for c in data["items"]: print(f" {c['name']:30s} {c['token'][:8]}...{c['token'][-4:]} 上次使用: {c.get('used_at') or '从未'}")
|
Node.js
1 2 3 4 5 6 7 8
|
const USER_ID = '89518d07-5560-4b05-92c1-667f3ddf6a4b' const url = new URL('https://platform.acedata.cloud/api/v1/credentials/') url.searchParams.set('user_id', USER_ID)
const r = await fetch(url, { headers: { authorization: 'Bearer platform-v1-92eb****629c' }, }) console.log(await r.json())
|
响应示例(HTTP 200)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
{ "count": 5, "items": [ { "id": "df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6", "user_id": "89518d07-5560-4b05-92c1-667f3ddf6a4b", "application_id": "82f57141-2323-4453-8730-60f7d833a2da", "name": "production-server-01", "token": "ac****ab", "amount": null, "used_amount": 12.34, "remaining_amount": null, "disabled": false, "expired_at": null, "tags": ["prod"], "metadata": null, "client_ip_allowlist": null, "used_at": "2026-04-26T08:30:00Z", "created_at": "2026-04-26T07:55:00Z", "updated_at": "2026-04-26T08:30:00Z" } ] }
|
⚠️ 列表接口的 token 字段是脱敏的(前 2 + **** + 后 2 字符)。需要完整 Token 时请到创建 AceDataCloud 平台 API 凭证接口在创建当时保存。如果忘了保存只能轮换或删除重建。
响应字段说明
| 字段 |
类型 |
说明 |
id |
UUID |
凭证 ID |
user_id |
UUID |
所属用户 |
application_id |
UUID |
关联的 Application |
name |
string |
用户自定义名称(便于在控制台辨认) |
token |
string |
脱敏后的 Token 预览 |
amount |
number \ |
null |
单凭证额度上限(null 表示无上限,可用 Application 全部余额) |
used_amount |
number |
该凭证累计已消耗 |
remaining_amount |
number \ |
null |
剩余可用额度(如 amount 为 null 则也为 null) |
disabled |
boolean |
是否被禁用 |
expired_at |
string \ |
null |
过期时间 |
tags |
array \ |
null |
用户自定义标签 |
metadata |
object \ |
null |
自定义元数据 |
client_ip_allowlist |
array \ |
null |
允许调用的 IP 白名单(CIDR) |
used_at |
string \ |
null |
上次使用时间 |
created_at |
string |
创建时间 |
updated_at |
string |
最近变更时间 |
错误处理
| HTTP |
code |
含义 |
| 401 |
not_authenticated |
缺少账户令牌 |
| 403 |
permission_denied |
未传 ?user_id= 或传了别人的 user_id |
实用提示
token 脱敏不可逆——只有在创建或轮换那一刻完整明文返回一次,请务必当场存进密码管理器。
- 生产环境强烈推荐设
amount 限额:通过创建凭证时指定,可避免凭证泄露后被无限制扣费。
- 僵尸凭证清理:
used_at 为 null 或长时间未更新的,可以批量删除。
相关接口