GET /account/{account_id}
Returns comprehensive account information including balances, positions, open orders, and margin status.
Request
Path Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
account_id | number | Yes | Nord account ID |
curl https://zo-mainnet.n1.xyz/account/12345Response
{
"updateId": 1,
"orders": [
{
"orderId": 1,
"marketId": 1,
"side": "ask",
"size": 1,
"price": 1,
"originalOrderSize": 1,
"clientOrderId": null
}
],
"positions": [
{
"marketId": 1,
"openOrders": 1,
"perp": null,
"actionId": 1
}
],
"balances": [
{
"tokenId": 1,
"token": "…",
"amount": 1
}
],
"margins": {
"omf": 1,
"mf": 1,
"imf": 1,
"cmf": 1,
"mmf": 1,
"pon": 1,
"pn": 1,
"bankruptcy": true
}
}Response Fields
Account Object
| Field | Type | Description |
|---|---|---|
updateId | number | Sequence number for state tracking |
balances | Balance[] | Token balances |
positions | Position[] | Market positions |
orders | Order[] | Open orders |
margins | Margins | Account margin/health status |
Balance Object
| Field | Type | Description |
|---|---|---|
tokenId | number | Token identifier |
token | string | Token symbol (e.g., “USDC”) |
amount | number | Total balance |
Position Object
| Field | Type | Description |
|---|---|---|
marketId | number | Market identifier |
openOrders | number | Number of open orders in this market |
perp | PerpPosition | null | Perpetual position details |
actionId | number | Last action that modified this position |
PerpPosition Object
| Field | Type | Description |
|---|---|---|
baseSize | number | Position size in base asset |
price | number | Entry/average price |
isLong | boolean | True if long, false if short |
sizePricePnl | number | PnL from size/price changes (USDC) |
fundingPaymentPnl | number | PnL from funding payments (USDC) |
updatedFundingRateIndex | number | Funding rate index at last update |
Order Object
| Field | Type | Description |
|---|---|---|
orderId | number | Unique order identifier |
marketId | number | Market identifier |
side | string | bid (buy) or ask (sell) |
price | number | Order price |
size | number | Remaining order size |
originalOrderSize | number | Original order size |
clientOrderId | number | null | Optional client-provided order ID |
Margins Object
| Field | Type | Description |
|---|---|---|
omf | number | Open Margin Fraction numerator (USD) |
mf | number | Margin Fraction numerator (USD) |
imf | number | Initial Margin requirement numerator |
cmf | number | Cancel Margin requirement numerator |
mmf | number | Maintenance Margin requirement numerator |
pon | number | Position + Orders Notional (USD) |
pn | number | Position Notional (USD) |
bankruptcy | boolean | True if account is bankrupt |
[!NOTE] Margin fractions are expressed as numerators. Divide by
ponorpnto get the actual ratio. For example, ifomf = 15000andpon = 50000, the open margin fraction is 0.3 (30%).
Example: Python
import requests
API_URL = "https://zo-mainnet.n1.xyz"
def get_account(account_id: int):
resp = requests.get(f"{API_URL}/account/{account_id}")
return resp.json()
account = get_account(12345)
# Print balances
print("Balances:")
for balance in account["balances"]:
print(f" {balance['token']}: {balance['amount']:.2f}")
# Print positions
print("\nPositions:")
for pos in account["positions"]:
if pos.get("perp"):
perp = pos["perp"]
direction = "LONG" if perp["isLong"] else "SHORT"
pnl = perp["sizePricePnl"] + perp["fundingPaymentPnl"]
print(f" Market {pos['marketId']}: {direction} {perp['baseSize']:.4f} @ ${perp['price']:,.2f} (PnL: ${pnl:,.2f})")
# Print open orders
print("\nOpen Orders:")
for order in account["orders"]:
side = "BUY" if order["side"] == "bid" else "SELL"
print(f" {side} {order['size']:.4f} @ ${order['price']:,.2f}")
# Check account health
margins = account["margins"]
if margins["pon"] > 0:
margin_ratio = margins["omf"] / margins["pon"]
print(f"\nMargin Ratio: {margin_ratio:.2%}")
if margins["bankruptcy"]:
print("⚠️ ACCOUNT IS BANKRUPT")Error Responses
| Status | Description |
|---|---|
| 404 | Account not found |
Last updated on