Skip to main content

Import of ISDOC format invoices via REST API

How to Import ISDOC Using the Flexi API

Written by Petr Pech

ISDOC (Information System Document) is an electronic invoicing format used in the Czech Republic. ABRA Flexi supports both import and export of invoices in this format. The API allows you to import received invoices and, using an advanced parameter, also issued invoices.

How to Call the API

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 enabled, issued invoices can be imported at the address https://localhost:5434/c/firma/faktura-vydana.isdoc.

For demonstration purposes, we will use the curl tool. 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 a custom installation with an automatically generated certificate, you must 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. Let's now look at what other parameters can be used.

URL Parameters

  • typDokl - Document type (required), type: identifier

  • typUcOp - Accounting posting template, type: identifier

  • odpocetZaloh - Automatic deduction of advances and tax documents for advance payments (default: true), type: boolean

  • ucetniObdobi - This parameter allows you to specify which accounting period the document should be imported into, type: abbreviation (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, an invoice is imported into the issued invoices register and simultaneously into the previous period 2020. For this to work, you must enable the advanced parameter, which can be found in our add-ons — How to import ISDOC issued 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 advance deduction will not be processed automatically. More details below.

Advance and Advance Tax Document Deductions

If an ISDOC invoice contains advance deductions or advance tax document deductions, 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 include a warning about the presence of advances.

The server response will still be RESPONSE: status=HTTP/1.1 201 Created. The response also contains a warning describing the fact that advance or advance tax document deductions exist.

<?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 or is not specified, the system will attempt to find the advance documents corresponding to 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 documents that were found.

For a document to be eligible for deduction, it must meet the following requirements:

  • The company, currency, and amount of the document must match (same or greater). The company must be saved in the address book in advance.

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

If multiple matches exist, 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 advances fails, you can either prepare the documents so that the deduction can be performed, or use the parameter odpocetZaloh=false and complete the deduction in a separate call.

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.

Did this answer your question?