Skip to main content

Importing an ISDOC Invoice via REST API

How to import ISDOC using the Flexi API

Written by Petr Pech

ISDOC, or Information System Document, is a format for electronic invoicing in the Czech Republic. ABRA Flexi supports both importing and exporting invoices in this format. Received invoices can be imported via the REST API, and with the use of an advanced parameter, issued invoices can be imported as well.


How to call it

Import is called using the method PUT or POST on the received invoices evidence; the request body is the file itself:

PUT https://demo.flexibee.eu/c/demo/faktura-prijata.isdoc?typDokl=code:ZBOZI-FAKTURA
Content-Type: application/x-isdoc

<obsah souboru .isdoc>

You can specify the input format in two ways, which can also be combined:

Input file

URL extension

Content-Type header

ISDOC

.isdoc

application/x-isdoc

PDF with an embedded ISDOC invoice

.pdf

application/pdf

It's enough to specify just one of the two — PUT /c/{firma}/faktura-prijata without an extension works if you send the correct header Content-Type.

⚠️ For a PDF, the electronic invoice must be embedded in the file as an attachment invoice.isdoc — such a file is produced, for example, by exporting from ABRA Flexi. A plain PDF without embedded data will be rejected on import with the error isDocImportNepodariloSeNajitInvoiceIsdoc.

Importing an issued invoice

If the company has the advanced parameter paramImportIsdocFav enabled with the value true, issued invoices can be imported the same way:

PUT https://demo.flexibee.eu/c/demo/faktura-vydana.isdoc?typDokl=code:FAKTURA
Content-Type: application/x-isdoc

How to enable the parameter is described in the guide to this add-on.


URL parameters

Parameter

Required

Meaning

typDokl

yes

The document type under which the invoice will be imported. Specified as an identifier.

typUcOp

no

Posting template, again as an identifier.

odpocetZaloh

no

Automatic deduction of advances and tax documents for advance payments. The default value is true.

ucetniObdobi

no

The accounting period into which the document will be imported — a period abbreviation, for example ucetniObdobi=2025.

fileName

no

The name of the file attached to the invoice. The API stores the file the invoice was created from as an attachment. Without this parameter, the attachment is named import_{kod-faktury}.isdoc, or import_{kod-faktury}.pdf respectively.

The API silently ignores unknown parameters, so a typo in the name of an optional parameter does not cause an error — it's simply not used.

Usage examples

Importing an issued invoice into a past accounting period:

PUT https://demo.flexibee.eu/c/demo/faktura-vydana.isdoc?typDokl=code:FAKTURA&ucetniObdobi=2025
Content-Type: application/x-isdoc

Importing a received invoice without automatic deduction of advances and with a custom attachment name:

PUT https://demo.flexibee.eu/c/demo/faktura-prijata.isdoc?typDokl=code:FAKTURA&odpocetZaloh=false&fileName=faktura_dodavatele.isdoc
Content-Type: application/x-isdoc

A successful import returns 201 and in results the ID and number of the resulting document:

{
"winstrom": {
"@version": "1.0",
"success": "true",
"stats": {
"created": "1",
"updated": "0",
"deleted": "0",
"skipped": "0",
"failed": "0"
},
"results": [
{
"id": "2853",
"code": "PF0006/2026",
"ref": "/c/demo/faktura-prijata/2853"
}
]
}
}

ℹ️ If you import a document into an accounting period other than the current one, the response usually contains the warning dokladDuzpMimoAktualniUcetniObdobi. The document is still created, however. Legislative rules may, though, reject import into older periods entirely — for example, when the date of taxable supply exceeds the legal deadline.


Deduction of advances and advance tax documents

If an ISDOC invoice contains deductions of advances or advance tax documents, they can be deducted automatically during import.

With the parameter odpocetZaloh=false, the invoice will be created without deductions. The response is still 201 Created, but it contains a warning about the presence of advances:

