Error Handling

Several errors or unexpected states can occur when communicating with banks. Information about the error will be provided in the XS2A API. The list of possible errors consists of six main groups: USER, BANK, TECHNICAL, NOT_SUPPORTED, MAINTENANCE, CONSENT. These top-level categories can be arbitrarily extended with subcategories to provide more detailed information.

The top-level categories are always provided. The sub-categories are optional, however, the error is described as precisely as possible. For example: If the bank provides the information that the consumer entered an incorrect password, the error category would be USER.ACCESS_DENIED.CREDENTIALS. If the information provided by the bank does not allow for such a specific mapping the error category USER.ACCESS_DENIED or maybe even only USER is used if that is what can be deducted from the current state and context.

It is recommended to implement at least the top-level category in order to have a fallback value for subcategories that might be added in the future.

Error categories in the responses of the endpoints for the XS2A App & Auth API are reduced to the top-level categories for TECHNICAL, NOT_SUPPORTED and MAINTENANCE.

USER

An error that was caused by the consumer happened.

USER.ABORTED

The consumer aborted the process.

USER.ACCESS_DENIED

Access was denied.

USER.ACCESS_DENIED.CREDENTIALS

Access was denied, because the consumer provided incorrect credentials.

USER.ACCESS_DENIED.BLOCKED

Access was denied, because the consumer's account is blocked by the bank.

USER.CONFIGURATION

The consumer has to manually log into their account, because the bank expects some kind of configuration.

Example:

The consumer has to allow transfers to unknown beneficiaries.

USER.CONFIGURATION.CONFIRM_INFOPAGE

The consumer has to manually log into their account and confirm that she/he has read an information message.

USER.CONFIGURATION.ACCOUNT

The consumer has to manually log into their account and perform configurations related to their account.

Example:

The account was recently opened and needs to be activated.

USER.CONFIGURATION.AUTHENTICATION_METHOD

The consumer has to manually log into their account and perform configurations related to authentication methods.

USER.SESSION

An error occurred that is related to the consumer's session.

USER.SESSION.TIMEOUT

The consumer took too long to proceed in the session.

USER.SESSION.DUPLICATE

The consumer has logged into their bank account on a different device or browser window and thus blocks Open banking. by Klarna from accessing the account.

USER.TRANSFER_DENIED

The transfer was denied, because of unspecified reasons related to the consumer.

USER.TRANSFER_DENIED.INSUFFICIENT_FUNDS

The transfer was denied, because the consumer did not have sufficient funds.

USER.TRANSFER_DENIED.TRANSFER_TYPE_NOT_POSSIBLE

The transfer was denied, because the type of transfer is not possible.

BANK

An error that was caused by the bank happened.

BANK.TRANSFER_DENIED

The transfer was denied by the bank.

BANK.TRANSFER_DENIED.DUPLICATE

The transfer was denied by the bank, because it duplicates a recent transfer.

BANK.TRANSFER_DENIED.TO_ACCOUNT_BLOCKED

The transfer was denied, because the bank prevents sending money to the recipient's account.

BANK.TECHNICAL

A technical error caused by the bank happened.

BANK.API_TIMEOUT

The bank's server took too long to respond.

TECHNICAL

A technical error happened.

NOT_SUPPORTED

The requested action is not supported.

NOT_SUPPORTED.SEVERAL_ACCESSORS

The requested action is not supported, because a transfer would have to be confirmed by a second accessor of the account.

Example:

An account of an underaged holder was selected and requires a separate confirmation by the respective supervisor.

NOT_SUPPORTED.TRANSACTIONS_DATE_RANGE

The requested date range is not supported for this bank. For some banks, only transactions from the last 90 days may be fetched.

Example:

The requested date range is set like this:

from_date: <the date 101 days before today>

to_date: <the date 91 days before today>

While this configuration requests only a 10-day range it contains days that are more than 90 days in the past. However, the bank only allows up to 90 days and as a result no transactions are retrievable.

NOT_SUPPORTED.BUSINESS_ACCOUNT

The requested action is not supported, because the consumer's account is a business account.

NOT_SUPPORTED.ACCOUNTS_NOT_APPLICABLE

The requested action is not supported, because there are no applicable accounts to execute this action.

