export_period_statement
Export a month of purchase invoices as a CSV file with KSeF details for accountants to forward via email.
Instructions
Write one month of purchase invoices as a CSV an accountant can forward.
period is a calendar month spelled YYYY-MM. The month is the unit a
period is closed in, and both ends being fixed is what lets the same request
be answered from disk instead of spending one of twenty metadata queries an
hour a second time.
working_directory overrides the directory declared during onboarding for
this one call. Whichever is used is created 0700 if it is new, is refused
outright if it lies inside the cache or data root — those are internal
storage and deleting statements must never reach the archive — and is
reported in warnings when its path looks like a cloud sync folder, unless
the taxpayer acknowledged that directory during onboarding.
The file holds ten columns, in this order: KSeF number, the seller's own invoice number, issue date, seller NIP, seller name, gross, net, VAT, currency, and a KOD I verification code. The code is composed from the seller NIP, the issue date and the SHA-256 of the archived invoice body; rows whose body is not in the archive yet say so instead of carrying a blank code.
Addresses, bank accounts, invoice lines and local paths are absent on purpose: this file is written to be attached to an e-mail. The paths are in this answer instead.
Amounts are written exactly as KSeF stated them — no rounding, no float anywhere on the path — with a comma as the decimal separator and a semicolon between fields, which is what a Polish spreadsheet expects. Sums are in this answer, per currency, and never one figure across several of them.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | ||
| working_directory | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nip | Yes | ||
| path | Yes | ||
| period | Yes | ||
| message | Yes | ||
| complete | Yes | ||
| warnings | No | ||
| row_count | Yes | ||
| from_cache | Yes | ||
| queried_at | Yes | ||
| environment | Yes | ||
| gross_totals | Yes |