Skip to content
🌐Network: Mainnet

Parameters Reference

A comprehensive glossary of all parameters used across the o2 Exchange API endpoints.

Showing 41 of 41 parameters
account
string (Address)query

User wallet address to filter trades or orders

FormatB256 hex string (64 characters with 0x prefix)
Example0x91F0E90eff49ee08c0d42E617F5ec4e7A52F5b3A9D9E3Bbd0Aa995567fe98df5
address
string (Address)query

User wallet address for balance queries

FormatB256 hex string (64 characters with 0x prefix)
Example0x91F0E90eff49ee08c0d42E617F5ec4e7A52F5b3A9D9E3Bbd0Aa995567fe98df5
asset_id
string (AssetId)query

Asset contract identifier for balance queries

FormatB256 hex string (64 characters with 0x prefix)
Example0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b
How to getGet from markets list (base_asset or quote_asset) GET /markets
contract
string (ContractId)query

Trading account contract ID for filtering

FormatB256 hex string (64 characters with 0x prefix)
Example0xd3ca0cbf374bb2e11e1f554b088e0bc6b168b251b820a42a69624be4aa2f2a2f
How to getCreate a new trading account POST /accounts
count
numberquery

Number of items to return in a single request

Maximum50 for trades
Example25
count_back
numberquery

Number of historical bars to return. Overrides time range when specified.

Used inGET /bars
Maximum5000
Example100
depth
numberquery

Number of price levels to return on each side (bids and asks)

Default500
Maximum500
Example100
direction
stringquery

Query direction for result ordering

Values
ascAscending order (oldest first)
descDescending order (newest first)
Exampledesc
from
number (ms)query

Start timestamp in milliseconds (Unix epoch time) for historical data range

Used inGET /bars
FormatUnix timestamp in milliseconds
Example1699100000000
is_open
booleanquery

Filter to show only open/active orders

Values
trueReturn only active/unfilled orders
falseReturn all orders
Exampletrue
level
numberquery

Order book aggregation level

Default2
Values
2Aggregated order book (price levels with total volumes)
3Full depth order book
Example2
market_id
stringquery

Unique identifier for a trading market

FormatB256 hex string (64 characters with 0x prefix)
Example0xc0c5c48315d8cfff9f00777f81fdf04e9b4ef69e802a1a068549a8d6a06ee19f
How to getGet from markets list GET /markets
market_pair
stringquery

Market pair in BASE_QUOTE format (aggregator endpoints alternative to market_id)

Format{BASE_ASSET}_{QUOTE_ASSET}
ExampleFUEL_USDC
How to getGet trading pairs from market summary GET /aggregated/summary
order_id
stringquery

Specific order identifier. Must be used together with market_id.

Used inGET /order
FormatB256 hex string (64 characters with 0x prefix)
Example0x7f8e9d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e
How to getGet from orders history GET /orders
owner
string (Address)query

Owner wallet address to look up the trading account

FormatB256 hex string (64 characters with 0x prefix)
Example0x91F0E90eff49ee08c0d42E617F5ec4e7A52F5b3A9D9E3Bbd0Aa995567fe98df5
owner_contract
string (ContractId)query

Owner contract ID to look up the trading account (when owner is a contract)

FormatB256 hex string (64 characters with 0x prefix)
Example0xd3ca0cbf374bb2e11e1f554b088e0bc6b168b251b820a42a69624be4aa2f2a2f
precision
numberquery

Price aggregation precision level. Controls how prices are grouped in order book display.

Used inGET /depth
FormatPower of 10 (1, 10, 100, 1000, etc.)
Example10
resolution
stringquery

Bar/candlestick time resolution

Used inGET /bars
Values
1m, 5m, 15m, 30mMinutes
1h, 4h, 12hHours
1dDays
1wWeeks
1MMonths
Example5m
start_order_id
stringquery

Starting order ID for pagination. Use with start_timestamp.

FormatB256 hex string (64 characters with 0x prefix)
Example0x7f8e9d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e
How to getGet from previous orders response GET /orders
start_timestamp
stringquery

Starting timestamp filter for pagination

FormatUnix timestamp in milliseconds (as string)
Example1699200000
start_trade_id
stringquery

Starting trade ID for pagination. Use with start_timestamp.

FormatB256 hex string (64 characters with 0x prefix)
Example0x5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b
How to getGet from previous trades response GET /trades
to
number (ms)query

End timestamp in milliseconds (Unix epoch time) for historical data range

Used inGET /bars
FormatUnix timestamp in milliseconds
Example1699200000000
trade_account_id
string (ContractId)query

Trading account contract ID for account lookup

FormatB256 hex string (64 characters with 0x prefix)
Example0xd3ca0cbf374bb2e11e1f554b088e0bc6b168b251b820a42a69624be4aa2f2a2f
How to getGet from account info or create new account POST /accounts
O2-Owner-Id
string (B256)header

Trading account owner address for authentication and authorization

Format64-character hexadecimal string (with or without 0x prefix)
Example0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
actions
array<MarketActions>body

Array of market actions to execute. Each element contains a market_id and an array of actions (CreateOrder, CancelOrder, SettleBalance, RegisterReferer). Maximum 5 actions total distributed across maximum 5 markets.

