Spending

Get Cashflow Sankey

GET
/v1/households/{household_id}/analytics/cashflow-sankey

Describes how income flows into spending and savings over an inclusive date range, as the nodes and links of a Sankey diagram. Income categories flow into a single total node, which flows out to expense groups, to ungrouped expense categories, and to savings when income exceeds spending. Each expense group flows on to its categories. When spending exceeds income, a shortfall node supplies the difference, so what enters total always equals what leaves it.

Category totals are netted and split into income and expenses as in the category breakdown; uncategorized transactions are split by their own sign. Node and link amounts are positive magnitudes in the household's reporting currency, rounded so that every node equals the sum of its links to the minor unit, and each node's percentage is its share of total. Nodes are listed column by column, largest first: uncategorized nodes follow the rest of their column, shortfall and savings come last, and categories inside a group follow their group's order. Hidden and deleted transactions, transactions on deleted accounts, split parents, and transfers are excluded; pending transactions are included. A range with no income or spending returns no nodes.

Authorization

PersonalApiToken
AuthorizationBearer <token>

Use your personal API token (penny_pat_…) as the bearer credential. Enter the token only; the client adds the Bearer prefix. Read-only tokens permit read requests. Read/write tokens remain limited by your current household membership and role. See https://penny.finance/docs/api#authentication for setup.

In: header

Path Parameters

household_id*Household Id

Query Parameters

start_date*Start Date
Formatdate
end_date*End Date
Formatdate
tag_ids?array<string>|null
account_ids?array<string>|null

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/households/string/analytics/cashflow-sankey?start_date=2019-08-24&end_date=2019-08-24"
{  "start_date": "2019-08-24",  "end_date": "2019-08-24",  "income": {    "amount": "68.42",    "currency": "USD"  },  "expenses": {    "amount": "68.42",    "currency": "USD"  },  "net": {    "amount": "68.42",    "currency": "USD"  },  "nodes": [    {      "id": "expense_category:Ct5nR8wY1jFu",      "kind": "income_category",      "category_id": "Ct5nR8wY1jFu",      "group_id": "Cg2mV7pL4zXe",      "name": "Coffee & Dining",      "emoji": "☕️",      "amount": {        "amount": "68.42",        "currency": "USD"      },      "percentage": "68.42"    }  ],  "links": [    {      "source": "total",      "target": "expense_group:Cg2mV7pL4zXe",      "amount": {        "amount": "68.42",        "currency": "USD"      }    }  ]}