Expense Category Report
NOTE: This report is deprecated. It is recommended to use the Group By Category report which supports similar features.
Build a report with grouped transactions by category. Each category will have a sum and count of all transaction for this category from the respective account.
URL and Request Body Structure of a Expense Category Report
POST /insights/v1/reports/expense-category/create HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: Token <Token>
Host: <Host>
{
"insights_consumer_id": String,
"insights_account_ids": ?Array<String>,
"excluded_insights_account_ids": ?Array<String>,
"report_days": ?Integer,
"from_date": ?Date,
"to_date": ?Date,
"only_main_category" : ?Boolean,
"states": ?Array<Enum<'PROCESSED', 'PENDING', 'CANCELED', 'FAILED', 'UNKNOWN'>>
"split_by": ?Enum<'MONTH'>,
"split_by_month_adjusted_day": ?Integer,
"excluded_categories": ?Array<String>,
"category_ids": ?Array<String>,
"labels": ?Array<{
"key": String,
"value": String
}>,
"excluded_labels": ?Array<{
"key": String,
"value": String
}>,
"order": ?Array<OrderBy>,
"required_data_availability": ?Enum<'COMPLETE', 'PARTIAL', 'NONE'>,
"combine_accounts": ?Enum<'NONE', 'ALL'>
}
The insights_consumer_id
parameter identifies the consumer whose transactions are used to generate the report.
The list of accounts, identified by the insights_account_id
, which will filter all transactions from the consumer to only those accounts. If missing, all accounts of the insights_consumer_id
will be used to generate the report(s). The insights_account_ids
parameter must be empty if the excluded_insights_account_ids
parameter is set.
The list of insights_account_id
s which will be excluded from the report generation. The excluded_insights_account_ids
parameter must be empty if the insights_account_ids
parameter is set.
This parameter offers to provide a timeframe without need to calculate dates. If the report_days
property is set, 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 report should be generated can be set by specifying either the from_date
and to_date
parameters or this report_days
parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.
The from_date
parameter (in combination with the to_date
parameter) will be used as the inclusive start date for this timeframe.
The timeframe for which the report should be generated can be set by specifying either the from_date
and to_date
parameters or the report_days
parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.
The to_date
parameter (in combination with the from_date
parameter) will be used as the inclusive end date for this timeframe.
The timeframe for which the report should be generated can be set by specifying either the from_date
and to_date
parameters or the report_days
parameter. If no timeframe is specified, the default timeframe of the last 62 days will be used.
Since transactions can fit into multiple categories, this option tells the report to only consider the most significant category. The default for this flag is false
.
Filters the transactions to only include transactions with a transaction state in the given list.
Split each report into multiple reports depending on the requested timeframe and this parameter, resulting reports will be ordered ascending by timeframe.
For example: Setting this parameter to MONTH
, from_date
to 2021-01-01
and to_date
to 2021-03-31
results in three reports, one for each month.
MONTH
: Split by month, default start day of a month is the 1. That can be changed withsplit_by_month_adjusted_day
.
Adjust the month start day. Valid values are 1-31, default is 1.
Excludes every transaction that has a category-ID which matches against one from this list of category-ID's. Only valid ID's can be passed.
If only_main_category
is set to true
, it will only exclude transactions that have their main category-ID matching against one from this list of category-ID's.
Filter the transactions to include only transactions matching the categories identified by the category_ids
. The id must match a category from the Category List.
Included transactions will be filtered to only contain those that have at least one of the requested key-value pairs.
Included transactions will be filtered to only contain those that have none one of the listed key-value pairs.
If a transaction is included by the labels
parameter and excluded by the excluded_labels
parameter in the same request it will be excluded.
Use this parameter to return the categories in a specific order. If this field is not set the default order will be AMOUNT
& DESC
. Chaining the order is available.
Defines minimum requirement for transaction data that must be available in the given timeframe. The default is COMPLETE
.
COMPLETE
- data for the whole timeframe must be availablePARTIAL
- some data in the timeframe must be availableNONE
- no data in the timeframe must be available
OrderBy
{
"order": ?Enum<'ASC', 'DESC'>,
"field": Enum<'AMOUNT','COUNT','NAME'>
}
Sets the direction of order: ascending or descending. The default setting is ascending (ASC
).
Can be used to combine the available accounts for a consumer to present the response in different ways. Default value is NONE
.
NONE
- Does not combine any accounts. The response will include separate reports for each account that is available.ALL
- Combines all available accounts and presents a combined result.
Response Structure of Expense Category Report
{
"data": {
"reports": Array<ExpenseReport>
}
}
The list of reports generated depending on the requested parameters.
Expense Report
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": String,
"insights_account_ids": Array<String>,
"categories": Array<CategoryInfo>,
"from_date": Date,
"to_date": Date,
"refreshed_at": DateTime,
"total_amount_sum": Amount,
"split_by_month": ?Month,
"data_availability": Enum<'COMPLETE', 'PARTIAL', 'NONE'>
}
The insights_consumer_id
is the consumer identifier for the account(s) used in this report.
The insights_account_ids
is used to identify a specific account within Account Insights.
Depending on type of report and requested account-settings this could be a list of ids.
List of all category found for the account with count and sum of the corresponding transactions.
The starting date used to generate this report.
The refreshed_at
shows when the data for this account were last refreshed.
The total amount of expenses. This is the the sum of all categories.amount_sum
-values.
The month this report represents. Is only returned if split_by
is set to MONTH
.
The availability of transaction data for the requested timeframe.
COMPLETE
- data for the whole timeframe was availablePARTIAL
- some data in the timeframe was availableNONE
- no data in the timeframe was available
CategoryInfo
{
"id": String,
"name": String,
"count": Integer,
"amount_sum": Amount,
"amount_percentage": Double
}
The unique identifier of the category. Further details about a category will be provided by the Category List call.
The percentage of the amount this category has compared to all other categories. All percentages combined may not add up to exactly 100% but slightly lower/higher because of rounding and the inexact representation of floating point numbers.
Example request
{
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"report_days": 30,
"only_main_category": true,
"order": [
{
"order": "ASC",
"field": "AMOUNT"
}
],
"labels": [
{
"key": "order-id-for-company-1",
"value": "123456789"
}
],
"excluded_labels": [
{
"key": "order-id-for-company-1",
"value": "1234"
}
],
"combine_accounts": "ALL"
}
Example response
{
"data": {
"reports": [
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"3b3d678f-66b7-4b23-a2a5-0bfd275e86a1",
"d111084f-04ef-4808-9455-939a7694c3be"
],
"refreshed_at": "2021-06-15T09:22:02.523Z",
"total_amount_sum": {
"amount": 15965,
"currency": "EUR"
},
"categories": [
{
"id": "8f1f56e6-a312-454d-b0ee-e20350cb5c1c",
"name": "Bank charges",
"count": 4,
"amount_sum": {
"amount": 1438,
"currency": "EUR"
},
"amount_percentage": 9.0072033
},
{
"id": "0723e731-132d-4f00-a655-d9768dddc9b3",
"name": "Health insurance",
"count": 1,
"amount_sum": {
"amount": 14527,
"currency": "EUR"
},
"amount_percentage": 90.9927967
}
],
"from_date": "2021-05-21",
"to_date": "2021-06-14",
"data_availability": "COMPLETE"
}
]
}
}
Example request with splitBy
{
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"3b3d678f-66b7-4b23-a2a5-0bfd275e86a1",
"d111084f-04ef-4808-9455-939a7694c3be"
],
"from_date": "2021-01-01",
"to_date": "2021-02-28",
"split_by": "MONTH",
"combine_accounts": "NONE"
}
Example response with splitBy
{
"data": {
"reports": [
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"3b3d678f-66b7-4b23-a2a5-0bfd275e86a1"
],
"refreshed_at": "2021-06-15T09:22:02.523Z",
"total_amount_sum": {
"amount": 1438,
"currency": "EUR"
},
"categories": [
{
"id": "8f1f56e6-a312-454d-b0ee-e20350cb5c1c",
"name": "Bank charges",
"count": 4,
"amount_sum": {
"amount": 1438,
"currency": "EUR"
},
"amount_percentage": 100.0
}
],
"from_date": "2021-01-01",
"to_date": "2021-01-31",
"split_by_month": "2021-01",
"data_availability": "COMPLETE"
},
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"3b3d678f-66b7-4b23-a2a5-0bfd275e86a1"
],
"refreshed_at": "2021-06-15T09:22:02.523Z",
"total_amount_sum": {
"amount": 14527,
"currency": "EUR"
},
"categories": [
{
"id": "0723e731-132d-4f00-a655-d9768dddc9b3",
"name": "Health insurance",
"count": 1,
"amount_sum": {
"amount": 14527,
"currency": "EUR"
},
"amount_percentage": 100.0
}
],
"from_date": "2021-02-01",
"to_date": "2021-02-28",
"split_by_month": "2021-02",
"data_availability": "COMPLETE"
},
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"d111084f-04ef-4808-9455-939a7694c3be"
],
"refreshed_at": "2021-06-15T09:22:02.523Z",
"total_amount_sum": {
"amount": 1438,
"currency": "EUR"
},
"categories": [
{
"id": "8f1f56e6-a312-454d-b0ee-e20350cb5c1c",
"name": "Bank charges",
"count": 4,
"amount_sum": {
"amount": 1438,
"currency": "EUR"
},
"amount_percentage": 100.0
}
],
"from_date": "2021-01-01",
"to_date": "2021-01-31",
"split_by_month": "2021-01",
"data_availability": "COMPLETE"
},
{
"type": "EXPENSE_CATEGORIES",
"insights_consumer_id": "6c03aff-8fa0046-ffae74-b0cbc-4d5fd1",
"insights_account_ids": [
"d111084f-04ef-4808-9455-939a7694c3be"
],
"refreshed_at": "2021-03-05T09:22:02.523Z",
"total_amount_sum": {
"amount": 456789,
"currency": "EUR"
},
"categories": [
{
"id": "0723e731-132d-4f00-a655-d9768dddc9b3",
"name": "Groceries",
"count": 3,
"amount_sum": {
"amount": 456789,
"currency": "EUR"
},
"amount_percentage": 100.0
}
],
"from_date": "2021-02-01",
"to_date": "2021-02-28",
"split_by_month": "2021-02",
"data_availability": "COMPLETE"
}
]
}
}