Architecture and inbound scope
The official KSeF 2.0 integrator documentation recommends incremental retrieval through asynchronous POST /invoices/exports when synchronizing KSeF with an external local database. Build that flow as distinct stages: authorize the subject, start an export for a defined window and SubjectType, poll its status, download every returned part, decrypt and unpack it, validate the package, stage records, commit them to durable storage, and only then advance the checkpoint. Keep orchestration separate from ERP posting so a tax-code or supplier-matching exception cannot corrupt transport state. Define scope for every Polish entity, environment and role before implementation. A company may occur as Subject1, Subject2, Subject3 or an authorized subject, so an inbound design limited to the buyer role can miss documents that users can legitimately access. This is practical integration guidance, not legal or tax advice; confirm the flows and permissions applicable to each entity with official documentation and qualified advisers.