# n8n-nodes-ksef

This is an n8n community node for **KSeF** (Krajowy System e-Faktur) - the Polish National e-Invoice System.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

## Operations

### Session
- **Start Session** - Initialize KSeF session using certificate or token authentication
- **Check Status** - Check the status of a session by reference number

### Invoice
- **Get Invoice** - Download invoice XML by KSeF number
- **Search Invoices** - Search invoices metadata with date filters and pagination

## Credentials

Configure the KSeF API credentials with:

- **Environment** - Demo, Test, or Production
- **NIP** - Tax identification number
- **Auth Type** - Token or Certificate
- **API Token** (for token auth) - Token generated in KSeF application
- **Private Key** (for certificate auth) - Private key in PEM format
- **Certificate** (for certificate auth) - Public certificate in PEM format
- **Passphrase** (optional) - Passphrase for encrypted private key

## Compatibility

- Tested with n8n version 1.x
- Supports both RSA and ECDSA certificates
- Compatible with KSeF API v2

## Resources

- [KSeF Official Documentation](https://ksef.mf.gov.pl/)
- [n8n community nodes docs](https://docs.n8n.io/integrations/community-nodes/)

## License

[MIT](LICENSE)
