ISDOC, or Information System Document, is a format for electronic invoicing in the Czech Republic. ABRA Flexi supports importing and exporting invoices in this format. The API allows you to import received invoices and, using an advanced parameter, also issued invoices.
Calling method
You can use the HTTP method: PUT or POST.
The endpoint for importing ISDOC is https://localhost:5434/c/firma/faktura-prijata.isdoc.
If the advanced parameter paramImportIsdocFav = true is activated, issued invoices can be imported at https://localhost:5434/c/firma/faktura-vydana.isdoc.
For this example, we'll use the curl program. cURL has its own documentation.
curl -H "Content-Type: application/x-isdoc" -k -u xxx:xxx -X PUT https://localhost:5434/c/firma/faktura-prijata.isdoc?typDokl=code:ZBOZI-FAKTURA" -T "/cesta/soubor.isdoc"
-u specifies the authorization credentials for Flexi.
-H header specifying the file type
-k if you are using your own installation with an automatically generated certificate, you need to ignore the untrusted certificate authority.
-T the file being sent (request body)
The example includes the URL parameter typDokl, which represents the document type under which the document will be imported into ABRA Flexi. Now let's look at the other parameters that can be used.
URL parameters
typDokl- Document type (required), type: identifier
typUcOp- Posting rule, type: identifier
odpocetZaloh- Automatic deduction of advance payments and advance tax documents (default: true), type: boolean
ucetniObdobi- The value of this parameter specifies the accounting period into which the document should be imported, type: code (e.g. ucetniObdobi=2022)
Usage examples
curl -H "Content-Type: application/x-isdoc" -k -u xxx:xxx -X PUT https://localhost:5434/c/firma/faktura-vydana.isdoc?typDokl=code:FAKTURA&ucetniObdobi=2020" -T "/cesta/soubor.isdoc"
In this example, the invoice is imported into the issued invoices record and, at the same time, into the past period 2020. For this to work, you need to enable the advanced parameter described in our add-ons - How to import issued ISDOC invoices?
curl -H "Content-Type: application/x-isdoc" -k -u xxx:xxx -X PUT https://localhost:5434/c/firma/faktura-prijata.isdoc?typDokl=code:FAKTURA&odpocetZaloh=false" -T "/cesta/soubor.isdoc"
In the example above, the odpocetZaloh parameter is set to false, so the automatic deduction will not be processed. More on this below.
Deducting advance payments and advance tax documents
If an ISDOC invoice contains deductions of advance payments or advance tax documents, they can be automatically deducted during import. If the URL parameter odpocetZaloh=false, the invoice will be created without deductions, and the server response will contain a warning about the presence of advance payments.
The server response will still be RESPONSE: status=HTTP/1.1 201 Created. In addition, the response contains a warning describing the fact that there are deductions of advance payments or advance tax documents.
<?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
If the URL parameter odpocetZaloh=true is set or is not provided, the system will attempt to find the advance payment documents for the listed deductions and deduct them. If this fails, the API call will end with an error (code 400) and an error message is returned listing the deductions and advance payment documents that were found.
For a document to be deductible, it must meet the following requirements:
The document's company, currency, and amount (same or greater) must match. The company must already be saved in the address book.
The deduction document number must match the received document number or internal number of the advance payment document. Alternatively, the variable symbol of the deduction and the advance payment must match.
If there are multiple matches, the deduction will not be performed.
Example response for a failed automatic deduction
RESPONSE: status=HTTP/1.1 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>
</result>
</results>
</winstrom>
If the automatic deduction of advance payments fails, you can either prepare the documents so that the deduction can be performed, or use the odpocetZaloh=false parameter and complete the deduction in a separate call.
Default warehouse for stock items
If the imported ISDOC contains stock items, ABRA Flexi will create a stock document for the invoice. The warehouse to which the stock is received is determined by the advanced parameter paramImportIsdocVychoziSklad. The value of the parameter is the warehouse code.
⚠️ If you have more than one warehouse on record, 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, just like other advanced parameters:
<winstrom version="1.0">
<parametr>
<paramK>paramImportIsdocVychoziSklad</paramK><--kod parametru-->
<hodnota>SKLAD</hodnota><--kód skladu, hodnota parametru-->
</parametr>
</winstrom>
FAQ
Need help?
If you have any questions about the application, please contact us at podporaflexi@abra.eu or via the chat window in the bottom right corner.
