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.
HTTP Status Codes of Errors
| HTTP status | Errors |
|---|---|
400 | Invalid language, Invalid request: … |
401 | Missing Package header, Invalid Package |
404 | event: Game not found — the match was not found, see section 4 below |
403 | Package has expired, Package is blocked, Package is not active yet, Access from IP/site … is not allowed, Access denied, The language is not available in your package. |
429 | Too many requests |
503 | Temporarily unavailable, try again later |
With any status, the error body is JSON with error_code and error_message (format above); a 404 from event
has the regular envelope with body.message. If your HTTP client
throws an exception on 4xx/5xx statuses, read the response body in that case as well.
Before October 10, 2026, API key and language errors, as well as
Game not found, were returned with HTTP status 200. If your integration expects only 200, contact your SportAPI manager.
1. API Key Errors
Missing Package header (HTTP 401)
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 (HTTP 401)
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 (HTTP 403)
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 (HTTP 403)
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 (HTTP 403)
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 (HTTP 403)
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 (HTTP 403)
The key does not provide access to the requested data or sport.
Check whether:
sportIdis included in the client’s subscription;- for
event, the sport of this match is included in the subscription: a match of another sport is not returned bygame_id; - the correct API method is being used: for an unknown address the API returns
Access deniedwith HTTP status 403; - an internal method is being requested;
- the key belongs to the selected connection.
The language is not available in your package. (HTTP 403)
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 (HTTP 400)
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 returns this error. Other methods respond to invalid path values with the
Invalid request error (below).
Invalid request: … (HTTP 400)
The path contains an invalid value — for example, the line type is not live/line, the format is not
sub/list/group, or the search text is shorter than 2 characters. The error text says what is wrong:
{
"error_code": 100,
"error_message": "Invalid request: type must be live or line, format sub, list or group"
}
Fix the request address; repeating the same request will not help.
Too many requests (HTTP 429)
The key sends more requests than allowed (50 per second on average, up to 100 in a short burst; the limit can be
changed by agreement). The response has a Retry-After header — how many seconds to wait before retrying. Reduce the
request rate (see update guidelines) and cache responses on your side.
Temporarily unavailable, try again later (HTTP 503)
The line source is temporarily unavailable or overloaded. Methods that need data not held in the API’s memory respond
this way: search (search) and event for a match not yet in memory. The response includes a Retry-After header
with the number of seconds to wait before retrying.
4. Responses from the Specific Match Method
Some event method states are not returned as error_code. Instead, they appear as a
body.message inside the regular response envelope: Game not found with HTTP status 404, Game id finished
with HTTP status 200 (a notification about the match state, not an error). In both cases, do not retry the
same request.
Game not found (HTTP 404)
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 (HTTP 200)
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