Maximum5 actions, 5 markets
Example[{ "market_id": "0x...", "actions": [{ "CreateOrder": { "side": "Buy", "price": "1000000000", "quantity": "100000000", "order_type": "Spot" } }] }]
amount
stringbody

Amount to withdraw (as string to preserve precision). Must be in asset's smallest unit.

FormatInteger as string (to preserve precision)
Example1000000
call
objectbody

Contract call parameters object containing method name and arguments

Example{ "method": "place_order", "params": { ... } }
calls
arraybody

Array of contract call parameter objects for batch execution

Example[{ "method": "deposit", "params": {...} }]
collect_orders
booleanbody

When true, the API will subscribe to order events and return the created orders in the response. For fastest confirmations, set this to false.

Defaultfalse
Exampletrue
contract_id
stringbody

Trading account contract ID for session or account operations

FormatB256 hex string (64 characters with 0x prefix)
Example0xd3ca0cbf374bb2e11e1f554b088e0bc6b168b251b820a42a69624be4aa2f2a2f
How to getCreate a new trading account POST /accounts
estimate_gas_usage
booleanbody

When true, estimates gas usage for the transaction before execution. Helps prevent out-of-gas errors.

Defaultfalse
Examplefalse
expiry
stringbody

Session expiry timestamp (Unix epoch time). Session becomes invalid after this time.

FormatUnix timestamp in seconds
Example1699200000
identity.Address
stringbody

User wallet address for creating a new trading account contract

FormatB256 hex string (64 characters with 0x prefix)
Example0x91F0E90eff49ee08c0d42E617F5ec4e7A52F5b3A9D9E3Bbd0Aa995567fe98df5
implementation
stringbody

New implementation contract address for account upgrades

FormatB256 hex string (64 characters with 0x prefix)
Example0x7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef123456
min_gas_limit
stringbody

Minimum gas limit for the transaction execution. Overrides automatic gas calculation.

FormatInteger as string
Example1000000
nonce
stringbody

Nonce value for replay attack protection. Must be unique and incrementing.

order_type
string | objectbody

Specifies the execution behavior for a CreateOrder action. Controls how the order matches against the order book.

Values
SpotExecutes at best price; unfilled added to book (default)
MarketImmediate execution; auto-cancelled after fill
FillOrKillAll-or-nothing; reverts if not completely filled
PostOnlyMaker-only; reverts if any would be taker
{ "Limit": [price, timestamp] }Price-time priority execution
{ "BoundedMarket": {...} }Market order within price bounds
Example"Spot"
session_id
object (Identity)body

Session key identifier. Can be an Address or ContractId identity type used to authorize session-based transactions.

Format{ "Address": "0x..." } or { "ContractId": "0x..." }
Example{ "Address": "0x91F0E90eff49ee08c0d42E617F5ec4e7A52F5b3A9D9E3Bbd0Aa995567fe98df5" }
signature
object (JsonSignature)body

Cryptographic signature proving ownership and authorization. Supports Secp256r1, Secp256k1, and Ed25519.

trade_account_id
string (ContractId)body

Trading account contract ID for session actions

FormatB256 hex string (64 characters with 0x prefix)
Example0xd3ca0cbf374bb2e11e1f554b088e0bc6b168b251b820a42a69624be4aa2f2a2f
How to getCreate a new trading account POST /accounts
variable_outputs
numberbody

Number of variable outputs to include in the transaction. Required when outputs are not known in advance.

Maximum10
Example5

Parameter Patterns & Best Practices

Mutual Exclusivity

Some parameters cannot be used together:

Account Lookup (GET /accounts):

  • Use owner OR trade_account_id, never both

Trade/Order Filtering (GET /trades_by_account, GET /orders):

  • Use account OR contract, never both

Pagination Pattern

When paginating through trades or orders:

  1. Initial Request: Omit pagination parameters

    GET /trades?market_id=XXX&direction=desc&count=50
  2. Subsequent Requests: Use timestamp and ID from last item

    GET /trades?market_id=XXX&direction=desc&count=50&start_timestamp=1699200000&start_trade_id=0xabc...
  3. Direction Usage:

    • desc: Newest first (most common for UI)
    • asc: Oldest first (useful for backfilling)

Rate Limits

  • Trades: Maximum 50 items per request
  • Bars (OHLCV): Maximum 5000 bars per request
  • Order Book Depth: Maximum 500 levels per side (aggregator)

Authentication Requirements

Authenticated endpoints require:

  1. O2-Owner-Id header with owner address
  2. signature in request body (cryptographically signed)
  3. nonce in request body (unique and incrementing)

The signature must be generated by signing the request payload with the owner's private key.

WebSocket Parameters

For WebSocket subscriptions, parameters are sent in the message body:

json
{
  "action": "subscribe_depth",
  "market_id": "c0c5c48315d8cfff9f00777f81fdf04e9b4ef69e802a1a068549a8d6a06ee19f",
  "precision": "10"
}

Available Actions

  • subscribe_depth: Order book updates
    • Requires: market_id, precision
  • subscribe_orders: Order updates
    • Requires: market_id, account parameters
  • subscribe_trades: Trade updates
    • Requires: market_id
  • subscribe_balances: Balance updates
    • Requires: account parameters

See System Endpoints for detailed WebSocket examples.