Checking VAT Taxpayers Against the Ministry’s Flat File
A command-line tool for verifying Polish VAT taxpayers locally. The Ministry of Finance publishes the official register both as an API and as a daily “flat file”. The API allows only ten lookups a day, so for anything beyond a handful of checks the flat file is the practical route. This project downloads that file, loads it into a local database, and answers the one question the file is built to answer: does a given taxpayer hold a given bank account?
Why hashes, not records
The flat file never lists accounts in the clear. Each entry is a SHA-512 hash of the concatenation \textit{date} + \textit{NIP} + \textit{account}, applied a fixed number of times that the file itself declares. Because the date is part of the input, every daily file is completely different from the last, even when the underlying register has not changed. To check a pair you reproduce the same hashing, with that day’s date and iteration count, and look for the result among the stored hashes.
Two tools
Downloading and checking are split into two programs over a shared SQLite database that is created if it is missing. The downloader fetches the current day’s file and replaces the hash tables wholesale, appending a row to the metadata table with the download time, the file’s generation date, and the number of hash iterations to apply. The checker takes a tax number (NIP) and a 26-digit account number; if the database is stale or absent it offers to refresh it first, then reports whether the account is real (a literal single account) or virtual (matched through a mask, meaning it may exist as a subaccount rather than verbatim).
Source
The C# solution, its tests against the Ministry’s API, and usage notes are in the source repository.