Skip to main content

Set Margin Mode

Default is the regular margin mode. This mode is valid for USDT Perp, USDC Perp and Option.

HTTP Request

POST /unified/v3/private/account/setMarginMode

Request Parameters

ParameterRequiredTypeComments
setMarginModetruestringREGULAR_MARGIN, PORTFOLIO_MARGIN

Response Parameters

ParameterTypeComments
reasonsarrayEmpty array if the request is submitted successfully. Otherwise, there are failure Object
> reasonCodestringFail reason code
> reasonMsgstringFail reason msg

Request Example

POST /unified/v3/private/account/setMarginMode HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672023475526
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json

{
"setMarginMode": "REGULAR_MARGIN"
}

Response Example

{
"retCode": 3400045,
"retMsg": "Set margin mode failed",
"result": {
"reasons": [
{
"reasonCode": "3400102",
"reasonMsg": "Please ensure that there are no active orders in your USDC account, including Limit, Market and Conditional orders"
},
{
"reasonCode": "3400101",
"reasonMsg": "Please ensure that there are no positions in your USDC account, including USDC perpetual and options"
}
]
}
}