查詢API Key相關信息
獲取API key的相關信息。使用待查詢的api key調用接口。適用於母、子帳戶的api key。
提示
任意權限可以訪問該接口
HTTP 請求
GET /v5/user/query-api
請求參數
無
返回參數
參數 | 類型 | 說明 |
---|---|---|
id | string | 唯一id. 內部使用 |
note | string | 備註 |
apiKey | string | Api key |
readOnly | integer | 0 :可讀可寫. 1 :只讀 |
secret | string | 總是"" |
permissions | Object | 權限類型 |
> ContractTrade | array | 合約交易的權限 Order , Position |
> Spot | array | 現貨交易的權限 SpotTrade |
> Wallet | array | 錢包的權限 AccountTransfer , SubMemberTransfer (母帳戶), SubMemberTransferList (子帳戶), Withdraw (母帳戶) |
> Options | array | USDC合約的權限. 該權限支持USDC合約下的期權和永續交易 OptionsTrade |
> Derivatives | array | [] |
> CopyTrading | array | 總是[] , 因為帶單帳戶現在只需要通過ContractTrade 權限項來進行API帶單 |
> BlockTrade | array | 大宗交易的權限. 子帳戶暫不支持,總是[] |
> Exchange | array | 兌換的權限 ExchangeHistory |
> NFT | array | NFT的權限 NFTQueryProductList . 子帳戶暫不支持, 總是[] |
> Affiliate | array | 代理商權限. 僅代理商可以擁有此權限, 否則總是[] |
ips | array | 綁定的IP |
type | integer | Api key類型. 1 :個人使用, 2 :綁定到第三方應用 |
deadlineDay | integer | API key失效的倒數日. 針對那些未綁定IP的api key或者修改過密碼的帳戶 |
expiredAt | datetime | API key的過期日. 針對那些未綁定IP的api key或者修改過密碼的帳戶 |
createdAt | datetime | API key的創建日 |
unified | integer | 該字段已廢棄 |
uta | integer | API Key所屬的帳戶是否為統一交易帳戶. 0 :經典帳戶; 1 :統一交易账户 |
userID | integer | 用戶 ID |
inviterID | integer | 邀請人 ID(邀請該賬號加入平台的賬號的UID) |
vipLevel | string | VIP用戶等級 |
mktMakerLevel | string | market maker等級 |
affiliateID | integer | 代理商Id. 0 : 表示無任何代理綁定關係 |
rsaPublicKey | string | RSA公鑰 |
isMaster | boolean | 是否為主帳戶下的api key |
parentUid | string | 主帳戶uid. 如果是主帳戶本身調用, 則返回"0" |
kycLevel | string | 個人帳戶的kyc等級. LEVEL_DEFAULT , LEVEL_1 , LEVEL_2 |
kycRegion | string | 個人帳戶的kyc地區 |
請求示例
- HTTP
- Python
- Node.js
GET /v5/user/query-api HTTP/1.1
Host: api.bybit.com
X-BAPI-API-KEY: XXXXXX
X-BAPI-TIMESTAMP: 1676430842094
X-BAPI-RECV-WINDOW: 5000
X-BAPI-SIGN: XXXXXX
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.get_api_key_information())
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.getQueryApiKey()
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "",
"result": {
"id": "13770661",
"note": "readwrite api key",
"apiKey": "XXXXXX",
"readOnly": 0,
"secret": "",
"permissions": {
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"Derivatives": [],
"CopyTrading": [],
"BlockTrade": [],
"Exchange": [],
"NFT": [],
"Affiliate": []
},
"ips": [
"*"
],
"type": 1,
"deadlineDay": 66,
"expiredAt": "2023-12-22T07:20:25Z",
"createdAt": "2022-10-16T02:24:40Z",
"unified": 0,
"uta": 0,
"userID": 24617703,
"inviterID": 0,
"vipLevel": "No VIP",
"mktMakerLevel": "0",
"affiliateID": 0,
"rsaPublicKey": "",
"isMaster": true,
"parentUid": "0",
"kycLevel": "LEVEL_DEFAULT",
"kycRegion": ""
},
"retExtInfo": {},
"time": 1697525990798
}