Skip to content

KSeF2 CLI

KSeF2 CLI wraps the ksef2 Python SDK in a script-friendly command-line tool. It is intended for local operations, CI jobs, and operational scripts that need to authenticate with KSeF, query invoices, submit invoices, inspect sessions, or manage administrative resources without writing Python code.

The CLI is intentionally stateless by default. Authenticated commands accept credentials through global options or environment variables. A local config file is available for developer workstations, but secrets should normally come from environment variables or a trusted secret manager in shared environments.

The package exposes two equivalent executables:

Terminal window
ksef2
ksef2-cli

Global options come before the command group:

Terminal window
ksef2 --env test --nip 5261040828 --test-cert auth login --json

The command groups mirror the SDK domains:

  • auth
  • invoices
  • online
  • batch
  • tokens
  • sessions
  • certificates
  • permissions
  • limits
  • peppol
  • encryption
  • testdata
  • config