API Overview
Operational basics for integrating with the o2 REST and WebSocket APIs.
For contract addresses, market IDs, asset IDs, chain IDs, and RPC endpoints, see Network Identifiers. For SDK-first integration guides, use Authentication & Signing, Orders, and Sessions.
Where To Start
| Category | Use It For |
|---|---|
| Health Check | API server health status |
| Market Data | Markets, tickers, summaries, fees, and order book depth |
| Trading | Trades, candles, order action payloads, order history, and session endpoints |
| Accounts | Account creation, balances, owner operations, withdrawals, and nonce windows |
| WebSockets | WebSocket streams, reconnect behavior, and stream errors |
| Aggregator Endpoints | /v1/agg/ aliases for third-party market-data integrations |
Order creation and cancellation are submitted as actions through POST /v1/session/actions.
- Create Order documents the
CreateOrderaction payload and links to each supported order type. - Cancel Order documents the
CancelOrderaction payload. - Order History documents read endpoints for retrieving orders after submission.
For signing, session authorization, batching, and nonce rules, see Session Management and Nonces.
Networks
o2 docs and examples reference three networks: Mainnet, Testnet, and Devnet. Use the network selector in the docs header to switch interactive examples where supported.
Mainnet
Use mainnet for production trading.
| Component | URL |
|---|---|
| REST API | https://api.o2.app |
| WebSocket | wss://api.o2.app/v1/ws |
| Trading UI | https://trade.o2.app |
Mainnet has no faucet. For deposits and withdrawals, use the o2 trading UI or follow the Deposits & Withdrawals guide.
Testnet
Use testnet for integration testing.
| Component | URL |
|---|---|
| REST API | https://api.testnet.o2.app |
| WebSocket | wss://api.testnet.o2.app/v1/ws |
| Fuel RPC | https://testnet.fuel.network/v1/graphql |
| Faucet | https://fuel-o2-faucet.vercel.app/api/testnet/mint-v2 |
For faucet behavior, whitelisting, and thin testnet order books, see Testing on Testnet.
Devnet
Devnet is also referenced by the SDK quick starts and bot integration guide.
| Component | URL |
|---|---|
| REST API | https://api.devnet.o2.app |
| WebSocket | wss://api.devnet.o2.app/v1/ws |
| Fuel RPC | https://devnet.fuel.network/v1/graphql |
| Faucet | https://fuel-o2-faucet.vercel.app/api/devnet/mint-v2 |
Allowed HTTP Verbs
The o2 REST API uses these HTTP verbs:
| Verb | Usage |
|---|---|
GET | Retrieve markets, order books, trades, orders, balances, account state, and health information |
POST | Create accounts, execute session actions, run account operations, withdraw assets, and call analytics actions |
PUT | Create or update trading sessions |
Unsupported verbs should be treated as unavailable unless a specific endpoint page documents them.
Authentication Headers
Public market data endpoints generally do not require signatures.
Account-specific state-changing endpoints require signed payloads. Most session and account operation endpoints also require:
O2-Owner-Id: 0x<owner_b256_address>For the full owner/session key model and signing flows, see Authentication & Signing.
Server Location
The o2 API is hosted on AWS in the Tokyo region: ap-northeast-1.
If you are colocating latency-sensitive infrastructure, use ap-northeast-1 as the reference region unless the o2 team provides updated guidance.
Response Format
REST responses are JSON. Error responses use structured error codes where available; see Error Codes.
Interactive endpoint pages use the selected network from the docs network selector when possible.
Health Check
Check API server health status.
GET /health
Response:
{
"status": "ok"
}Reference Format
Endpoint pages document:
- HTTP method and path
- query parameters or request body
- response shape
- rate limit
- source reference
For cross-cutting behavior, use the dedicated references: