分销机构管理 API
分销机构 API 允许合作伙伴自主管理 API Key,为其客户创建和分发子 Key,实现独立的用户管理和配额控制。
基础信息
- Base URL:
https://open.aicoin.com/api/upgrade/v2/distributor - 鉴权方式:签名参数(见 如何获取 API 认证参数)
说明:
- 签名参数(AccessKeyId / SignatureNonce / Timestamp / Signature)统一放在 URL Query。签名计算仅使用以下字符串(顺序固定):
AccessKeyId={AccessKeyId}&SignatureNonce={SignatureNonce}&Timestamp={Timestamp},再用SecretKey进行HmacSHA1后取 hex digest,最后对 hex 字符串进行Base64。 - 业务参数放在请求体 JSON(仅
POST/PUT接口)。 - GET 请求的所有业务参数均放在 URL Query。
请求必带参数
管理 API 的每个请求需要携带:
AccessKeyIdSignatureNonceTimestampSignature
接口列表
GET/api/upgrade/v2/distributor/info
获取分销机构信息
获取当前分销机构的基础信息(包含子 Key 上限与月度总额度)。
请求参数
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
access_key- Type
- string
- Description
- 分销机构 AccessKey
- Name
name- Type
- string
- Description
- 分销机构名称
- Name
level- Type
- string
- Description
- 分销机构自身等级
- Name
max_sub_keys- Type
- integer
- Description
- 允许创建的子 Key 数量上限
- Name
sub_key_count- Type
- integer
- Description
- 当前已创建的子 Key 数量
- Name
max_total_quota- Type
- integer
- Description
- 分销机构月度总额度上限
请求
GET
/api/upgrade/v2/distributor/infocurl -G https://open.aicoin.com/api/upgrade/v2/distributor/info \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"access_key": "distributor_ak_xxxx",
"name": "Partner-Alpha",
"level": "Default",
"max_sub_keys": 100,
"sub_key_count": 45,
"max_total_quota": 1000000
}
}
GET/api/upgrade/v2/distributor/quota
获取配额详情
获取分销机构维度的月度配额对账信息(含已分配/可分配/已消耗/剩余)。
请求参数
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
说明:
max_total_quota是分销机构维度的“总月度请求数硬上限”(所有子 Key 合计消耗)。allocated_quota是当前已分配给所有子 Key 的月度额度总和。available_quota是当前分销机构剩余可分配给子 Key 的月度额度 (max_total_quota - allocated_quota)。used_quota是本月所有子 Key 累计已消耗的请求总数。remaining_quota是本月分销机构总额度下剩余可用的请求数 (max(max_total_quota - used_quota, 0))。
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
max_total_quota- Type
- integer
- Description
- 合同约定的月度总请求额度上限
- Name
allocated_quota- Type
- integer
- Description
- 已分配给所有子 Key 的月度额度总和
- Name
available_quota- Type
- integer
- Description
- 剩余可分配配额
- Name
used_quota- Type
- integer
- Description
- 本月已真实消耗的请求数(所有子 Key 合计)
- Name
remaining_quota- Type
- integer
- Description
- 本月剩余可用请求数
请求
GET
/api/upgrade/v2/distributor/quotacurl -G https://open.aicoin.com/api/upgrade/v2/distributor/quota \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"max_total_quota": 1000000,
"allocated_quota": 650000,
"available_quota": 350000,
"used_quota": 12500,
"remaining_quota": 987500
}
}
GET/api/upgrade/v2/distributor/levels
列出可用档位
用于列出当前分销机构已经配置过的 level 名称列表。
请求参数
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- array
- Description
- 档位名称列表
请求
GET
/api/upgrade/v2/distributor/levelscurl -G https://open.aicoin.com/api/upgrade/v2/distributor/levels \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": ["gold", "silver"]
}
GET/api/upgrade/v2/distributor/levels/:level
获取档位配置
返回指定档位的“配额模板 + 权限集合”。
请求参数
- Name
level- Type
- string
- Description
- 档位名称(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
request_limits- Type
- object
- Description
限额模板
- Name
max_time_range- Type
- integer
- Description
- 最大查询时间跨度(秒)
- Name
max_request- Type
- integer
- Description
- 默认月度请求限额
- Name
request_rate_limit- Type
- integer
- Description
- 每分钟请求速率限制(QPM)
- Name
permissions- Type
- array
- Description
- 权限集合(resource_type + actions)
请求
GET
/api/upgrade/v2/distributor/levels/:levelcurl -G https://open.aicoin.com/api/upgrade/v2/distributor/levels/gold \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"request_limits": {
"max_time_range": 2592000,
"max_request": 200000,
"request_rate_limit": 120
},
"permissions": [
{"resource_type": "futures", "actions": ["FUNDING_RATE_HISTORY"]}
]
}
}
PUT/api/upgrade/v2/distributor/levels/:level
创建或更新档位配置
创建或更新指定档位的“限额模板 + 权限集合”。
请求参数
- Name
level- Type
- string
- Description
- 档位名称(路径参数)
- Name
request_limits- Type
- object
- Description
- 限额模板
- Name
permissions- Type
- array
- Description
- 权限集合(resource_type + actions)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
说明:
permissions用于配置“资源-动作”的允许集合。request_limits用于配置该档位的限额模板。
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
PUT
/api/upgrade/v2/distributor/levels/:levelcurl -X PUT 'https://open.aicoin.com/api/upgrade/v2/distributor/levels/gold?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE' \
-H 'Content-Type: application/json' \
-d '{
"request_limits": {
"max_time_range": 2592000,
"max_request": 200000,
"request_rate_limit": 120
},
"permissions": [
{"resource_type": "futures", "actions": ["FUNDING_RATE_HISTORY", "WEIGHTED_FUNDING_RATE"]},
{"resource_type": "trading_pair", "actions": ["TRADE_DATA", "LATEST_DEPTH"]}
]
}'
响应
{
"success": true,
"msg": "Operation successful"
}
DELETE/api/upgrade/v2/distributor/levels/:level
删除档位配置
删除指定档位的配置(权限集合与配额模板)。
请求参数
- Name
level- Type
- string
- Description
- 档位名称(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
DELETE
/api/upgrade/v2/distributor/levels/:levelcurl -X DELETE 'https://open.aicoin.com/api/upgrade/v2/distributor/levels/gold?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE'
响应
{
"success": true,
"msg": "Operation successful"
}
POST/api/upgrade/v2/distributor/sub-keys
创建子 Key
创建一个子 Key 并分配其独立配额与限流参数。
请求参数
- Name
name- Type
- string
- Description
- 子 Key 名称
- Name
monthly_quota- Type
- integer
- Description
- 子 Key 月度配额(可选,不传走默认/自动分配;显式传入时必须>=1)
- Name
rate_limit- Type
- integer
- Description
- 每分钟请求限制(QPM)
- Name
max_time_range- Type
- integer
- Description
- 最大查询时间跨度(秒)
- Name
expires_in- Type
- integer
- Description
- 有效期(秒)
- Name
metadata- Type
- string
- Description
- 扩展信息(JSON string)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
说明:
secret_key仅在创建时返回一次,如遗失需使用“重置密钥”接口。monthly_quota:- 显式传入时必须
>=1,否则返回400,错误信息:子Key月度额度必须>=1。 - 不传时:
- 若分销机构配置了
max_total_quota > 0,默认分配当前剩余可分配额度(available_quota = max_total_quota - allocated_quota)。 - 若
max_total_quota == 0,使用系统默认值(当前默认1000)。
- 若分销机构配置了
- 显式传入时必须
- 子 Key 实际消耗时,不仅受自身
monthly_quota限制,还受分销商max_total_quota的硬上限限制。
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
access_key- Type
- string
- Description
- 子 AccessKey
- Name
secret_key- Type
- string
- Description
- 子 SecretKey(仅创建时返回)
- Name
name- Type
- string
- Description
- 子 Key 名称
- Name
level- Type
- string
- Description
- 子 Key 等级
- Name
created_at- Type
- string
- Description
- 创建时间(RFC3339)
- Name
expires_at- Type
- string
- Description
- 过期时间(RFC3339,可为 null)
请求
POST
/api/upgrade/v2/distributor/sub-keyscurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE' \
-H 'Content-Type: application/json' \
-d '{
"name": "客户A的API Key",
"monthly_quota": 10000,
"rate_limit": 60,
"max_time_range": 2592000,
"expires_in": 31536000,
"metadata": "{\"customer_id\":\"12345\"}"
}'
响应
{
"success": true,
"data": {
"access_key": "sub_ak_xxxx",
"secret_key": "sub_sk_xxxx",
"name": "客户A的API Key",
"level": "premium",
"created_at": "2026-01-29T14:30:15+08:00",
"expires_at": null
}
}
GET/api/upgrade/v2/distributor/sub-keys
获取子 Key 列表
获取子 Key 列表,支持分页与筛选。
请求参数
- Name
page- Type
- integer
- Description
- 页码
- Name
page_size- Type
- integer
- Description
- 每页条数
- Name
status- Type
- integer
- Description
- 状态筛选(可选)
- Name
keyword- Type
- string
- Description
- 关键字筛选(可选)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
list- Type
- array
- Description
- 子 Key 列表
- Name
total- Type
- integer
- Description
- 总数
- Name
page- Type
- integer
- Description
- 当前页码
- Name
page_size- Type
- integer
- Description
- 每页条数
请求
GET
/api/upgrade/v2/distributor/sub-keyscurl -G https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys \
-d "page=1" \
-d "page_size=10" \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"list": [
{
"access_key": "sub_ak_xxxx",
"name": "客户A的API Key",
"status": 1,
"monthly_quota": 10000,
"rate_limit": 60,
"max_time_range": 2592000,
"expires_at": 1769485324
}
],
"total": 1,
"page": 1,
"page_size": 10
}
}
GET/api/upgrade/v2/distributor/sub-keys/:access_key
获取子 Key 详情
获取指定子 Key 的详细信息。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
- 子 Key 详情
请求
GET
/api/upgrade/v2/distributor/sub-keys/:access_keycurl -G https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"access_key": "sub_ak_xxxx",
"name": "客户A的API Key",
"status": 1,
"monthly_quota": 10000,
"rate_limit": 60,
"max_time_range": 2592000,
"expires_at": "2026-01-29T14:30:15+08:00",
"metadata": "{\"customer_id\":\"12345\"}"
}
}
PUT/api/upgrade/v2/distributor/sub-keys/:access_key
更新子 Key
更新指定子 Key 的配置。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
name- Type
- string
- Description
- 子 Key 名称(可选)
- Name
status- Type
- integer
- Description
- 状态(可选)
- Name
monthly_quota- Type
- integer
- Description
- 月度配额(可选)
- Name
rate_limit- Type
- integer
- Description
- QPM 限流(可选)
- Name
max_time_range- Type
- integer
- Description
- 最大查询时间跨度(秒,可选)
- Name
expires_in- Type
- integer
- Description
- 有效期(秒,从当前时间开始;传 0 表示清空有效期)
- Name
metadata- Type
- string
- Description
- 扩展信息(JSON string,可选)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
PUT
/api/upgrade/v2/distributor/sub-keys/:access_keycurl -X PUT 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE' \
-H 'Content-Type: application/json' \
-d '{"monthly_quota": 20000, "rate_limit": 120}'
响应
{
"success": true,
"msg": "Operation successful"
}
DELETE/api/upgrade/v2/distributor/sub-keys/:access_key
删除子 Key
删除指定子 Key。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
DELETE
/api/upgrade/v2/distributor/sub-keys/:access_keycurl -X DELETE 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE'
响应
{
"success": true,
"msg": "Operation successful"
}
POST/api/upgrade/v2/distributor/sub-keys/:access_key/enable
启用子 Key
启用指定子 Key。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
POST
/api/upgrade/v2/distributor/sub-keys/:access_key/enablecurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx/enable?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE'
响应
{
"success": true,
"msg": "Operation successful"
}
POST/api/upgrade/v2/distributor/sub-keys/:access_key/disable
禁用子 Key
禁用指定子 Key。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
POST
/api/upgrade/v2/distributor/sub-keys/:access_key/disablecurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx/disable?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE'
响应
{
"success": true,
"msg": "Operation successful"
}
POST/api/upgrade/v2/distributor/sub-keys/:access_key/reset-secret
重置子 Key 密钥
重置指定子 Key 的密钥,重置后原 SecretKey 立即失效。
请求参数
- Name
access_key- Type
- string
- Description
- 子 AccessKey(路径参数)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
返回数据
- Name
access_key- Type
- string
- Description
- 子 AccessKey
- Name
secret_key- Type
- string
- Description
- 新的子 SecretKey
请求
POST
/api/upgrade/v2/distributor/sub-keys/:access_key/reset-secretcurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/sub_ak_xxxx/reset-secret?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE'
响应
{
"success": true,
"data": {
"access_key": "sub_ak_xxxx",
"secret_key": "new_sub_sk_xxxx"
}
}
GET/api/upgrade/v2/distributor/sub-keys/stats
子 Key 统计
获取子 Key 总数、启用/禁用数,以及分销机构月度额度使用概览。
请求参数
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
data- Type
- object
- Description
- 统计数据
请求
GET
/api/upgrade/v2/distributor/sub-keys/statscurl -G https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/stats \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应
{
"success": true,
"data": {
"total_sub_keys": 120,
"active_sub_keys": 115,
"disabled_sub_keys": 5,
"total_quota": 1000000,
"used_quota": 450000,
"remaining_quota": 550000
}
}
POST/api/upgrade/v2/distributor/sub-keys/batch-enable
批量启用子 Key
批量启用多个子 Key。
请求参数
- Name
access_keys- Type
- array
- Description
- 需要启用的子 AccessKey 列表
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
POST
/api/upgrade/v2/distributor/sub-keys/batch-enablecurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/batch-enable?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE' \
-H 'Content-Type: application/json' \
-d '{"access_keys": ["ak_xxx1", "ak_xxx2"]}'
响应
{
"success": true,
"msg": "Operation successful"
}
POST/api/upgrade/v2/distributor/sub-keys/batch-disable
批量禁用子 Key
批量禁用多个子 Key。
请求参数
- Name
access_keys- Type
- array
- Description
- 需要禁用的子 AccessKey 列表
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
success- Type
- boolean
- Description
- 接口状态
- Name
msg- Type
- string
- Description
- 操作结果描述
请求
POST
/api/upgrade/v2/distributor/sub-keys/batch-disablecurl -X POST 'https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/batch-disable?AccessKeyId=YOUR_ACCESS_KEY_ID&SignatureNonce=RANDOM_NONCE&Timestamp=CURRENT_TIMESTAMP&Signature=YOUR_SIGNATURE' \
-H 'Content-Type: application/json' \
-d '{"access_keys": ["ak_xxx1", "ak_xxx2"]}'
响应
{
"success": true,
"msg": "Operation successful"
}
GET/api/upgrade/v2/distributor/sub-keys/export
导出子 Key
导出子 Key 数据,返回 JSON 文件内容。
请求参数
- Name
keyword- Type
- string
- Description
- 关键字筛选(可选)
- Name
AccessKeyId- Type
- string
- Description
- 分销机构主 AccessKeyId
- Name
SignatureNonce- Type
- string
- Description
- 签名随机数
- Name
Timestamp- Type
- string
- Description
- 请求时间戳(秒)
- Name
Signature- Type
- string
- Description
- 使用 HmacSHA1 + Base64 生成的签名
返回数据
- Name
data- Type
- array
- Description
- 导出的子 Key 数据列表(文件内容)
请求
GET
/api/upgrade/v2/distributor/sub-keys/exportcurl -G https://open.aicoin.com/api/upgrade/v2/distributor/sub-keys/export \
-d "AccessKeyId=YOUR_ACCESS_KEY_ID" \
-d "SignatureNonce=RANDOM_NONCE" \
-d "Timestamp=CURRENT_TIMESTAMP" \
-d "Signature=YOUR_SIGNATURE"
响应(文件内容示例)
[
{
"access_key": "sub_ak_xxxx",
"name": "客户A的API Key",
"status": 1,
"monthly_quota": 10000,
"used_quota": 1200,
"created_at": "2026-01-27"
}
]
错误码约定(HTTP)
200:成功400:参数错误401:签名认证失败(缺参/时间戳过期/签名错误/无效 access key)403:权限不足(非分销机构/机构被禁用/子 key 被禁用或过期/分销主 key 访问非管理接口等)429:频率或配额限制触发500:内部错误