Examples:

  • An account of account_type CREDITCARD was used to initiate a transfer. Creditcard accounts can’t be used for bank transfers. That is also indicated by the transfer_type of the account which would be set to NONE.

  • The user has selected a SAVINGS account to receive the transaction history and the bank does not allow transactions to be fetched for accounts with account_type set to SAVING.

NOT_SUPPORTED.AUTHENTICATION_METHOD

The requested action is not supported, because of an unsupported authentication method.

NOT_SUPPORTED.AUTHENTICATION_METHOD.ON_MOBILE_DEVICE

The requested action is not supported, because the authentication method is not allowed for the mobile device the consumer is using.

Examples:

The consumer uses their banking application and their OTP app on the same device. This is not compliant with SCA (Strong Customer Authentication) regulations as it requires separate devices to be used.

The user has to scan a QR-code from the same device they use for the authentication which is almost always physically impossible.

MAINTENANCE

One or more of the services involved are undergoing maintenance.

MAINTENANCE.BANK

The bank's service is undergoing maintenance.

MAINTENANCE.BANK.ACCOUNTS

The bank's service is undergoing maintenance that affects the consumer's account.

MAINTENANCE.BANK.TRANSFER

The bank's service is undergoing maintenance that affects doing transfers.

MAINTENANCE.XS2A

Open banking. by Klarna is undergoing maintenance.

A general error when using a consent that can not be specified in detail.

This could also be an expired, revoked or limit exceeded issue but the bank does not specify it as such.

CONSENT.EXPIRED

The consent lifetime has expired.

CONSENT.REVOKED

The consent has been revoked.

Examples:

  • The user has revoked the consent in their online banking.

  • The user has granted a consent to their account to another provider/license holder other than Klarna. This can cause any existing consents to automatically get revoked.

CONSENT.LIMIT_EXCEEDED

The daily limit of the consent usage has been exceeded.

Example:

Some banks allow only a certain number of requests per day for a given consent. Typically the limit is 4 requests per day per consent.

Timeouts

There are currently three different types of timeouts which are present in the XS2A-API as well as in the Auth API:

  • Request timeout:
    • The XS2A-API has an internal timeout of 130 seconds for each request. Requests reaching the timeout will return a BANK.API_TIMEOUT error code (see reference above).
  • XS2A Session timeout:
    • Sessions from the XS2A-API time out after 30 minutes of inactivity.
    • Once the 30 minutes have passed, the session can not be interacted with anymore, meaning all data (such as flow results) has to be fetched before the timeout.
  • Bank Session timeout:
    • The connection to the bank times out after 5 minutes of inactivity. This will return a USER.SESSION.TIMEOUT error code (see reference above).
    • It is not possible to do further actions once the bank session has timed out, however, data (such as flow results) can still be fetched.

Invalid Requests

All responses with a response code >=400 should be handled as an error with the format described in this section.

{
    "error": {
        "code": String,
        "message": String,
        "errors": ?Array<ErrorDetails>
    }
}

error_code String, always present

The error_code property indicates the type of the error.

error_message String, always present

The error_message contains the error message.

error_details ErrorDetails[], optional

Provides more information about the error(s).

ErrorDetails

{
    "code": ?String,
    "message": ?String,
    "location": ?String
}

code String, optional

The error_code property indicates a more detailed code of the error.

message String, optional

As message a more detailed error message can be provided.

location String, optional

The location shows line (and column) of the error, if applicable.

Error Examples

Request is missing parameters

HTTP 400 Bad request
{
    "error": {
        "code": "bad_request",
        "message": "IntendedReport is missing required parameters fromDate and toDate."
    }
}

Validation error in request

HTTP 400 Bad request
{
    "error": {
        "code": "bad_request",
        "message": "Bad Request",
        "errors": [
            {
                "message": "must not be null",
                "location": "insights_consumer_id"
            }
        ]
    }
}

API token is invalid

HTTP 403 Forbidden
{
    "error": {
        "code": "forbidden",
        "message": "HTTP 403 Forbidden"
    }
}

API token is missing

HTTP 403 Forbidden
{
    "error": {
        "code": "illegalAuthorizationHeader",
        "message": "Authorization header not found or in wrong format"
    }
}

results matching ""

    No results matching ""