Skip to main content

Document Cost Allocation Using REST API

How to allocate a document using a service in the Flexi API?

Written by Petr Pech

Just like in the desktop or web application, you can use the Document Allocation function. The document allocation function can only be used on a document that does not contain any line items. This function allows you to allocate a document into individual document line items.

This function is available for selected ABRA Flexi registers:

  • faktura-prijata

  • faktura-vydana

  • banka

  • pokladni-pohyb

  • pohledavka

  • zavazek

Calling method

You can use the HTTP method: PUT.

The endpoint for submitting an allocation is governed by the register; you then provide the document identifier, for example:

URL parameters

The input data in Flexi API consists of individual allocation lines with the accounting details required for correct posting. Each line has the following parameters. All parameters are case-sensitive:

  • typUcOp - Posting template (identifier of a record from the predpis-zauctovani register)

  • sazbaDph - VAT rate (identifier of a record from the sazba-dph register)

  • sumZkl - Base amount (decimal number)

  • zklMdUcet - Debit of base (identifier of a record from the ucet register)

  • zklDalUcet - Credit of base (identifier of a record from the ucet register)

  • sumDph - VAT amount (decimal number)

  • dphMdUcet - Debit of VAT (identifier of a record from the ucet register)

  • dphDalUcet - Credit of VAT (identifier of a record from the ucet register)

  • clenDph - VAT line (identifier of a record from the cleneni-dph register)

  • clenKonVykDph - VAT control statement line (identifier of a record from the cleneni-kontrolni-hlaseni register)

  • stredisko - Cost centre (identifier of a record from the stredisko register)

  • cinnost - Activity (identifier of a record from the cinnost register)

  • zakazka - Project (identifier of a record from the zakazka register)

A description of the individual registers can be found here.

Usage examples

  1. Allocating a received invoice across two lines

<winstrom version="1.0"> 
<faktura-prijata>
<rozuctujDoklad>
<radkyRozuctovani>
<radek>
<typUcOp>code:NÁKUP ZBOŽÍ A</typUcOp>
<sumZkl>75.0</sumZkl>
<sazbaDph>1</sazbaDph>
<zklMdUcet>code:131001</zklMdUcet>
<zklDalUcet>code:321001</zklDalUcet>
<clenDph>code:000P</clenDph>
</radek>
<radek>
<typUcOp>code:NÁKUP ZBOŽÍ B</typUcOp>
<sumZkl>25.0</sumZkl>
<sazbaDph>1</sazbaDph>
<zklMdUcet>code:131001</zklMdUcet>
<zklDalUcet>code:321001</zklDalUcet>
<clenDph>code:000P</clenDph>
</radek>
</radkyRozuctovani>
</rozuctujDoklad>
</faktura-prijata>
</winstrom>

2. Allocating a liability across two lines in JSON:

{
"winstrom": {
"zavazek": {
"rozuctujDoklad": {
"radkyRozuctovani": [
{
"typUcOp": "code:CESTOVNÉ",
"sumZkl": "750.0",
"sazbaDph": "1",
"zklMdUcet": "code:512001",
"zklDalUcet": "code:314001",
"clenDph": "code:40-41"
},
{
"typUcOp": "code:CESTOVNÉ",
"sumZkl": "250.0",
"sazbaDph": "1",
"zklMdUcet": "code:512001",
"zklDalUcet": "code:314001",
"clenDph": "code:40-41"
}
]
}
}}}

Failed requests

  1. The sum of line amounts does not match the total document amount; Flexi API responds as follows:

    "message": "Suma položek nesouhlasí se sumou dokladu."

  2. A parameter value that does not exist in the data was entered

    "message": "Záznam pro parametr (zklMdUcet) nebyl v datovém zdroji nalezen: cz.winstrom.vo.ucto.Ucet#code:521002 [ZAV0005/2223]",

    "code": "NOT-FOUND(cz.winstrom.vo.ucto.Ucet)(code:521002)"

  3. A syntax error — an incorrectly formatted entry, for example:

    "winstrom": {
    "zavazek": {
    "rozuctujDoklad": {
    "radkyRoyuctovani": [

    Výseldek Chyba 500: "message": "Interní chyba aplikace."

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?