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.
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: @suport_sportapi
- Official website: sportapi.net