Skip to main content

REST API

This page summarizes the current REST surface exposed by the Gateway service.

Status

The Gateway is the HTTP entry point for the backend stack. It validates X-API-Key headers and proxies requests to internal services.

Current write routes support the invite-only closed beta and route through the Broadcast service for registered users. Read routes are broader and include health, market, and account queries.

Base Environments

The current OpenAPI spec lists these environments:

EnvironmentBase URL
Localhttp://localhost:8080
Developmenthttps://dev.ollo.finance
Productionhttps://ollo.finance

Availability depends on environment and access policy.

Authentication

Most protected routes require:

X-API-Key: your-key

Main Endpoint Groups

Health

  • GET /health
  • GET /health/{service}

Accounts

  • POST /v1/accounts/create
  • GET /v1/accounts/{id}
  • POST /v1/accounts/{id}/deposit
  • POST /v1/accounts/{id}/withdraw

Orders

  • POST /v1/accounts/{account_id}/trade
  • GET /v1/accounts/{account_id}/orders
  • POST /v1/accounts/{account_id}/orders/cancel

Markets

  • GET /v1/markets
  • GET /v1/markets/{market_id}/orderbook
  • GET /v1/markets/{market_id}/funding

Liquidation

  • GET /v1/liquidation/accounts/{id}/health
  • GET /v1/liquidation/market/{market_id}
  • GET /v1/liquidation/account/{account_id}
  • GET /v1/liquidation/position/{position_id}
  • POST /v1/liquidation/account/{account_id}/liquidate
  • POST /v1/liquidation/position/{position_id}/liquidate

Request-Format Notes

The current Gateway route definitions use large integer fields as strings. For order placement:

  • market_id is a bytes32 hex string
  • collateral is a large integer string
  • side uses 0 = LONG, 1 = SHORT
  • order_type uses 0 = MARKET, 1 = LIMIT
  • limit_price is only relevant for limit orders

Example: Create An Account

curl -X POST \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"owner":"0x..."}' \
https://dev.ollo.finance/v1/accounts/create

Example: List Markets

curl https://dev.ollo.finance/v1/markets

Example: Place A Trade

curl -X POST \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"market_id":"0x...",
"collateral":"1000000000",
"side":0,
"leverage":5,
"order_type":0,
"limit_price":"0"
}' \
https://dev.ollo.finance/v1/accounts/1/trade

Source Of Truth

The Gateway OpenAPI file and route definitions are authoritative for the current route shape:

  • services/gateway/openapi.yaml
  • services/gateway/src/routes/*