Skip to main content

Create Sub-account API Key (For Master Account) (TRADE)

API Description​

Create a new API Key for a sub-account.

HTTP Request​

POST /sapi/v1/sub-account/subAccountApi

Request Weight(UID)​

3000

Request Parameters​

NameTypeMandatoryDescription
emailSTRINGYESSub-account email
apiNameSTRINGYESAPI Key name
statusINTEGERYESIP restriction status. 1 = unrestricted, 2 = restricted to trusted IPs, 3 = third-party IP restriction
canTradeBOOLEANNOSpot & Margin trading permission, default false
canMarginLoanRepayBOOLEANNOMargin borrow/repay permission, default false
canFuturesTradeBOOLEANNOFutures trading permission, default false
canUniversalTransferBOOLEANNOUniversal transfer permission, default false
canVanillaOptionsBOOLEANNOVanilla options permission, default false
canFixApiTradingBOOLEANNOFIX API Trading permission. Only supported for API Keys using an Ed25519 public key. Setting it to true for any other key type returns -9000 Unsupported operation
canFixApiReadingBOOLEANNOFIX API Reading permission. Only supported for API Keys using an Ed25519 public key. Setting it to true for any other key type returns -9000 Unsupported operation
ipAddressSTRINGNORequired when status=2. IP address list, max 500 chars
thirdPartyNameSTRINGNORequired when status=3. Third-party name
publicKeySTRINGNOEd25519 public key (optional, for Ed25519 type API Key)
recvWindowLONGNO
timestampLONGYES
  • status=2 requires ipAddress
  • status=3 requires thirdPartyName
  • Asset Sub Account is not supported
  • The caller must pass the KYC IP restriction check

Response Example​

{
"apiName": "myKey",
"apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A",
"secretKey": "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j",
"canTrade": true,
"canMarginLoanRepay": false,
"canFuturesTrade": false,
"canUniversalTransfer": false,
"canVanillaOptions": false,
"canFixApiTrading": true,
"canFixApiReading": false,
"status": 2,
"ipList": [
"192.168.1.1",
"10.0.0.1"
]
}

Response Parameters​

NameTypeDescription
apiNameSTRINGAPI Key name
apiKeySTRINGAPI Key (public key)
secretKeySTRINGSecret Key. Returned only once on creation, please keep it safe
canTradeBOOLEANSpot & Margin trading permission
canMarginLoanRepayBOOLEANMargin borrow/repay permission
canFuturesTradeBOOLEANFutures trading permission
canUniversalTransferBOOLEANUniversal transfer permission
canVanillaOptionsBOOLEANVanilla options permission
canFixApiTradingBOOLEANFIX API Trading permission
canFixApiReadingBOOLEANFIX API Reading permission
statusINTEGERIP restriction status. 1 = unrestricted, 2 = restricted to trusted IPs, 3 = third-party IP restriction
ipListARRAYIP list (IP addresses when status=2; third-party names when status=3)