Robust API integrations aren't just about the happy path — knowing exactly how to detect and respond to each error type keeps your app stable when something goes wrong upstream. This reference covers every error code Live Football API returns and how to handle it.
The Standard Error Format
Every error, regardless of type, returns the same JSON shape:
{
"success": false,
"message": "Access denied. Possible reasons: Invalid key, insufficient credits, daily limit exceeded, or inactive account.",
"timestamp": "2026-08-27 14:22:01"
}
This means you can write a single error-checking function rather than parsing different shapes per error type:
async function callApi(endpoint, params) {
const res = await fetch(`https://live-football-api.com/api/v1/${endpoint}?${new URLSearchParams(params)}`);
const data = await res.json();
if (!data.success) {
handleApiError(res.status, data.message);
return null;
}
return data.data;
}
Error Code Reference
| Code | Meaning | Typical Fix |
|---|---|---|
| 400 | Bad request — missing or invalid parameter | Check required params (e.g. match_id, league_id) are present and correctly formatted |
| 401 | API key missing or invalid | Verify api_key is included and copied correctly from your dashboard |
| 403 | Access denied — insufficient credits, daily limit exceeded, or inactive account | Check credit balance and account status; top up or contact support |
| 429 | Insufficient credits | Top up your credit balance before retrying |
| 500 | Database error | Transient — retry with backoff; not caused by your request |
| 503 | Upstream data source unavailable | Retry after a few seconds — the underlying data feed is temporarily down |
Handling 400 Errors: Parameter Validation
Catch missing parameters client-side before they reach the API, since a 400 almost always means a required field is missing or malformed:
function validateMatchDetailsParams(params) {
if (!params.match_id) {
throw new Error('match_id is required for /live_match_details');
}
}
Handling 401 Errors: Key Problems
A 401 means the key itself is the problem, not your request logic. Distinguish this from other errors so your app can prompt for re-authentication rather than retrying the same broken request:
if (status === 401) {
logOutUserOrRefreshApiKey();
return;
}
Handling 429 and 403: Credit and Access Issues
These require a different response than a simple retry — retrying immediately won't help if credits are actually exhausted:
if (status === 429 || status === 403) {
notifyOpsTeamCreditsLow();
showUserFallbackContent(); // cached data, or a friendly message
return;
}
Handling 500 and 503: Transient Failures
Unlike client-side errors, these are worth retrying — with exponential backoff to avoid hammering a struggling service:
async function fetchWithRetry(endpoint, params, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const res = await fetch(`.../${endpoint}?${new URLSearchParams(params)}`);
if (res.status !== 500 && res.status !== 503) return res;
await new Promise(r => setTimeout(r, 2 ** attempt * 1000)); // 1s, 2s, 4s
}
throw new Error('Max retries exceeded');
}
Building a Central Error Handler
Combining the patterns above into one reusable handler keeps error logic consistent across your whole app:
function handleApiError(status, message) {
switch (true) {
case status === 400:
console.error('Bad request:', message);
break;
case status === 401:
redirectToApiKeySetup();
break;
case status === 403 || status === 429:
showLowCreditsWarning();
break;
case status >= 500:
scheduleRetry();
break;
default:
console.error('Unexpected error:', message);
}
}
Frequently Asked Questions
Does a 503 mean my API key or account has a problem?
No, a 503 specifically indicates the upstream data source is temporarily unavailable — it's unrelated to your account and typically resolves within seconds.
Should I retry every failed request automatically?
Only for 500 and 503 errors, which are transient. Retrying 400, 401, 403, or 429 without fixing the underlying issue (bad params, invalid key, low credits) will just repeat the same failure.
How do I tell a credits problem apart from a rate limit?
Both 403 and 429 can relate to credits and limits — check the message field, which specifies the exact reason (invalid key, insufficient credits, daily limit exceeded, or inactive account).
Is the error response format consistent across all endpoints?
Yes, every endpoint returns the same success, message, and timestamp structure on error, so one error-handling function can cover your entire integration.