Insights

A successfully finished flow returns a consumer identifier and the available account identifiers for this consumer. These IDs will be needed later to specify the consumer/account for which a report should be generated. To check if this flow was finished successfully, the client backend server needs to call the flow-finished-callback.

Request Body Structure of an Insights Flow

{
    "intended_reports" : Array<IntendedReport>,
    "refresh_days": ?int,
    "from_date": ?Date,
    "to_date": ?Date,
    "accounts" : ?RefreshFlowAccounts,
    "insights_consumer_id" : ?string,
    "data_retention_minutes" : ?int
}

intended_reports IntendedReport[], required

To fit the bank data needed for the later report, the intended_reports will limit the retrieved information to the insights requested here.

refresh_days Integer, optional

This parameter offers to give a timeframe without need to calculate dates. If refresh_days provides a value, the parameters from_date and to_date will be derived from current day (today) minus the given number of days.

The timeframe for which the data should be retrieved can be set by specifying either the from_date and to_date parameters or this refresh_days parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.

from_date Date (String: "YYYY-MM-DD"), optional

The from_date property (in combination with the to_date property) will be used as the start date for the account information to be retrieved. It has to be provided in the YYYY-MM-DD format according to ISO 8601.

The timeframe for which the data should be updated can be set by specifying either the from_date and to_date parameters or this refresh_days parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.

to_date Date (String: "YYYY-MM-DD"), optional

The to_date property (in combination with the from_date property) will be used as the end date for the account information to be retrieved. It has to be provided in the YYYY-MM-DD format according to ISO 8601.

The timeframe for which the data should be updated can be set by specifying either the from_date and to_date parameters or this refresh_days parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.

accounts RefreshFlowAccounts, optional

There are 3 scenarios:

  1. accounts property is empty: The consumer will be given the account selection to select one account during Open banking. by Klarna session.
  2. accounts with empty IDs and IBANs and its "all" property is "true": All accounts of the consumer will be used for the refresh.
  3. accounts contains IDs or IBANs and its "all" property is "false" (or not set): Only the given accounts will be refreshed.

Other combinations will result in validation errors.

insights_consumer_id String, optional

This insights_consumer_id will be used to identify a consumer. It will be used to assign all data retrieved in this flow to this consumer. If left empty, a new identifier will be generated and returned in the response to this call.

data_retention_minutes int, optional

Depending on the use-case, it might be helpful to store transactions (maybe consolidate transactions for a single consumer from different sources) for some minutes. With the data_rention_minutes this can be determined. If left empty, the default value of 10 minutes will be used.

Response Structure of a successful Flow

{
    "data": {
        "state" : enum<'PROCESSING', 'CONSUMER_INPUT_NEEDED', 'ABORTED', 'EXCEPTION', 'FINISHED'>,
        "result" : ?{
            "type" : enum<'error', 'insights_refresh'>,
            "accounts" : [ {
                "insights_account_id" : string,
                "iban" : string
                } ],
            "insights_consumer_id" : string
        }
    }
}

state String, always present

The state property holds the current state of the flow. Find a more detailed description here

result String, always present

The result property holds the data returned by the Insights-Refresh flow.

result.type String, always present

For successful flows the type property always holds the value insights_refresh.

result.accounts RefreshFlowResponseAccount[], always present

The accounts will be a list of type RefreshFlowResponseAccount, listing the available accounts to generate reports from.

result.insights_consumer_id String, always present

The retrieved data was stored with this insights_consumer_id. It can be used to identify this consumer when generating a report later.

RefreshFlowResponseAccount

{
    "insights_account_id": string,
    "iban": string
}

insights_account_id String, always present

The Account-Insights - UUID representing the account with this insights_consumer_id.

iban String, always present

The IBAN from the account of this insights_consumer_id.

Example Response for a successful Insights Flow

{    

  "data": {
    "state": "FINISHED",
    "result": {
      "type": "insights_refresh",
      "accounts": [
        {
          "insights_account_id": "8ed4ac35-04b0-4c4f-a283-41b6e387c422"
        }
      ],
      "insights_consumer_id": "3dbd396b-f8ef-4ab6-9cd8-c5426eafb212"
    }
  }
}

results matching ""

    No results matching ""