When an error occurs, the SPAR API returns a structured error response. The language of error messages is determined by the language parameter in your request (en for English or sv for Swedish).
All error responses include metaData and error only. Null fields are omitted from the JSON response. The detail field within error is optional and may be omitted when no additional context is available.
{
"metaData": {
"apiLogId": 547660,
"timeStamp": "2026-07-21T09:25:00",
"resource": "SPAR Consumer (1231)",
"method": "GET",
"requestUrl": "https://se-webservice.apps.creditsafe.com/spar?searchnumber=199999999999"
},
"error": {
"code": "15",
"text": "Ingen träff"
}
}| Field | Type | Description |
|---|---|---|
metaData | Object | Request metadata for tracing and troubleshooting (always present) |
error | Object | Error details container (always present) |
error.code | String | Application error code (e.g., "R1", "EX2", "7", "15") |
error.text | String | Human-readable error message in the requested language |
error.detail | String or null | Additional error details when available. May contain SPAR supplier error messages. Will be omitted when no additional details are available. |
Error messages are returned in the language specified by the language parameter (en or sv). Default is English.
| Code | Text | Detail |
|---|---|---|
| R1 | The language must be either en (default) or sv (swedish) | |
| EX2 | Ogiltigt personnummer | Felaktigt format på personnummer |
| Code | Text | Detail |
|---|---|---|
| EX1 | Åtkomst till SPAR tjänsten | Inloggningsuppgifter till SPAR saknas |
| EX1 | Åtkomst till SPAR tjänsten | SPAR uppdrags id felaktigt |
| Code | Text | Detail |
|---|---|---|
| R2 | Token får inte saknas eller vara tom | |
| R3 | Sluttiden för token är ogiltig | |
| R4 | Token har gått ut | |
| R5 | Token är ogiltig | |
| R6 | Ogiltig token-utgivare |
| Code | Text | Detail |
|---|---|---|
| 7 | Ej tillgång till tjänsten | Ditt kundkonto har inte tjänsten SPAR Consumer (1231) |
| 7 | Ej tillgång till tjänsten | Användaren har inte tjänsten SPAR Consumer (1231) |
| 7 | Ej tillgång till tjänsten | Ingen åtkomst för kontot eller användaren till tjänsten SPAR Consumer (1231) |
| 8 | Rapporter/poäng slut | Inga kvarvarande rapporter för kontot eller användaren till tjänsten SPAR Consumer (1231) |
| Code | Text | Detail |
|---|---|---|
| 15 | Ingen träff | |
| 15 | Ingen träff | Söknumret får inte saknas eller vara tomt |
| Code | Text | Detail |
|---|---|---|
| EX3 | Oväntat fel | Oväntat felmeddelande från SPAR: <SPAR internt meddelande> |
Important: The SPAR service depends on an external system operated by the Swedish Tax Agency. Creditsafe cannot guarantee 100% uptime and cannot intervene in the event of downtime caused by issues on SPAR's side.
If a report request takes more than 30 seconds, a 504 Gateway Timeout response will be returned.
A 504 Gateway Timeout is most likely a server environment issue at Creditsafe. Please report this kind of issue to Creditsafe support at integration@creditsafe.se including details on the request that timed out (search number, timestamp, and any transaction IDs).
For transient errors (EX1, EX3), implement exponential backoff retry logic:
Initial retry: Wait 1 second
Second retry: Wait 2 seconds
Third retry: Wait 4 seconds
Maximum: 3 retriesAlways log the complete error response including:
error.codeerror.texterror.detail(when present)
- 15 (Ingen träff / No match): This is a valid business outcome, not a technical error
- EX1, EX3 (SPAR issues): Retry after a delay
- R2-R6 (Token errors): Refresh your token
- 7, 8 (Access errors): Contact Creditsafe - these require account configuration changes
Track error frequency to identify:
- Systematic issues (for example, always getting error 7)
- Intermittent problems (for example, occasional EX1 errors)
- Usage patterns that need adjustment
When contacting Creditsafe support about an error:
- Include the
error.code,error.text, anderror.detailfrom the response - Specify the timestamp when the error occurred
- Describe what you were trying to accomplish (search number, parameters used)
- Include your
transactionidif you used one
This information allows support to quickly locate and investigate your specific request.
When using the usespartest parameter, the service routes to different SPAR environments:
- false (default) - Uses live SPAR on production hosts, or sandbox database on sandbox hosts
- true - Uses SPAR test environment on all hosts
The optional usespartest query parameter controls which SPAR environment is used:
false(default) - Uses live SPAR on production hosts, or sandbox database on sandbox hoststrue- Uses SPAR test environment on all hosts
See the API reference for more details on request parameters.