If you're looking to get Bet365 odds via API, you've likely discovered that Bet365 doesn't offer a public API for developers. This means direct integration is out of the question for most projects. Instead, the practical approach involves using a third-party managed odds API that aggregates data from Bet365 and other major UK bookmakers.
This guide explains why direct access is problematic and walks you through how to get Bet365 odds via API integration using a service like UK Odds API. You'll learn how to pull pre-match football odds JSON, avoiding the pitfalls of web scraping and ensuring reliable access to the data you need for your applications.
The Challenge of Getting Bet365 Odds via API
Bet365 is a dominant force in the UK betting market, making its odds highly sought after by developers building comparison sites, betting tools, or data analysis platforms. However, unlike some other betting exchanges or data providers, Bet365 does not provide a public-facing API for developers to programmatically access their odds data. This isn't unique to Bet365; most major sportsbooks protect their data fiercely.
Their business model relies on users visiting their site or app directly. Providing an open API would allow competitors or third-party services to display their odds without driving traffic to their platform. This is a fundamental reason why you won't find an official Bet365 odds API for general use.
Why Direct Bet365 API Access Isn't Practical
Without an official API, developers typically consider two main routes to get Bet365 odds: reverse-engineering their internal APIs or web scraping. Both come with significant technical and legal hurdles. Reverse-engineering is complex, unstable, and often violates terms of service. Their internal APIs are not designed for public consumption and can change without notice, breaking your integration constantly.
Web scraping, while seemingly straightforward, is a cat-and-mouse game. Bookmakers like Bet365 invest heavily in anti-bot technologies. They detect and block automated requests, implement CAPTCHAs, and frequently change their website's structure. This makes maintaining a scraper a full-time job, requiring constant debugging and re-engineering. The legal implications of scraping are also a concern, as it often breaches terms of service and can lead to IP bans or legal action.

The Scraping Trap: What Breaks and Why
Many developers start by trying to scrape Bet365's website directly. It seems like the easiest way to get the data. You write a Python script with BeautifulSoup or Selenium, and for a few hours, it works. Then it breaks.
Here's a common list of what goes wrong:
- IP Bans: Bet365 detects automated requests and blocks your server's IP address. You need proxies, which adds cost and complexity.
- CAPTCHAs: Automated challenges pop up, requiring human interaction to proceed. This makes unattended scraping impossible.
- Website Changes: HTML structure shifts, CSS classes change, and JavaScript rendering methods evolve. Your scraper needs constant updates.
- Rate Limiting: Even if you avoid a full ban, too many requests too quickly will get you throttled, slowing down your data collection.
- Data Normalization: Each bookmaker's site has a different layout and terminology. You spend countless hours writing code to normalize "Home/Draw/Away" from one site and "1X2" from another.
- Legal Risks: Scraping often violates terms of service, leading to potential legal action or permanent account bans.
This constant battle means that building and maintaining a reliable Bet365 scraper is far more resource-intensive than it initially appears. It diverts valuable development time from your core product.
How a Managed Odds API Solves the Problem
A managed odds API like UK Odds API offers a robust alternative to direct scraping. Instead of you battling anti-bot measures and parsing inconsistent HTML, a dedicated service handles all the heavy lifting. We maintain direct integrations with Bet365 and other UK bookmakers, normalize the data, and provide it through a stable, well-documented REST API. This allows you to get Bet365 odds via API without the operational overhead.
Our API provides pre-match football odds JSON data, meaning you get prices for scheduled fixtures before kickoff. We handle the complexities of data collection, cleaning, and delivery, so you can focus on building your application. This approach ensures reliability, scalability, and compliance, freeing you from the "scraping trap."

