BillingRun
ResponseOne period billed by a plan. Starting a run answers 202: the run is its own job. With dry_run=true it is computed and returned without storing anything, with a fingerprint to start the real run with, so it bills exactly what was previewed.
Returned in responses. Its enums are open: tolerate values not listed here, which later versions may add.
Attributes
25Leave draft invoices, issue them, or issue and email them. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) draft, issue, issue_send
Invoice date. A run made before the dates were stored answers the day it was made, the day its invoices were dated.
Where a run is. completed_with_errors: some recipients failed validation. superseded: a later run of the same plan and period replaced it (its issued invoices are kept). failed: it created nothing (failed_reason says why).
Known values (open: expect new ones) queued, running, completed, completed_with_errors, failed, superseded
The run's recipients and invoices by what happened to them.
7 attributes of counts
The currency (ISO 4217) of the run's invoices and its totals: the plan's when the run was made (a plan's currency may change for later periods).
Every variable value the run used, the plan's own included.
6 attributes of each item
The value, as a decimal string with at most 6 decimal places (a 7th is refused); it is stored and read back as sent, never rounded to fewer. Null with purchase_invoice_id: the variable's invoice formula over the chosen lines (invoice_formula on the plan variable; the lines' sum when it has none), computed by the server and kept to 6 places, half-even.
Details
A value sent with purchase_invoice_id must equal that result exactly.
Whether the purchase invoice lines are read with their VAT (included, the default) or without it: the line.amount of the invoice formula.
Known values (open: expect new ones) included, excluded
Where a running run is. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) compute, drafts, issue, send
Why a failed run failed; a failed run created nothing. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) blocked, plan_not_ready, result_changed, stale, worker_failed, unexpected_error
Sums over the invoices the run made (a credit invoice counts negative), each computed as the invoice computes it.
What stops the run; a dry run lists them all.
12 attributes of each item
What stops the run. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) missing_allocation_basis, missing_recipient, missing_reading_blocks_run, missing_asked_variable, missing_timed_variable, unresolved_account, unresolved_tax_code, external_source_unpublished, line_unresolved, invalid_boolean_formula, currency_not_active, currency_changed
Their display names as defined on the type (Pindala; Maksja, Omanik).
Labels of the lines that cannot be computed for this object.
Labels of the allocation lines whose split over everyone would be wrong.
currency_not_active: the plan's currency, no longer on the company's list. currency_changed: the currency of the period's issued invoices, which a re-run in the plan's currency would bill beside.
Per object or contact. On a list only with expand=recipients.
20 attributes of each item
Null in partners-mode plans (recipients come from billing_plan_recipient, not billing_object).
The payer billed; null for a dry-run row whose payer is not resolved.
What the run did: made an invoice, had nothing to bill, failed validation (error_code), or kept an issued invoice of an earlier run of the period (issued_untouched). New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) generated, skipped, validation_failed, issued_untouched
DA-139: the failure's machine-readable identity, registered in util/warning_codes.py under the billing_recipient_failure family and obliged warnings.billing_recipient_failure.<code> copy in both locales.
Details
Null for a non-failed outcome, and for a row generated before DA-139 shipped — in which case error (the server's English sentence) is the only text available.
The figures the localised sentence interpolates (e.g. line_label, amount), lifted out of error because a translated sentence places its values differently. Null when the code takes no parameters.
Lines billed on an estimate, settled by a later run.
Phase 241 (D-03): review-worthy flags on this recipient (e.g. missing_reading_policy=flag_recipient markers) — separate from outcome, whose enum is frozen (D-03). Null when the recipient carries no flags. Free-form per- entry shape; populated by the run-generation path (Phase 241-03/04).
KÜ part 1 (owner Q25): the co-recipients this row was billed with (the other owners), printed and e-mailed beside the primary partner_id. Empty for a one-partner bill.
The co-recipients' names, in billing order ("Mari Tamm + Jaan Tamm").
The invoice's total; a consolidated invoice's whole total on each member.
The invoice's rate: 1 in the book currency; for a foreign invoice the European Central Bank rate of its posting date (a draft's until issuing fixes it). Null without an invoice.
Parts of recipients left out (null, or an empty list) because the token's scopes do not read them: contacts (the payers, by contacts:read), invoices (invoice ids, numbers and totals, by invoices:read), objects (the objects, by objects:read). Each recipient's English error is left out with them.
Known values (open: expect new ones) contacts, invoices, objects