Guide
Prediction marketMarket dataEvent contracts API key

Betfair Exchange API guide

Betfair is the world’s largest betting exchange, and trading its markets is the closest thing to prediction-market trading in the UK and Europe.

Last verified · Also known as Betfair API, Betfair API-NG, Betfair Exchange API, betfairlightweight

Quick answer

Betfair’s Exchange API (API-NG) lets a program browse markets, read prices and place back and lay bets on sports, politics and other events. You log in with username and password (or a client certificate for bots) to get a session token and send it with your application key. A free delayed key is for development; a live key costs a one-off fee. The Stream API pushes prices and order changes.

Betfair Exchange API at a glance

Pricing
One-off live key fee; commission on net winnings
Availability
UK, Ireland, much of the EU, Australia; not US
Paper trading
Delayed application key for development
Integration type
REST + API key
In AlgoGP
Design and backtest in AlgoGP, connect the exported code
Auth
App key + session token (interactive or cert login)
Endpoints
JSON-RPC: listMarketCatalogue, listMarketBook, placeOrders
Streaming
Exchange Stream API (TLS socket)
Keys
Delayed key free; live key one-off fee
Python
betfairlightweight, flumine framework

Betting exchange markets as a trading venue

Prices are decimal odds; implied probability is 1 / odds. Strategies range from pre-race value models to in-play scalping. The open-source flumine framework (built on betfairlightweight) handles streaming, order management and backtesting from historical stream files.

Build a Betfair Exchange strategy with AlgoGP

AlgoGP does not connect to Betfair Exchange natively yet. Betfair Exchange uses plain HTTPS with an API key, so it is a good candidate for a native adapter; it is not built in yet.

  1. 1

    Design and backtest in AlgoGP

    Describe the strategy to the copilot and backtest it on years of normalized history. The result does not depend on any vendor.

  2. 2

    Export the Python project

    Every project exports strategy.py, market_data.py, brokers.py and live.py. The strategy only sees bars, cash, positions and orders, never a vendor’s wire format.

  3. 3

    Plug in Betfair Exchange

    Implement the four adapter methods (account, positions, submit_market_order and a candle fetcher) with Betfair Exchange’s SDK, or keep a built-in platform for paper trading and add Betfair Exchange when you go live.

Betfair Exchange API: frequently asked questions

Is the Betfair API free?

The delayed development key is free; a live key costs a one-off fee and normal commission applies.

Can US residents use Betfair?

No; Betfair Exchange is not available in the US. Kalshi and Polymarket serve US event trading.

Design and backtest your Betfair Exchange strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to Betfair Exchange. The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to Betfair Exchange

Free plan, no card required.

Betfair Exchange alternatives

Frameworks that connect to Betfair Exchange

Independent guide. AlgoGP is not affiliated with Betfair Exchange. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.

Build a strategy