<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>true</success>
<stats>
<created>1</created>
<updated>0</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>0</failed>
</stats>
<results>
<result>
<id>109</id>
<code>PF0017/2022</code>
<warnings>
<warning>Doklad (PF023/2050) obsahuje odpočty záloh nebo zálohových daňových dokladů, doklad byl vytvořen bez odpočtů.

Zálohy:
Číslo dokladu | Variabilní symbol | Částka
----------------------------------------
ZALOHA_2 | 12345 | 100,00 Kč

Zálohové daňové doklady:
Číslo dokladu | Variabilní symbol | Částka
-------------------------------------
ZDD_1 | 98765432 | 200,00 Kč</warning>
</warnings>
</result>
</results>
</winstrom>

Automatic deduction

With odpocetZaloh=true, or if the parameter is not specified, the system will try to find advance documents matching the listed deductions and deduct them. If this fails, the call ends with the error 400, and the response lists the deductions and the advance documents that were found.

For a document to be deducted, it must meet the following requirements:

  • The document's company, currency, and amount must match — the same or greater. The company must already be saved in the address book.

  • The deduction document number must match the received or internal number of the advance document, or the variable symbol of the deduction and the advance must match.

  • If there are multiple matches, the deduction will not be performed.

Example response for a failed automatic deduction with status 400 Bad Request:

<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>false</success>
<stats>
<created>0</created>
<updated>0</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>1</failed>
</stats>
<results>
<result>
<errors>
<error>Doklad (PF023/2050) obsahuje odpočty záloh nebo zálohových daňových dokladů, které se nepodařilo automaticky odečíst.

Zálohy:
Číslo dokladu | Variabilní symbol | Částka | Nalezený doklad
----------------------------------------------------------
ZALOHA_1 | 123456 | 250,00 Kč | nenalezeno
ZALOHA_2 | 999999 | 100,00 Kč | nenalezeno
ZALOHA_2 | 999999 | 300,00 Kč | Z0001/2022

Zálohové daňové doklady:
Číslo dokladu | Variabilní symbol | Částka | Nalezený doklad
-------------------------------------------------------
ZDD_1 | 852585 | 200,00 Kč | PF0001/2022
ZDD_2 | 852586 | 200,00 Kč | PF0002/2022
ZDD_3 | 852587 | 200,00 Kč | nenalezeno
ZDD_4 | 852588 | 200,00 Kč | nenalezeno</error>
</errors>
</result>
</results>
</winstrom>

If automatic deduction of advances fails, either prepare the documents so that the deduction can go through, or use odpocetZaloh=false and complete the deduction with a separate call.


Default warehouse for stock items

If the imported ISDOC contains stock items, ABRA Flexi will create a warehouse document for the invoice. The warehouse to which the stock is received is determined by the advanced parameter paramImportIsdocVychoziSklad, whose value is the warehouse code.

⚠️ If you keep records for more than one warehouse, setting this parameter is required. Unlike the import wizard in the desktop application, the target warehouse cannot be selected interactively when calling via the API.

The parameter is uploaded to the company via XML import, the same way as other advanced parameters:

<winstrom version="1.0">
<parametr>
<!-- kód parametru -->
<paramK>paramImportIsdocVychoziSklad</paramK>
<!-- kód skladu, hodnota parametru -->
<hodnota>SKLAD</hodnota>
</parametr>
</winstrom>


Error states

Error code

Cause

The parameter typDokl is missing or invalid — the message reads Neplatna nebo chybejici hodnota povinneho parametru typDokl.

isDocImportNepodariloSeNajitInvoiceIsdoc

No embedded invoice invoice.isdoc was found in the submitted PDF.

dokladDuzpUctoPoDuzpPuvError2025

The date of taxable supply exceeds the legal deadline — typically when importing into a significantly older accounting period.

All of the cases listed above return 400, and the document is not created.


FAQ


Related

Did this answer your question?