Nov 26, 2026

How to build an odds comparison site with a REST API

An odds comparison site does one thing well: for each match, show every book's price and highlight the best one per outcome. Here's the data model and the code to ship it fast.

The core pattern: best price per outcome

You don't want to compute "best" on the client from raw feeds. sportdb.io returns it for you: one call to /v1/{sport}/odds gives every book's price and a best block per outcome.

GET https://sportdb.io/v1/football/odds -H "X-API-Key: sdb_live_..." # → { "data": [ { "home": "Real Madrid", "away": "Barcelona", "market": "1x2", "best": { "home": {"odd": 1.95, "book": "meridian"}, "away": {"odd": 4.20, "book": "maxbet"} }, "books": [ {"book":"mozzart","home":1.90,"draw":3.60,"away":4.10}, … ] } ] }

Render it

Rows = books, columns = outcomes, and highlight the cell that matches best. That's the whole UI. A complete single-file example (paste your key, runs in the browser) is in our examples repo:

Tips