Sportsbook API Integration: A Developer's Checklist for Odds Data

What a sportsbook API integration involves when you are adding odds data to a product: keys and authentication, choosing endpoints, ids and normalization, polling vs streaming, webhooks, errors, rate limits, credits and going live.

By PreciseAPI Engineering

Published

Search for "sportsbook API integration" and you will find two different jobs under the same name. One is an operator plugging a betting platform into its site: wallets, bet placement, settlement and player accounts. The other is a product team adding sportsbook odds to an app, a screen, a model or a media site. This guide is about the second one: what a sportsbook API integration involves when the thing you are integrating is odds data, and the order to do the work in so nothing surprises you on launch day.

The examples use the PreciseAPI feed, a sports odds data API. It supplies prices from 23 sportsbooks, plus exchanges and DFS apps, across 17 leagues. It does not take bets, hold balances or publish picks, so there is no wallet or bet-placement step here.

Two kinds of sports betting API integrations

It is worth settling which one you are doing before you plan anything, because the scope is very different.

Sportsbook platform integrationOdds data integration
Who does itLicensed operators launching a bookApps, screens, models, media, DFS tools
What crosses the APIBets, balances, settlements, player accountsPrices, events, scores, line history
Hard partsWallet consistency, compliance, settlementIds and matching, freshness, request budget
LicensingA gaming license in each marketDepends on your product, not on the data

If you need bet placement, you need a sportsbook platform, not an odds feed. If you need prices from many books in one shape, read on. The betting app guide covers where an odds app ends and a sportsbook begins, including deep links that send users to a book's own slip.

Step 1: Authentication and keys

Every request carries an API key in a header. Authorization: Bearer <key> is the recommended form; X-API-Key: <key> is equivalent. A key in the URL (?api_key=) is refused with 401 api_key_in_url, because URLs end up in proxy and browser logs.

A few habits at this stage save a lot of trouble later:

The full key is shown once, when you create it. If it is lost, roll it: that revokes the old key and issues a replacement with the same name and restrictions.

Step 2: Map your features to endpoints

Most integrations need four or five endpoints, not all of them. Write your feature list down and map each item before you write code, because the map also tells you your credit cost.

FeatureEndpointCredits
League, source and market lists/v1/leagues, /v1/sportsbooks, /v1/marketsFree
Schedule/v1/events1
Game lines for many games/v1/odds2
Every market for one game/v1/events/{id}/odds2
Player props/v1/props3
Best price per outcome/v1/best-lines3
Futures/v1/futures2
Line movement/v1/history3
Scores and results/v1/scores1
Live pushWebSocket /v1/stream1 per connection-minute

Credits are charged per request, not per book or market, so one /v1/odds call for a whole league costs the same 2 credits whether it returns two books or all of them. Props, futures and history need a paid plan, and in-play games and the stream need Syndicate. The endpoint reference lists every parameter.

Step 3: Ids and normalization

The part of any sportsbook API integration that takes longest is rarely the HTTP call. It is deciding that two books' listings are the same game and the same bet. An odds API does that matching for you, and your job is to build on its ids rather than on names:

Key your database and your caches on those ids. Cache the reference lists (/v1/leagues, /v1/sportsbooks, /v1/markets) for hours; they are free, but they rarely change. And treat them as data rather than a hard-coded list, because new sources, leagues and market keys can appear within v1 without a version change. The normalization post explains how the ids are built, and the versioning page lists what can change without notice.

Step 4: Polling or streaming

There are two ways to keep prices current, and the right one depends on how fresh "current" needs to be.

Polling means calling /v1/odds or /v1/best-lines on a timer. It suits pre-game screens, content sites, scheduled jobs and models, and it works on every plan. Request several leagues or event ids per call instead of one call per game.

Streaming means one WebSocket connection to /v1/stream. You subscribe to leagues or events, receive a full snapshot, then deltas with only the markets that changed, each message with a sequence number. If a number is skipped, you send resync and get a fresh snapshot. The stream also sends event messages when a game's status, score or clock changes. It is part of Syndicate, together with live in-play odds.

The polling vs WebSockets post works out the break-even, and the Node.js streaming tutorial builds a client with gap detection and reconnects.

Step 5: Webhooks for line moves

If what you need is "tell me when this line moves", you may not need to poll or stream at all. Alert rules watch the feed and send a signed line.moved POST to your endpoint when a main-market price moves by at least your threshold or the spread or total changes. Rules can be narrowed to leagues, books and markets, and each delivered alert costs 1 credit. Edge includes 2 webhook endpoints, Sharp 10 and Syndicate 25.

Verify every delivery before you trust it. The PreciseAPI-Signature header is t=<unix seconds>,v1=<hex>, where v1 is an HMAC-SHA256 of "<t>.<raw body>" with your endpoint's secret:

import crypto from 'node:crypto';

function verify(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(',').map((kv) => kv.split('=')));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false; // replay protection
  const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
  return parts.v1?.length === expected.length && crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}

