Skip to content

Spending Comparison Endpoint

GET
/api/v1/budget/spending-comparison
curl --request GET \
--url 'https://example.com/api/v1/budget/spending-comparison?limit=50&offset=0'

Compare the spending of two periods in the caller’s base currency, by category and subcategory, with the change, its percent, the share of the total and the notable changes.

Pass a preset (this_month, last_30_days, this_year; the default) or all four custom dates (current_from, current_to, previous_from, previous_to, inclusive); anything else (a preset with a date, some of the dates, a reversed range, a range over 1830 days) is a 422 invalid_period. Spending is the spending heatmap’s: no transfer, no off-budget account, no category flagged exclude from spending. One bounded object whose category rows are paged by limit and offset (total_rows counts them all). Read-only.

preset
Any of:
string
Allowed values: this_month last_30_days this_year
current_from
Any of:
string format: date
current_to
Any of:
string format: date
previous_from
Any of:
string format: date
previous_to
Any of:
string format: date
limit
Limit
integer
default: 50 >= 1 <= 250
offset
Offset
integer
0

Successful Response

Media typeapplication/json
SpendingComparisonOut

Spending of two periods side by side, by category and subcategory.

Every amount is spending in base_currency, as the spending heatmap counts it (no transfer, no off-budget account, no category flagged exclude from spending). Percent is null unless the previous amount is above zero. preset is null for a custom request. totals, total_rows and notable cover every category whatever the page of rows. A currency with no rate on the day of a row counts 0 and is named in missing_rate_currencies. The route is read-only.

object
base_currency
required
Base Currency
string
preset
required
Any of:
string
Allowed values: this_month last_30_days this_year
partial
required
Partial
boolean
current
required
PeriodRangeOut

One compared period: both dates are inclusive, days counts them.

object
date_from
required
Date From
string format: date
date_to
required
Date To
string format: date
days
required
Days
integer
previous
required
PeriodRangeOut

One compared period: both dates are inclusive, days counts them.

object
date_from
required
Date From
string format: date
date_to
required
Date To
string format: date
days
required
Days
integer
totals
required
ComparisonTotalsOut

Total spending of each period; delta is current minus previous.

delta_pct is null unless the previous total is above zero.

object
current
required
Current
string
previous
required
Previous
string
delta
required
Delta
string
delta_pct
required
Any of:
string
rows
Rows
Array<object>
ComparisonRowOut

A category row; children are its subcategories (empty without subcategory spending).

object
category_id
required
Any of:
integer
subcategory_id
required
Any of:
integer
current
required
Current
string
previous
required
Previous
string
delta
required
Delta
string
delta_pct
required
Any of:
string
share_pct
required
Any of:
string
status
required
Status
string
Allowed values: new gone increase decrease unchanged
children
Children
Array<object>
ComparisonLeafOut

Spending of one category or subcategory in both periods.

category_id null is Uncategorized. subcategory_id is null on a category row and on its “no subcategory” child. delta_pct is null unless the previous amount is above zero; share_pct is the share of the current total, null when that total is not above zero.

object
category_id
required
Any of:
integer
subcategory_id
required
Any of:
integer
current
required
Current
string
previous
required
Previous
string
delta
required
Delta
string
delta_pct
required
Any of:
string
share_pct
required
Any of:
string
status
required
Status
string
Allowed values: new gone increase decrease unchanged
total_rows
required
Total Rows
integer
notable
Notable
Array<object>
NotableChangeOut

A category whose change is large enough to mention (same meaning as a row’s figures).

object
category_id
required
Any of:
integer
kind
required
Kind
string
Allowed values: increase decrease new gone
current
required
Current
string
previous
required
Previous
string
delta
required
Delta
string
delta_pct
required
Any of:
string
missing_rate_currencies
Missing Rate Currencies
Array<string>

Example

{
"preset": "this_month",
"rows": [
{
"status": "new",
"children": [
{
"status": "new"
}
]
}
],
"notable": [
{
"kind": "increase"
}
]
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}