---
title: "Spending Aggregate"
method: GET
path: "/api/analysis/spending"
tags: ["Analysis"]
---

# Spending Aggregate

`GET /api/analysis/spending`

## Request

- Base URL: `https://api.earmarkiq.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.earmarkiq.app/api/analysis/spending`
- Auth: HTTP bearer

Spending totals for a period, grouped by category and/or month.

Replaces paging transactions to draw a chart. Same numbers, ~2 KB.

## Query parameters

- `from` string, date, required
- `to` string, date, required
- `group_by` string

## Response `200`

Successful Response

- SpendingAggregateResponse
  - `from` string, date, required
  - `to` string, date, required
  - `group_by` string[], required
  - `currency` string, required
  - `total` number, required
  - `count` integer, required
  - `by_category` SpendingCategoryTotal[], nullable
    - `category` string, required
    - `total` number, required
    - `count` integer, required
  - `by_month` SpendingMonthTotal[], nullable
    - `month` string, required
    - `total` number, required
    - `count` integer, required
  - `cells` SpendingCell[], nullable
    - `category` string, required
    - `month` string, required
    - `total` number, required
    - `count` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/earmarkiq/apis/earmark-api.md) · [All operations](https://skmtc.dev/earmarkiq/apis/earmark-api/llms.txt) · [OpenAPI document](https://skmtc.dev/earmarkiq/apis/earmark-api/revisions/4a2c41907105?raw)
