Building with AI

Point your AI assistant at files written for it, and keep your key out of the conversation.

Updated

Files for AI tools

Every page of these docs is also published as plain Markdown, and the whole set is available in forms an AI assistant or coding agent can read in one go.

FileWhat it holds
/ai-context.mdA compact starter prompt, current endpoint list and integration checklist to paste into a coding assistant. No API key is included.
/llms.txtA short index: what the API is, the base URL, how to authenticate, and a link to every docs page as Markdown.
/llms-full.txtEvery docs page in one Markdown file, samples and recorded outputs included.
/openapi.jsonThe OpenAPI 3.1 contract: every route, parameter, object and error. It is the source of the API reference.
/docs/reference.mdThe API reference as Markdown, with a runnable sample for each operation.

Markdown for any page

Add .md to a page's path to get the same page as Markdown. For example, /docs/quickstart.md is the quickstart, and /docs/best-practices.md is best practices. The Markdown has the same text, the same code samples and the same recorded outputs as the page, without the site's navigation. Coverage lists work the same way: /leagues.md, /bookmakers.md and /docs/markets.md.

Starting a session

Open your account's developer tools, choose Build with AI, and click Copy AI starter pack. Add your project goal, language and plan before sending it to your assistant. You can also download the same Markdown. Its endpoint list is generated from the verified contract when the site builds.

Give your assistant the index first and let it fetch what it needs, or paste the contract if it cannot fetch pages. A prompt that works well:

I am building with the SockOdds API v1.
Read https://sockodds.com/llms.txt and the pages it links to, and use
https://sockodds.com/openapi.json as the source of truth for routes and fields.

Rules for the code you write:
- Read the API key from the SOCKODDS_API_KEY environment variable. Never ask me
  for the key and never write it into code, config files or logs.
- Send it only as the Authorization: Bearer header, from server-side code.
- Before following links.next, verify it stays on the documented API origin
  under /v1/ and preserves the endpoint and filters.
- Prices are decimal_odds. Check observed_at, and treat a missing price as
  "no current quote", never as zero.
- Handle application/problem+json errors, and honor Retry-After on a per-minute 429.
  On Monthly allowance reached, read credits_needed and credits_reset: ask for
  fewer markets, regions or bookmakers, or wait for the reset.

To build a poller and a database with your assistant, give it Collect and store odds and the example script.

Keep your key out of the chat

An assistant does not need your key to write code for this API. Keep the key in an environment variable on your machine or server, and let the code read it at run time:

  • Do not paste your key into a prompt, an issue or a shared notebook. Treat anything you type into a chat as something others may read.
  • If an agent runs code for you, set SOCKODDS_API_KEY in the environment it runs in, rather than giving it the key as text.
  • If a key ends up in a conversation, a commit or a log, rotate it from your account.

Test an endpoint before writing code

In your account, choose Explore data. Select an active account key. You can choose Show API key and Use in playground from its account card, or paste a saved API key into the password field, then choose Available sports, Upcoming games or Bookmaker odds. Use Browse all endpoints for the full list. Common filters are shown first; More filters and About this filter expose the other parameters, types, allowed values and defaults. Bookmakers has a searchable checkbox picker with type filters and removable chips. Choose up to 20 bookmakers or Use all bookmakers. Browsing and choosing do not send API requests.

Markets has a searchable picker with game, team and player categories. Choose up to 20 market types, remove selections with their chips, or choose Use all markets to omit the market filter. Choices follow the selected league; catalogue support does not guarantee a current price. Results let you expand market periods and lines, reveal more markets and compare all returned bookmaker prices. Leave other optional fields blank to omit them, or use Reset filters to start again. The URL and code update as you edit; they do not send a request. Click Try this request to see readable results. Expand View JSON & request details for the complete response, HTTP status and timing. Next page makes one more request using the response cursor. Every request uses your plan's normal allowance; there is no background polling.

The tester keeps the key in the current page and sends it over HTTPS to SockOdds to make that request. It is never saved in browser storage or included in copied code or AI context. Clear key removes it from the tester. A newly issued key also has a Test this key button while its one-time display is open.

