Account & Balance Management
Manage trading accounts and check asset balances across trading accounts and order books.
Create Trading Account
Create a new trading account contract for a user.
POST /v1/accounts
Request Body
curl -X POST \
"https://api.o2.app/v1/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json"The identity field uses the Fuel Identity type with an Address variant. Rate Limit: 1 request/second (IP-based)
Source: packages/api/src/app/routes/v1/accounts.rs:create_account_handler
Get Account Information
Get trading account information.
GET /v1/accounts
Query Parameters
curl -X GET \
"https://api.o2.app/v1/accounts" \
-H "Accept: application/json"Parameters: Provide exactly one of owner, owner_contract, or trade_account_id.
Source: packages/api/src/app/routes/v1/accounts.rs:get_account_handler
Get Account Balance
Get balance for a specific asset in a trading account.
GET /v1/balance
Query Parameters
curl -X GET \
"https://api.o2.app/v1/balance" \
-H "Accept: application/json"Parameters: Provide either address OR contract (not both).
Response Structure (source):
order_books: Map of order book IDs to balance infolocked: Balance currently locked in open orders (string)unlocked: Liquid balance available inside the book (string)
total_locked: Total locked balance across all books (string)total_unlocked: Total liquid balance to be settled across all books (string)trading_account_balance: Balance available in the trading account (string)
Example Response:
json
{
"order_books": {
"0xbook_id": {
"locked": "0",
"unlocked": "34878720000"
}
},
"total_locked": "0",
"total_unlocked": "59878720000",
"trading_account_balance": "25000000000"
}