1. Overview
This REST API provides programmatic access to football tournament data. You can retrieve teams, groups, fixtures, scores, players, goal scorers, and tournament statistics. All responses are in JSON format.
The API requires a valid API key and a tournament ID. Keys are issued per tournament and must be kept secret.
2. Authentication
Every request must include your API key. You can send it in two ways:
- Query parameter:
&api_key=YOUR_API_KEY - HTTP header:
X-API-Key: YOUR_API_KEY
73c26a920a0552181c2bc20b15237713Replace with your own key. Keys are tournament‑specific – a key for
uftn0001 will not work for uftn0002.
3. API Endpoint
Base URL: https://www.kenyafootballdata.com/api.php
(For local testing: http://localhost:3000/api.php)
All requests are HTTP GET. Three parameters are required:
| Parameter | Required | Description | Example |
|---|---|---|---|
t | Yes | Tournament ID | uftn0001 |
type | Yes | Data type (see table below) | teams |
api_key | Yes | Your secret API key | 73c26a920a0552181c2bc20b15237713 |
4. Available Data Types (type)
| Type | Returns |
|---|---|
teams | All teams participating: ID, name, logo, district, group, status. |
groups | Group names, description, venue, qualification/relegation spots, team count. |
fixtures | All scheduled matches (past & future) with home/away, date, time, location, result if played. |
scores | Only finished matches: final score, result, points, attendance, gate collections. |
stats | Overall tournament totals: matches played, total goals, average goals, biggest win, best team. |
players | Registered players: name, position, shirt number, photo, team, licence status. |
scorers | Top 20 goal scorers: player name, goals, team. |
statistics | Discipline (yellow/red cards), assists (total + top assisters), injury count. |
5. Example Requests & Responses
5.1 Get all teams in tournament uftn0001
Request URL:
https://www.kenyafootballdata.com/api.php?t=uftn0001&type=teams&api_key=YOUR_KEY
Response (truncated):
{
"success": true,
"data": [
{
"team_id": "uftm00001",
"team_name": "Team 1",
"team_logo": null,
"district": "Mombasa",
"group": "Group 1",
"status": null
},
...
]
}
5.2 Get top goal scorers
https://www.kenyafootballdata.com/api.php?t=uftn0001&type=scorers&api_key=YOUR_KEY
{
"success": true,
"data": [
{"player_id": "ufp0000003", "player_name": "Player 3 Lovence", "goals": 4, "team_id": "uftm00001", "team_name": "Team 1"}
]
}
5.3 Get tournament statistics (cards, assists, injuries)
https://www.kenyafootballdata.com/api.php?t=uftn0001&type=statistics&api_key=YOUR_KEY
{
"success": true,
"data": {
"disciplinary": { "yellow_cards": 4, "red_cards": 1 },
"assists": { "total_assists": 8, "top_assists": [...] },
"injuries": { "total_injuries": 2 },
"top_card_recipients": [...]
}
}
5.4 Get fixtures (schedule)
https://www.kenyafootballdata.com/api.php?t=uftn0001&type=fixtures&api_key=YOUR_KEY
5.5 Get finished scores
https://www.kenyafootballdata.com/api.php?t=uftn0001&type=scores&api_key=YOUR_KEY
6. Integration Examples
JavaScript (with fetch)
fetch('https://www.kenyafootballdata.com/api.php?t=uftn0001&type=teams&api_key=YOUR_KEY')
.then(response => response.json())
.then(data => {
if (data.success) {
console.log(data.data);
} else {
console.error(data.error);
}
});
PHP (using cURL)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.kenyafootballdata.com/api.php?t=uftn0001&type=scorers&api_key=YOUR_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
foreach ($data['data'] as $scorer) {
echo $scorer['player_name'] . ' - ' . $scorer['goals'] . ' goals<br>';
}
}
?>
Python (requests)
import requests
params = {'t': 'uftn0001', 'type': 'players', 'api_key': 'YOUR_KEY'}
resp = requests.get('https://www.kenyafootballdata.com/api.php', params=params)
data = resp.json()
if data['success']:
for player in data['data']:
print(player['name'], player['team']['name'])
cURL (command line)
curl "https://www.kenyafootballdata.com/api.php?t=uftn0001&type=stats&api_key=YOUR_KEY"
7. Error Handling & Status Codes
All errors return a JSON object with "success": false and an "error" field explaining the problem.
| HTTP Code | Meaning | Error message example |
|---|---|---|
| 200 | Success (even if no data, success=true) | - |
| 400 | Missing or invalid parameter | Missing tournament id (t) |
| 401 | Invalid/expired API key or missing key | Invalid or expired API key for this tournament. |
| 404 | Tournament not found | Tournament not found. |
"Invalid type", check the spelling of the type parameter. Allowed values: teams, groups, fixtures, scores, stats, players, scorers, statistics.
8. Best Practices & Security
- Never expose your API key in client‑side code (frontend JavaScript, mobile apps). Call the API from your own backend server instead.
- Use HTTPS – always encrypt the connection to prevent key leakage.
- Rotate keys periodically – contact admin to revoke old keys and issue new ones.
- Cache responses when possible to reduce load and improve speed (e.g., scores might be cached for 5 minutes).
- Respect rate limits – do not poll the API more than once every few seconds unless necessary.
- Store your key securely – environment variables or secret management services.
9. Frequently Asked Questions
Click the "Request API Key" button below or contact support.
The key might be expired or revoked. Also ensure you are using the correct tournament ID – keys are per tournament.
Yes, but do not embed the key in the app. Create a simple backend proxy that holds the key and forwards requests to our API.
Your administrator may set daily or hourly limits. Contact them for details.
Data is updated in real time when scores, players, or fixtures are entered in the admin panel. There is no artificial delay.