A credit note can be created via the API and linked to an invoice in a single request. This is done using the dobropisuj service, which creates the document, transfers the selected items to it in negative quantities, and creates a link to the credited invoice.
Credit note in a single request
<winstrom version="1.0">
<faktura-vydana>
<typDokl>code:DOBROPIS</typDokl>
<dobropisuj>
<dobropisovanyDokl>code:VF1-0001/2026</dobropisovanyDokl>
<polozkyDokladu>
<polozka>
<id>123</id>
<mnozMj>1</mnozMj>
</polozka>
</polozkyDokladu>
</dobropisuj>
</faktura-vydana>
</winstrom>
In the polozka element, id is the item of the credited invoice, and mnozMj is the quantity to be credited. This creates a document with negative items and a link typVazbyDokl.hlavaDobropis. If the item has recorded serial numbers, they are specified in the vyrobniCislaId element.
Linking an existing credit note
If you already have a credit note and just want to add the link, use vytvor-vazbu-dobropis:
<winstrom version="1.0">
<faktura-vydana>
<id>code:DOBROPIS1</id>
<vytvor-vazbu-dobropis>
<dobropisovanyDokl>code:VF1-0001/2026</dobropisovanyDokl>
<vytvorZapocet>true</vytvorZapocet>
<typDoklZapocet>code:ZAPOCET</typDoklZapocet>
</vytvor-vazbu-dobropis>
</faktura-vydana>
</winstrom>
The optional vytvorZapocet immediately creates a mutual offset that settles both the invoice and the credit note; in that case typDoklZapocet is required. The link can also be removed using an empty <zrus-vazbu-dobropis></zrus-vazbu-dobropis> element.
⚠️ A single credit note can only be linked to one invoice; conversely, multiple credit notes can be linked to a single invoice. Attempting to link an already linked credit note to another invoice will result in an error, as will a reference to a non-existent document.
ℹ️ The vytvor-vazbu-dobropis service only links document headers, not items. For stock items, make sure to check the purchase price — if you don't specify it, the current stock price will be used, and if the goods are not in stock, the price from the price list will be used instead. An incorrect price will affect stock status.
