API Configuraton

This documentation provides information on configuring the API for our sportsbetting FiveM script, which offers real-time sports odds from various bookmakers.

Configuration

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

API Key

You dont need an API Key if you are using the subscription package as its provided by us.

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.

sky_sportsbettin/config/api_config.lua
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:

Scores & Results has to be ticked (✔) for the event to work.
sky_sportsbettin/config/api_config.lua
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.

sky_sportsbettin/config/api_config.lua
API_Config.CacheUpdateTime = 120

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:

sky_sportsbettin/config/api_config.lua
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

Possible Issues

If you're experiencing API-ERROR: 0, it's likely due to regional API blocks—countries like Singapore often restrict access. Try changing your server's hosting location or open a Discord ticket to request a refund.

Support

Need help? Our support team is always ready to assist

Join Discord