Modify Master API Key
Modify the settings of master api key. Use the api key pending to be modified to call the endpoint. Use master user's api key only.
tip
The API key must have one of the below permissions in order to call this endpoint..
- master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal"
- For Read_Write apikey, adding or deleting FiatP2P, FiatBitPay, and FiatConvertBroker is prohibited.
ComplianceAppealcan be granted only to Bybit global master accounts with read-write API keys (readOnly=0). Subaccounts, other sites, OAuth, and TaxAPI keys are not supported.
info
Only the api key that calls this interface can be modified
HTTP Request
POST/v5/user/update-apiRequest Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| readOnly | false | integer | 0 (default): Read and Write. 1: Read only |
| permissions | false | Object | Tick the types of permission. Don't send this param if you don't want to change the permission |
| > ContractTrade | false | array | Contract Trade. ["Order","Position"] |
| > Spot | false | array | Spot Trade. ["SpotTrade"] |
| > Wallet | false | array | Wallet. ["AccountTransfer","SubMemberTransfer"] |
| > Options | false | array | USDC Contract. ["OptionsTrade"] |
| > Exchange | false | array | Convert. ["ExchangeHistory"] |
| > Earn | false | array | Earn product. ["Earn"] |
| > FiatP2P | false | array | P2P ["FiatP2POrder", "Advertising"] |
| > FiatBitPay | false | array | Bybit Pay ["FaitPayOrder"] |
| > FiatConvertBroker | false | array | Fiat convert ["FiatConvertBrokerOrder"] |
| > BitCard | false | array | Bybit card permission, ["BitCard"] |
| > ByXPost | false | array | Community post permission, ["ByXPost"] |
| > Affiliate | false | array | Affiliate permission. ["Affiliate"]
|
| > Derivatives | false | array | ["DerivativesTrade"] |
| > BlockTrade | false | array | ["BlockTrade"] |
| > Compliance | false | array | Compliance permission for querying TM Onchain appeal status and submitting related materials. Set to ["ComplianceAppeal"] to grant or [] to revoke. When updating other permission categories, include the current value to retain this permission. Clear this category before changing readOnly to 1. |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| id | string | Unique id. Internal used |
| note | string | The remark |
| apiKey | string | Api key |
| readOnly | integer | 0: Read and Write. 1: Read only |
| secret | string | Always "" |
| permissions | Object | The types of permission |
| > ContractTrade | array | Permisson of contract trade |
| > Spot | array | Permisson of spot |
| > Wallet | array | Permisson of wallet |
| > Options | array | Permission of USDC Contract. It supports trade option and usdc perpetual. |
| > Derivatives | array | Permission of Unified account |
| > BlockTrade | array | Permission of blocktrade |
| > Exchange | array | Permission of convert |
| > Earn | array | Permission of earn |
| > Affiliate | array | Affiliate permission |
| > FiatP2P | array | Permission of P2P |
| > FiatBitPay | array | Permission of Bybit pay |
| > FiatConvertBroker | array | Permission of fiat convert |
| > NFT | array | Deprecated, always [] |
| > CopyTrading | array | Deprecated, always [] |
| > Compliance | array | Updated Compliance permission, ComplianceAppeal, for querying TM Onchain appeal status and submitting related materials. Only Bybit global master accounts with read-write API keys (readOnly=0) can hold this permission; returns [] when not granted or revoked. |
| ips | array | IP bound |
Request Example
- HTTP
- Python
- Node.js
POST /v5/user/update-api HTTP/1.1
Host: api.bybit.com
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1676431264739
X-BAPI-RECV-WINDOW: 5000
X-BAPI-SIGN: XXXXXX
Content-Type: application/json
{
"readOnly": null,
"permissions": {
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"CopyTrading": [
"CopyTrading"
],
"BlockTrade": [],
"Exchange": [
"ExchangeHistory"
],
"Compliance": [
"ComplianceAppeal"
],
"NFT": [
"NFTQueryProductList"
]
}
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="xxxxxxxxxxxxxxxxxx",
api_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
)
print(session.modify_master_api_key(
permissions={
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"Derivatives": [
"DerivativesTrade"
],
"CopyTrading": [
"CopyTrading"
],
"BlockTrade": [],
"Exchange": [
"ExchangeHistory"
],
"Compliance": [
"ComplianceAppeal"
],
"NFT": [
"NFTQueryProductList"
]
}
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'xxxxxxxxxxxxxxxxxx',
secret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
});
client
.updateMasterApiKey({
permissions: {
ContractTrade: ['Order', 'Position'],
Spot: ['SpotTrade'],
Wallet: ['AccountTransfer', 'SubMemberTransfer'],
Options: ['OptionsTrade'],
Derivatives: ['DerivativesTrade'],
CopyTrading: ['CopyTrading'],
BlockTrade: [],
Exchange: ['ExchangeHistory'],
Compliance: ['ComplianceAppeal'],
NFT: ['NFTQueryProductList'],
},
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Response Example
{
"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"
],
"Earn": [],
"Compliance": [
"ComplianceAppeal"
],
"NFT": [
"NFTQueryProductList"
]
},
"ips": [
"*"
]
},
"retExtInfo": {},
"time": 1676431265427
}