跳至主要内容

修改母帳戶的API Key設置

修改母帳戶API key的設置。使用待修改的api key調用接口。需使用帳戶的API key。

提示

在調用接口時,使用的API key至少需要擁有以下其中一種權限

  • 母API key: "Account Transfer(資產帳戶劃轉)", "Subaccount Transfer(母子帳戶劃轉)", "Withdrawal(提幣)"
信息

只能修改調用該接口的api key

HTTP 請求

POST /v5/user/update-api

請求參數

參數是否必須類型說明
readOnlyfalseinteger0 (默認):可讀可寫. 1:只讀
ipsfalsestring綁定IP. 比如: "192.168.0.1,192.168.0.2"注意:
  • 不傳參數ips 或者入参值為"*"意味著不綁定
  • 不綁定IP的api key將有90天的有效期限
  • 一旦帳戶密碼做了修改,帳戶下的非永久api key將在7天後失效
permissionsfalseObject勾選api key權限. 如果不修改權限, 則不要傳入該參數
> ContractTradefalsearray合約. ["Order","Position"]
> Spotfalsearray現貨. ["SpotTrade"]
> Walletfalsearray錢包. ["AccountTransfer","SubMemberTransfer"]
> OptionsfalsearrayUSDC合約. ["OptionsTrade"]
> Derivativesfalsearray統一帳戶權限. 該字段失效, 因為系統將會自動根據您的帳戶類型(經典帳戶和統一帳戶)來決定是否增加該權限
> CopyTradingfalsearray跟單交易. ["CopyTrading"]
> BlockTradefalsearray大宗商品交易. ["BlockTrade"]
> Exchangefalsearray兌換. ["ExchangeHistory"]
> NFTfalsearrayNFT. ["NFTQueryProductList"]
> Affiliatefalsearray代理商查詢權限. ["Affiliate"]
  • 該權限僅作用於代理商
  • 如果您需要該權限, 請確保移除所有其他權限項

返回參數

參數類型說明
idstring唯一id. 內部使用
notestring備註
apiKeystringApi key
readOnlyinteger0:可讀可寫. 1:只讀
secretstring總是 ""
permissionsObject權限類型
> ContractTradearray合約交易的權限
> Spotarray現貨交易的權限
> Walletarray錢包的權限
> OptionsarrayUSDC合約的權限. 該權限支持USDC合約下的期權和永續交易
> Derivativesarray統一帳戶權限
> CopyTradingarray跟單交易的權限
> BlockTradearray大宗交易的權限
> Exchangearray兌換的權限
> NFTarrayNFT的權限
ipsarray綁定的IP

請求示例

POST /v5/user/update-api HTTP/1.1
Host: api.bybit.com
X-BAPI-API-KEY: XXXXXX
X-BAPI-TIMESTAMP: 1676431264739
X-BAPI-RECV-WINDOW: 5000
X-BAPI-SIGN: XXXXXX
Content-Type: application/json

{
"readOnly": null,
"ips": "*",
"permissions": {
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"CopyTrading": [
"CopyTrading"
],
"BlockTrade": [],
"Exchange": [
"ExchangeHistory"
],
"NFT": [
"NFTQueryProductList"
]
}
}

響應示例

{
"retCode": 0,
"retMsg": "",
"result": {
"id": "13770661",
"note": "xxxxx",
"apiKey": "xxxxx",
"readOnly": 0,
"secret": "",
"permissions": {
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"Derivatives": [
"DerivativesTrade"
],
"CopyTrading": [
"CopyTrading"
],
"BlockTrade": [],
"Exchange": [
"ExchangeHistory"
],
"NFT": [
"NFTQueryProductList"
]
},
"ips": [
"*"
]
},
"retExtInfo": {},
"time": 1676431265427
}