Overview
The LoL Tracker API is a proxy service that forwards requests to the Riot Games API. This means Riot’s rate limits apply directly to your usage of this backend.Riot API Rate Limit Tiers
Riot Games enforces different rate limits based on your API key type:Development Keys
Free tier for testing and development| Limit Type | Allowance |
|---|---|
| Requests per second | 20 requests |
| Requests per 2 minutes | 100 requests |
| Key duration | 24 hours (expires daily) |
Development keys expire after 24 hours. You must regenerate them daily from the Riot Developer Portal.
Production Keys
Approved for live applications| Limit Type | Allowance |
|---|---|
| Requests per second | Varies (typically 500+) |
| Requests per 2 minutes | Varies (typically 30,000+) |
| Key duration | Does not expire |
| Requirements | Application approval from Riot |
How Rate Limits Apply to This API
Player Endpoint Rate Limit Impact
The/api/jugador/:nombre/:tag endpoint makes 3 sequential requests to Riot API:
-
Account lookup (
index.js:26-29) -
Summoner profile (
index.js:34-37) -
Ranked stats (
index.js:43-46)
Match History Endpoint Rate Limit Impact
The/api/historial/:nombre/:tag endpoint is much more expensive on rate limits:
-
Account lookup (
index.js:76-83) -
Match ID list (
index.js:89-96) -
Match details (
index.js:104-107) - One request per matchThis runs in a loop for each match returned
Example: Fetching 10 matches
Example: Fetching 10 matches
If you request 10 matches with
?cantidad=10:- 1 request for account lookup
- 1 request for match ID list
- 10 requests for individual match details
- Total: 12 requests to Riot API
Rate Limit Response
When you exceed Riot’s rate limits, you’ll receive a429 Too Many Requests response from Riot API.
What happens in the code:
- Riot returns 429 status
- The backend catches it at
index.js:201-203 - You receive a 500 error:
{"error": "Hubo un problema al buscar al jugador."}
Pagination as a Rate Limiting Strategy
The match history endpoint supports pagination to control request volume:Query Parameters
| Parameter | Default | Description | Defined At |
|---|---|---|---|
inicio | 0 | Starting index (offset) | index.js:86 |
cantidad | 10 | Number of matches to retrieve | index.js:87 |
Pagination strategy: Request smaller batches of matches (5-10) to stay within rate limits. Load more as needed rather than fetching everything upfront.
Best Practices for Staying Within Limits
1. Implement Client-Side Caching
Since the backend doesn’t cache responses, implement caching in your frontend:- Player stats don’t change instantly
- Match history is immutable (completed games don’t change)
- Reduces redundant API calls
2. Request Smaller Match Batches
Bad approach (22 requests):3. Handle 429 Responses with Retry Logic
Implement exponential backoff when rate limited:4. Debounce User Input
Prevent excessive API calls from rapid user actions:5. Monitor Your Rate Limit Usage
Riot includes rate limit headers in responses:These headers are not currently exposed by the LoL Tracker backend. Consider modifying the backend to forward these headers to help monitor your usage.
Optimization Tips
Reduce Match History Requests
The match history loop (index.js:102-196) makes one API call per match. To optimize:
-
Start with fewer matches
- Default
cantidad=10means 12 requests - Consider reducing to
cantidad=5(7 requests)
- Default
-
Implement infinite scroll instead of loading all matches
- Load 5 matches initially
- Load 5 more when user scrolls to bottom
- Users rarely view more than 10-15 matches
-
Cache match details
- Match data never changes once the game is complete
- Cache aggressively (days or weeks)
Be Strategic About Player Lookups
Each player lookup costs 3 requests:Rate Limit Scenarios
Scenario 1: Multiple Player Searches
User action: Search for 10 different players rapidly API calls: 10 players × 3 requests = 30 requests Result with Development Key:- ✅ Within 20/second limit if searches happen over 2+ seconds
- ❌ Exceeds limit if all searches happen instantly
Scenario 2: Loading Match History
User action: View match history for one player (default 10 matches) API calls: 2 + 10 = 12 requests Result with Development Key:- ✅ Within 20/second limit
- ⚠️ But only 8 more requests available in that second
Scenario 3: Multiple Users Simultaneously
User action: 5 users each search for a player at the same time API calls: 5 users × 3 requests = 15 requests Result with Development Key:- ✅ Within 20/second limit
- ⚠️ But approaching the limit quickly
Scenario 4: Power User Loading Many Matches
User action: Load 50 matches for one player API calls: 2 + 50 = 52 requests Result with Development Key:- ❌ Exceeds 20/second limit
- ❌ Exceeds 100/2-minute limit if done twice
- Limit
cantidadparameter to maximum of 10-15 - Use pagination to load additional matches on demand
- Add rate limiting on the backend to spread requests over time
Monitoring Rate Limits
Check Server Logs
Watch for 429 errors in the console:Track Request Patterns
The server logs each player search:Riot Developer Portal
Visit the Riot Developer Portal to:- View your current API key tier
- Monitor rate limit violations
- Apply for production API keys
- Check API status and uptime
Upgrading to Production Keys
If you’re consistently hitting development key limits, consider applying for a production key: Requirements:- Clear use case and application description
- Demonstrated responsible API usage
- Implementation of rate limiting and caching
- Terms of Service compliance
- 25x-50x higher rate limits
- Non-expiring API keys
- Priority support
- Production-ready reliability
- Visit Riot Developer Portal
- Navigate to “App Registration”
- Submit detailed application
- Wait 1-2 weeks for review
Related Resources
- Response Codes & Error Handling - Understanding API errors including 429 responses
- Match History Endpoint - Using pagination parameters
- Riot API Documentation - Official rate limit documentation