Answer with a 2xx within 5 seconds and do the work afterwards. Failed deliveries are retried on a schedule, and deliveries can arrive out of order or twice, so de-duplicate on the event id. The webhooks docs cover retries and the dashboard's test ping, and the Discord bot tutorial wires alerts to a channel.

Step 6: Errors, rate limits and credits

Every error has an HTTP status and a stable code in a JSON body, and every response carries an X-Request-Id to quote to support. Branch on the code, keep a default branch for codes you haven't seen, and retry only what is worth retrying:

const API = 'https://api.preciseapi.com/v1';

async function api(path, params = {}, attempt = 0) {
  const res = await fetch(`${API}${path}?${new URLSearchParams(params)}`, {
    headers: { Authorization: `Bearer ${process.env.PRECISEAPI_KEY}` },
  });
  if (res.ok) return res.json();

  const body = await res.json().catch(() => ({}));
  const retryable = res.status === 429 || res.status >= 500; // rate_limited, warming_up, maintenance, internal_error
  if (retryable && attempt < 4) {
    const wait = Number(res.headers.get('retry-after')) || 2 ** attempt;
    await new Promise((r) => setTimeout(r, wait * 1000));
    return api(path, params, attempt + 1);
  }
  throw new Error(`${res.status} ${body.error?.code} (${res.headers.get('x-request-id')})`);
}

const { data, meta } = await api('/odds', { league: 'nfl', markets: 'main', books: 'pinnacle,draftkings,fanduel' });
console.log(data.length, 'games,', meta.credits_used, 'credits');

A 400 invalid_parameter names the bad param; fix the request instead of retrying it. A 402 insufficient_credits or key_credit_cap means the balance or the key's cap is spent. A 403 plan_feature_unavailable means the request needs a higher plan, for example live games on Edge or Sharp.

Errors are never charged. Successful responses report their cost in X-Credits-Used and X-Credits-Remaining, and the rate limit in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Limits are per account, over a rolling minute: 20 requests on the Sandbox key, 300 on Edge, 1,200 on Sharp and 3,000 on Syndicate. The credits and rate limits guide has worked monthly budgets.

Step 7: Handle stale and suspended prices

An odds integration that shows a price a book has already pulled is worse than one that shows nothing. Three fields carry that information:

/v1/status is free and reports each source as operational, suspended or no_data, which belongs on your own monitoring dashboard. The data model docs explain every clock.

Going live: a checklist

Before you point real users at the integration, check each of these:

  1. Keys live on your server only, one per environment, with restrictions and a credit cap on non-production keys.
  2. Reference data is cached and new ids are handled without crashing.
  3. Everything is keyed on event, market and selection ids, not names.
  4. Responses shared by many users are cached once in your backend, not fetched per viewer.
  5. 429 and 5xx responses back off using Retry-After; 4xx errors are logged with their request id.
  6. Suspended and stale markets are hidden or marked.
  7. Stream clients detect sequence gaps, resync and reconnect with backoff.
  8. Webhook handlers verify signatures, answer fast and de-duplicate.
  9. Usage alerts watch /v1/usage (free) or the credit headers.
  10. Someone is subscribed to the changelog for additive changes.

If you would rather not write the plumbing, the official Node.js and Python SDKs handle retries on 429 and 5xx, stream reconnects and gap recovery, and webhook verification. For other languages there is an OpenAPI 3.1 spec and a Postman collection.

Plans for an integration

The free Sandbox gives 50 one-time credits and a free key for pre-game odds and props at 20 requests a minute, which is enough to prove the integration works. Edge ($49.99 a month) adds 100,000 credits, futures, line history and webhooks. Sharp ($199.99) is unlimited pre-game. Syndicate ($249.99) is unlimited and adds live in-play odds and the WebSocket stream. The pricing page has the full table, and the quickstart gets a first request working.

Frequently asked questions

What does a sportsbook API integration involve?

For odds data: getting keys and keeping them server-side, mapping features to endpoints, building on the API's event, market and selection ids, choosing polling or streaming, handling errors, rate limits and credits, and hiding stale prices. Platform integrations for operators add wallets, bet placement and settlement, which an odds data API doesn't provide.

Can I place bets through PreciseAPI?

No. PreciseAPI is a sports odds data API. It supplies prices, scores and line history, and its responses can carry links to a book's own event page or bet slip, but bets are placed at the sportsbook.

How long does an odds API integration take?

A first request takes minutes with the quickstart. A production integration takes longer, mostly for caching, error handling and stale-price handling rather than for the API calls themselves. Using the provider's ids instead of matching names yourself is the biggest time saver.

Should my app call the odds API directly from the browser?

No. A key in client code can be copied. Proxy requests through your own backend, which also lets you cache one response for every user.

Which sports betting API integrations need the Syndicate plan?

Anything that shows games in progress: in-play odds, live scores and the game clock, and the WebSocket stream. Pre-game screens, models, content sites and webhook alerts work on Edge and Sharp.

Keep reading