Sport Line API — Error Handling
Common Error Format
Most access and parameter validation errors use the following format:
{
"error_code": 100,
"error_message": "Invalid Package"
}
| Field | Type | Description |
|---|---|---|
error_code | number | Numeric error category code |
error_message | string | Text describing the cause |
When processing a response, check for error_code and error_message. Do not rely only
on the HTTP response status.
1. API Key Errors
Missing Package header
The API key was not sent in the Package HTTP header.
{
"error_code": 100,
"error_message": "Missing Package header"
}
Check whether:
- the
Packageheader is present; - the key was mistakenly added to the URL or request body;
- the HTTP client adds the header to every request.
Invalid Package
The supplied key was not found in the system.
Check whether:
- the entire key was copied;
- there are spaces before or after the value;
- the key belongs to the correct environment;
- the key was replaced by the SportAPI manager.
Package has expired
The key has expired or access has been disabled.
What to do:
- confirm the access expiration date;
- check the payment or trial status;
- contact the SportAPI manager to renew or activate access.
Package is blocked
The key is temporarily paused (for example, by agreement with the manager). Its expiration date does not change.
What to do: contact the SportAPI manager.
Package is not active yet
The key’s access period has not started yet: the key was issued in advance with a future start
date. The start date is the starts_at field of the account method.
What to do: wait for the start date or confirm it with the SportAPI manager.
Access from IP … is not allowed for this Package / Access from site … is not allowed for this Package
The key is restricted to the client’s server IP addresses or websites, and the request came from a different address or site. The error text contains the IP address or site the request came from (the site — for requests from a browser).
What to do:
- check that the request is sent from your server, not from a local computer, or from your website;
- if the server IP has changed, or a new server, site, or mirror was added, send the address or site from the error text to the SportAPI manager;
- the address you are calling from is returned in the
your_ipfield of theaccountmethod.
2. Subscription and Permission Errors
Access denied
The key does not provide access to the requested data or sport.
Check whether:
sportIdis included in the client’s subscription;- the correct API method is being used;
- an internal method is being requested;
- the key belongs to the selected connection.
The language is not available in your package.
The requested language exists in Sport Line API but is not included in the client’s subscription.
What to do:
- use a language available to the current key;
- request the language list from the manager;
- add another language to the subscription if necessary.
3. Request Parameter Errors
Invalid language
The supplied language code is not supported by the API.
Check:
- the
langvalue in the URL; - the spelling and letter case of the language code;
- that the request path contains no extra characters.
Wrong data type (accept only live or line)
The line type parameter contains a value other than live or line.
{
"error_code": 90,
"error_message": "Wrong data type (accept only live or line)"
}
Allowed values:
| Value | Purpose |
|---|---|
line | Prematch matches |
live | Matches currently in progress |
The search method explicitly returns this error. For other methods, an invalid line
type may result in an empty response, so validate the value before sending the request.
4. Responses from the Specific Match Method
Some event method states are not returned as error_code. Instead, they appear as a
message inside a successful response envelope.
Game not found
No match was found for the supplied identifier.
{
"status": 1,
"page": "/v1/event",
"body": {
"message": "Game not found"
}
}
Check whether:
game_idorsgame_idis correct;- the match belongs to the requested
lineorlivetype; - the match exists in the current
eventsresponse.
Game id finished
The match is no longer available in the current line under the supplied game_id.
{
"status": 1,
"page": "/v1/event",
"body": {
"message": "Game id finished"
}
}
The message does not identify the exact reason. The Prematch match may have moved to
Live under a new game_id, been cancelled, or disappeared from the line for another
reason. Sport Line API does not provide separate statuses for these cases.
What to do:
- stop requesting
eventwith the previousgame_id; - refresh the match list through
eventsfor the required line type; - do not conclude that the match started, ended, or was cancelled based only on this message.
5. An Empty Response Is Not Always an Error
An empty body array may mean that no data is available for the selected conditions:
{
"status": 1,
"page": "/v1/events",
"body": []
}
Before showing an error to the user, check whether:
- matches are available for the selected sport;
tournamentIdis correct;- the request uses the correct
lineorlivetype; - the requested data is available to the current subscription.
Recommended Application Handling
- Parse the JSON response.
- Check for
error_code. - If
error_codeis present, handle the known value and write technical information to the log without the API key. - If the response contains
body.message, handle the state of the specific match. - If
bodyis an empty array, display an empty state instead of a system error. - Do not expose the API key, internal URL, or complete technical log to clients.
Information to Send to Support
If the cause of an error is unknown, send:
- the request URL without the API key;
- the request time and time zone;
error_codeanderror_message;- the response body with all sensitive data removed;
- the
lineorlivetype; - the language,
sportId,tournamentId, andgameId, if used.
Do not send an active API key in a public chat or issue.
- SportAPI support: @sportapinet_bot
- Official website: sportapi.net