API Reference
Preview Alert
Render a single (event_type, channel) preview using the production
formatters. Auth-scoped — only the caller’s own most-recent wallet trade
is used as sample data, and only when wallet_address is in their
tracked_wallets set.
The endpoint NEVER sends a real alert — it only renders. Use the existing
per-channel /me/<channel>/test POST endpoints to send a real test.
GET
Preview Alert
Authorizations
Issue from /v1/keys (or admin-issued for enterprise tier).
Headers
Query Parameters
Previous
Get PriceGet a price for a single token.
Public endpoint — no authentication required.
Mirrors Polymarket's ``GET /price?token_id=...&side=BUY|SELL``.
``side=BUY`` returns the best BID; ``side=SELL`` returns the best
ASK — matching Polymarket's LIVE CLOB wire behaviour and its API
reference ("Returns the best bid price for BUY side or best ask
price for SELL side" — docs.polymarket.com/api-reference/
market-data/get-market-price). NOTE: PM's own docs are
self-contradictory here — the orderbook *guide*
(trading/orderbook#prices) claims "getPrice BUY → Best ask", which
contradicts PM's actual wire. PolySim originally mirrored the guide
text and was therefore INVERTED vs live PM until 2026-06-10 (Fable
API evaluation P0, verified twice with back-to-back live probes:
PM /price?side=BUY == PM /book best bid). The wire is the
authority. ``side`` is treated as REQUIRED at the handler level —
both missing and invalid values return 400 ``{"error": "Invalid
side"}`` matching Polymarket's CLOB contract.
Migration note (2026-06-10): before this fix, ``side=BUY`` returned
the best ask and ``side=SELL`` the best bid. Any PolySim-native
consumer that adapted to the inverted semantics will now see
values flipped to the other side of the book; bots ported from
py-clob-client / live PM become correct without changes.
Implementation note (post-PR #1091 Codex/Copilot review): ``side``
is declared ``Optional`` in the FastAPI signature (not ``Query(...)``)
precisely so the missing-side case lands in this handler — not in
``api_validation_error_handler`` as a 422 — and yields the PM-style
400 uniformly. The earlier required-Query variant routed missing
side through FastAPI's validator before reaching this code, giving
422 instead of 400. PM SDK porters branching on ``{"error":
"Invalid side"}`` would otherwise hit two different envelopes for
the same logical error.
Migration note (2026-05-11): the prior PolySim-extension behaviour
where ``side`` was optional and missing-side returned the cached
last-traded price has been removed. SDK consumers relying on that
fallback should switch to ``GET /v1/last-trade-price`` (last fill)
or ``GET /v1/midpoint`` (best-bid/best-ask average). Fresh-brain
audit PR #1075 flagged the silent fallback as drift that bites
Polymarket SDK ports on first use.
Next
Preview Alert