Skip to main content
The 0xio Oracle provides real-time price feeds, swap quotes, and historical price data for the 0xio ecosystem. Prices are aggregated from multiple sources (CoinGecko + DexScreener) with anomaly detection and stored in PostgreSQL for historical chart data.

Base URL

Authentication

Most API endpoints require an API key. Get your key from the Developer Portal. Include the key in the x-api-key header:
Keep your API key secret. Never expose it in client-side code or public repositories.

Protected vs Public Endpoints


Health Check

Full Health Check

Returns detailed service status including database and cache connectivity. Response:

Simple Liveness Probe

Returns a simple response for load balancer health checks. Response:

Prices

Get Token Price

Get the current spot price for a specific token. Parameters: Example:
Response:
The source field indicates where the price came from:
  • aggregated(coingecko+dexscreener): Multi-source aggregation with anomaly detection (OCT / wOCT)
  • pyth: Pyth Network oracle feed (SOL, ETH, and other non-OCT symbols)
  • static: Hardcoded value (stablecoins USDC / USDT)

Get All Prices

Get current prices for all supported tokens (OCT, WOCT, USDC, USDT, SOL, ETH). Example:
Response:

Get OCT Detailed Market Data

Get full aggregated market data for OCT including 24h change, volume, liquidity, and source breakdown. Example:
Response:

Get TWAP Prices

Get 5-minute time-weighted average prices for OCT and ETH alongside the current spot, plus the OCT spot-vs-TWAP deviation. Example:
Response:

Trading

Get Swap Quote

Get a swap quote with expected output amount and price impact. Query Parameters: Example:
Response:

Get AMM Reserves

Get current liquidity pool reserves. Example:
Response:

Simulate Trade

Simulate a trade execution against the AMM. Updates internal reserves for quote accuracy. Request Body:
Response:

Update Liquidity (Admin)

Update liquidity reserves. Used by the watcher service to sync on-chain balances. Request Body:
Response:

Chart Data

Get Price History

Get historical price data over a configurable time range. Points are downsampled to fit the range (e.g. 30d → ~1 point per 2h). Query Parameters: Example:
Response:
The time field on chart data points is a Unix timestamp in seconds (suitable for charting libraries like Lightweight Charts). Other endpoints (/health, /api/price/oct/details, /api/reserves) return timestamps in milliseconds.

API Key Management

List Your Keys

List all API keys associated with your wallet address. Requires wallet signature for privacy. Query Parameters: Example:
Response:

Generate New Key

Generate a new API key. Requires wallet signature for verification. Keys follow the format 0xio-{hex}-oracle. Request Body:
Signature Message Format:
Example: 0xio-api-key:oct1abc123...:1706270400 Response:
Store your API key securely! It will only be shown once.
Use the Developer Portal to create keys easily - it handles wallet signing automatically.

Revoke Key

Revoke an existing API key. The key to revoke must be provided in the header. Headers:
Response:

Error Responses

Error responses use the shape { "error": "message" }, with a retry_after field added on 429.

Code Examples

JavaScript/TypeScript

Python

Rust