Spending Comparison Endpoint
const url = 'https://example.com/api/v1/budget/spending-comparison?limit=50&offset=0';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Responses
Section titled “Responses”Successful Response
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
One compared period: both dates are inclusive, days counts them.
object
One compared period: both dates are inclusive, days counts them.
object
A category row; children are its subcategories (empty without subcategory spending).
object
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
A category whose change is large enough to mention (same meaning as a row’s figures).
Example
{ "preset": "this_month", "rows": [ { "status": "new", "children": [ { "status": "new" } ] } ], "notable": [ { "kind": "increase" } ]}Validation Error
object
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}