# Account

Account configuration (position mode, leverage, isolated margin) and account queries (balance, positions, leverage settings, asset flow).

## Set Position Mode

> Switch between \`one\_way\` and \`hedge\` position modes. Rejected if there are open positions\
> or active orders. Method A signature (\`tag = 10\`).<br>

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/position-mode":{"post":{"tags":["Account"],"summary":"Set Position Mode","operationId":"setPositionMode","description":"Switch between `one_way` and `hedge` position modes. Rejected if there are open positions\nor active orders. Method A signature (`tag = 10`).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WriteCommonParams"},{"type":"object","required":["position_mode"],"properties":{"position_mode":{"type":"string","enum":["one_way","hedge"]}}}]}}}},"responses":{"200":{"description":"Position mode updated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"position_mode":{"type":"string"}}}}}]}}}},"422":{"description":"Rejected (e.g. `20004` open positions/orders prevent switch)"}}}}},"components":{"schemas":{"WriteCommonParams":{"type":"object","required":["address","nonce","expires_after","signature"],"properties":{"address":{"type":"string","description":"Signer's Ethereum address (`0x`-prefixed, lowercase hex). The node uses `ecrecover` to verify this matches the recovered signer.","pattern":"^0x[a-fA-F0-9]{40}$"},"nonce":{"type":"integer","format":"int64","description":"Millisecond Unix timestamp (`Date.now()`). Tracked **per signer** — each Agent Key has an independent nonce space."},"expires_after":{"type":"integer","format":"int64","description":"Expiration timestamp (ms). Recommended `Date.now() + 600_000` (10 minutes)."},"target_address":{"type":"string","description":"Optional target account address. Omit to operate on the signer's own account.\nUsed when an Agent operates on a sub-account.\n**Conditionally signed**: it does not enter `actionHash`, but when present it must be\nincluded as `Agent.targetAddress` in the EIP-712 struct (6-field Agent — see Signing\nMethod A). **Not allowed** on private-key-only endpoints.\n","pattern":"^0x[a-fA-F0-9]{40}$"},"signature":{"$ref":"#/components/schemas/Signature"}}},"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Get Contract Leverage

> If no per-user override exists, returns the symbol's \`default\_leverage\` from \`/market/symbols\`.

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/leverage":{"get":{"tags":["Account"],"summary":"Get Contract Leverage","operationId":"getContractLeverage","description":"If no per-user override exists, returns the symbol's `default_leverage` from `/market/symbols`.","parameters":[{"$ref":"#/components/parameters/AddressQuery"},{"name":"symbol_id","in":"query","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Current leverage","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"symbol_id":{"type":"integer"},"margin_mode":{"type":"string"},"position_side":{"type":"string"},"leverage":{"type":"integer"}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Set Contract Leverage

> Configure leverage for a perpetual contract. Method A signature (\`tag = 11\`).\
> \
> Errors: \`40002\` (leverage out of bracket), \`40003\` (isolated with open position only allows higher leverage), \`20003\` (insufficient margin).<br>

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/leverage":{"post":{"tags":["Account"],"summary":"Set Contract Leverage","operationId":"setContractLeverage","description":"Configure leverage for a perpetual contract. Method A signature (`tag = 11`).\n\nErrors: `40002` (leverage out of bracket), `40003` (isolated with open position only allows higher leverage), `20003` (insufficient margin).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WriteCommonParams"},{"type":"object","required":["symbol_id","margin_mode","leverage"],"properties":{"symbol_id":{"type":"integer"},"margin_mode":{"type":"string","enum":["cross","isolated"]},"position_side":{"type":"string","enum":["long","short"],"description":"Required when hedge + isolated (each side can have its own leverage)."},"leverage":{"type":"integer"}}}]}}}},"responses":{"200":{"description":"Leverage updated","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"symbol_id":{"type":"integer"},"margin_mode":{"type":"string"},"position_side":{"type":"string"},"leverage":{"type":"integer"}}}}}]}}}}}}}},"components":{"schemas":{"WriteCommonParams":{"type":"object","required":["address","nonce","expires_after","signature"],"properties":{"address":{"type":"string","description":"Signer's Ethereum address (`0x`-prefixed, lowercase hex). The node uses `ecrecover` to verify this matches the recovered signer.","pattern":"^0x[a-fA-F0-9]{40}$"},"nonce":{"type":"integer","format":"int64","description":"Millisecond Unix timestamp (`Date.now()`). Tracked **per signer** — each Agent Key has an independent nonce space."},"expires_after":{"type":"integer","format":"int64","description":"Expiration timestamp (ms). Recommended `Date.now() + 600_000` (10 minutes)."},"target_address":{"type":"string","description":"Optional target account address. Omit to operate on the signer's own account.\nUsed when an Agent operates on a sub-account.\n**Conditionally signed**: it does not enter `actionHash`, but when present it must be\nincluded as `Agent.targetAddress` in the EIP-712 struct (6-field Agent — see Signing\nMethod A). **Not allowed** on private-key-only endpoints.\n","pattern":"^0x[a-fA-F0-9]{40}$"},"signature":{"$ref":"#/components/schemas/Signature"}}},"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Adjust Isolated Margin

> Add to or remove from an isolated position's margin balance.\
> \
> \- \*\*Adding\*\*: requires \`cross\_effective\_margin − adjust\_amount ≥ cross\_required\_margin\`.\
> \- \*\*Removing\*\* (\`adjust\_amount\` negative): requires post-adjustment \`isolated\_effective\_margin ≥ isolated\_required\_margin\`.\
> \
> Method A signature (\`tag = 15\`).<br>

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/isolated-margin":{"post":{"tags":["Account"],"summary":"Adjust Isolated Margin","operationId":"adjustIsolatedMargin","description":"Add to or remove from an isolated position's margin balance.\n\n- **Adding**: requires `cross_effective_margin − adjust_amount ≥ cross_required_margin`.\n- **Removing** (`adjust_amount` negative): requires post-adjustment `isolated_effective_margin ≥ isolated_required_margin`.\n\nMethod A signature (`tag = 15`).\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/WriteCommonParams"},{"type":"object","required":["symbol_id","position_side","adjust_amount"],"properties":{"symbol_id":{"type":"integer"},"position_side":{"type":"string","enum":["both","long","short"],"description":"Required. One-way mode → `both`; hedge mode → `long` / `short`."},"adjust_amount":{"type":"string","description":"Positive = add, negative = remove (decimal string)."}}}]}}}},"responses":{"200":{"description":"Adjustment acknowledged","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"tx_hash":{"type":"string"},"symbol_id":{"type":"integer"},"position_side":{"type":"string"},"adjust_amount":{"type":"string"}}}}}]}}}}}}}},"components":{"schemas":{"WriteCommonParams":{"type":"object","required":["address","nonce","expires_after","signature"],"properties":{"address":{"type":"string","description":"Signer's Ethereum address (`0x`-prefixed, lowercase hex). The node uses `ecrecover` to verify this matches the recovered signer.","pattern":"^0x[a-fA-F0-9]{40}$"},"nonce":{"type":"integer","format":"int64","description":"Millisecond Unix timestamp (`Date.now()`). Tracked **per signer** — each Agent Key has an independent nonce space."},"expires_after":{"type":"integer","format":"int64","description":"Expiration timestamp (ms). Recommended `Date.now() + 600_000` (10 minutes)."},"target_address":{"type":"string","description":"Optional target account address. Omit to operate on the signer's own account.\nUsed when an Agent operates on a sub-account.\n**Conditionally signed**: it does not enter `actionHash`, but when present it must be\nincluded as `Agent.targetAddress` in the EIP-712 struct (6-field Agent — see Signing\nMethod A). **Not allowed** on private-key-only endpoints.\n","pattern":"^0x[a-fA-F0-9]{40}$"},"signature":{"$ref":"#/components/schemas/Signature"}}},"Signature":{"type":"object","description":"ECDSA signature components `(r, s, v)` over the EIP-712 signing hash.","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex string with `0x` prefix."},"s":{"type":"string","description":"32-byte hex string with `0x` prefix."},"v":{"type":"integer","description":"Recovery identifier — typically 27 or 28.","enum":[27,28]}}},"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```

