Documentation Index
Fetch the complete documentation index at: https://docs.footycollect.sunr4y.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
FootyCollect implements rate limiting to prevent abuse and ensure fair usage of API resources. Rate limiting is enforced at two levels:- DRF Throttling - For internal API endpoints (
/api/) - django-ratelimit - For external API proxy endpoints (
/fkapi/)
Rate limits apply per IP address for anonymous users and per user account for authenticated users.
DRF API Rate Limits (/api/)
Internal API endpoints use Django REST Framework’s throttling system with configurable rates.
Default Throttle Rates
| User Type | Default Limit | Configurable Via |
|---|---|---|
| Authenticated | 100 requests/hour | DJANGO_DRF_USER_THROTTLE_RATE |
| Anonymous | 20 requests/hour | DJANGO_DRF_ANON_THROTTLE_RATE |
Throttle Classes
The API uses two throttle classes:Customizing Throttle Rates
You can customize throttle rates using environment variables:FKAPI Rate Limits (/fkapi/)
External API proxy endpoints use django-ratelimit for IP-based rate limiting.
Rate Limit Configuration
| Endpoint Pattern | Rate Limit | Scope |
|---|---|---|
All /fkapi/ endpoints | 100 requests/hour | Per IP address |
Protected Endpoints
The following endpoints are rate-limited:GET /fkapi/clubs/search/- Search clubsGET /fkapi/clubs/{club_id}/seasons/- Get club seasonsGET /fkapi/clubs/{club_id}/seasons/{season_id}/kits/- Get kitsGET /fkapi/kits/search/- Search kitsGET /fkapi/kits/{kit_id}/- Get kit detailsGET /fkapi/brands/search/- Search brandsGET /fkapi/competitions/search/- Search competitionsGET /fkapi/seasons/search/- Search seasonsGET /fkapi/filters/- Get filter options
Implementation
Rate limiting is implemented using the@ratelimit decorator:
FKAPI rate limits are IP-based and apply regardless of authentication status. All users from the same IP share the same quota.
Rate Limit Headers
When rate limits are exceeded, the API returns custom headers to help you track your usage.FKAPI Response Headers
| Header | Description | Example |
|---|---|---|
X-RateLimit-Limit | Maximum requests allowed | 100/h |
X-RateLimit-Remaining | Requests remaining in window | 0 |
Retry-After | Seconds until rate limit resets | 3600 |
Example Rate Limit Response
HTTP Status Codes
429 Too Many Requests
When you exceed the rate limit, you’ll receive a429 Too Many Requests response.
DRF API Response:
Handling Rate Limits
Exponential Backoff
Implement exponential backoff to handle rate limit errors gracefully:Rate Limit Monitoring
Track your rate limit usage to avoid hitting limits:Best Practices
Authenticate to get higher limits
Authenticate to get higher limits
Anonymous users are limited to 20 requests/hour on DRF endpoints. Authenticate to get 100 requests/hour.
Implement request caching
Implement request caching
Cache API responses to reduce the number of requests:
Batch requests when possible
Batch requests when possible
Instead of making multiple individual requests, batch operations where supported:
Handle 429 errors gracefully
Handle 429 errors gracefully
Always implement retry logic with exponential backoff:
Monitor your usage
Monitor your usage
Track API usage to avoid unexpected rate limiting:
- Log all API requests with timestamps
- Monitor rate limit headers in responses
- Set up alerts before hitting limits
- Review usage patterns to optimize requests
Rate Limit Configuration
Environment Variables
Configure rate limits using environment variables in production:Custom Throttle Rates
For custom deployments, you can modify throttle rates inconfig/settings/base.py:
Exception Handling
FootyCollect uses a custom DRF exception handler:Requesting Higher Limits
If you need higher rate limits for production use:- Contact support via GitHub Issues
- Describe your use case and required limits
- Provide details about your application
Higher rate limits are evaluated on a case-by-case basis for legitimate production use cases.
Summary
| API Type | Authenticated | Anonymous | Scope | Reset Period |
|---|---|---|---|---|
DRF API (/api/) | 100 req/hour | 20 req/hour | Per user/IP | 1 hour |
FKAPI (/fkapi/) | 100 req/hour | 100 req/hour | Per IP | 1 hour |
Next Steps
- API Introduction - Learn about available endpoints
- Authentication - Set up API authentication