Skip to main content

Locking periods via REST API

How to lock a period in the Flexi API?

Written by Petr Pech

Accounting period locks are available in the API as the zamek record type. They can be both read and created, so locking periods can be automated just like in the desktop application.


Reading locks

GET /c/{firma}/zamek.xml?detail=full&limit=0

Each lock is described by three groups of data:

Field

Meaning

zamekK

Lock status — zamek.otevreno, zamek.polozamceno (locked except for accounting) or zamek.zamceno.

platiOdData, platiDoData

The period the lock applies to.

modulFav, modulFap, modulBan, modulSkl, …

The modules the lock affects. Each module has its own boolean field, so you can lock, for example, just issued invoices.


Creating a lock

<winstrom version="1.0">
<zamek>
<zamekK>zamek.zamceno</zamekK>
<platiOdData>2024-03-01</platiOdData>
<platiDoData>2024-03-31</platiDoData>
<modulFav>true</modulFav>
</zamek>
</winstrom>

You can change the status of an existing lock with a regular update — just specify the id and the new zamekK. A lock can also be deleted using the action="delete" attribute.


What a lock causes

Attempting to create a document with a date inside a locked period will result in an error:

Doklad nelze vložit do zamčeného období.

ℹ️ The lock only applies to modules that have true set. If the issued invoices module is locked, a bank document with the same date will be created without any issue. The zamek.polozamceno status also won't let a regular user create a document.

💡 If you really need to insert a document into a locked period, switch the lock to zamek.otevreno, create the document, and then switch the lock back — both steps can be done via the API.


Related

Did this answer your question?