Skip to main content

Placeholders

A placeholder is a named value your invoice template can insert: the recipient's name, the invoice reference, the total, or something you define yourself such as a purchase-order number.

Placeholders are what make one template work for every invoice: you write #ph("recipient_name") once, and each rendered PDF carries that invoice's own recipient.

They are used inside the two Typst snippets you control: the post-invoice block and the footer.

Reading a placeholder

Please quote #ph("payment_concept") when paying.

ph("key") returns the value for that key, or an empty string if the invoice has no value for it. That makes optional content easy to guard, so a whole block disappears instead of leaving a stray label behind:

#if ph("purchase_order") != "" [
*Purchase order:* #ph("purchase_order")
]
The {{key}} form

Older templates may contain {{recipient_name}} written directly in the text. That form still works (it is substituted before rendering) but it cannot express "leave this out when empty": an unfilled {{key}} leaves the literal text on the invoice. Prefer #ph("key").

Built-in placeholders

These are always available and are resolved from the invoice's own frozen data, so they show what was true when the invoice was created, never today's company or customer details. Dates and amounts are formatted in the invoice's language.

The document

KeyValue
invoice_idThe document reference, for example 2026/0007 (a proforma or draft carries its own reference).
invoice_uuidThe internal identifier of the document.
invoice_created_atThe document's date: the issue date for an issued invoice, the creation date for a proforma or draft.
invoice_document_labelThe document's name in its language: Invoice, Corrective Invoice, Proforma, Draft Invoice.
invoice_issue_labelThe label for that date: Issued for an issued invoice, Created for a proforma or draft.
invoice_dueThe payment due date. Currently the same as invoice_created_at.
invoice_totalThe total, formatted, without a currency, for example 1.234,56.
invoice_total_with_currencyThe total followed by the currency code, for example 1.234,56 EUR.
currency_codeThe invoice's ISO-4217 currency code, for example EUR.

Your company (the issuer)

KeyValue
company_nameLegal name.
company_friendly_nameTrading / display name, if set.
company_display_nameThe friendly name when set, otherwise the legal name.
company_emailContact email.
company_phoneContact phone.
company_fiscal_idTax identification number.
company_address_linesStreet address, one line per line break.
company_address_lines_inlineThe same street address joined with commas.
company_address_zipcodePostal code.
company_address_cityCity.
company_address_stateState / province.
company_address_countryCountry name.

The recipient

KeyValue
recipient_nameName.
recipient_fiscal_idTax identification number.
recipient_emailContact email.
recipient_phoneContact phone.
recipient_address_linesStreet address, one line per line break.
recipient_address_lines_inlineThe same street address joined with commas.
recipient_address_zipcodePostal code.
recipient_address_cityCity.
recipient_address_stateState / province.
recipient_address_countryCountry name.

Payment

KeyValue
payment_recipientWho to pay: your company's legal name.
payment_conceptWhat to quote when paying: the document reference.

Custom placeholders

When the value cannot be derived from the invoice (a purchase-order number, a billing period, a project code), you declare a custom placeholder and fill it in when creating the invoice.

A declaration has four parts:

FieldMeaning
KeyThe name you read in the template, as in #ph("purchase_order").
LabelWhat the person creating the invoice sees on the form. Required.
RequiredWhen on, the invoice cannot be created until the field has a value.
DefaultPre-fills the field, and can still be edited per invoice.

A key cannot be one of the built-in keys listed above, and cannot be declared twice in the same place.

Declaring a custom placeholder

  • Company-wide: the Invoice settings card on the Company page. Offered on every invoice.
  • Per recipient: the invoice template override on a customer's entity form. Offered only on invoices to that customer.

When creating an invoice, the two sets are merged: the company's declarations plus the recipient's. If both declare the same key, the recipient's wins, so one customer can carry a different label, a different default, or a different required flag for the same key.

Filling it in on an invoice

Once you pick a recipient on the invoice form, a field appears for each merged declaration, labelled as declared and pre-filled with its default. Required fields are validated before the invoice can be created.

The Custom fields section of the invoice form, with one input per declared placeholder (a required Period and a Purchase order), each showing its key as the placeholder text.

The values are then frozen onto that invoice, alongside the template snippets themselves. Editing or removing a declaration later never changes an invoice that already exists, and an older invoice that predates a declaration simply resolves that key to an empty string, so a guarded block collapses instead of breaking.