o2 Exchange API Endpoints Reference
Complete reference of all available API endpoints with interactive examples and detailed documentation.
Network Configuration
Use the network selector in the top navigation bar to choose your preferred API environment. All interactive examples and code snippets will automatically update to use the selected network.
Overview
The o2 Exchange API provides comprehensive access to trading functionality, market data, and account management for the Fuel-based decentralized exchange. This documentation is organized into logical sections for easy navigation:
Endpoint Categories
- Market Data - Trading pair information, market statistics, and real-time ticker data
- Order Book & Depth - Real-time order book depth data showing current bids and asks
- Trading Data - Historical trade data and OHLCV candlestick information
- Account & Balance - Trading account creation and asset balance management
- Order Management - Order history retrieval and individual order details
- Session Management - Trading session keys for automated trading operations
- Account Operations - Advanced account operations including contract calls and withdrawals
- System Endpoints - Health checks, metrics, and WebSocket connections
Quick Start
- Network Selection: Choose your target environment using the network selector above
- Authentication: Most endpoints are public; account-specific operations require signatures
- Rate Limits: Reasonable limits are applied (e.g., max 50 trades per request, 5000 bars per request)
- Response Format: All endpoints return JSON responses with consistent error handling
Interactive Testing
Each endpoint page includes interactive ApiTryIt components where you can:
- Input parameters and see the URL update in real-time
- Execute actual API calls to test endpoints
- View responses with proper formatting
- Generate code examples in Shell, Node.js, and Rust
Query Patterns & Best Practices
Pagination
Many endpoints support pagination using:
start_timestamp+start_trade_id/start_order_id- Starting pointdirection- "asc" or "desc" for query directioncount- Number of items to return
Identity Parameters
Endpoints accepting account identifiers support:
address- User wallet address (Address type)contract- Trading account contract ID (ContractId type)
WebSocket Real-time Data
For real-time updates, connect to the WebSocket endpoint (/ws) on your selected network with subscriptions for:
- Order book updates (
subscribe_depth) - Order updates (
subscribe_orders) - Trade updates (
subscribe_trades) - Balance updates (
subscribe_balances)
For comprehensive parameter documentation, see the Parameters Reference.
Source Code References
All endpoints include direct references to the source code implementation in the packages/api/src/ directory for developers who want to understand the underlying implementation details.
Need help? Navigate through the sections above or use the sidebar to explore specific endpoint categories.