## Get Balance

> Raw on-chain balance data (no price-derived fields like equity/upnl).

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/balance":{"get":{"tags":["Account"],"summary":"Get Balance","operationId":"getBalance","description":"Raw on-chain balance data (no price-derived fields like equity/upnl).","parameters":[{"$ref":"#/components/parameters/AddressQuery"}],"responses":{"200":{"description":"Account balance","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"address":{"type":"string"},"coins":{"type":"array","items":{"$ref":"#/components/schemas/BalanceCoin"}}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"BalanceCoin":{"type":"object","properties":{"coin_id":{"type":"integer"},"balance":{"type":"string"},"spot_order_frozen":{"type":"string"},"transfer_frozen":{"type":"string"},"isolated_balance":{"type":"string","description":"Sum of isolated margins for this coin."},"created_time":{"type":"integer","format":"int64"},"updated_time":{"type":"integer","format":"int64"}}}}}}
```

## Get Positions

> All open positions for \`address\`.

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/positions":{"get":{"tags":["Account"],"summary":"Get Positions","operationId":"getPositions","description":"All open positions for `address`.","parameters":[{"$ref":"#/components/parameters/AddressQuery"}],"responses":{"200":{"description":"Open positions","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#/components/schemas/Position"}}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"Position":{"type":"object","description":"Open position.","properties":{"symbol_id":{"type":"integer"},"address":{"type":"string"},"position_side":{"type":"string","enum":["both","long","short"]},"margin_mode":{"type":"string","enum":["cross","isolated"]},"open_size":{"type":"string","description":"Position size. Positive = long, negative = short."},"avg_price":{"type":"string","description":"Average open price."},"leverage":{"type":"integer"},"cum_realized_pnl":{"type":"string"},"cum_close_size":{"type":"string"},"cum_close_value":{"type":"string"},"cum_fee":{"type":"string"},"cum_funding_fee":{"type":"string"},"max_size":{"type":"string"},"isolated_margin":{"type":"string","nullable":true,"description":"Isolated margin (only present when `margin_mode=isolated`)."},"adl_level":{"type":"integer","minimum":1,"maximum":5},"created_time":{"type":"integer","format":"int64"},"updated_time":{"type":"integer","format":"int64"}}}}}}
```