Getting Pre-Match Football Odds JSON with UK Odds API
Integrating with UK Odds API to get Bet365 odds is a straightforward process. We'll use Python for these examples, but the principles apply to any language.
Step 1: Authenticate Your API Key
First, you need an API key. Sign up on the UK Odds API homepage to get yours. All requests to our API require your key in the X-Api-Key header.
Here's how you'd set up your environment and a basic request in Python:
import os
import requests
# It's best practice to store your API key as an environment variable
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY") # Replace YOUR_API_KEY if not using env var
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# Test authentication by listing bookmakers
try:
response = requests.get(f"{BASE_URL}/v1/bookmakers", headers=headers, timeout=10)
response.raise_for_status() # Raise an exception for HTTP errors
bookmakers_data = response.json()
print(f"Successfully connected. Found {bookmakers_data['count']} bookmakers.")
# Find Bet365's bookmaker_code
bet365_code = next((bm['bookmaker_code'] for bm in bookmakers_data['bookmakers'] if bm['name'] == 'Bet365'), None)
print(f"Bet365 Bookmaker Code: {bet365_code}")
except requests.exceptions.RequestException as e:
print(f"API connection error: {e}")
print("Please check your API key and network connection.")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This snippet connects to the /v1/bookmakers endpoint to verify your API key and identify Bet365's unique bookmaker_code. This code, like UO003 for Bet365, is stable and won't change even if the bookmaker rebrands.
Step 2: Find Upcoming Football Events
Next, you need to find the football events for which you want odds. You can query the /v1/football/events endpoint, filtering by schedule_date and has_odds=true.
import os
import requests
from datetime import datetime, timedelta
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY")
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# Get events for tomorrow
tomorrow_date = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
try:
events_response = requests.get(
f"{BASE_URL}/v1/football/events",
headers=headers,
params={"schedule_date": tomorrow_date, "has_odds": "true", "per_page": "5"},
timeout=30,
)
events_response.raise_for_status()
events_data = events_response.json()
print(f"\nUpcoming events for {tomorrow_date}:")
if events_data["events"]:
for event in events_data["events"]:
print(f"- {event['home_team']} vs {event['away_team']} (ID: {event['event_id']})")
# Store the first event_id for the next step
first_event_id = events_data["events"][0]["event_id"]
print(f"\nUsing event ID: {first_event_id} for odds retrieval.")
else:
print("No events with odds found for this date.")
first_event_id = None
except requests.exceptions.RequestException as e:
print(f"Error fetching events: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This code fetches up to 5 football events scheduled for tomorrow that have available odds. It then prints a summary and stores the event_id of the first event, which we'll use in the next step to retrieve specific odds.
Step 3: Retrieve Bet365 Odds for a Specific Event
With an event_id in hand, you can now fetch the full pre-match football odds JSON for that fixture using the /v1/football/events/{event_id}/odds endpoint. This response will include odds from all supported bookmakers, including Bet365.
import os
import requests
from datetime import datetime, timedelta
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY")
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# --- Re-run previous steps to ensure we have an event_id and bet365_code ---
# (In a real application, you'd manage these more robustly)
# Get Bet365's bookmaker_code (assuming it was found in Step 1)
bookmakers_response = requests.get(f"{BASE_URL}/v1/bookmakers", headers=headers, timeout=10)
bookmakers_response.raise_for_status()
bookmakers_data = bookmakers_response.json()
bet365_code = next((bm['bookmaker_code'] for bm in bookmakers_data['bookmakers'] if bm['name'] == 'Bet365'), None)
if not bet365_code:
print("Bet365 bookmaker code not found. Exiting.")
exit()
# Get an event_id (assuming it was found in Step 2)
tomorrow_date = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
events_response = requests.get(
f"{BASE_URL}/v1/football/events",
headers=headers,
params={"schedule_date": tomorrow_date, "has_odds": "true", "per_page": "1"},
timeout=30,
)
events_response.raise_for_status()
events_data = events_response.json()
first_event_id = events_data["events"][0]["event_id"] if events_data["events"] else None
if not first_event_id:
print("No events found to retrieve odds for. Exiting.")
exit()
# --- Now fetch the odds ---
try:
odds_response = requests.get(
f"{BASE_URL}/v1/football/events/{first_event_id}/odds",
headers=headers,
params={"package": "core", "odds_format": "decimal"},
timeout=60,
)
odds_response.raise_for_status()
odds_data = odds_response.json()
print(f"\nOdds for {odds_data['event_title']} (ID: {odds_data['event_id']}):")
# Example of the response structure (truncated for brevity)
# This shows how the markets array contains selections, which then contain odds from various bookmakers.
print(f"Markets available: {len(odds_data['markets'])}")
print("First market example:")
if odds_data['markets']:
first_market = odds_data['markets'][0]
print(f" Market Name: {first_market['market_name']}")
print(f" Selections: {len(first_market['selections'])}")
for selection in first_market['selections']:
print(f" - {selection['selection_name']}")
# Find Bet365 odds for this selection
bet365_odds = next(
(o['odds'] for o in selection['odds'] if o['bookmaker_code'] == bet365_code),
"N/A"
)
print(f" Bet365 Odds: {bet365_odds}")
except requests.exceptions.RequestException as e:
print(f"Error fetching odds: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
The odds_data JSON response contains a markets array. Each market has selections, and each selection has an odds array. This odds array contains objects, each with a bookmaker_code and the odds value. You can filter this array to specifically find the Bet365 odds.
A truncated example of the JSON response for a single market selection might look like this:
{
"event_id": "EVT123456",
"event_title": "Man Utd vs Liverpool",
"kickoff_utc": "2026-04-26T15:00:00Z",
"markets": [
{
"market_id": "MKT001",
"market_name": "Match Result",
"market_group": "main",
"selections": [
{
"selection_name": "Man Utd",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 2.50, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 2.45, "status": "active" }
]
},
{
"selection_name": "Draw",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 3.40, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 3.30, "status": "active" }
]
},
{
"selection_name": "Liverpool",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 2.80, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 2.75, "status": "active" }
]
}
]
}
]
}
In this example, UO003 represents Bet365 (assuming it was identified in Step 1). You can see its odds for "Man Utd" are 2.50.
Step 4: Extract and Process the Odds Data
Once you have the JSON response, you can parse it to extract the specific Bet365 odds you need. The Python code in Step 3 already demonstrates how to iterate through markets and selections to find Bet365's prices. You can extend this logic to store the data, display it, or feed it into your application's logic.
For example, to get the best Bet365 odds for a specific selection across all markets (if applicable), you'd iterate and compare. Or, if you only care about the "Match Result" market, you'd filter by market_name.
# Continuing from Step 3, assuming odds_data and bet365_code are available
bet365_match_result_odds = {}
if odds_data and odds_data['markets']:
for market in odds_data['markets']:
if market['market_name'] == "Match Result": # Filter for the main market
print(f"\n--- Bet365 Odds for {market['market_name']} ---")
for selection in market['selections']:
# Find Bet365 odds for this specific selection
bet365_price = next(
(o['odds'] for o in selection['odds'] if o['bookmaker_code'] == bet365_code),
None
)
if bet365_price:
bet365_match_result_odds[selection['selection_name']] = bet365_price
print(f"{selection['selection_name']}: {bet365_price}")
else:
print(f"{selection['selection_name']}: Bet365 odds not found.")
break # Exit after finding Match Result market
print("\nFinal Bet365 Match Result Odds Dictionary:")
print(bet365_match_result_odds)
This final snippet demonstrates how to specifically target the "Match Result" market and pull out only the Bet365 odds for each selection, storing them in a dictionary. This is a common pattern for integrating pre-match football odds JSON into your applications.
Common Mistakes When Integrating Odds APIs
Even with a managed API, developers can run into common issues. Knowing these pitfalls helps you build more robust integrations.
- Ignoring Rate Limits: Every API has limits. Hitting them too often will result in temporary bans. Implement proper caching and exponential backoff.
- Not Handling
event_idChanges: Whilebookmaker_codeis stable,event_idrefers to a specific fixture. Ensure your logic correctly identifies and uses the correctevent_idfor the match you're tracking. - Assuming All Markets Are Available: Different API plans or even bookmakers might not offer every market for every event. Check the
marketsarray andpackageparameter. - Not Checking
statusFields: Odds can beactive,suspended, orclosed. Always check thestatusfield for selections before using the odds. - Hardcoding Dates: Always use dynamic date generation (like
datetime.now()) forschedule_dateparameters, not fixed strings. - Poor Error Handling: Network issues, invalid API keys, or temporary service outages can occur. Implement
try-exceptblocks and retry logic.
API Alternatives for UK Bookmaker Odds
When you need to get Bet365 odds via API or other UK bookmaker data, you have several options beyond direct scraping. Each has its pros and cons.
| Feature / Provider | Direct Scraping (Bet365) | Generic Global Odds API (e.g., The Odds API) | UK Odds API | | :----------------- | :------------------------ | :------------------------------------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------## The Bet365 API Problem: Why Direct Access Fails (and What Developers Do Instead)
Developers often hit a wall trying to get Bet365 odds via API. The simple truth is, Bet365 doesn't offer a public API. This isn't an oversight; it's a deliberate business decision to control their data and drive traffic to their own platforms. For anyone building an odds comparison site, a betting bot, or a data analysis tool, this presents a significant hurdle.
This guide will explain why direct API access to Bet365 is impractical and often impossible. We'll then show you the robust alternative: using a managed odds API like UK Odds API to reliably access pre-match football odds JSON, including data from Bet365, without resorting to the fragile and legally ambiguous world of web scraping.
Why Direct Bet365 API Access Isn't an Option
Most major bookmakers, including Bet365, do not provide public APIs for their odds data. Their core business relies on users interacting directly with their platform. Allowing third-party applications to pull odds programmatically would bypass their user interface, impacting their traffic, advertising revenue, and direct customer engagement.
Attempts to bypass this by reverse-engineering their internal APIs or directly scraping their website are common. However, these methods are inherently unstable and legally risky. Internal APIs are subject to frequent, undocumented changes. Web scraping, while technically feasible for a short time, leads to a constant battle against sophisticated anti-bot measures.
The Scraping Trap: Why It Breaks and What It Costs
Many developers, faced with no official Bet365 API, turn to web scraping. The idea is simple: write a script to visit the Bet365 website, parse the HTML, and extract the odds. In practice, this quickly becomes a nightmare.
Here’s a breakdown of what typically goes wrong and why scraping is a false economy:
- IP Bans and CAPTCHAs: Bet365 employs advanced bot detection. Your server's IP address will be quickly identified and banned. You'll encounter CAPTCHAs that require human intervention, making automated data collection impossible. This forces you to invest in costly proxy networks and CAPTCHA-solving services.
- Website Structure Changes: Bookmakers frequently update their website layouts, HTML elements, and JavaScript rendering. A minor change can completely break your scraper, requiring immediate and often complex re-coding. This means constant maintenance and debugging.
- Rate Limiting: Even if you avoid a full ban, making too many requests in a short period will trigger rate limits. Your data feed will slow down or stop, rendering your application's odds outdated.
- Data Normalization: Every bookmaker presents odds and market names differently. You spend significant development time writing custom logic to normalize data from Bet365, William Hill, Ladbrokes, and others into a consistent format for your application.
- Legal and Ethical Concerns: Scraping often violates a website's terms of service. This can lead to legal threats, permanent IP bans, or even account closures if you have a betting account with them. It's a high-risk approach for critical data.
The cumulative effect is that maintaining a reliable Bet365 scraper becomes a full-time job, diverting resources from developing your actual product. It's a treadmill of fixes and workarounds that rarely provides stable, high-quality data.
How a Managed Odds API Provides a Reliable Solution
The most practical and reliable way to get Bet365 odds via API is through a managed odds API service. These services act as an intermediary, handling the complex and resource-intensive task of collecting, normalizing, and delivering pre-match football odds from multiple bookmakers, including Bet365.
UK Odds API is built specifically for this purpose. We maintain robust integrations with Bet365 and many other major UK bookmakers. Our service provides a single, consistent REST API endpoint for all your data needs. This means you get:
- Reliable Data: We handle the anti-bot measures, website changes, and data normalization. Your application receives clean, structured JSON data consistently.
- Stable Endpoints: Our API endpoints are stable and well-documented. You don't have to worry about your integration breaking every time a bookmaker updates their site.
- Comprehensive Coverage: Access odds from Bet365 alongside other key UK bookmakers through one integration. This is crucial for building comprehensive odds comparison tools.
- Focus on Development: You can dedicate your development resources to building features for your application, rather than fighting a never-ending battle against scraping challenges.
- Compliance: Using a licensed data provider mitigates the legal and ethical risks associated with direct scraping.
By using a managed service, you effectively get Bet365 odds via API without the operational nightmare. You query our API, and we deliver the data.
Getting Pre-Match Football Odds JSON with UK Odds API
Let's walk through how to integrate with UK Odds API to retrieve pre-match football odds JSON, specifically looking for Bet365's prices. We'll use Python for these examples.
Step 1: Authenticate Your API Key
Before making any requests, you need to set up your API key. Sign up on the UK Odds API homepage to get your key. It should be included in the X-Api-Key header for every request.
It's good practice to store your API key as an environment variable to keep it out of your codebase.
import os
import requests
# Load API key from environment variable or replace placeholder
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY")
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# Verify API key and get bookmaker codes
try:
bookmakers_response = requests.get(f"{BASE_URL}/v1/bookmakers", headers=headers, timeout=10)
bookmakers_response.raise_for_status()
bookmakers_data = bookmakers_response.json()
print(f"Connected successfully. Found {bookmakers_data['count']} bookmakers.")
# Find Bet365's unique bookmaker_code
bet365_code = next((bm['bookmaker_code'] for bm in bookmakers_data['bookmakers'] if bm['name'] == 'Bet365'), None)
if bet365_code:
print(f"Bet365's internal code is: {bet365_code}")
else:
print("Bet365 not found in the list of supported bookmakers (check your plan).")
except requests.exceptions.RequestException as e:
print(f"API connection error: {e}")
print("Ensure your API key is correct and you have network access.")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This code snippet first attempts to fetch the list of supported bookmakers. This confirms your API key is valid and allows you to identify the stable bookmaker_code for Bet365 (e.g., UO003). This code is crucial for filtering odds in later steps.
Step 2: Find Upcoming Football Events
Now that you have your bet365_code, you need to find the specific football fixtures you're interested in. The /v1/football/events endpoint provides a list of scheduled matches. You can filter these by schedule_date and ensure they has_odds=true.
import os
import requests
from datetime import datetime, timedelta
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY")
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# Get events for tomorrow's date
target_date = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
try:
events_response = requests.get(
f"{BASE_URL}/v1/football/events",
headers=headers,
params={"schedule_date": target_date, "has_odds": "true", "per_page": "5"},
timeout=30,
)
events_response.raise_for_status()
events_data = events_response.json()
print(f"\n--- Upcoming Football Events for {target_date} ---")
if events_data["events"]:
for event in events_data["events"]:
print(f" - {event['home_team']} vs {event['away_team']} (ID: {event['event_id']})")
# Select the first event_id for the next step
first_event_id = events_data["events"][0]["event_id"]
print(f"\nSelected event ID for odds retrieval: {first_event_id}")
else:
print(f"No events with odds found for {target_date}.")
first_event_id = None
except requests.exceptions.RequestException as e:
print(f"Error fetching events: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
This script fetches the first 5 events with odds for tomorrow. The event_id is essential for retrieving specific odds for that match. You'd typically iterate through these events or select a specific one based on your application's needs.
Step 3: Retrieve Bet365 Odds for a Specific Event
Once you have an event_id and Bet365's bookmaker_code, you can fetch the detailed odds for that specific fixture. The /v1/football/events/{event_id}/odds endpoint provides all available pre-match odds from supported bookmakers for that event.
import os
import requests
from datetime import datetime, timedelta
API_KEY = os.environ.get("UKODDSAPI_KEY", "YOUR_API_KEY")
BASE_URL = "https://api.ukoddsapi.com"
headers = {"X-Api-Key": API_KEY}
# --- Re-fetch necessary data for demonstration purposes ---
# In a real application, you'd pass these values between functions or store them.
# Get Bet365's bookmaker_code
bookmakers_response = requests.get(f"{BASE_URL}/v1/bookmakers", headers=headers, timeout=10)
bookmakers_response.raise_for_status()
bookmakers_data = bookmakers_response.json()
bet365_code = next((bm['bookmaker_code'] for bm in bookmakers_data['bookmakers'] if bm['name'] == 'Bet365'), None)
if not bet365_code:
print("Bet365 bookmaker code not found. Exiting.")
exit()
# Get an event_id
target_date = (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
events_response = requests.get(
f"{BASE_URL}/v1/football/events",
headers=headers,
params={"schedule_date": target_date, "has_odds": "true", "per_page": "1"},
timeout=30,
)
events_response.raise_for_status()
events_data = events_response.json()
selected_event_id = events_data["events"][0]["event_id"] if events_data["events"] else None
if not selected_event_id:
print("No events found to retrieve odds for. Exiting.")
exit()
# --- Fetch the odds for the selected event ---
try:
odds_response = requests.get(
f"{BASE_URL}/v1/football/events/{selected_event_id}/odds",
headers=headers,
params={"package": "core", "odds_format": "decimal"},
timeout=60,
)
odds_response.raise_for_status()
odds_data = odds_response.json()
print(f"\n--- Odds for {odds_data['event_title']} (ID: {odds_data['event_id']}) ---")
# Iterate through markets and selections to find Bet365 odds
for market in odds_data['markets']:
print(f"\nMarket: {market['market_name']}")
for selection in market['selections']:
bet365_price = next(
(o['odds'] for o in selection['odds'] if o['bookmaker_code'] == bet365_code and o['status'] == 'active'),
"N/A"
)
print(f" - {selection['selection_name']}: Bet365 Odds = {bet365_price}")
except requests.exceptions.RequestException as e:
print(f"Error fetching odds: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
The JSON response for odds is structured with a markets array, where each market contains a selections array. Inside each selection, there's an odds array. Each object in this odds array represents a price from a specific bookmaker, identified by its bookmaker_code. The code above demonstrates how to navigate this structure and extract Bet365's odds.
Here's an example of what the markets section of the JSON response might look like when fetching odds:
{
"event_id": "EVT987654",
"event_title": "Arsenal vs Chelsea",
"kickoff_utc": "2026-05-01T19:00:00Z",
"markets": [
{
"market_id": "MKT001",
"market_name": "Match Result",
"market_group": "main",
"selection_count": 3,
"selections": [
{
"selection_name": "Arsenal",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 1.90, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 1.85, "status": "active" },
{ "bookmaker_code": "UO008", "odds": 1.92, "status": "active" }
]
},
{
"selection_name": "Draw",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 3.60, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 3.50, "status": "active" },
{ "bookmaker_code": "UO008", "odds": 3.65, "status": "active" }
]
},
{
"selection_name": "Chelsea",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 4.20, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 4.10, "status": "active" },
{ "bookmaker_code": "UO008", "odds": 4.25, "status": "active" }
]
}
]
},
{
"market_id": "MKT005",
"market_name": "Both Teams to Score",
"market_group": "goals",
"selection_count": 2,
"selections": [
{
"selection_name": "Yes",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 1.70, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 1.68, "status": "active" }
]
},
{
"selection_name": "No",
"line": null,
"odds": [
{ "bookmaker_code": "UO003", "odds": 2.00, "status": "active" },
{ "bookmaker_code": "UO027", "odds": 2.05, "status": "active" }
]
}
]
}
],
"note": "Example only — response is truncated."
}
In this example, UO003 (Bet365) offers 1.90 for Arsenal to win and 1.70 for Both Teams to Score (Yes). You can see how easy it is to pinpoint the specific bookmaker's odds once you have the structured JSON.
Step 4: Integrate and Process the Odds Data
With the data extracted, you can integrate it into your application. This might involve:
- Storing in a Database: Persist the odds data for historical analysis or backtesting.
- Displaying on a Website: Power an odds comparison table or a real-time dashboard.
- Feeding a Betting Bot: Use the odds to inform automated betting strategies.
- Running Analytics: Analyze market movements or identify value bets.
The key is that the data is clean, normalized, and readily available in a standard JSON format, making it easy to work with in any programming language.