Sports Betting

Betfair Exchange Setup Guide

Time: 15 minutes | Difficulty: Advanced | Market: Sports Betting Mode: Full automation | API: Betting API (REST) + Exchange Stream API | Docs: developer.betfair.com

This guide wires a Betfair exchange bot to the Betting API using the botwir3 runtime. Configure API credentials, connect to exchange markets, and run automated betting strategies locally.


Before you start

Verify that automated operation is permitted under Betfair's current terms of service before deploying. botwir3 provides tools for building structured automation. The user is responsible for compliance with the platform's terms and all applicable regulations.

Jurisdiction. Betfair Exchange is not available in the United States. Verify availability in the applicable jurisdiction before proceeding.

Activation fee. Betfair charges a £499 one-time activation fee for a personal Live App Key (as of April 2026). A separate £299 fee applies to Software Vendors under a different licensing path. The Delayed App Key (free) provides access to delayed data for testing.

Betfair Terms and Conditions | Developer Program FAQ | Last verified: May 2026

What you need

  • A Betfair account with funds deposited (required for Live App Key activation)
  • A Developer App Key (Delayed for testing, Live for production — £499 activation)
  • The botwir3 runtime downloaded and unzipped
  • A strategy config file from the builder

Step 1: Create API credentials

  1. Log in to developer.betfair.com
  2. Navigate to My Account → Manage App Keys
  3. Create a Delayed App Key (free — for testing and development)
  4. To activate a Live App Key, follow the activation process (£499 fee, requires funded account)
  5. Note the App Key value
  6. Generate a session token using the Betfair login API or certificate-based authentication

Permissions required: Betting API access is granted through the App Key. All account-level permissions (betting, market data) are tied to the App Key tier. Permissions to disable: N/A — Betfair API keys do not have granular permission scopes. Fund withdrawal is not available through the API.

🔒 Security. Betfair API keys do not grant withdrawal access. Fund transfers require the Betfair website. Certificate-based authentication (client SSL) provides stronger session security than username/password login.

Step 2: Configure the adapter

Create adapter.json in the bot directory:

{
  "adapter": "betfair",
  "credentials": {
    "app_key": "paste-app-key-here",
    "username": "paste-betfair-username-here",
    "password": "paste-betfair-password-here"
  },
  "market_filter": {
    "event_type": "1",
    "market_type": "MATCH_ODDS"
  },
  "environment": "live",
  "rate_limit_ms": 200
}

event_type: 1 = Soccer, 2 = Tennis, 7 = Horse Racing, 4339 = Greyhounds. See the Betfair event types reference.

market_type: MATCH_ODDS, OVER_UNDER_25, WIN, PLACE, etc.

API keys are stored in a local config file on the machine running the bot. They are not transmitted to botwir3 or any third party. botwir3 never sees, stores, or has access to platform credentials.

Step 3: Test the connection

botwir3 test --adapter betfair

Expected output:

[botwir3] Adapter: betfair
[botwir3] Connection: OK
[botwir3] App Key tier: delayed (or live)
[botwir3] Rate limit: 12 requests/second (data), 5 requests/second (betting)

Step 4: Start the bot

botwir3 start --config my-strategy.json

The runtime loads the strategy, computes the spec hash, connects to the Betfair Betting API via the local credentials, and begins evaluating signals. The gate function compares proposed actions against the configured spec. The user is responsible for monitoring the bot and verifying execution outcomes.

Rate limits and considerations

EndpointLimitNotes
Betting API (data)12 requests/secondMarket data, prices, runner metadata
Betting API (betting)5 requests/secondPlace, cancel, replace orders
Exchange Stream APIPer connectionReal-time price streaming. Lower latency than polling.

Cost structure. Beyond the £499 activation fee, Betfair charges a Market Base Rate of 2–5% on net winnings per market. A Premium Charge of 20–60% applies to accounts that are consistently profitable over time. These charges are material to strategy profitability — factor them into position sizing and expected returns.

Common Betfair bot configurations include pre-match value betting (identifying mispriced odds before events start), in-play trading (buying and selling positions during live events), and lay-the-draw strategies on soccer markets. Third-party tools (Fairbot, Wagertool, BetAngel) provide GUI-based alternatives — botwir3 provides the local, air-gapped version with configurable discipline features. All actions and decisions are recorded in the local ledger.

Troubleshooting

ErrorCauseFix
CONNECTION_REFUSEDInvalid App Key or session expiredRegenerate session token. Verify App Key is active.
RATE_LIMITEDToo many requests per secondIncrease rate_limit_ms in adapter config. Use the Exchange Stream API for real-time data instead of polling.
PERMISSION_DENIEDDelayed App Key used for live bettingActivate a Live App Key (£499). Delayed keys are read-only.
MARKET_NOT_OPENMarket is suspended or closedVerify market status. In-play markets suspend briefly during events.
MANDATE_INTEGRITY_VIOLATIONConfig file modified while bot is runningStop the bot, verify config, restart

Related guides


One bot. $129. No subscription. No $749/mo platform. → Build for Betfair


Build your Betfair Exchange bot

botwir3 compiler

1 Platform

2 Objective