Get Started

API Overview

Agra exposes an authenticated HTTP + WebSocket API for trading. Makers post signed orders that rest in the matching engine; takers settle them onchain. Collateral stays in the maker's wallet.

Base URL

SettingValue
Base URLhttps://api.agra.gg
Versioned namespace/v1/*
Health checkGET /healthz (public, no auth)
1curl https://api.agra.gg/healthz
2# -> {"status":"ok","version":"2.0.0"}

Surface area

  • Markets: metadata, depth, single-market top, and bulk top-of-book.
  • Orders: quote, sign + submit, read, history, batch placement, cancels, and the dead-man's switch.
  • Trades & account: wallet trade history and the account-summary.
  • Referrals: code, registration status, registration, and stats.
  • WebSockets: public market data (/v1/ws) and market-maker quoting (/v1/mm/ws).

Conventions

ValueEncodingExample
AmountsDecimal strings (never JSON numbers)"0.98"
SizesRaw integer token units (wei-style)"1000000000000000000" (1.0 at 18 decimals)
PricesDecimal ratio of quote per bond"0.98"
TimestampsUnix seconds (integers)1900003600
Signed-order timesUnix second strings; EIP-712 fields start_time / end_time / counter"1900003600"

Strings avoid floating-point precision loss.

Authentication & signing

  • X-API-Key gates admission to the API.
  • Value-bearing actions additionally require a wallet signature: EIP-712 for order placement, EIP-191 (personal_sign) for cancels and referral registration.

A leaked API key alone cannot place orders or move funds. See Authentication.

Verify quotes before signing. A signature authorizes a value transfer, so treat the quote endpoint as untrusted: confirm a quoted order matches your intent before you sign it. See Order Construction & EIP712 Signing.

Rate limits & errors

Requests are rate-limited per API key and per IP; a breach returns HTTP 429 with a back-off hint in details.retry_after_seconds. All non-2xx responses share one envelope, { status, code, response, details }, while success responses return the resource directly. See Error Handling.

Where to go next