API documentation

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 /portfolio

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 object
total object required

Aggregated portfolio value.

usd string

Total value in USD. String-encoded decimal.

btc string

Total value in BTC (when available). String-encoded decimal.

balances array

Per-asset balances. Omitted when totalOnly=true.

asset string required

Asset ticker symbol (e.g., USDT, BTC, ETH)

name string

Asset name (currently identical to asset)

free string required

Free balance available for trading. String-encoded decimal for precision.

wallet string required

Total wallet balance for the asset. String-encoded decimal for precision.

locked string required

Balance locked in open orders. String-encoded decimal for precision.

lockedByBot string | null

Portion of the balance locked by bots. String-encoded decimal for precision.

usd string

Estimated USD value of the wallet balance. String-encoded decimal for precision.

total string required

Total wallet balance (equals wallet). String-encoded decimal for precision.

partial boolean

Present and true when some assets could not be valued (their USD value is missing from total).

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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 /portfolio/positions

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 object

Open positions keyed by trading symbol.

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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 /portfolio/position/leverage

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 array
symbol string required

Trading pair (e.g., SOLUSDT)

side string required

Position side. BOTH = one-way mode.

enum: "LONG" · "SHORT" · "BOTH"

leverage string required

Currently configured leverage multiplier (string-encoded).

type string required

Margin type for this symbol.

enum: "ISOLATED" · "CROSSED"

cpnl string

Cumulative PnL for this symbol, if available. String-encoded decimal.

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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.

POST /portfolio/position/leverage

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 string required

Exchange identifier (e.g., "binance-futures")

symbol string required

Trading pair (e.g., "SOLUSDT")

leverage integer required

Leverage multiplier

marginType string

Margin type for this position (optional)

enum: "ISOLATED" · "CROSSED"

side string

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 null
meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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 /portfolio/margin-mode

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 object
mode integer

1 = single, 2 = multi, 3 = portfolio, 4 = other

enum: 1 · 2 · 3 · 4

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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.

POST /portfolio/margin-mode

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 integer 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 object
mode integer

New margin mode applied: 1 = single, 2 = multi, 3 = portfolio, 4 = other

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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.

POST /portfolio/position/margin-type

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 string required

Trading pair to change margin type for (e.g., SOLUSDT)

marginType string 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 object
symbol string

Trading pair that was updated

marginType string

New margin type applied (ISOLATED or CROSSED)

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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 /portfolio/leverage-brackets

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 array
symbol string

Trading pair

brackets array
bracket integer

Bracket tier number

initialLeverage integer

Maximum leverage allowed in this bracket

notionalCap string

Maximum notional value. String-encoded decimal.

notionalFloor string

Minimum notional value. String-encoded decimal.

maintenanceMarginRate string

Maintenance margin rate. String-encoded decimal.

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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 /portfolio/dust

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 object

Dust assets keyed by ticker (exchange-specific shape).

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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.

POST /portfolio/dust/convert

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 string required

Exchange identifier (e.g., binance-spot).

assets array<string> required

Asset tickers to convert.

toAsset string

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 object

Conversion result.

meta object

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 string (uuid) required

Unique identifier for this API request, useful for support tickets and debugging

timestamp integer required

Response timestamp in Unix milliseconds

version string required

API version

idempotencyKey string

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.

Cookie Preferences

Manage your cookie preferences below. Necessary cookies are always active as they are essential for the website to function properly.

Strictly Necessary

Essential for the website to function. These cookies cannot be disabled.

Analytics

Help us understand how visitors interact with our website by collecting and reporting information anonymously.

Marketing

Used to track visitors across websites to display relevant advertisements.

Preferences

Allow the website to remember choices you make, such as language or region.