Documentation/API reference
Developers

API reference

The public REST API served by the indexer: markets, prices, positions, orders, and protocol state.

Overview

Element serves a public REST API from its indexer. Responses are JSON, CORS is open, and reads are over HTTP. Owner-scoped routes take an owner address; nothing is authenticated because everything served is public on-chain data.

Building an integration?

Integrate against the REST routes below and the on-chain contracts directly. For SDK access or integration support, reach out through the official Element channel.

Endpoints

REST endpoints
RoutePurposeResponse
GET /healthLiveness check{ ok: true }
GET /marketsList the 16 market IDs{ markets: string[] }
GET /market-hoursCurrent session and hourssession and hours object
GET /halt-statusVenue halt mode{ haltMode }: 0 none, 1 reduce-only, 2 full
GET /eventsIndexed protocol events{ events }; filters: owner, name, marketId, limit
GET /positions?owner=Positions for an address (owner required){ positions }
GET /orders?owner=Orders for an address (owner required){ orders }
GET /ohlcvOn-the-fly candles from marks{ market, resolution, candles }
GET /stats?market=Per-market display card: mark, 24h change/high/low/volume, OI, liquidity, oraclestats object (native units; null fields degrade gracefully)
GET /queue/:marketIdPayout queue for a market{ entries }

OHLCV candles

The candles route builds OHLCV on the fly from recorded marks. Prices are returned as 1e8 fixed-point mantissa strings. A single request spans at most 2,000 candles; widen the resolution or narrow the range to fit.

RequestGET /ohlcv?market=<bytes32>&resolution=<seconds>&from=<unixSec>&to=<unixSec> -> { market, resolution, candles: [{ bucket, open, high, low, close, ticks }] }

Market stats

The stats route returns the display card for one market: the mark, its 24-hour change, high, low, and volume, plus live open interest, available liquidity, and the oracle price. Values are in native units (prices 1e8, USDG amounts 6 decimals) and any field can be null when data is missing, so it degrades gracefully rather than erroring. It is read-only display data, not a settlement source.

RequestGET /stats?market=<bytes32> -> { market, markPx1e8, oraclePx1e8, prevDayPx1e8, priceChange24h1e8, priceChangePct24h, high24h1e8, low24h1e8, volume24hUsdg1e6, openInterestUsdg1e6, availableLiquidityUsdg1e6, fundingRate, lastPriceAgeSec }

Units

  • Prices are 1e8 fixed point
  • USDG amounts are 6 decimals
  • Health is a x1000 index (liquidatable below 1000)
  • Trading fee rates are stored in 0.001% units; other rates are true basis points. See Fees & costs