Transaction data: list and fetch transactions, with date-range and account filtering, and manual category correction.
See Transactions and Categorising Transactions.
Summary
Functions
Creates a single manual transaction (for a manual, non-bank-connected
account). attrs typically includes "accountId", "amount",
"description", and "date".
Creates multiple manual transactions in a single call. transactions is
a list of the same shape accepted by create/3.
Deletes a manual transaction (one created via create/3 or create_many/3).
Removes all splits from a transaction, merging it back into a single line.
Fetches a single transaction by id.
Lists transactions for the user identified by token.
Lists file attachments (e.g. receipts) attached to a transaction.
Lists the current splits on a transaction.
Splits a transaction into multiple parts, each with its own amount and category - for example splitting a supermarket trip into "groceries" and "household".
Updates arbitrary attributes on a transaction. Use update_category/4
for the common case of just correcting the category.
Corrects a transaction's category, recording the user's override (and training future automatic categorisation for similar transactions).
Replaces a transaction's splits with a new set.
Types
@type transaction() :: map()
Functions
@spec create(MoneyHub.Config.t(), String.t(), map()) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Creates a single manual transaction (for a manual, non-bank-connected
account). attrs typically includes "accountId", "amount",
"description", and "date".
@spec create_many(MoneyHub.Config.t(), String.t(), [map()]) :: {:ok, [transaction()]} | {:error, MoneyHub.Error.t()}
Creates multiple manual transactions in a single call. transactions is
a list of the same shape accepted by create/3.
@spec delete(MoneyHub.Config.t(), String.t(), String.t()) :: :ok | {:error, MoneyHub.Error.t()}
Deletes a manual transaction (one created via create/3 or create_many/3).
@spec delete_splits(MoneyHub.Config.t(), String.t(), String.t()) :: :ok | {:error, MoneyHub.Error.t()}
Removes all splits from a transaction, merging it back into a single line.
@spec get(MoneyHub.Config.t(), String.t(), String.t()) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Fetches a single transaction by id.
@spec list(MoneyHub.Config.t(), String.t(), keyword()) :: {:ok, [transaction()]} | {:error, MoneyHub.Error.t()}
Lists transactions for the user identified by token.
Options
:account_id- filter to a single account.:from_date/:to_date- ISO 8601 date strings ("2024-01-01").:category- filter by category id.:limit/:offset- pagination.
@spec list_files(MoneyHub.Config.t(), String.t(), String.t()) :: {:ok, [map()]} | {:error, MoneyHub.Error.t()}
Lists file attachments (e.g. receipts) attached to a transaction.
@spec list_splits(MoneyHub.Config.t(), String.t(), String.t()) :: {:ok, [map()]} | {:error, MoneyHub.Error.t()}
Lists the current splits on a transaction.
@spec split(MoneyHub.Config.t(), String.t(), String.t(), [map()]) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Splits a transaction into multiple parts, each with its own amount and category - for example splitting a supermarket trip into "groceries" and "household".
splits is a list of %{"amount" => amount, "category" => category_id}
maps. See
Transaction Splits.
@spec update(MoneyHub.Config.t(), String.t(), String.t(), map()) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Updates arbitrary attributes on a transaction. Use update_category/4
for the common case of just correcting the category.
@spec update_category(MoneyHub.Config.t(), String.t(), String.t(), String.t()) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Corrects a transaction's category, recording the user's override (and training future automatic categorisation for similar transactions).
@spec update_splits(MoneyHub.Config.t(), String.t(), String.t(), [map()]) :: {:ok, transaction()} | {:error, MoneyHub.Error.t()}
Replaces a transaction's splits with a new set.