Rest API
Get Account Balances
Get Started
Rest API
WebSocket API
- WebSocket Connection
- Order Creation
- Order Book
- Error Reference
Rest API
Get Account Balances
This endpoint retrieves the account balances.
GET
/
api
/
v1
/
balances
curl --request GET \
--url https://user-account.sandbox.rails.xyz/api/v1/balances \
--header 'Authorization: Bearer <token>'
{
"balances": {
"totalBalance": "99996952.15429778",
"availableBalance": "99521353.92161779",
"deposit": "100000000",
"withdraw": "879.12",
"withdrawFees": "8.88",
"fees": "608.02030021",
"pnl": "-1292.78457349",
"funding": "-259.04082851",
"volume": "608020.300274",
"margin": "7261788.9945241110003337",
"maintenanceMargin": "475598.23267999",
"leverage": "1",
"marketBalancesMap": {
"BTC-USD": {
"position": "467782.520726",
"positionQuantity": "7",
"liquidationPrice": "126380.268279734335477455",
"openBuy": "60000",
"openBuyQty": "1",
"openSell": "0",
"openSellQty": "0",
"pnl": "-1292.78457349",
"positionPnl": "-1292.7845734999864",
"funding": "113.21723468000002",
"positionFunding": "113.21723468000002",
"volume": "600695.07832",
"fees": "600.69507826",
"liquidationFees": "0",
"margin": "6498468.2474181248786156",
"maintenanceMargin": "527842.520726"
},
"ETH-USD": {
"position": "28894.648055999998",
"positionQuantity": "8",
"liquidationPrice": "28902.648056",
"openBuy": "0",
"openBuyQty": "0",
"openSell": "8000",
"openSellQty": "3",
"pnl": "406.23975999",
"positionPnl": "406.2397599999995",
"funding": "-486.82005787000037",
"positionFunding": "-486.82005787000037",
"volume": "43545.091964",
"fees": "43.54509196",
"liquidationFees": "0",
"margin": "762320.7471059860003337",
"maintenanceMargin": "28902.648056"
}
}
}
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
Example value: ETH-USD
. To get all supported markets, call /api/v1/markets endpoint. Omit this parameter to get results across all markets.
Response
200 - application/json
Successful response
A map of market names (e.g., BTC-USD
and ETH-USD
) to market balance details. The key is the market name, and the value is an object containing market-specific balance details.
curl --request GET \
--url https://user-account.sandbox.rails.xyz/api/v1/balances \
--header 'Authorization: Bearer <token>'
{
"balances": {
"totalBalance": "99996952.15429778",
"availableBalance": "99521353.92161779",
"deposit": "100000000",
"withdraw": "879.12",
"withdrawFees": "8.88",
"fees": "608.02030021",
"pnl": "-1292.78457349",
"funding": "-259.04082851",
"volume": "608020.300274",
"margin": "7261788.9945241110003337",
"maintenanceMargin": "475598.23267999",
"leverage": "1",
"marketBalancesMap": {
"BTC-USD": {
"position": "467782.520726",
"positionQuantity": "7",
"liquidationPrice": "126380.268279734335477455",
"openBuy": "60000",
"openBuyQty": "1",
"openSell": "0",
"openSellQty": "0",
"pnl": "-1292.78457349",
"positionPnl": "-1292.7845734999864",
"funding": "113.21723468000002",
"positionFunding": "113.21723468000002",
"volume": "600695.07832",
"fees": "600.69507826",
"liquidationFees": "0",
"margin": "6498468.2474181248786156",
"maintenanceMargin": "527842.520726"
},
"ETH-USD": {
"position": "28894.648055999998",
"positionQuantity": "8",
"liquidationPrice": "28902.648056",
"openBuy": "0",
"openBuyQty": "0",
"openSell": "8000",
"openSellQty": "3",
"pnl": "406.23975999",
"positionPnl": "406.2397599999995",
"funding": "-486.82005787000037",
"positionFunding": "-486.82005787000037",
"volume": "43545.091964",
"fees": "43.54509196",
"liquidationFees": "0",
"margin": "762320.7471059860003337",
"maintenanceMargin": "28902.648056"
}
}
}
}