- Home
- Developers
- REST & CCXT API
REST & CCXT API
The API behind the app.
A public REST API with a generated OpenAPI document, a CCXT-compatible perpetuals interface, and WebSocket streams for live market data. Reads are open to anyone, from anywhere, with no key.
- Mainnet base
- aftermath.finance/api
- Testnet base
- testnet.aftermath.finance/api
- Public reads
- No API key
- CORS
- Access-Control-Allow-Origin: *
- Documented limit
- 1,000 req / 10 s
- Spec
- OpenAPI 1.0.0, MIT
Base URLs
Two hosts, one contract.
One base URL per network. Paths on this page are written relative to that base, exactly as they appear in the spec.
- Mainnet
- https://aftermath.finance/api
- Testnet
- https://testnet.aftermath.finance/api
- Reference UI
- https://aftermath.finance/docs
- Spec title
- Aftermath Finance API 1.0.0
# No key, no signup. CORS is open to any origin.
curl https://aftermath.finance/api/perpetuals/markets
# The generated OpenAPI document behind the Swagger UI
curl https://aftermath.finance/api/openapi/spec.jsonThe spec is generated from the service with utoipa and published as JSON and YAML, so a client generator produces types that match what the server actually serves.
Authentication
Signatures, not keys.
There is no API key to issue, so there is none to leak. Authorization for user-scoped routes is a wallet signature, which means the account itself is the credential.
Public reads need nothing
Prices, markets, orderbooks, candles, pools, farms, staking, and chain config are open. No key, no registration, no origin restriction.
User routes sign a fixed string
User-scoped routes are authorized by a wallet signature over one fixed message: Aftermath Terms and Conditions. The user signs it once and the signature is reused.
A bearer token is optional
If you would rather carry a token than a signature, POST /auth/access-token exchanges the signature for an optional bearer token.
Limits and CORS
1,000 requests per 10 seconds.
That is the documented ceiling for the public API, and it is enough for most bots and dashboards. If your workload needs more, open a ticket in Discord with your sui-address and the rate you are asking for.
- Documented limit
- 1,000 requests / 10 seconds
- Key required
- None for public reads
- Higher limits
- By request, in Discord
- CORS
- Any origin
Responses carry Access-Control-Allow-Origin: *, so a front end can call the API from the browser without a proxy.
Request a higher limitEndpoint groups
What you can read.
Representative groups, not the full route list. The Swagger UI is generated from the running service and is the authoritative inventory.
| Group | Covers |
|---|---|
| Prices | Coin prices in USD. |
| Coins | Coin data. |
| Router | Trade routes, via trade-route. |
| Pools | Pool data, including CoinGecko-format tickers. |
| Perpetuals | Config, markets, 24h stats, orderbooks, candles, funding history, order history. |
| Perpetuals vaults | Vault data. |
| Staking | afSUI APY, exchange rate, validator APYs, and TVL. |
| Farms | Farm data. |
| CCXT | markets, ticker, orderbook, trades, OHLCV. |
| DEX Screener | Adapter endpoints in DEX Screener format. |
| Chain config | /sui/epoch and /addresses. |
| Auth | POST /auth/access-token for a bearer token. |
| WebSockets | /perpetuals/ws/updates and per-market candle streams. |
CCXT
Stock CCXT talks to the book.
CCXT ships an Aftermath exchange integration, so an existing trading bot points at Aftermath by changing one line. No Aftermath-specific client, no bespoke transport.
The API also serves CCXT-shaped routes directly — markets, ticker, orderbook, trades, and OHLCV — if you would rather call them over plain HTTP than through the library.
import ccxt
exchange = ccxt.aftermath()
markets = exchange.load_markets()
print(list(markets))Available in the Python, JavaScript, and PHP builds of CCXT. The market set is returned at runtime, so nothing is hardcoded on your side.
WebSockets
Live market data.
Polling is fine for history. For anything live, subscribe — the perpetuals stream carries orderbook, trade, candle, and position updates over a single connection.
A second stream returns candles for one market at a fixed interval, which is the cheaper subscription when all you render is a chart.
API documentation# Orderbook, trade, candle, and position updates
GET /perpetuals/ws/updates
# Candles for a single market at a fixed interval
GET /perpetuals/ws/market-candles/{market_id}/{interval_ms}FAQ
Frequently asked questions
Read the full route list.
The Swagger UI is generated from the running service, so every route, parameter, and response shape on it is current.