packages feed

hledger-2.0: embeddedfiles/hledger-web.1

.TH "HLEDGER\-WEB" "1" "December 2026" "hledger-web-2.0 " "hledger User Manuals"



.SH NAME
hledger\-web \- web interface and API for \f[CR]hledger\f[R], a robust,
friendly plain text accounting app.
.SH SYNOPSIS
\f[CR]hledger\-web [OPTS] [QUERY]\f[R]
.PD 0
.P
.PD
or
.PD 0
.P
.PD
\f[CR]hledger web [OPTS] [QUERY]\f[R]
.SH DESCRIPTION
This manual is for hledger\(aqs web interface, version 2.0.
See also the hledger manual for common concepts and file formats.
.PP
hledger is a robust, user\-friendly, cross\-platform set of programs for
tracking money, time, or any other commodity, using double\-entry
accounting and a simple, editable file format.
hledger is inspired by and largely compatible with ledger(1), and
largely interconvertible with beancount(1).
.PP
hledger\-web is hledger\(aqs web interface.
In a web browser, it shows the journal, account registers, and the main
financial reports with their charts, and lets you search them, add
transactions, and (if allowed) edit the journal files.
It shows more at once than the hledger CLI or hledger\-ui (eg the
accounts beside a register, or a report\(aqs chart above its table), and
every view has its own url, so it can be bookmarked or shared.
.PP
hledger\-web also lets you share a journal with multiple users, or even
the public web.
There is no user authentication, so if you need that you should put it
behind a suitable web proxy (see Permissions).
.PP
Like hledger, it reads from (and appends to) a journal file specified by
the \f[CR]LEDGER_FILE\f[R] environment variable (defaulting to
\f[CR]$HOME/.hledger.journal\f[R]); or you can specify files with
\f[CR]\-f\f[R] options.
It can also read timeclock files, timedot files, or any CSV/SSV/TSV file
with a date field.
(See hledger(1) \-> Input for details.)
.PP
hledger\-web can be run in three modes:
.IP \(bu 2
\f[CR]\-\-serve\-browse\f[R] mode (the default): the app serves the web
UI and JSON API, and opens your default web browser to show the app if
possible, and exits automatically once no browser window has shown it
for fifteen minutes.
.IP \(bu 2
\f[CR]\-\-serve\f[R]: the app just serves the web UI and JSON API.
.IP \(bu 2
\f[CR]\-\-serve\-api\f[R]: the app just serves the JSON API.
.PP
In all cases hledger\-web runs as a foreground process, logging requests
to stdout.
.SH OPTIONS
hledger\-web provides the following command line options:
.IP
.EX
Flags:
     \-\-serve\-browse            server mode: serve the web UI and JSON API,
                               and open a browser, and exit if inactive for 15m
                               (default)
     \-\-serve                   server mode: just serve the web UI and JSON
                               API
     \-\-serve\-api               server mode: just serve the JSON API
     \-\-allow=view|add|edit     set the user\(aqs access level for changing data
                               (default: \(gaadd\(ga on a local\-only address, \(gaview\(ga
                               otherwise). It also accepts \(gasandstorm\(ga for that
                               platform (reading from the
                               \(gaX\-Sandstorm\-Permissions\(ga request header).
     \-\-cors=ORIGIN             allow cross\-origin requests from the specified
                               origin; setting ORIGIN to \(dq*\(dq allows requests
                               from any origin
     \-\-host=IPADDR             listen on this IP address (default: 127.0.0.1)
     \-\-port=PORT               listen on this TCP port (default: 5000); 0
                               means a free port chosen by the OS
     \-\-socket=SOCKET           listen on the given unix socket instead of an
                               IP address and port (only on unix)
     \-\-base\-url=BASEURL        set the base url (default: http://IPADDR:PORT)
     \-\-chart[=KIND,net,SCALE]  set the charts\(aq defaults, as the commands\(aq
                               \-\-chart does. KIND: lay out the statements\(aq
                               charts with each period\(aqs sections in one bar,
                               above and below zero (diverging, the default),
                               or side by side (grouped). net: show the net
                               total lines by default (the N key toggles them,
                               and the browser remembers that). SCALE: the
                               amount that fills the charts (eg 1000 or 1000
                               USD; one per commodity), for comparable charts.
     \-\-lang=LANG               show the web UI in this language (en, de, es,
                               ru, zh); or with auto, use each viewer\(aqs browser
                               language if available, otherwise the server\(aqs.
                               (Default: the browser\(aqs language if available,
                               otherwise en.)
.EE
.PP
By default hledger\-web listens only on IP address \f[CR]127.0.0.1\f[R],
which can be accessed only from the local machine.
.PP
To allow access from elsewhere, use \f[CR]\-\-host\f[R] to specify an
externally accessible address configured on this machine.
The special address \f[CR]0.0.0.0\f[R] causes it to listen on all of
this machine\(aqs addresses.
.PP
Similarly, you can use \f[CR]\-\-port\f[R] to listen on a TCP port other
than 5000.
This is useful if you want to run multiple hledger\-web instances on a
machine.
\f[CR]\-\-port 0\f[R] makes the operating system choose a free port,
which is reported in the startup message and in the default base url,
and is where the browser is opened in \f[CR]\-\-serve\-browse\f[R] mode.
This can be useful eg when scripting.
.PP
When \f[CR]\-\-socket\f[R] is used, hledger\-web creates and
communicates via a socket file instead of a TCP port.
This can be more secure, respects unix file permissions, and makes
certain use cases easier, such as running per\-user instances behind an
nginx reverse proxy.
(Eg:
\f[CR]proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;\f[R].)
.PP
You can use \f[CR]\-\-base\-url\f[R] to change the protocol, hostname,
port and path that appear in hledger\-web\(aqs hyperlinks.
This is useful eg when integrating hledger\-web within a larger website.
The default is \f[CR]http://HOST:PORT/\f[R] using the server\(aqs
configured host address and TCP port (or \f[CR]http://HOST\f[R] if PORT
is 80).
Note this affects url generation but not route parsing.
.PP
hledger\-web also supports many of hledger\(aqs general options:
.IP
.EX
General input flags:
  \-f \-\-file=[FMT:]FILE      Use this as the journal file (\- means stdin). If
                            not specified, $LEDGER_FILE or \(ti/.hledger.journal
                            will be used. If specified more than once, the
                            files will be read in order. Each file\(aqs format
                            (journal, csv, timeclock, timedot, rules..) is
                            inferred from the file extension or a FMT: prefix.
                            Some commands (add, import) write to the (first)
                            file, and expect it to be in journal format.
     \-\-rules=RULESFILE      Use rules defined in this rules file for
                            converting subsequent CSV/SSV/TSV files. If not
                            specified, uses FILE.csv.rules for each FILE.csv.
     \-\-alias=A=B|/RGX/=RPL  transform account names from A to B, or by
                            replacing regular expression matches
     \-\-auto                 generate extra postings by applying auto posting
                            rules (\(dq=\(dq) to all transactions
     \-\-forecast[=PERIOD]    Generate extra transactions from periodic rules
                            (\(dq\(ti\(dq), from after the latest ordinary transaction
                            until 6 months from now. Or, during the specified
                            PERIOD (the equals is required). Auto posting rules
                            will also be applied to these transactions. In
                            hledger\-ui, also make future\-dated transactions
                            visible at startup.
     \-\-ignore\-assertions    don\(aqt check balance assertions by default
     \-\-ignore\-lots          don\(aqt track lots: skip lot checks, inferred cost
                            bases and gain postings
  \-I                        shortcut for \-\-ignore\-assertions \-\-ignore\-lots
     \-\-txn\-tolerance=...    how much imbalance to allow in transactions:
                            \(aqentry\(aq:   \- the entry\(aqs precision (default)
                            \(aqdisplay\(aq: \- display precision (legacy)
     \-\-infer\-costs          infer costs from conversion equity postings
     \-\-infer\-equity         infer conversion equity postings from costs
     \-\-infer\-imbalance      add postings showing tolerated imbalances
     \-\-infer\-market\-prices  infer market prices from costs
     \-\-pivot=TAGNAME        use a different field or tag as account names
  \-s \-\-strict               do extra error checks (and override \-I)

General output flags (affecting some commands):
  \-b \-\-begin=DATE           include postings/transactions on/after this date
  \-e \-\-end=DATE             include postings/transactions before this date
                            (with a report interval, will be adjusted to
                            following subperiod end)
  \-D \-\-daily                set report interval: 1 day
  \-W \-\-weekly               set report interval: 1 week
  \-M \-\-monthly              set report interval: 1 month
  \-Q \-\-quarterly            set report interval: 1 quarter
  \-Y \-\-yearly               set report interval: 1 year
  \-p \-\-period=PERIODEXP     set begin date, end date, and/or report interval,
                            with more flexibility
     \-\-today=DATE           override today\(aqs date (affects relative dates)
     \-\-date2                match/use secondary dates instead (deprecated)
  \-U \-\-unmarked             include only unmarked postings/transactions
  \-P \-\-pending              include only pending postings/transactions
  \-C \-\-cleared              include only cleared postings/transactions
                            (\-U/\-P/\-C can be combined)
  \-R \-\-real                 include only non\-virtual postings
  \-E \-\-empty                Show zero items, which are normally hidden.
                            In hledger\-ui & hledger\-web, do the opposite.
     \-\-depth=DEPTHEXP       if a number (or \-NUM): show only top NUM levels
                            of accounts. If REGEXP=NUM, only apply limiting to
                            accounts matching the regular expression.
  \-B \-\-cost                 convert amounts to their cost basis ({}), or else
                            their cost/sale amount (\(at/\(at\(at)
  \-V \-\-market               valuation mode: show amounts converted to market
                            value at period end(s) in their default valuation
                            commodity. Short for \-\-value=end.
  \-X \-\-exchange=COMM        valuation mode: show amounts converted to market
                            value at period end(s) in the specified commodity.
                            Short for \-\-value=end,COMM.
     \-\-value=WHEN[,COMM]    valuation mode: show amounts converted to market
                            value on the specified date(s) in their default
                            valuation commodity or a specified commodity. WHEN
                            can be:
                            \(aqthen\(aq:     value on transaction dates
                            \(aqend\(aq:      value at period end(s)
                            \(aqnow\(aq:      value today
                            YYYY\-MM\-DD: value on given date
                            \(aqcost\(aq:     cost basis, or else transacted cost
                            (same as \-B)
                            \(aqtransacted\(aq: transacted cost/sale amount (\(at/\(at\(at)
                            only
                            COMM may be written in double quotes; \(aq\(dq\(dq\(aq or an
                            empty COMM means the no\-symbol commodity.
     \-\-lots                 show lot subaccounts and other lot details
  \-c \-\-commodity\-style=S    Override a commodity\(aqs display style.
                            Eg: \-c \(aq.\(aq or \-c \(aq1.000,00 EUR\(aq
     \-\-pretty[=YN]          Use box\-drawing characters in text output? The
                            optional \(aqy\(aq/\(aqyes\(aq or \(aqn\(aq/\(aqno\(aq arg requires =.
     \-\-title=T              set or customise a report title
     \-\-subreport\-titles=TS  customise subreport headings in compound reports
                            (|\-separated)
     \-\-period\-titles=OPT    customise headings in periodic reports:
                            \(aqcompact\(aq: readable period names when possible
                            \(aqdates\(aq:   exact dates/date ranges always

General help flags:
  \-?                        show the hledger quick reference
  \-h \-\-help                 show this command\(aqs usage help
     \-\-info                 show this command\(aqs manual with info
     \-\-man                  show this command\(aqs manual with man
     \-\-webman               show this command\(aqs manual on the web
     \-\-examples             show examples for this command
     \-\-version              show version information
     \-\-test[=PATTERN]       run built\-in tests (those matching PATTERN) and
                            exit
     \-\-write\-lang=LANG      write LANG\(aqs PO file to the config directory, for
                            editing translations, and exit
     \-\-debug=[1\-9]          show this much debug output (default: 1)
     \-\-pager=YN             use a pager when needed ? y/yes (default) or n/no
     \-\-color=YNA \-\-colour   use ANSI color ? y/yes, n/no, or auto (default)
.EE
.PP
Some of these can be adjusted while hledger\-web is running, in the web
UI\(aqs Options panel.
.PP
hledger\-web shows accounts with zero balances by default (like
\f[CR]hledger\-ui\f[R], and unlike \f[CR]hledger\f[R]);
\f[CR]\-E/\-\-empty\f[R] starts it with them hidden instead.
In the web UI, the Zero balances option or the \f[CR]z\f[R] key shows or
hides them.
(The holdings page differs: its closed positions are hidden by default,
as in the \f[CR]holdings\f[R] command; \f[CR]\-E\f[R] starts it with
them shown, and \f[CR]z\f[R] there shows or hides them.)
.PP
Report options and a query given at startup set the view hledger\-web
opens with, by putting them in its url (see URL parameters).
Eg \f[CR]hledger\-web \-V \-M\f[R] opens
\f[CR]/balancesheet?interval=monthly&value=end\f[R], and
\f[CR]hledger\-web \-\-cleared \-3 assets\f[R] opens
\f[CR]/balancesheet?q=assets status:*&depth=3\f[R].
They are only a starting point: they can be changed in the web UI, and
they don\(aqt affect other urls or the JSON API.
Report options that hledger\-web has no equivalent for are ignored.
.PP
Note, a startup query doesn\(aqt restrict what hledger\-web serves; to
do that, give it a file holding only the entries to serve (eg one
written by \f[CR]hledger print QUERY\f[R]).
.PP
If you use the bash shell, you can auto\-complete flags by pressing TAB
in the command line.
If this is not working see Install > Shell completions.
.SH WEB UI
hledger\-web\(aqs main views are:
.IP \(bu 2
the \f[B]journal view\f[R], showing journal entries, newest first, with
their postings
.IP \(bu 2
the \f[B]report views\f[R], described below: the balance sheet, income
statement, cashflow statement (and holdings, for journals using lots),
and All accounts report
.IP \(bu 2
a \f[B]register view\f[R] for each account, reached by clicking an
account name, showing the transactions affecting that account (and its
subaccounts), with a running balance and a balance chart.
.PP
Every page has, from the top: links to the journal and the reports, the
search form, the options, and then the view itself.
The options are hidden until you open them (click Options, or press
\f[CR]o\f[R]); while hidden, they list the ones in effect, eg
\(dqMonthly · Depth 2 · Tree\(dq.
.PP
The journal and register show the newest 1000 matching transactions,
with links to older and newer pages.
When the transactions span more than one year, the options include a row
of years, to narrow the view to one year; shift\-click a second year to
select a range of years.
.PP
The register\(aqs chart shows the running balance over the page\(aqs
transactions.
With several commodities, use the legend, or the \f[CR][\f[R] and
\f[CR]]\f[R] keys, to choose the one charted.
Click a point to go to its transaction, or drag across the chart to see
the transactions of those dates.
The register\(aqs Costs option shows the costs recorded with its
amounts.
.PP
The \f[B]sidebar\f[R] lists every account, and optionally their balances
(parent balances include subaccounts).
The search doesn\(aqt change it, except that its dates set the
balances\(aq date.
The balances are hidden at first, since on a large journal they take
much of each page\(aqs time; click the \(dqBalances\(dq heading above
the accounts to show them, or to hide them again.
These are historical balances, as of the end of the report period set by
date:, otherwise the latest (the heading shows the date).
While the balances are hidden, all accounts are listed, even with Zero
balances: Hidden.
It is always a tree, with carets that fold and open each group, whether
the Accounts option is List or Tree.
The − and + above it fold or open a level of the whole tree, without
changing the page; its depth is its own, apart from the page\(aqs depth
limit.
The browser remembers the sidebar\(aqs depth and the groups you open or
close (until the next − or +).
The button at the top left (or the \f[CR]s\f[R] key) shows or hides the
sidebar, and it stays the way you left it from page to page.
On a narrow screen, it slides the sidebar in or out.
.PP
Click an account name to see its register, with the search, or an amount
to see the transactions it is made of.
In the journal and register, click a date to see that day\(aqs journal
entries.
.PP
The \f[B]search form\f[R] filters every view with hledger\(aqs query
syntax, eg \f[CR]expenses date:thismonth\f[R]; the help dialog
summarises the query types.
The search and the options are part of the page\(aqs url (see URL
parameters).
.PP
The \f[B]add form\f[R] (press \f[CR]a\f[R], or click \(dqAdd a
transaction\(dq in the journal view) adds a transaction to the main
journal file, if the access level allows it, and if the journal would
still be readable with it added (see Editing, uploading, downloading).
It autocompletes account names and descriptions from your existing
entries.
.PP
The \f[B]help dialog\f[R] (press \f[CR]?\f[R], or click the question
mark button) lists these keyboard shortcuts, which work when you are not
typing in a field:
.IP \(bu 2
\f[CR]h\f[R] or \f[CR]?\f[R] \- show or hide the help dialog
.IP \(bu 2
\f[CR]g\f[R] \- go to another page: shows a menu of the pages, each with
its key; then \f[CR]j\f[R] journal, \f[CR]b\f[R] balance sheet,
\f[CR]i\f[R] income statement, \f[CR]c\f[R] cashflow statement,
\f[CR]h\f[R] holdings (for journals using lots), \f[CR]a\f[R] all
accounts (escape to cancel)
.IP \(bu 2
\f[CR]n\f[R] / \f[CR]p\f[R] \- go to the next / previous page, in the
\f[CR]g\f[R] menu\(aqs order, wrapping round
.IP \(bu 2
\f[CR]a\f[R] \- add a transaction (escape to cancel)
.IP \(bu 2
\f[CR]s\f[R] \- show or hide the sidebar
.IP \(bu 2
shift with \f[CR]1\f[R]\-\f[CR]9\f[R] \- fold or open the sidebar\(aqs
accounts to that depth, as its − and + do (by the digit keys\(aq place,
whatever the layout; except where shift with one types a character that
is a shortcut itself, eg a digit on AZERTY keyboards, or \f[CR]/\f[R] on
German ones)
.IP \(bu 2
\f[CR]b\f[R] \- show or hide the sidebar\(aqs balances, as its Balances
heading does (while the sidebar shows)
.IP \(bu 2
\f[CR]o\f[R] \- show or hide the report options
.IP \(bu 2
\f[CR]c\f[R] \- show or hide the report\(aqs chart (on pages with one)
.IP \(bu 2
\f[CR][\f[R] / \f[CR]]\f[R] \- chart the previous / next commodity (on
pages whose chart has several, wrapping round)
.IP \(bu 2
\f[CR]N\f[R] \- show or hide the chart\(aqs net total line (on pages
whose chart has one)
.IP \(bu 2
\f[CR]d\f[R] \- show or hide the report\(aqs data, its table (on pages
with a chart)
.IP \(bu 2
\f[CR]f\f[R] \- full window: show only the report\(aqs heading and data,
or everything (\f[CR]s\f[R], \f[CR]o\f[R] and \f[CR]/\f[R] leave it,
showing what they ask for)
.IP \(bu 2
\f[CR]z\f[R] \- show or hide accounts with zero balances (on the
holdings page: closed positions)
.IP \(bu 2
\f[CR]t\f[R] \- show accounts as a tree, or a list
.IP \(bu 2
\f[CR]H\f[R] \- show ending balances, or balance changes
.IP \(bu 2
\f[CR]L\f[R] \- show or hide lot detail
.IP \(bu 2
\f[CR]V\f[R] \- show amounts at market value, or as recorded
.IP \(bu 2
\f[CR]B\f[R] \- show amounts at cost, or as recorded
.IP \(bu 2
\f[CR]R\f[R] \- show only real postings, or all
.IP \(bu 2
\f[CR]U\f[R], \f[CR]P\f[R], \f[CR]C\f[R] \- show only unmarked, pending,
or cleared transactions, or all
.IP \(bu 2
\f[CR]S\f[R] \- sort by amount, or by account
.IP \(bu 2
\f[CR]T\f[R], \f[CR]A\f[R] \- add or remove the row total and average
columns (multi\-period reports)
.IP \(bu 2
\f[CR]D\f[R], \f[CR]W\f[R], \f[CR]M\f[R], \f[CR]Q\f[R], \f[CR]Y\f[R] \-
set the report interval (daily, weekly, monthly, quarterly, yearly);
pressed again, remove it
.IP \(bu 2
\f[CR]0\f[R]\-\f[CR]9\f[R], \f[CR]\-\f[R], \f[CR]+\f[R] \- set or adjust
the account depth limit (\f[CR]\-\f[R] and \f[CR]+\f[R] step between 0
and the deepest)
.IP \(bu 2
\f[CR]/\f[R] \- focus the search form, ready to add a term (escape to
leave it)
.IP \(bu 2
\f[CR]Delete\f[R] or \f[CR]Backspace\f[R] \- clear the search, as its
clear button does
.PP
The pages are light or dark, following your OS or browser\(aqs color
scheme setting, and switch when it changes.
.PP
Editing, uploading and downloading journal files is described below.
.SH PERMISSIONS
You can restrict who can access hledger\-web by
.IP \(bu 2
setting the IP address it listens on (see \f[CR]\-\-host\f[R] above).
By default it listens on 127.0.0.1, accessible to users on the local
machine only.
.IP \(bu 2
or by putting it behind an authenticating proxy, such as caddy or apache
.IP \(bu 2
or by putting it behind a firewall.
.PP
And you can restrict what the users reaching it can do, by specifying
the \f[CR]\-\-allow=ACCESSLEVEL\f[R] option at startup.
ACCESSLEVEL is one of:
.IP \(bu 2
\f[CR]view\f[R] \- allows viewing the journal file(s)
.IP \(bu 2
\f[CR]add\f[R] \- also allows adding new transactions to the main
journal file
.IP \(bu 2
\f[CR]edit\f[R] \- also allows editing, uploading or downloading the
journal file(s)
.IP \(bu 2
\f[CR]sandstorm\f[R] \- (for the hledger\-web Sandstorm app:) allows
whichever of \f[CR]view\f[R], \f[CR]add\f[R], or \f[CR]edit\f[R] are
specified in the \f[CR]X\-Sandstorm\-Permissions\f[R] HTTP header
.PP
The default access level is \f[CR]add\f[R] when listening on a
local\-only address (\f[CR]127.0.0.1\f[R], \f[CR]::1\f[R],
\f[CR]localhost\f[R], or a unix socket), and \f[CR]view\f[R] otherwise.
To allow more than the default access, start it with an explicit
\f[CR]\-\-allow=add\f[R] or \f[CR]\-\-allow=edit\f[R] option.
.SH EDITING, UPLOADING, DOWNLOADING
If you start hledger\-web with \f[CR]\-\-allow=edit\f[R], you\(aqll see
a new \(dqspanner\(dq button to the right of the search form.
Clicking this will let you edit, upload, or download the journal file or
any files it includes.
.PP
Note, unlike any other hledger command, in this mode you (or any
visitor) can alter or wipe the data files.
Before saving an edited or uploaded file, hledger\-web saves a numbered
backup of it (eg \f[CR]main.journal.1\f[R], then
\f[CR]main.journal.2\f[R]); if the backup can\(aqt be written, the file
is not changed.
(Adding a transaction appends it to the main journal file without making
a backup.)
hledger\-web is not aware of version control systems, currently; if you
use one, you\(aqll have to arrange to commit the changes yourself.
.PP
Changes which would leave the journal unreadable are refused, and the
file is not changed.
This applies to edits, uploads and added transactions.
Each change is checked as the next read of the journal will check it, in
the context of all the journal\(aqs files and with the options
hledger\-web was started with: so transactions must balance, balance
assertions must pass (unless started with \f[CR]\-I\f[R]), lots must be
valid, and with \f[CR]\-\-strict\f[R], the strict checks must pass too.
.SH REPORTS
Besides the journal and the account registers, hledger\-web shows these
reports.
The sidebar and the links at the top of every page lead to each of them,
and so does the \f[CR]g\f[R] key followed by the first letter of the
report\(aqs name:
.IP \(bu 2
\f[B]Balance sheet\f[R] (\f[CR]b\f[R], \f[CR]/balancesheet\f[R]):
assets, liabilities and net worth, like the balancesheet command.
Its Equity option adds an equity section, like balancesheetequity.
.IP \(bu 2
\f[B]Income statement\f[R] (\f[CR]i\f[R], \f[CR]/incomestatement\f[R]):
revenues, expenses and net income, like incomestatement.
.IP \(bu 2
\f[B]Cashflow\f[R] (\f[CR]c\f[R], \f[CR]/cashflow\f[R]): changes in cash
accounts, like cashflow.
.IP \(bu 2
\f[B]Holdings\f[R] (\f[CR]h\f[R], \f[CR]/holdings\f[R]): investments and
their performance, like holdings.
Shown only for journals that use lots; see below.
.IP \(bu 2
\f[B]All accounts\f[R] (\f[CR]a\f[R], \f[CR]/balance\f[R]): all
accounts, or those you search for, like balance.
.PP
Each report shows a chart and then a table (by default; both can be
toggled).
Click any amount to see the transactions it is made of.
.SS Options
A report\(aqs options (click Options, or press \f[CR]o\f[R]) change what
it shows.
These are similar to hledger\(aqs command\-line options and
hledger\-ui\(aqs keys.
The main ones, with their keyboard shortcuts:
.IP \(bu 2
\f[B]Interval\f[R] (\f[CR]D\f[R], \f[CR]W\f[R], \f[CR]M\f[R],
\f[CR]Q\f[R], \f[CR]Y\f[R]): one column for the whole period, or one per
day, week, month, quarter or year (see Report intervals).
Until you choose one, the reports pick an interval to suit the period
shown (except holdings, whose interval is its own; see Holdings):
monthly for up to two years, quarterly for up to six, yearly beyond.
Click a column\(aqs heading to see the report for just its dates.
.IP \(bu 2
\f[B]Show\f[R] (\f[CR]H\f[R]): balance changes in each period, or ending
balances (which include everything before the period).
The balance sheet shows ending balances by default and the other reports
show changes, as their commands do; the report\(aqs heading says which
it is showing.
.IP \(bu 2
\f[B]Depth\f[R] (\f[CR]0\f[R]\-\f[CR]9\f[R], \f[CR]\-\f[R],
\f[CR]+\f[R]): how many levels of accounts to show (see Depth).
Depth 0 shows only the totals.
Until you choose one, the depth is 1, the top\-level accounts.
The − and + beside the table\(aqs Account heading step it too.
In tree mode they fold or open a level of the whole tree.
(The sidebar has a depth of its own; see above.)
.IP \(bu 2
\f[B]Accounts\f[R] (\f[CR]t\f[R]): a list, or a tree with subtotals; the
List and Tree links beside the table\(aqs Account heading switch too.
In a tree, the accounts below the depth limit are folded, and their
carets open them in place (at depth 0, all of them, under each
section\(aqs total).
.IP \(bu 2
\f[B]Amounts\f[R] (\f[CR]B\f[R], \f[CR]V\f[R]): as recorded, at cost, or
at market value at the end of each period (see Cost reporting and Value
reporting).
.IP \(bu 2
\f[B]Zero balances\f[R] (\f[CR]z\f[R]): hide or show accounts whose
balance is zero.
(On the holdings page, \f[CR]z\f[R] toggles Closed positions instead;
use this option\(aqs links there.)
.IP \(bu 2
\f[B]Equity\f[R] (balance sheet only): hide or show the equity section.
The browser remembers this choice for each hledger\-web server.
.IP \(bu 2
\f[B]Status\f[R] (\f[CR]U\f[R], \f[CR]P\f[R], \f[CR]C\f[R]),
\f[B]Postings\f[R] (\f[CR]R\f[R]), account types, and commodities: show
only transactions with that status, only real postings, or only some
account types or commodities.
These rows edit the search, adding a term like \f[CR]status:*\f[R] or
\f[CR]type:A\f[R].
Shift\-click selects several types or commodities.
.PP
The options you choose stay in effect as you move to other pages, except
Show, which each report sets to its own default.
On the journal and register, the report options are shown muted, but are
kept.
.PP
The search form filters reports as it does the other pages, and its
\f[CR]date:\f[R] terms set the report\(aqs dates.
An interval or depth typed in the search, like \f[CR]date:monthly\f[R]
or \f[CR]depth:2\f[R], moves into the options when the page reloads.
A depth limit for some accounts only, like \f[CR]depth:assets=3\f[R],
stays in the search.
.PP
The options are also URL parameters, so you can bookmark a report with
them.
.PP
(For more detail, see the hledger manual, eg CONCEPTS.)
.SS Charts
A report\(aqs chart is the one its command draws with
\f[CR]\-\-chart\f[R]: eg a bar per account, or with an interval, each
account over time, and for the statements, each section and the net
total.
In tree mode it shows the accounts down to the depth limit.
With several commodities, use the legend, or the \f[CR][\f[R] and
\f[CR]]\f[R] keys, to choose the one charted.
The Balance page\(aqs and statements\(aq charts stack each period\(aqs
accounts (or sections) in one bar, above and below zero; the Chart row
in Options (or \f[CR]\-\-chart=grouped\f[R] at startup) shows a bar per
account type (or section), side by side, instead (on the Balance page
with no interval, for the whole period, as
\f[CR]balance \-\-chart=grouped\f[R] does).
\f[CR]\-\-chart\f[R] at startup takes the same value as the commands\(aq
\f[CR]\-\-chart\f[R]; its SCALE amounts fix the scales of the report and
register charts, so that they can be compared.
Hover over a bar or a line (or on a touch screen, tap it) to see its
period (or date, or account), its series and its amount.
Charts are drawn as wide as the page shows them, and redrawn when that
changes, eg when you hide or show the sidebar or resize the window.
.PP
The \f[CR]c\f[R] key hides or shows the chart, and \f[CR]d\f[R] the
table (the report\(aqs data).
You can also click the Chart and Data buttons at their top right
corners, whose carets show whether they are shown.
The \f[CR]N\f[R] key shows or hides the net total line (or marks), eg a
statement\(aqs net, or holdings\(aq value or net gain; this is hidden at
first, leaving the bars it totals (or with \f[CR]\-\-chart=net\f[R] at
startup, shown at first).
The browser remembers this for each hledger\-web server, and once you
have chosen with \f[CR]N\f[R], your choice wins over
\f[CR]\-\-chart=net\f[R].
.SS From a report to its transactions
Click an amount to see its account\(aqs register for that period: the
transactions the amount is made of.
An ending balance\(aqs register starts with the balance brought forward,
so its final running balance is that amount.
A section\(aqs total shows the register of all the section\(aqs
accounts.
An amount shown at cost or market value leads to a register showing its
amounts the same way.
.PP
Some things can make the register look different from the report:
.IP \(bu 2
The statements show liabilities, equity and revenues as positive
amounts, as their commands do, so their registers show the same amounts
negated.
The amount\(aqs tooltip says so.
.IP \(bu 2
When a posting has a date of its own, the report counts it on that date,
but the register lists its whole transaction, on the transaction\(aqs
date.
.SS Holdings
The holdings report shows one row for each commodity held in each
account, with its cost basis, value and gains.
Its chart has a bar for each one, showing its cost basis and unrealised
gain or loss.
Its own options can show:
.IP \(bu 2
each lot separately (\f[B]Lots\f[R], \f[CR]L\f[R]),
.IP \(bu 2
fully disposed positions and their realised gains (\f[B]Closed
positions\f[R], \f[CR]z\f[R]),
.IP \(bu 2
all values in the market valuation commodity (\f[B]Values\f[R]).
.PP
Closed positions are hidden by default, as in the \f[CR]holdings\f[R]
command, but the totals\(aq RGain and XIRR always include them; a note
below the table says how many are hidden, with a link to show them.
.PP
Its depth limit doesn\(aqt fold accounts: as on the command line, it
merges the deeper accounts\(aq positions, by commodity, into the
accounts at the limit.
.PP
With an \f[B]Interval\f[R] chosen (it picks none by itself), it shows
how your holdings changed, like holdings with a report interval: a row
for each period\(aqs end, with the totals of all the holdings then, and
a bar for each in the chart.
Each row\(aqs date links to the holdings on that date.
This page\(aqs interval is its own, since it makes a different report
here: choosing one doesn\(aqt change the other reports\(aq interval, nor
theirs this page\(aqs, and an interval given at startup (eg
\f[CR]\-M\f[R]) is theirs.
Its \f[B]Gains\f[R] option chooses what the gain columns cover: each
period, the time since the report\(aqs start date, or the time since
acquisition (the default).
With the first two, the chart shows those gains: realised, and
unrealised (hatched).
\f[CR]H\f[R] toggles between gains since acquisition and gains in each
period.
.PP
On journals that use lots, every page also has a Lots option, showing
lot subaccounts and per\-lot postings.
.SH URL PARAMETERS
A page\(aqs url includes its search and options, so a bookmark or a
shared link shows the same view.
You can also write these urls yourself, eg
\f[CR]/balancesheet?interval=monthly&depth=2\f[R] or
\f[CR]/register?account=assets:bank\f[R].
These are the parameters, most corresponding to hledger options:
.IP \(bu 2
\f[CR]q\f[R] \- the search
.IP \(bu 2
\f[CR]account\f[R] \- the account whose register to show (with its
subaccounts, unless \f[CR]subs=0\f[R])
.IP \(bu 2
\f[CR]page\f[R] \- which page of transactions to show, in the journal
and register (1 is the newest)
.IP \(bu 2
\f[CR]interval\f[R] \- \f[CR]daily\f[R], \f[CR]weekly\f[R],
\f[CR]monthly\f[R], \f[CR]quarterly\f[R] or \f[CR]yearly\f[R] (like
\f[CR]\-D\f[R], \f[CR]\-W\f[R], \f[CR]\-M\f[R], \f[CR]\-Q\f[R],
\f[CR]\-Y\f[R]), or \f[CR]none\f[R] for one column; without it the
reports pick one
.IP \(bu 2
\f[CR]hinterval\f[R] \- the holdings page\(aqs own interval, in the same
words; without it, none
.IP \(bu 2
\f[CR]depth\f[R] \- a number (like \f[CR]\-\-depth\f[R]), or
\f[CR]all\f[R] for no limit; without it, 1
.IP \(bu 2
\f[CR]accum\f[R] \- \f[CR]change\f[R], \f[CR]historical\f[R] or
\f[CR]cumulative\f[R] (like \f[CR]\-\-change\f[R], \f[CR]\-H\f[R],
\f[CR]\-\-cumulative\f[R]); on the holdings page, with an interval, what
the gains cover
.IP \(bu 2
\f[CR]value\f[R] \- \f[CR]none\f[R], \f[CR]cost\f[R], or
\f[CR]then\f[R], \f[CR]end\f[R], \f[CR]now\f[R] or a date, optionally
followed by \f[CR],COMMODITY\f[R] (like \f[CR]\-\-value\f[R])
.IP \(bu 2
\f[CR]infer\f[R] \- \f[CR]1\f[R] to infer market prices from transaction
costs too (like \f[CR]\-\-infer\-market\-prices\f[R])
.IP \(bu 2
\f[CR]empty\f[R] \- \f[CR]1\f[R] to show zero balances, \f[CR]0\f[R] to
hide them (like \f[CR]\-E\f[R])
.IP \(bu 2
\f[CR]list\f[R] \- \f[CR]tree\f[R] or \f[CR]flat\f[R] (like
\f[CR]\-\-tree\f[R], \f[CR]\-\-flat\f[R])
.IP \(bu 2
\f[CR]sort\f[R] \- \f[CR]amount\f[R] (like \f[CR]\-S\f[R])
.IP \(bu 2
\f[CR]total\f[R], \f[CR]avg\f[R], \f[CR]pct\f[R] \- \f[CR]1\f[R] to add
totals, averages, or show percentages (like \f[CR]\-T\f[R],
\f[CR]\-A\f[R], \f[CR]\-%\f[R])
.IP \(bu 2
\f[CR]calc\f[R] \- \f[CR]valuechange\f[R], \f[CR]gain\f[R] or
\f[CR]count\f[R] (like \f[CR]\-\-valuechange\f[R], \f[CR]\-\-gain\f[R],
\f[CR]\-\-count\f[R])
.IP \(bu 2
\f[CR]date2\f[R] \- \f[CR]1\f[R] to use secondary dates (like
\f[CR]\-\-date2\f[R])
.IP \(bu 2
\f[CR]costs\f[R] \- \f[CR]1\f[R] to show costs, in the register
.IP \(bu 2
\f[CR]equity\f[R] \- \f[CR]1\f[R] or \f[CR]0\f[R], on the balance sheet
(the old \f[CR]/balancesheetequity\f[R] address leads to
\f[CR]equity=1\f[R])
.IP \(bu 2
\f[CR]lots\f[R] \- \f[CR]1\f[R] to show lots (like \f[CR]\-\-lots\f[R])
.IP \(bu 2
\f[CR]closed\f[R] \- \f[CR]1\f[R], on the holdings page, to show closed
positions, \f[CR]0\f[R] to hide them
.IP \(bu 2
\f[CR]chart\f[R] \- \f[CR]grouped\f[R], on the Balance and statement
pages, to chart each period\(aqs account types (or sections) side by
side (like \f[CR]\-\-chart=grouped\f[R])
.SH RELOADING
hledger\-web detects changes made to the files by other means (eg if you
edit it directly, outside of hledger\-web), and it will show the new
data when you reload the page or navigate to a new page.
If a change makes a file unparseable, hledger\-web will display an error
message until the file has been fixed.
.PP
(If you are viewing files mounted from another machine, make sure that
both machines have roughly the same idea of what time it is.)
.SH JSON API
In addition to the web UI, hledger\-web also serves a JSON API that can
be used to get data or add new transactions.
If you want the JSON API only, you can use the \f[CR]\-\-serve\-api\f[R]
flag.
Eg:
.IP
.EX
$ hledger\-web \-f examples/sample.journal \-\-serve\-api
\&...
.EE
.PP
You can get JSON data from these routes:
.IP
.EX
/version
/accountnames
/transactions
/prices
/commodities
/accounts
/accounttransactions/ACCOUNTNAME
/openapi.json
.EE
.PP
Eg, all account names in the journal (similar to the accounts command).
(hledger\-web\(aqs JSON does not include newlines, here we use python to
prettify it):
.IP
.EX
$ curl \-s http://127.0.0.1:5000/accountnames | python3 \-m json.tool
[
    \(dqassets\(dq,
    \(dqassets:bank\(dq,
    \(dqassets:bank:checking\(dq,
    \(dqassets:bank:saving\(dq,
    \(dqassets:cash\(dq,
    \(dqexpenses\(dq,
    \(dqexpenses:food\(dq,
    \(dqexpenses:supplies\(dq,
    \(dqincome\(dq,
    \(dqincome:gifts\(dq,
    \(dqincome:salary\(dq,
    \(dqliabilities\(dq,
    \(dqliabilities:debts\(dq
]
.EE
.PP
Or all transactions:
.IP
.EX
$ curl \-s http://127.0.0.1:5000/transactions | python3 \-m json.tool
[
    {
        \(dqtcode\(dq: \(dq\(dq,
        \(dqtcomment\(dq: \(dq\(dq,
        \(dqtdate\(dq: \(dq2008\-01\-01\(dq,
        \(dqtdate2\(dq: null,
        \(dqtdescription\(dq: \(dqincome\(dq,
        \(dqtindex\(dq: 1,
        \(dqtpostings\(dq: [
            {
                \(dqpaccount\(dq: \(dqassets:bank:checking\(dq,
                \(dqpamount\(dq: [
                    {
                        \(dqacommodity\(dq: \(dq$\(dq,
                        \(dqacost\(dq: null,
                        \(dqacostbasis\(dq: null,
\&...
.EE
.PP
Most of the JSON corresponds to hledger\(aqs data types; for details of
what the fields mean, see the Hledger.Data.Json haddock docs and click
on the various data types, eg Transaction.
And for a higher level understanding, see the journal docs.
There is also a basic OpenAPI specification, also served at
\f[CR]/openapi.json\f[R].
.PP
Some routes return a report type wrapping the data; eg
\f[CR]/accounttransactions\f[R] returns an AccountTransactionsReport, a
report title and a list of items.
The handlers in Hledger.Web.Handler.MiscR show what each route returns.
.PP
You can add a new transaction to the journal with a PUT request to
\f[CR]/add\f[R], if hledger\-web was started with
\f[CR]\-\-allow=add\f[R] (the default when listening on a local\-only
address).
The payload must be the full, exact JSON representation of a hledger
transaction (partial data won\(aqt do).
The journal must still be readable with the transaction added, with
hledger\-web\(aqs startup options (see Editing, uploading, downloading);
if not, the response has status 400 and the error message, and the
journal is not changed.
You can get sample JSON from hledger\-web\(aqs \f[CR]/transactions\f[R]
or \f[CR]/accounttransactions\f[R], or from hledger\(aqs print command.
Eg, this saves the first transaction of the sample journal to
\f[CR]txn.json\f[R]:
.IP
.EX
$ hledger \-f examples/sample.journal print \-O json | python3 \-c \(aqimport json,sys; json.dump(json.load(sys.stdin)[0], sys.stdout, indent=4)\(aq > txn.json
.EE
.PP
Here\(aqs how it looks (remember, this JSON corresponds to hledger\(aqs
Transaction and related data types):
.IP
.EX
{
    \(dqtcode\(dq: \(dq\(dq,
    \(dqtcomment\(dq: \(dq\(dq,
    \(dqtdate\(dq: \(dq2008\-01\-01\(dq,
    \(dqtdate2\(dq: \f[B]null\f[R],
    \(dqtdescription\(dq: \(dqincome\(dq,
    \(dqtindex\(dq: 1,
    \(dqtpostings\(dq: [
        {
            \(dqpaccount\(dq: \(dqassets:bank:checking\(dq,
            \(dqpamount\(dq: [
                {
                    \(dqacommodity\(dq: \(dq$\(dq,
                    \(dqacost\(dq: \f[B]null\f[R],
                    \(dqacostbasis\(dq: \f[B]null\f[R],
                    \(dqaquantity\(dq: {
                        \(dqdecimalMantissa\(dq: 1,
                        \(dqdecimalPlaces\(dq: 0,
                        \(dqfloatingPoint\(dq: 1
                    },
                    \(dqastyle\(dq: {
                        \(dqascommodityside\(dq: \(dqL\(dq,
                        \(dqascommodityspaced\(dq: \f[B]false\f[R],
                        \(dqasdecimalmark\(dq: \(dq.\(dq,
                        \(dqasdigitgroups\(dq: \f[B]null\f[R],
                        \(dqasprecision\(dq: 0,
                        \(dqasrounding\(dq: \(dqNoRounding\(dq
                    }
                }
            ],
            \(dqpbalanceassertion\(dq: \f[B]null\f[R],
            \(dqpcomment\(dq: \(dq\(dq,
            \(dqpdate\(dq: \f[B]null\f[R],
            \(dqpdate2\(dq: \f[B]null\f[R],
            \(dqporiginal\(dq: \f[B]null\f[R],
            \(dqpreal\(dq: \(dqRealPosting\(dq,
            \(dqpstatus\(dq: \(dqUnmarked\(dq,
            \(dqptags\(dq: [],
            \(dqptransaction_\(dq: \(dq1\(dq
        },
        {
            \(dqpaccount\(dq: \(dqincome:salary\(dq,
            \(dqpamount\(dq: [
                {
                    \(dqacommodity\(dq: \(dq$\(dq,
                    \(dqacost\(dq: \f[B]null\f[R],
                    \(dqacostbasis\(dq: \f[B]null\f[R],
                    \(dqaquantity\(dq: {
                        \(dqdecimalMantissa\(dq: \-1,
                        \(dqdecimalPlaces\(dq: 0,
                        \(dqfloatingPoint\(dq: \-1
                    },
                    \(dqastyle\(dq: {
                        \(dqascommodityside\(dq: \(dqL\(dq,
                        \(dqascommodityspaced\(dq: \f[B]false\f[R],
                        \(dqasdecimalmark\(dq: \(dq.\(dq,
                        \(dqasdigitgroups\(dq: \f[B]null\f[R],
                        \(dqasprecision\(dq: 0,
                        \(dqasrounding\(dq: \(dqNoRounding\(dq
                    }
                }
            ],
            \(dqpbalanceassertion\(dq: \f[B]null\f[R],
            \(dqpcomment\(dq: \(dq\(dq,
            \(dqpdate\(dq: \f[B]null\f[R],
            \(dqpdate2\(dq: \f[B]null\f[R],
            \(dqporiginal\(dq: \f[B]null\f[R],
            \(dqpreal\(dq: \(dqRealPosting\(dq,
            \(dqpstatus\(dq: \(dqUnmarked\(dq,
            \(dqptags\(dq: [],
            \(dqptransaction_\(dq: \(dq1\(dq
        }
    ],
    \(dqtprecedingcomment\(dq: \(dq\(dq,
    \(dqtsourcepos\(dq: [
        {
            \(dqsourceColumn\(dq: 1,
            \(dqsourceLine\(dq: 31,
            \(dqsourceName\(dq: \(dq/home/user/hledger/examples/sample.journal\(dq
        },
        {
            \(dqsourceColumn\(dq: 1,
            \(dqsourceLine\(dq: 34,
            \(dqsourceName\(dq: \(dq/home/user/hledger/examples/sample.journal\(dq
        }
    ],
    \(dqtstatus\(dq: \(dqUnmarked\(dq,
    \(dqttags\(dq: []
}
.EE
.PP
And here\(aqs how to add it with curl.
This should append a new entry to your journal file:
.IP
.EX
$ curl http://127.0.0.1:5000/add \-X PUT \-H \(aqContent\-Type: application/json\(aq \-\-data\-binary \(attxn.json
.EE
.SH DEBUG OUTPUT
You can add \f[CR]\-\-debug[=N]\f[R] to the command line to log debug
output.
N ranges from 1 (least output, the default) to 9 (maximum output).
Typically you would start with 1 and increase until you are seeing
enough.
Debug output goes to stderr, interleaved with the requests logged on
stdout.
To capture debug output in a log file instead, you can usually redirect
stderr, eg:
.PD 0
.P
.PD
\f[CR]hledger\-web \-\-debug=3 2>hledger\-web.log\f[R].
.SH LANGUAGE
hledger\-web\(aqs pages can be shown in another language when a
translation catalog is available (see Languages in the hledger manual).
.PP
When hledger\-web is started with \f[CR]\-\-lang LANG\f[R], eg
\f[CR]\-\-lang de\f[R], every page is in that language, whatever the
browser asks for.
So you can use hledger\-web in a language other than your browser\(aqs,
or give every user of a shared server the same language.
.PP
Otherwise the language is chosen per request, and the first of these
naming an available translation wins:
.IP "1." 3
a \f[CR]_LANG\f[R] query parameter, eg \f[CR]?_LANG=de\f[R].
This choice is remembered in a \f[CR]_LANG\f[R] cookie.
.IP "2." 3
the \f[CR]_LANG\f[R] cookie
.IP "3." 3
the browser\(aqs \f[CR]Accept\-Language\f[R] header, ie the browser\(aqs
or system\(aqs language settings
.PP
If none does, pages are in English, or with \f[CR]\-\-lang auto\f[R], in
the language of hledger\-web\(aqs environment.
So viewers usually get their browser\(aqs language automatically, if
hledger\-web has it.
Catalogs, including any in the config directory, are loaded when
hledger\-web starts.
.SH ENVIRONMENT
\f[B]LEDGER_FILE\f[R] The main journal file to use when not specified
with \f[CR]\-f/\-\-file\f[R].
Default: \f[CR]$HOME/.hledger.journal\f[R].
.SH BUGS
We welcome bug reports in the hledger issue tracker
(https://bugs.hledger.org), or on the hledger chat or mail list
(https://hledger.org/support).
.PP
Some known issues:
.PP
Without JavaScript (eg in text\-mode browsers), pages can be viewed and
their links followed, but the add form, help dialog, keyboard shortcuts,
sidebar toggle and folding don\(aqt work.


.SH AUTHORS
Simon Michael <simon@joyful.com> and contributors.
.br
See http://hledger.org/CREDITS.html

.SH COPYRIGHT
Copyright 2007-2023 Simon Michael and contributors.

.SH LICENSE
Released under GNU GPL v3 or later.

.SH SEE ALSO
hledger(1), hledger\-ui(1), hledger\-web(1), ledger(1)