πError codes
Whenever you receive an unexpected response or experience unexpected behavior, check the HTTP response code and use this guide to troubleshoot the issue.
Quick reference
200
OK
Request succeeded
No action needed β
400
Bad Request
Malformed request, invalid parameters
Check request syntax and parameters
401
Unauthorized
Missing or invalid API token
Verify your API token
403
Forbidden
Accessing unauthorized resource
Check your plan access
404
Not Found
Resource doesn't exist
Verify the ID or endpoint
429
Too Many Requests
Rate limit exceeded
Reduce request frequency or upgrade plan
500
Internal Server Error
Server-side issue
Contact support if persistent
π‘ Pro tip: Always implement proper error handling in your code to catch and handle these errors gracefully.
Detailed error explanations
Click an error code below for detailed troubleshooting information:
200: OK β
What it means: Your request was successful and data has been returned.
Response structure:
{
"data": { ... },
"subscription": [ ... ],
"rate_limit": { ... },
"timezone": "UTC"
}Best practices:
Always check that
datafield exists before processingStore
rate_limitinformation to monitor your usageHandle empty data arrays appropriately
π Learn more: Understanding API Responses
400: Bad request β
What it means: There's a problem with how your request is formatted or the parameters you're using.
Common causes:
1. Invalid query parameters
2. Malformed include syntax
3. Invalid filter syntax
4. Invalid timezone
Example error response:
How to fix:
Check parameter spelling - Use exact names from documentation
Verify filter syntax - See Filter Tutorial
Validate include format - Use semicolons, no spaces
Test with minimal parameters - Remove optional params to isolate issue
Code example (Error handling):
π Related: Request Options | Filter Tutorial
401: Unauthorized π
What it means: Your API token is missing, invalid, or expired.
Common causes:
1. Missing API token
2. Token typo or extra spaces
3. Using test token in production
4. Revoked or expired token
Token was regenerated in MySportmonks
Token was manually revoked
Account subscription expired
Example error response:
How to fix:
Verify your token:
Go to MySportmonks Dashboard
Navigate to API tokens section
Copy the correct token (don't type it manually)
Test with cURL:
Check token format in code:
Common mistakes to avoid:
β Hardcoding tokens in frontend code (security risk)
β Including quotes around the token
β Adding spaces before or after the token
β Using header authentication (use query parameter instead)
Security best practices:
π Related: Authentication Guide | Best Practices
403: Forbidden π«
What it means: Your API token is valid, but you don't have permission to access this resource.
Common Causes:
1. Resource not in your plan
2. Feature not available in your tier
3. Accessing premium endpoints
Example Error Response:
How to fix:
Check your plan access:
Go to MySportmonks Dashboard
Review "My Subscriptions" section
Check which leagues and features are included
Verify resource availability:
Common 403 scenarios:
Access Premier League
Standard+
Upgrade or filter to your leagues
Use xG data
Standard+
Upgrade or remove xG includes
Access Predictions
Predictions add-on
Add predictions to your plan
Live odds
Odds package
Subscribe to odds package
Workarounds (if you can't upgrade):
Filter requests to only leagues in your plan
Remove premium includes from requests
Check Data Features by League
π Related: Plan Features | Data Features per League
404: Not found π
What it means: The resource you're trying to access doesn't exist.
Common Causes:
1. Invalid ID
2. Wrong endpoint path
3. Resource was deleted
Example error response:
How to fix:
Verify the ID exists:
Check endpoint spelling:
Handle 404 gracefully:
Use ID finder tool:
Visit ID Finder
Search for teams, players, leagues, etc.
Get valid IDs for your requests
π Related: API Structure | Endpoints Reference
429: Too many requests β±οΈ
What it means: You've exceeded your plan's rate limit.
Common causes:
1. Making requests too quickly
2. Inefficient API usage
3. Not caching reference data
Example error response:
How to fix:
1. Check your rate limit: Every successful response includes rate limit info:
2. Implement rate limiting:
3. Implement retry with exponential backoff:
4. Optimisation strategies:
Use includes
50-80%
Combine related data in one request
Cache reference data
30-50%
Store types, states, leagues locally
Batch operations
40-60%
Use multi-ID endpoints where available
Smart polling
30-40%
Only poll live matches, reduce frequency
Example - Before & after optimisation:
5. Monitor your usage:
π Related: Rate Limiting Guide | Includes Tutorial | Best Practices
500: Internal server error π§
What it means: Something went wrong on our servers.
When this happens:
Temporary server issue
Database connectivity problem
Unexpected data format causing server error
Service maintenance or deployment
Example error response:
How to handle:
1. Implement retry logic:
2. Check API status:
Visit Sportmonks Status Page (if available)
Check for maintenance announcements
Verify if issue is widespread or isolated
3. Contact support (if persistent):
4. Graceful degradation:
π Related: Best Practices | Contact Support
Common error scenarios
Scenario 1: "Data is missing"
Problem: Response is 200 OK but data is empty or missing fields.
Not an error code issue! This is usually because:
Resource not in your plan β Check plan access
Missing includes β Add necessary includes to request
Filtering too strict β Review filter syntax
Scenario 2: CORS Errors (Frontend)
Problem: "CORS policy: No 'Access-Control-Allow-Origin' header"
Solution: This isn't an API error - use a backend proxy:
π Learn more: CORS Best Practices
Scenario 3: Timeout errors
Problem: Request times out with no response.
Solutions:
Reduce includes complexity
Add pagination to large requests
Check your network connectivity
Increase timeout threshold in your code
Error handling code examples
Complete Example (JavaScript/Node.js)
See also
Rate Limiting Guide - Understand and optimize rate limits
Authentication - Setting up API access
Best Practices - Build robust applications
Request Options - Available query parameters
Contact Support - Get help when needed
Need help? Contact [email protected] or use the chat widget.
Last updated
Was this helpful?