Guide
Real-time prediction-market data: webhooks vs REST vs WebSocket
20 June 2026 · 6 min read
If you're building on Polymarket or Kalshi, the first wall you hit isn't strategy — it's plumbing. Getting clean, live market data, normalised across platforms, with trustworthy resolution, is weeks of work before you write a single line of the thing you actually care about. This guide covers the three ways to move that data — webhooks, REST, and WebSocket — when to reach for each, and how to skip building the ingestion layer yourself.
The problem with rolling your own
Prediction-market data looks simple from the outside — odds go up, odds go down. In practice you're juggling paginated market APIs, rate limits, websocket reconnects, price-vs-volume edge cases, and the genuinely hard part: resolution. When a market settles, what actually won? Scraped odds drift, APIs lag, and "resolved" fields aren't always final. Get that wrong and every backtest and signal downstream inherits the error.
So before comparing delivery methods, it's worth separating two things: how the data reaches you (the transport) and what you're getting (raw odds vs. calibrated, settled truth). The transport is the easy part. Let's do that first.
1. REST — pull when you need it
REST is the simplest model: you ask, you get an answer. It's perfect for snapshots, backfills, dashboards, and anything that doesn't need to react in real time. With Idmon, every endpoint is a plain authenticated GET:
curl -H "Authorization: Bearer YOUR_KEY" \
"https://api.idmon.io/api/alerts/recent?limit=20"
Use REST when: you poll on a schedule, you're hydrating a UI, you need historical context, or you're just getting started. Avoid it when: you need sub-second reactions — polling fast enough to feel "live" wastes your rate limit and still lags.
2. WebSocket — stream when latency matters
A WebSocket keeps one connection open and pushes events to you the instant they happen. It's the right tool for trading logic, live monitors, and anything where being a few seconds late costs you. You open the socket with your key and listen:
wss://api.idmon.io/ws?key=YOUR_KEY
// messages arrive as JSON: { "type": "alert", ... }
// plus "connected" on open and "ping" keep-alives
Use WebSocket when: latency is part of your edge, you're reacting to whale flow or movers as they print, or you'd otherwise be polling REST in a tight loop. Avoid it when: your consumer is a simple cron job or a serverless function that can't hold a connection — a webhook is cleaner there.
3. Webhooks — push into your own systems
Webhooks flip the direction: instead of you holding a connection, the data provider POSTs each event to a URL you own — a Discord channel, an internal endpoint, a queue. You do nothing until something happens. Idmon signs every delivery with an X-PMP-Signature header (HMAC-SHA256 of the raw body) so you can verify it's genuine:
// verify before trusting the payload
const expected = "sha256=" +
crypto.createHmac("sha256", SECRET).update(rawBody).digest("hex");
if (signature !== expected) reject();
Use webhooks when: you want signals pushed straight into a Discord/Slack/community, you're event-driven and don't want to manage a socket, or you're a Discord operator who just wants the feed to "appear." Avoid it when: you need to issue ad-hoc queries — webhooks are push-only, so pair them with REST for lookups.
Which one should you use?
| Method | Direction | Latency | Best for |
|---|---|---|---|
| REST | You pull | On demand | Snapshots, backfills, dashboards, getting started |
| WebSocket | Server streams | Real-time | Trading logic, live monitors, low-latency reactions |
| Webhooks | Server pushes | Real-time | Discord/community delivery, event-driven systems |
Most real builds use two: a stream or webhook for live events, plus REST for lookups and history. There's no single right answer — there's the right answer for your consumer.
The part that's actually hard: resolution truth
Transport is a solved problem. The thing that takes months to get right is knowing, reliably, what happened when a market settles — and calibrating how much to trust a signal before it does. This is where most "prediction-market data" stops at raw scrapes.
Idmon ships calibrated, on-chain-anchored resolution labels alongside the live feed: outcomes anchored to settlement rather than drifting odds, and signals scored by how they've actually performed. That's the layer you'd otherwise build and maintain yourself — across Polymarket, Kalshi, and beyond, normalised into one schema.
Try it without a key. The free /public/* endpoints serve most of the data at 60 requests/min — no signup. When you want real-time push, headroom, and a commercial licence, request a key and you'll be live within a business day.
Get started
- Read the API documentation — REST endpoints, the WebSocket protocol, and webhook signature verification.
- See the code examples in curl, Python, and Node.
- Email [email protected] for an API key, a developer key to try, or a free test channel for your Discord.