GET /v1/summary/cashflow
Income, spending, net and savings rate per month. Transfers are excluded.
Auth. Send the token in the X-Ledger-Token header.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
since | query | string | optional | First month, YYYY-MM |
until | query | string | optional | Last month, YYYY-MM, inclusive |
account_id | query | string | optional | Limit to one account. Omit for all accounts combined. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | One row per month, newest first | object[] |
400 | Request rejected | Error |
429 | Too many requests from this client address. Wait the number of seconds in Retry-After, then try again. | Error |
Example response
[
{
"month": "string",
"income_cents": 0,
"spending_cents": 0,
"net_cents": 0,
"savings_rate": 0
}
]
Code samples
Set KEY to your own token first.
curl
curl \
-H X-Ledger-Token:$KEY \
"https://api.sasek.org/ledger/v1/summary/cashflow"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/summary/cashflow", {
headers: { "X-Ledger-Token": KEY },
});
const data = await res.json();
Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/summary/cashflow",
method="GET",
headers={
"X-Ledger-Token": os.environ["KEY"],
},
)
with urllib.request.urlopen(request) as response:
print(json.load(response))