## Position History

> Closed positions. Up to 200 per page, last 1000 queryable.

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/positions/history":{"get":{"tags":["Account"],"summary":"Position History","operationId":"positionHistory","description":"Closed positions. Up to 200 per page, last 1000 queryable.","parameters":[{"$ref":"#/components/parameters/AddressQuery"},{"$ref":"#/components/parameters/SymbolIdQuery"},{"$ref":"#/components/parameters/StartTimeQuery"},{"$ref":"#/components/parameters/EndTimeQuery"},{"$ref":"#/components/parameters/LimitQuery"},{"$ref":"#/components/parameters/CursorQuery"}],"responses":{"200":{"description":"Closed positions","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#/components/schemas/PositionHistory"}},"next_cursor":{"type":"string","nullable":true},"has_more":{"type":"boolean"}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."},"SymbolIdQuery":{"name":"symbol_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Symbol ID. Omit to match all symbols."},"StartTimeQuery":{"name":"start_time","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"Start time (Unix ms)."},"EndTimeQuery":{"name":"end_time","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"End time (Unix ms)."},"LimitQuery":{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50},"description":"Page size."},"CursorQuery":{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Pagination cursor from the previous response's `next_cursor`."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"PositionHistory":{"type":"object","properties":{"symbol_id":{"type":"integer"},"position_side":{"type":"string","enum":["both","long","short"]},"margin_mode":{"type":"string","enum":["cross","isolated"]},"max_size":{"type":"string"},"avg_entry_price":{"type":"string"},"avg_close_price":{"type":"string"},"leverage":{"type":"integer"},"realized_pnl":{"type":"string"},"cum_fee":{"type":"string"},"cum_funding_fee":{"type":"string"},"open_time":{"type":"integer","format":"int64"},"close_time":{"type":"integer","format":"int64"}}}}}}
```

## Get Leverage Brackets

> User-specific (VIP-tiered) leverage / risk brackets per symbol. First tier floor is 0; subsequent tiers' floor = previous tier's \`notional\_cap\`.

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/leverage-bracket":{"get":{"tags":["Account"],"summary":"Get Leverage Brackets","operationId":"getLeverageBrackets","description":"User-specific (VIP-tiered) leverage / risk brackets per symbol. First tier floor is 0; subsequent tiers' floor = previous tier's `notional_cap`.","parameters":[{"$ref":"#/components/parameters/AddressQuery"}],"responses":{"200":{"description":"Leverage brackets","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"list":{"type":"array","items":{"type":"object","properties":{"symbol_id":{"type":"integer"},"brackets":{"type":"array","items":{"$ref":"#/components/schemas/LeverageBracket"}}}}}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"LeverageBracket":{"type":"object","properties":{"notional_cap":{"type":"string"},"max_leverage":{"type":"integer"},"mmr":{"type":"string"}}}}}}
```

