πŸ“”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

Code
Error
When It Happens
Quick Fix

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

circle-info

πŸ’‘ 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 data field exists before processing

  • Store rate_limit information to monitor your usage

  • Handle empty data arrays appropriately

πŸ“– Learn more: Understanding API Responsesarrow-up-right

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:

  1. Check parameter spelling - Use exact names from documentation

  2. Verify filter syntax - See Filter Tutorialarrow-up-right

  3. Validate include format - Use semicolons, no spaces

  4. Test with minimal parameters - Remove optional params to isolate issue

Code example (Error handling):

πŸ“– Related: Request Optionsarrow-up-right | Filter Tutorialarrow-up-right

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:

  1. Verify your token:

  2. Test with cURL:

  1. Check token format in code:

  1. 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 Guidearrow-up-right | Best Practicesarrow-up-right

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:

  1. Check your plan access:

  2. Verify resource availability:

  1. Common 403 scenarios:

Scenario
Plan needed
Solution

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

  1. Workarounds (if you can't upgrade):

πŸ“– Related: Plan Featuresarrow-up-right | Data Features per Leaguearrow-up-right

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:

  1. Verify the ID exists:

  1. Check endpoint spelling:

  1. Handle 404 gracefully:

  1. Use ID finder tool:

πŸ“– Related: API Structurearrow-up-right | Endpoints Referencearrow-up-right

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:

Strategy
Savings
How

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 Guidearrow-up-right | Includes Tutorialarrow-up-right | Best Practicesarrow-up-right

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:

3. Contact support (if persistent):

4. Graceful degradation:

πŸ“– Related: Best Practicesarrow-up-right | Contact Supportarrow-up-right

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:

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 Practicesarrow-up-right

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

Need help? Contact [email protected] or use the chat widget.

Last updated

Was this helpful?