What Is an Odds API Key?

An odds API key is a secret string issued by a data provider that identifies your account on every request. The provider uses it to decide what you may access and to count usage against your plan's quota. Anyone holding the key can spend that quota, so it must be kept secret.

What a key does

Identifies the account. Every request carries the key, and the provider maps it to your account. It is simpler than a login flow and designed for machine to machine requests.

Authorises access. The plan attached to the account determines which sports, markets, sources, and historical depth the key can reach. Two keys calling the same endpoint can receive different data.

Meters usage. Providers count requests, and often weight them by how much data a request returns, against a quota for the billing period. When the quota is exhausted, requests are refused until it resets or the plan changes.

Enforces rate limits. Separately from the quota, providers usually limit how quickly a single key can make requests. Exceeding that returns a rate limit response even when quota remains.

The key is usually passed as a query parameter or a request header. Headers are preferable where the provider supports them, because query strings are more likely to end up in logs, browser history, and error messages.

Quota and rate limit are different failures

A rate limit response means slow down and retry shortly. A quota response means stop, because retrying will fail until the period resets. Code that treats both the same either gives up too early on a rate limit or burns through retries against an exhausted quota. Read the provider's documentation for how each is signalled.

How keys leak

Committed to source control. A key written into a script and pushed to a repository is exposed to everyone who can see it, and removing it in a later commit does not remove it from history. Automated scanners look for exactly this.

Shipped to a browser or app. Any key included in front-end code or a mobile app can be extracted by anyone who uses it. If a browser needs odds data, route the request through your own server, which holds the key.

Printed in errors and logs. When a request fails, many HTTP libraries include the full URL in the exception message. If the key is in the query string, it is now in your terminal output, your log files, and anywhere those logs are shipped. This is one of the most common leaks and one of the least noticed.

Shared in screenshots and support threads. Pasting a failing request into a forum or chat to ask for help often includes the key.

Left in notebooks. Notebooks with outputs saved can contain the key in a cell or in a printed request long after the code was changed.

Handling keys properly

Store it outside the code. Read the key from an environment variable, loaded from a local file that is excluded from version control, or from a secrets manager in production.

Redact it in error handling. Wrap request errors so the key is stripped from any message before it is printed or logged. This is a few lines of code and it closes the most overlooked leak.

Keep it server-side. Clients call your service; your service calls the provider.

Use separate keys where the provider allows. One for development, one for production. A leaked development key then does not affect the production pipeline, and usage is easier to attribute.

Rotate on suspicion. If a key may have been exposed, generate a new one and revoke the old one immediately. Waiting to confirm misuse costs quota and can cost money.

Watch usage. A sudden jump in consumption that your own code does not explain is often the first sign a key has leaked.

Keys are one model for metering access. Some newer designs remove the shared secret altogether by attaching a payment to each request instead, which changes the leak problem entirely, since there is no long-lived credential to steal.

This page describes API practice and is not betting advice.

A minimal redaction pattern

Before printing or logging any request error, apply a regular expression that replaces the value of any key-like query parameter with a placeholder. Apply it in one shared helper that every request goes through, so a new endpoint added later cannot bypass it.

Frequently asked questions

What is an odds API key?
A secret string a data provider issues to identify your account on every request. The provider uses it to authorise access according to your plan and to count usage against your quota. Anyone who has the key can make requests that count against that quota.
Where should an API key be stored?
In an environment variable loaded from a local file excluded from version control, or in a secrets manager in production. Never write it into source code, front-end code, a mobile app, or a notebook that gets saved with outputs. Keep it server-side so clients never see it.
How do API keys usually leak?
Through commits to source control, inclusion in browser or app code, screenshots and support threads, saved notebook outputs, and error messages. Many HTTP libraries print the full request URL when a call fails, so a key in the query string ends up in terminal output and logs.
What should you do if an API key is exposed?
Generate a new key and revoke the old one immediately, then update wherever the key is stored. Do not wait to confirm misuse, since the cost is spent quota or charges. Afterwards, find and fix how the leak happened. Watching usage for unexplained jumps helps catch the next one early.
What is the difference between a quota error and a rate limit error?
A rate limit error means requests are arriving too quickly and a short wait before retrying will usually succeed. A quota error means the allowance for the period is used up, so retries will keep failing until it resets or the plan changes.