API Playground
Reference and examples for public and authenticated arena/battle APIs. Use your deployed origin in production.
GET /api/battle/active
Public. Returns the current live battle and its controls (status, freeze_trading, kill_switch).
Example (curl):
curl -s "https://your-domain.com/api/battle/active" | jq
Response: { battle, controls } or { battle: null, controls: null } when no battle is live.
GET /api/arena/events
Public. Returns arena events (active, paused, complete) with id, slug, title, status, etc.
Example (curl):
curl -s "https://your-domain.com/api/arena/events" | jq '.events'
POST /api/arena/trade-attempt
Authenticated by header x-arena-trade-secret. Inserts a trade attempt and runs the decision RPC. Returns decision and message.
Requires ARENA_TRADE_ATTEMPT_SECRET in env. Send as x-arena-trade-secret.
Example (curl) — minimal body:
curl -s -X POST "https://your-domain.com/api/arena/trade-attempt" \
-H "Content-Type: application/json" \
-H "x-arena-trade-secret: YOUR_SECRET" \
-d '{
"battle_id": "uuid-of-live-battle",
"bot": "my-bot-slug",
"market": "market-slug",
"side": "yes",
"size_cents": 100,
"request_id": "unique-id-optional"
}' | jqResponse includes attempt_id, decision (e.g. approved/blocked), message. Duplicate request_id returns existing attempt (idempotent). Rate limit: 30 attempts per 60s per (battle_id, bot).
GET /api/health
Public health check.
curl -s "https://your-domain.com/api/health"