Portfolio
Account balances, positions, history, and configuration
Base URL https://api.lexx-trade.com/api/v2 · All endpoints
require Ed25519 request signatures unless marked "no auth" — see Authentication.
Get account balance
Returns asset balances for the specified exchange account. By default returns non-zero balances. Use full=true to include all assets, or totalOnly=true to get only the aggregated portfolio value.
Query parameters
| exchange | string | Exchange account (e.g., binance-spot). Defaults to binance-spot when omitted. |
| full | boolean | When true, includes all assets (including zero balances) |
| totalOnly | boolean | When true, returns only the aggregated portfolio total without individual asset balances |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio");
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio")
print(res["data"]) Response 200 — Account balances. `data` is an OBJECT with an aggregated `total` and (unless `totalOnly=true`) a `balances` array.
data total required Aggregated portfolio value.
usd Total value in USD. String-encoded decimal.
btc Total value in BTC (when available). String-encoded decimal.
balances Per-asset balances. Omitted when totalOnly=true.
asset required Asset ticker symbol (e.g., USDT, BTC, ETH)
name Asset name (currently identical to asset)
free required Free balance available for trading. String-encoded decimal for precision.
wallet required Total wallet balance for the asset. String-encoded decimal for precision.
locked required Balance locked in open orders. String-encoded decimal for precision.
lockedByBot Portion of the balance locked by bots. String-encoded decimal for precision.
usd Estimated USD value of the wallet balance. String-encoded decimal for precision.
total required Total wallet balance (equals wallet). String-encoded decimal for precision.
partial Present and true when some assets could not be valued (their USD value is missing from total).
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (401, 429, 500)
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Get open positions
Returns all open futures/margin positions for the specified exchange account. For spot accounts use GET /portfolio (balance) instead.
Query parameters
| exchange | string | Futures exchange account (e.g., binance-futures). Defaults to binance-futures when omitted. |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio/positions" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio/positions' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio/positions");
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio/positions")
print(res["data"]) Response 200 — Open positions. `data` is an OBJECT keyed by symbol; each value is a PublicPosition.
data Open positions keyed by trading symbol.
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (401, 429, 500)
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Get current leverage for symbol(s)
Returns leverage settings for one or more symbols. Pass a comma-separated list in the symbols query parameter.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
| symbols required | string | Comma-separated list of trading pairs (e.g., "BTCUSDT" or "BTCUSDT,ETHUSDT,SOLUSDT") |
| marginType | string | Filter by margin type |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio/position/leverage?exchange=binance-spot&symbols=BTCUSDT" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio/position/leverage?exchange=binance-spot&symbols=BTCUSDT' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio/position/leverage", {
query: {"exchange":"binance-spot","symbols":"BTCUSDT"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio/position/leverage", query={"exchange": "binance-spot", "symbols": "BTCUSDT"})
print(res["data"]) Response 200 — Leverage info per symbol (from the internal `LeverageInfo` shape).
data symbol required Trading pair (e.g., SOLUSDT)
side required Position side. BOTH = one-way mode.
enum: "LONG" · "SHORT" · "BOTH"
leverage required Currently configured leverage multiplier (string-encoded).
type required Margin type for this symbol.
enum: "ISOLATED" · "CROSSED"
cpnl Cumulative PnL for this symbol, if available. String-encoded decimal.
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (401, 429, 500)
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Set leverage for a futures symbol
Set leverage multiplier for a specific symbol. Optionally specify margin type and position side for hedge-mode accounts. Requires TRADE permission.
Headers
| X-Idempotency-Key | string | Client-generated UUID for idempotent request handling (POST/PUT/DELETE only; ignored on other methods). If a request with the same key and the same parameters was already processed within the last 1 hour, the original response (status + body) is replayed without re-executing the operation. The same key with different parameters — or while the original request is still in flight — returns 409 IDEMPOTENCY_CONFLICT. 5xx responses are not cached. Strongly recommended for order creation and cancellation. |
Request body required
exchange required Exchange identifier (e.g., "binance-futures")
symbol required Trading pair (e.g., "SOLUSDT")
leverage required Leverage multiplier
marginType Margin type for this position (optional)
enum: "ISOLATED" · "CROSSED"
side Position side for hedge-mode (optional)
enum: "LONG" · "SHORT" · "BOTH"
Request samples
# Sign: timestamp + "POST" + "/v2/portfolio/position/leverage" + "" → see Authentication
curl -X POST 'https://api.lexx-trade.com/api/v2/portfolio/position/leverage' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("POST", "/portfolio/position/leverage");
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("POST", "/portfolio/position/leverage")
print(res["data"]) Response 200 — Leverage updated
data meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (400, 401, 403, 409, 429, 500)
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key/signature |
| 403 | Insufficient permissions or IP not whitelisted |
| 409 | Resource conflict (e.g., idempotency key reuse) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Get margin mode
Returns current account margin mode for the exchange.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio/margin-mode?exchange=binance-spot" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio/margin-mode?exchange=binance-spot' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio/margin-mode", {
query: {"exchange":"binance-spot"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio/margin-mode", query={"exchange": "binance-spot"})
print(res["data"]) Response 200 — Margin mode
data mode 1 = single, 2 = multi, 3 = portfolio, 4 = other
enum: 1 · 2 · 3 · 4
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (401, 429, 500)
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Set margin mode
Change the account margin mode. Requires TRADE permission. mode may alternatively be passed as a query parameter (the body value takes precedence). Note: the backend does not currently reject mode=4 ("other"), but it is a read-only marker, not a meaningful target — behavior is exchange-dependent; send only 1–3.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
Headers
| X-Idempotency-Key | string | Client-generated UUID for idempotent request handling (POST/PUT/DELETE only; ignored on other methods). If a request with the same key and the same parameters was already processed within the last 1 hour, the original response (status + body) is replayed without re-executing the operation. The same key with different parameters — or while the original request is still in flight — returns 409 IDEMPOTENCY_CONFLICT. 5xx responses are not cached. Strongly recommended for order creation and cancellation. |
Request body required
mode required 1 = single-margin, 2 = multi-asset, 3 = portfolio
enum: 1 · 2 · 3
Request samples
# Sign: timestamp + "POST" + "/v2/portfolio/margin-mode?exchange=binance-spot" + "" → see Authentication
curl -X POST 'https://api.lexx-trade.com/api/v2/portfolio/margin-mode?exchange=binance-spot' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("POST", "/portfolio/margin-mode", {
query: {"exchange":"binance-spot"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("POST", "/portfolio/margin-mode", query={"exchange": "binance-spot"})
print(res["data"]) Response 200 — Margin mode updated
data mode New margin mode applied: 1 = single, 2 = multi, 3 = portfolio, 4 = other
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (400, 401, 403, 409, 429, 500)
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key/signature |
| 403 | Insufficient permissions or IP not whitelisted |
| 409 | Resource conflict (e.g., idempotency key reuse) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Set position margin type
Switch a position between isolated and crossed margin. Requires TRADE permission.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
Headers
| X-Idempotency-Key | string | Client-generated UUID for idempotent request handling (POST/PUT/DELETE only; ignored on other methods). If a request with the same key and the same parameters was already processed within the last 1 hour, the original response (status + body) is replayed without re-executing the operation. The same key with different parameters — or while the original request is still in flight — returns 409 IDEMPOTENCY_CONFLICT. 5xx responses are not cached. Strongly recommended for order creation and cancellation. |
Request body required
symbol required Trading pair to change margin type for (e.g., SOLUSDT)
marginType required Target margin type. ISOLATED = dedicated margin per position, CROSSED = shared margin across all positions.
enum: "ISOLATED" · "CROSSED"
Request samples
# Sign: timestamp + "POST" + "/v2/portfolio/position/margin-type?exchange=binance-spot" + "" → see Authentication
curl -X POST 'https://api.lexx-trade.com/api/v2/portfolio/position/margin-type?exchange=binance-spot' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("POST", "/portfolio/position/margin-type", {
query: {"exchange":"binance-spot"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("POST", "/portfolio/position/margin-type", query={"exchange": "binance-spot"})
print(res["data"]) Response 200 — Position margin type updated
data symbol Trading pair that was updated
marginType New margin type applied (ISOLATED or CROSSED)
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (400, 401, 403, 409, 429, 500)
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key/signature |
| 403 | Insufficient permissions or IP not whitelisted |
| 409 | Resource conflict (e.g., idempotency key reuse) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Get leverage brackets
Returns leverage bracket tiers for futures symbols, including maximum leverage and notional value limits per bracket.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
| symbol required | string | Trading pair (e.g., BTCUSDT). Required. |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio/leverage-brackets?exchange=binance-spot&symbol=BTCUSDT" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio/leverage-brackets?exchange=binance-spot&symbol=BTCUSDT' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio/leverage-brackets", {
query: {"exchange":"binance-spot","symbol":"BTCUSDT"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio/leverage-brackets", query={"exchange": "binance-spot", "symbol": "BTCUSDT"})
print(res["data"]) Response 200 — Leverage bracket data
data symbol Trading pair
brackets bracket Bracket tier number
initialLeverage Maximum leverage allowed in this bracket
notionalCap Maximum notional value. String-encoded decimal.
notionalFloor Minimum notional value. String-encoded decimal.
maintenanceMarginRate Maintenance margin rate. String-encoded decimal.
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (401, 429, 500)
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Get convertible dust assets
Returns the small ("dust") balances on the exchange that are eligible for conversion to a target asset.
Query parameters
| exchange required | string | Exchange account identifier (see GET /exchange/supported). Determines which connected exchange account to use. Must match one of your connected accounts. |
Request samples
# Sign: timestamp + "GET" + "/v2/portfolio/dust?exchange=binance-spot" + "" → see Authentication
curl -X GET 'https://api.lexx-trade.com/api/v2/portfolio/dust?exchange=binance-spot' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("GET", "/portfolio/dust", {
query: {"exchange":"binance-spot"}
});
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("GET", "/portfolio/dust", query={"exchange": "binance-spot"})
print(res["data"]) Response 200 — Convertible dust assets (structure from the exchange).
data Dust assets keyed by ticker (exchange-specific shape).
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (400, 401, 429, 500)
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key/signature |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.
Convert dust to a target asset
Converts the listed dust assets into a target asset (default BNB). Requires TRADE permission.
Headers
| X-Idempotency-Key | string | Client-generated UUID for idempotent request handling (POST/PUT/DELETE only; ignored on other methods). If a request with the same key and the same parameters was already processed within the last 1 hour, the original response (status + body) is replayed without re-executing the operation. The same key with different parameters — or while the original request is still in flight — returns 409 IDEMPOTENCY_CONFLICT. 5xx responses are not cached. Strongly recommended for order creation and cancellation. |
Request body required
exchange required Exchange identifier (e.g., binance-spot).
assets required Asset tickers to convert.
toAsset Target asset for the conversion. Defaults to BNB.
default: "BNB"
Request samples
# Sign: timestamp + "POST" + "/v2/portfolio/dust/convert" + "" → see Authentication
curl -X POST 'https://api.lexx-trade.com/api/v2/portfolio/dust/convert' \
-H "X-LEXX-KEY: $LEXX_PUBLIC_KEY" \
-H "X-LEXX-SIGN: $SIGNATURE" \
-H "X-LEXX-TIMESTAMP: $TIMESTAMP" // lexx() — the signing helper from the Quickstart guide
const { data, meta } = await lexx("POST", "/portfolio/dust/convert");
console.log(data); # lexx() — the signing helper from the Quickstart guide
res = lexx("POST", "/portfolio/dust/convert")
print(res["data"]) Response 200 — Conversion result (structure from the exchange).
data Conversion result.
meta Standard response envelope metadata included in every successful API response. Rate-limit state is NOT in the body — it is delivered via the X-RateLimit-* response headers.
requestId required Unique identifier for this API request, useful for support tickets and debugging
timestamp required Response timestamp in Unix milliseconds
version required API version
idempotencyKey Echoed back on a successful mutating request (POST/DELETE) when the caller sent an X-Idempotency-Key header. Absent otherwise.
Error responses (400, 401, 403, 409, 429, 500)
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key/signature |
| 403 | Insufficient permissions or IP not whitelisted |
| 409 | Resource conflict (e.g., idempotency key reuse) |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
All errors share the { error: { code, status, message }, meta } envelope —
see Errors for every code.