Skip to main content

API Configuraton

This documentation provides information on configuring the API for our sportsbetting FiveM script, which offers real-time sports odds from various bookmakers. We provide two versions of this script: a one-time payment version and a subscription-based model.

Versions​

  • Cost: One-time fee.
  • API Key: Users must obtain their own API key from The Odds API.
  • Requests:
    • Free for up to 500 requests per month.
    • $25/month for up to 20,000 requests.

Configuration​

Below is the configuration required for integrating the API with your FiveM script.

API Key​

To use the API, you need an API key. If you are using the one-time payment version, obtain your API key from The Odds API.

API_Config.APIKey = ""

Sports Configuration​

Select the sports events you want to track. You can find a list of supported sports and bookmakers on The Odds API website:

warning

Scores & Results has to be ticked (βœ”) for the event to work.

API_Config.Sports = {
{
label = "UEFA Euro 2024",
sport = "soccer_uefa_european_championship",
bookmaker = "pinnacle"
},
{
label = "Bundesliga - Germany",
sport = "soccer_germany_bundesliga",
bookmaker = "pinnacle"
},
{
label = "Bundesliga 2 - Germany",
sport = "soccer_germany_bundesliga2",
bookmaker = "pinnacle"
},
{
label = "Baseball - MLB",
sport = "baseball_mlb",
bookmaker = "pinnacle"
}
}

Cache Update Time​

The cache update time determines how often the data is refreshed. The Odds API updates every 40 seconds. Setting this value higher will reduce the number of API requests but may result in less current results.

API_Config.CacheUpdateTime = 120
info

Caching Odds and Scores​

The odds and scores are cached in the data/ folder as JSON files. Caching is crucial for the following reasons:

  1. Performance Improvement: By storing data locally, the script can quickly access the latest odds and scores without making a new API request each time, reducing latency and improving response times.

  2. Reduced API Requests: Caching helps to minimize the number of API requests, which is especially important for users with limited request quotas. This ensures you stay within your request limits and avoid additional charges.

  3. Reliability: In case of temporary issues with the API or internet connectivity, the cached data can be used to provide the latest available information, ensuring continuous operation of the script.

Example Configuration​

Here is an example of a complete configuration:

API_Config = {}

-- Get your key here: https://the-odds-api.com/
API_Config.APIKey = "your_api_key_here"

API_Config.Sports = {
{
label = "UEFA Euro 2024",
sport = "soccer_uefa_european_championship",
bookmaker = "pinnacle"
},
{
label = "Bundesliga - Germany",
sport = "soccer_germany_bundesliga",
bookmaker = "pinnacle"
},
{
label = "Bundesliga 2 - Germany",
sport = "soccer_germany_bundesliga2",
bookmaker = "pinnacle"
},
{
label = "Baseball - MLB",
sport = "baseball_mlb",
bookmaker = "pinnacle"
}
}

-- Earliest time after the cache is updated in seconds
API_Config.CacheUpdateTime = 120