Expand Use this in your app to copy a cURL, JavaScript or Python example to move the tested request into your server app. These examples read SOCKODDS_API_KEY from the environment. The JSON tester covers the catalogue, identities, current prices, results, history and history-file listings. Persistent WebSocket connections and bulk Parquet downloads have separate streaming and history examples.

Check what it writes

AI assistants sometimes fill gaps from memory or from other APIs. Before you ship code an assistant wrote, check it against the API reference:

  • Every request uses the Authorization: Bearer header, not a key in the URL.
  • Field names match the contract: decimal_odds, observed_at, links.next, verdict and so on.
  • Ids keep their prefixes (ev_, pl_, mk_, oc_) and keys are lowercase, such as rlwc or sportsbet.
  • History is used only on a paid plan, and snapshots and the stream only on Pro or Business.

The examples are short, complete programs you can hand to an assistant as a starting point. Each one is run against a local copy of the API, and the output under it is what it printed.

Every plan reads every bookmaker we deliver except bet365, which is on Pro and Business only, so the bookmaker picker offers bet365 only on those keys. Use all included bookmakers omits the explicit filter. Browsing the picker does not send data requests.

Exchange activity and bet availability

Current odds carry two separate optional objects. markets[].exchanges[] describes each native exchange market; prices[].liquidity describes the specific selection, line and price. With group_by=bookmaker, liquidity sits on each outcome and exchange activity stays on each bookmaker's market. Native market_ref joins them; BetOpenly uses offer_ref because its feed identifies individual offers instead of markets.

VenueMarket activityAvailability for the specific bet
BetfairNative market totalMatched as matched_volumeExact back stake and best lay price/stake
MatchbookMarket volume as matched_volume, never runner volumeExact back stake and best lay price/stake
PolymarketNative market volume as matched_volume, never event volume or resting liquidityExact selected-token ask shares and buy cost
Kalshitraded_contracts from native volume_fp; this is a count, not moneyExact YES/NO ask contracts and USD buy cost
ProphetXMatched money is not supplied: totalStake includes open ordersExact stake at the selected back price
BetOpenlyMatched money is not supplied by the open-offer feedRemaining risk on the selected offer
Novig / Fanatics MarketsNo active verified feed; catalogue listing is not a data guaranteeNot supplied until verified

liquidity.available_to_back is the unrounded amount available for that bet before fees. Prediction markets additionally expose liquidity.contract: selection_ref, side, native price, unit (shares or contracts), and optional available quantity. Buy cost is native price times quantity on the same price rung. Decimal odds are a rounded conversion of the native contract price. A complementary YES/NO contract is not a lay; lay appears only when the source reports an actual lay price and size. Share and contract counts are never relabelled as money or added to monetary matched volume.

Market activity is scoped to the native exchange's market. A native market can span several canonical lines, or one canonical market can contain several native YES contracts. Deduplicate by bookmaker and market_ref; never add repeated totals across lines or outcomes. The playground labels separate native contracts with their selections.

Amounts use the enclosing price's observed_at; market activity includes its own observed_at. Explicit zero is valid. Missing amounts mean not supplied, never zero. currency is a verified unit or null when unknown; never infer it from the bookmaker's region. Current Polymarket captures do not declare the collateral currency, so it remains unknown instead of guessing USD, USDC or pUSD. Available money is not a guaranteed account betting limit; lay amounts are stake, not liability. Unavailable current quotes omit exchange data. Price-history ticks, opening/closing snapshots and bulk history files do not promise a volume/liquidity time series.

The account playground shows Market matched or Market activity above the selections and Available to back beside the best exchange price. Contract/share quantities stay visibly separate from money. Expand All bookmaker prices for every bet's availability and any actual lay prices. Missing totals say Matched volume not supplied. Existing bookmaker plan access applies to all fields; these additional venues require Pro.

Need help?FAQ · Email support

Search across the SockOdds documentation and catalogue.