Skip to content

Error Codes

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).

Error Response Structure

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"
  }
}

Response Fields

FieldTypeDescription
metaDataObjectRequest metadata for tracing and troubleshooting (always present)
errorObjectError details container (always present)
error.codeStringApplication error code (e.g., "R1", "EX2", "7", "15")
error.textStringHuman-readable error message in the requested language
error.detailString or nullAdditional error details when available. May contain SPAR supplier error messages. Will be omitted when no additional details are available.
Language-Specific Errors

Error messages are returned in the language specified by the language parameter (en or sv). Default is English.


HTTP 400 - Bad Request

CodeTextDetail
R1The language must be either en (default) or sv (swedish)
EX2Ogiltigt personnummerFelaktigt format på personnummer

HTTP 401 - Unauthorized

CodeTextDetail
EX1Åtkomst till SPAR tjänstenInloggningsuppgifter till SPAR saknas
EX1Åtkomst till SPAR tjänstenSPAR uppdrags id felaktigt

HTTP 403 - Forbidden

Authentication and Authorization Errors

CodeTextDetail
R2Token får inte saknas eller vara tom
R3Sluttiden för token är ogiltig
R4Token har gått ut
R5Token är ogiltig
R6Ogiltig token-utgivare

Access and Service Errors

CodeTextDetail
7Ej tillgång till tjänstenDitt kundkonto har inte tjänsten SPAR Consumer (1231)
7Ej tillgång till tjänstenAnvändaren har inte tjänsten SPAR Consumer (1231)
7Ej tillgång till tjänstenIngen åtkomst för kontot eller användaren till tjänsten SPAR Consumer (1231)
8Rapporter/poäng slutInga kvarvarande rapporter för kontot eller användaren till tjänsten SPAR Consumer (1231)

HTTP 404 - Not Found

CodeTextDetail
15Ingen träff
15Ingen träffSöknumret får inte saknas eller vara tomt

HTTP 500 - Internal Server Error

CodeTextDetail
EX3Oväntat felOvä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.


HTTP 504 - Gateway Timeout

If a report request takes more than 30 seconds, a 504 Gateway Timeout response will be returned.

Server Timeout

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).


Common Error Resolution Steps

1. Implement Retry Logic

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 retries

2. Log Error Details

Always log the complete error response including:

  • error.code
  • error.text
  • error.detail (when present)

3. Handle Specific Errors Appropriately

  • 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

4. Monitor Error Patterns

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

Contacting Support

When contacting Creditsafe support about an error:

  1. Include the error.code, error.text, and error.detail from the response
  2. Specify the timestamp when the error occurred
  3. Describe what you were trying to accomplish (search number, parameters used)
  4. Include your transactionid if you used one

This information allows support to quickly locate and investigate your specific request.


Additional Information

Environment Indicators

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

usespartest Parameter

The optional usespartest query parameter controls which SPAR environment is used:

  • false (default) - Uses live SPAR on production hosts, or sandbox database on sandbox hosts
  • true - Uses SPAR test environment on all hosts

See the API reference for more details on request parameters.