How to pass the API key
The new API (https://data.anysport.io/v1/soccer) supports only one method: pass it in the HTTP request header, using the fixed header name apikey (all lowercase, no X- prefix), with the value being your API key itself.
Code examples
Getting an API key
- Go to dashboard.anysport.io and sign up for an account.
- Verify the 6-digit code sent to your email.
- After logging in, your API key is displayed directly on the dashboard home page and can be copied at any time.
Regenerating your API key
You can regenerate your API key at any time from the dashboard. The old key is invalidated immediately. The new key is always visible on the dashboard and can be copied at any time.Security best practices
- Never commit your API key to a code repository (e.g. Git).
- Store the key in environment variables (a
.envfile) rather than hardcoding it in your code. - If you suspect your key has been leaked, regenerate it immediately.
- Do not expose the key in publicly accessible client-side JavaScript code.
- Do not append the key to URL query parameters (the new version doesn’t support this method anyway) — URLs are more easily captured in server access logs, browser history, proxy caches, and other intermediate points.