## Get Asset Flow

> Asset movement history (deposits, withdrawals, P\&L, fees, funding, etc.). Up to 2000 per page, last 10000 queryable.

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/asset-flow":{"get":{"tags":["Account"],"summary":"Get Asset Flow","operationId":"getAssetFlow","description":"Asset movement history (deposits, withdrawals, P&L, fees, funding, etc.). Up to 2000 per page, last 10000 queryable.","parameters":[{"$ref":"#/components/parameters/AddressQuery"},{"name":"coin_id","in":"query","required":false,"schema":{"type":"integer"}},{"name":"flow_type","in":"query","required":false,"schema":{"type":"string","enum":["deposit","withdraw","pnl","spot_buy","spot_sell","fee","funding_fee","liquidation","transfer","interest","isolated_open","isolated_close","isolated_margin_change","system_adjust"]}},{"$ref":"#/components/parameters/StartTimeQuery"},{"$ref":"#/components/parameters/EndTimeQuery"},{"$ref":"#/components/parameters/LimitQuery"},{"$ref":"#/components/parameters/CursorQuery"}],"responses":{"200":{"description":"Asset flow records (paginated)","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#/components/schemas/AssetFlow"}},"next_cursor":{"type":"string","nullable":true},"has_more":{"type":"boolean"}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."},"StartTimeQuery":{"name":"start_time","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"Start time (Unix ms)."},"EndTimeQuery":{"name":"end_time","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"End time (Unix ms)."},"LimitQuery":{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50},"description":"Page size."},"CursorQuery":{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Pagination cursor from the previous response's `next_cursor`."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}},"AssetFlow":{"type":"object","properties":{"flow_id":{"type":"string"},"coin_id":{"type":"integer"},"flow_type":{"type":"string","description":"See [Enums](/reference/enums) for the full list of flow types.","enum":["deposit","withdraw","pnl","spot_buy","spot_sell","fee","funding_fee","liquidation","transfer","interest","isolated_open","isolated_close","isolated_margin_change","system_adjust"]},"balance_delta":{"type":"string","description":"Positive = increase, negative = decrease."},"balance_after":{"type":"string"},"biz_id":{"type":"string"},"tx_hash":{"type":"string"},"update_time":{"type":"integer","format":"int64"}}}}}}
```

## GET /account/settings

> Get Account Settings

```json
{"openapi":"3.0.3","info":{"title":"Lynx DEX API","version":"1.5.0"},"tags":[{"name":"Account","description":"Account configuration (position mode, leverage, isolated margin) and account queries\n(balance, positions, leverage settings, asset flow).\n"}],"servers":[{"url":"http://10.34.8.77:8481/v1","description":"Production"}],"paths":{"/account/settings":{"get":{"tags":["Account"],"summary":"Get Account Settings","operationId":"getAccountSettings","parameters":[{"$ref":"#/components/parameters/AddressQuery"}],"responses":{"200":{"description":"Account settings","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ResponseEnvelope"},{"type":"object","properties":{"data":{"type":"object","properties":{"address":{"type":"string"},"position_mode":{"type":"string","enum":["one_way","hedge"]},"auto_borrow":{"type":"boolean"}}}}}]}}}}}}}},"components":{"parameters":{"AddressQuery":{"name":"address","in":"query","required":true,"schema":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"description":"Account address (`0x`-prefixed hex)."}},"schemas":{"ResponseEnvelope":{"type":"object","description":"Standard response envelope shared by every endpoint.","required":["code","msg","data"],"properties":{"code":{"type":"string","description":"`\"0\"` for success. Non-zero indicates an error code — see [Error Codes](/reference/error-codes)."},"msg":{"type":"string","description":"Empty on success; human-readable error description on failure."},"data":{"description":"Endpoint-specific payload on success; `null` on failure.","nullable":true},"trace_code":{"type":"string","description":"Backend trace identifier. Empty on success; populated on failure for support diagnostics."}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lynxtrade.world/rest-api/account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
