Skip to main content
Skip table of contents

Introduction Aggregations

Aggregations are an easy way to have your own reports created with aggregated data. The content as well as the assignment can be determined very easily.

What it solves

Typically, there are different transactional data analysis requirements for each use case. For example, in cash flow analysis, the order of categories differs for each bank, as does their content.

To give the API user the best possible flexibility here, the aggregation endpoint can be used directly. It is possible to create your own views of the transactions via this endpoint.

This provides the user with a very powerful interface that allows all label groups or labels (see Introduction to Labelled Transactions and Label Overview) to be assigned to individual views.

By the possibility to define several views in one request, the priorities can be defined.

Aggregations are also the basis for most cash flow and risk reports.

How it works

The endpoint can be found in the API Documentation.

Basics

Basically, a request looks like this:

JSON
{
  "aggregations": [
    {
      "alias": "MyFirstAggregation",
      "includeLabelGroup": [
        "LOANANDINTEREST"
      ],
      "excludeLabelGroup": [
        "RENTANDLIVING"
      ]
    }
  ]
}

aggregations is the list of aggregation views to be created. Each list item contains an alias corresponding to the section of the client, which must be unique within the aggregation list.

In addition to the alias, at least one includeLabelGroup must also be specified. This field contains a list of labels that should be assigned to this alias or view.
The higher levels of detail are always included.

Example:

If includeLabelGroup contains the label LOANANDINTEREST, then labels like CARLOAN, REALESTATELOAN, CARLEASING etc. are automatically included because they structurally represent a higher level of detail of LOANANDINTEREST.

In order to exclude certain labels from this aggregation, the excludeLabelGroup field can be used. This ensures that the labels specified below are not automatically taken into account.

Order and Priority

Another mechanism, which can be used, for example, for a cash flow analysis for a budgetary account, is the order of aggregations.

Since several of these objects can be specified in the request object, they also determine the order of assignment.

For example, you could make the following request:

JSON
{
  "aggregations": [
    {
      "alias": "Real estate loans",
      "includeLabelGroup": [
        "REALESTATELOAN"
      ]
    },
    {
      "alias": "Other loans",
      "includeLabelGroup": [
        "LOANANDINTEREST"
      ]
    }
  ]
}

In this example, the alias "Real estate loans" is created as the first view, which should contain all transactions labeled with REALESTATELOAN.
The second view is the alias Other loans. This contains all LOANANDINTEREST transactions, but not the REALESTATELOAN transactions.

Although REALESTATELOAN is a higher level of detail than LOANANDINTEREST, the order in the request means that this particular part is evaluated first.
All transactions that have been considered in this view cannot appear again in any other view.

The result is two aggregation views, one with real estate loans and the second with all other loans, without overlapping transactions.

Used data fields

All relevant transactions, which are matching to the given labels, are used for this purpose. This includes data like IBAN, account holder name, counterpart name, purpose, amount, and so on.

The result contains those sections:

Complete Month Section

List of complete (full) calendar months inside the report period under review in the format YYYY-MM.
The complete months list is based on transactions within the reporting time frame. The month with the first transaction determines the first month in this list.

This section is important to be able to recognize if a month is complete or not. In most cases, an evaluation should only be done on the basis of these months, as otherwise salaries or larger expenses could be missing in a month and thus distort the result.

Aggregations Section

This section contains a list of objects that correspond to the views specified in the request.

This overview only gives a rough summary of the values.

A full API schema can be seen here: https://docs.finapi.io/?product=di#post-/cases/-caseId-/aggregations

Field

Description

Mandatory

alias

Alias of the request to find the right view.

yes

totalTransactionsCount

The number of user's transactions, that took place in the aggregation period under review. This field takes into consideration all the transactions of the user, irrespectively of the assigned to them label.

yes

totalIncome

The total income during the period.

yes

totalSpending

The total income during the period.

yes

totalAmount

The total balance during the period.

yes

firstTransactionDate

Timestamp of when the first Transaction was created.

no

lastTransactionDate

Timestamp of when the last Transaction was created.

no

monthlyData

Monthly data in the aggregation.

no

Monthly Data Section

In this section, the monthly overviews are presented. It also includes a list of data for each individual month.

Field

Description

Mandatory

minTotalMonthlyAmount

The lowest amount available within the period.

yes

maxTotalMonthlyAmount

The highest amount available within the period.

yes

averageTotalMonthlyAmount

The average amount within the month.

yes

medianTotalMonthlyAmount

The number of daily balances which were retrieved for the given account within the month.

yes

totalMonthlyAmounts

Monthly data in the aggregation per month as a list.

no

Total Monthly Amounts

Field

Description

Mandatory

month

Month for which the values are calculated.

yes

totalIncome

The total income of the month.

yes

totalSpending

The total spending of the month.

yes

totalAmount

The total balance of the month.

yes

transactionIds

List of transaction IDs to retrieve referring transactions via the /transactions endpoint.

no

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.