What is FKAPI?
FKAPI is a RESTful API service that provides access to the Football Kit Archive database, which contains thousands of football kits from clubs around the world. It serves as the primary data source for kit metadata when adding items to your FootyCollect collection.FKAPI is an optional dependency. FootyCollect works without FKAPI, but you’ll need to enter all item details manually. With FKAPI running, you get automatic metadata population and search capabilities.
Key Features
- Club search: Search for clubs by name
- Season lookup: Get available seasons for each club
- Kit catalog: Browse kits by club and season
- Kit details: Retrieve complete kit information including colors, design, competitions, and images
- Bulk operations: Fetch multiple kits in a single request
How FKAPI Integrates with FootyCollect
The integration works through a client-service architecture:FKAPIClient
TheFKAPIClient class handles all communication with the FKAPI service:
Circuit Breaker
Prevents cascading failures by temporarily blocking requests after repeated failures
Rate Limiting
Maximum 100 requests per minute to protect the API
Retry Logic
Automatic retry with exponential backoff for failed requests
Response Caching
1-hour cache for search results and kit details
Configuration
Set these environment variables to enable FKAPI integration:.env
Search Workflow
1. Search for Clubs
When creating a new item, start by searching for a club:2. Get Club Seasons
Once you select a club, fetch available seasons:3. Browse Kits for Season
Select a season to see available kits:4. Get Kit Details
Retrieve complete metadata for the selected kit:Automatic Metadata Population
When you select a kit from FKAPI, FootyCollect automatically populates:Club Information
- Club name
- Club logo (downloaded and stored locally)
- Country
Season Data
- Season year (e.g., “2023-24”)
- Start and end dates
Kit Details
- Kit type (Home, Away, Third, Goalkeeper, etc.)
- Brand name and logo
- Main color and secondary colors
- Design pattern (Stripes, Plain, Hoops, etc.)
Competitions
- Associated leagues and tournaments
- Competition logos
How Kit Processing Works
How Kit Processing Works
The This ensures all related entities (clubs, brands, competitions) are created in your local database if they don’t already exist.
FKAPIKitProcessor service handles kit data processing:Advanced Features
Bulk Kit Fetching
Fetch multiple kits in a single API call:Bulk endpoint supports 2-30 slugs per request. Requests with fewer than 2 or more than 30 slugs will be rejected or truncated.
User Collection Scraping
Import your entire collection from Football Kit Archive:- Scrapes your Football Kit Archive collection
- Processes each kit through FKAPI
- Creates corresponding items in FootyCollect
- Downloads and optimizes kit images
Alternative Search Methods
If FKAPI is unavailable, the client falls back to alternative methods:Error Handling & Resilience
Circuit Breaker Pattern
Prevents overwhelming a failing FKAPI service:- Closed: Normal operation, all requests allowed
- Open: Service failing, requests blocked for timeout period
- Half-Open: Testing if service recovered
Retry with Exponential Backoff
Stale Cache Fallback
If FKAPI is unavailable, FootyCollect serves stale cached data:Benefits of FKAPI Integration
Time Savings
Automatically populate 10+ fields with a single kit selection
Data Accuracy
Official data from Football Kit Archive ensures correct details
Consistency
Standardized club names, brands, and competitions across all items
Rich Metadata
Access to competitions, design patterns, and color information
Logo Downloads
Automatic download of club and brand logos
Bulk Import
Import entire collections from Football Kit Archive
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/clubs/search | GET | Search clubs by keyword |
/api/seasons | GET | Get seasons for a club |
/api/clubs/{id}/kits | GET | Get kits for club/season |
/api/kits/{id} | GET | Get kit details |
/api/kits/search | GET | Search kits by keyword |
/api/kits/bulk | GET | Get multiple kits by slugs |
/api/brands/search | GET | Search brands |
/api/competitions/search | GET | Search competitions |
/api/user-collection/{id} | GET | Get user collection |
/api/user-collection/{id}/scrape | POST | Start collection import |
Running FKAPI Locally
To enable FKAPI integration in development:-
Clone the FKAPI repository:
- Follow FKAPI setup instructions to start the service
-
Configure FootyCollect environment:
- Restart FootyCollect to enable integration
For production deployments, run FKAPI as a separate service and configure the
FKA_API_IP to point to your FKAPI server.