Data boxes
A data box is an electronic repository intended for delivery and for performing acts towards public administration authorities. These documents take the form of a data message. Data boxes are established and administered by the Ministry of the Interior.

Picture: Received message in the data box
Using a data box, it is possible to send and receive official documents in electronic form (data messages) from public administration authorities. Another way of using a data box is sending a Postal data message, which enables communication also between other data box users.
Official documents in electronic form bearing the sender's electronic signature are delivered to the data box. All sent documents must also be marked with an advanced electronic signature.
A document (data message) that is delivered to a data box is deemed delivered at the moment an authorized person logs in to the data box. If the user does not log in to the data box within 10 days of the day the document was delivered, the document is deemed delivered on the last day of this period. As soon as a new data message is stored in the data box, a delivery notification is sent to a mobile phone (for a fee) or to an e-mail box (free of charge). A read message will be kept in the data box for 90 days. After this period, the message will be deleted unless the user has activated the paid Data vault service, which is used for storing - archiving data messages after the stated period.
Data boxes are accessible via a web browser at www.mojedatovaschranka.cz. All available information about data boxes, including the possibility of using a test environment, is available at www.datoveschranky.info.
Any file can be sent from K2 via a data box.
Conditions for Using Data Boxes in IS K2
If we want to use the functionality of sending and loading messages from data boxes in K2, we must meet several conditions and settings:
- The K2 user who will use data boxes must be linked to a Contact person record. This person must then have the login name and password for each data box they have access to filled in on the WEB, e-shop page for the ISDS (Data box) Web type. After changing the pairing of a Contact person with a User, K2 must be restarted before using the script. When setting up the login on the contact person, the Test connection function can be used, which verifies that the connection to the data box works. For login, it is also possible to enter the thumbprint of a certificate stored in Windows.

Picture: Settings on the user's contact person

Picture: Setting the login credentials for the data box
- A separate Book of letter mail must be defined for each data box; the data box ID must be entered in the Data box field in the default settings.
- The external document type in which we want to save messages must have the Copy type set. Usually "Unique transfer" or "DMS" (Document server) is set. The selected document type must be set in the Default book settings (the DS_DOC type is set by default).

Picture: Created book of letter mail
- The ISDS parameters must be set

Picture: ISDS parameters
- If we want to use a certificate to access the data box, this certificate must be included in the user's personal certificates and must be registered in the relevant data box in extended login. For more information, see below.
- To display or read downloaded messages, the FormFiller application or the FormFiller plug-in for the relevant internet browser must be installed http://www.602.cz/produkty/form_filler. The application allows saved messages to be opened in the form of a physical file with the .fo extension.
- When using encryption, opening files of the .docK2 type with the K2\bin\x64\ed_app.exe (or K2\bin\x84\ed_app.exe ) application must be registered on the PC.
- .NET 3.5 must be installed on the computer, and then the registration in pdfregistertool described in the following point must be run
- In the main K2 root, in the pdfregistertool.exe file, on the k2.NET utilities tab, the checkboxes in both columns should be checked (this is done by pressing the "Register!" button)

Certificates Related to Data Boxes
- A Personal certificate (a commercial one is sufficient) is used to verify the login to the data box.
- Trusted root certification authority: This certificate is imported into the trusted certification authorities and is available at http://vca.postsignum.cz (the root certificate postsignum root_qca2_root.cer is sufficient) - it is necessary for verifying the personal certificate.
- Certificate for reading and encrypting data messages: These certificates are distributed together with IS K2 and are stored in the K2\SupportFiles\Lang5 folder. The certificate K2Universal.cer (used for reading only) and K2Universal.pfx (used for reading and encryption) are available there. The user can use their own certificate (its name must then be entered in the CertificateName script parameter). The user must add these certificates to their personal certificates. These certificates ensure the security of messages in the form of files physically stored on disk.
Sending Data Messages from K2
Data messages can be sent from K2 in various ways:
- Any file can be sent using the Send through data box. function. This function can be run from the Communication - Data box - Send through data box . tree menu. The Sender field will be filled in with the user's set book of letter mail. In the form, we enter the Recipient by selecting from the Partners book. Only those partners who have the Data box field filled in on the first page of the Partners book are displayed here. Next, we fill in the Matter/Subject and attach a file. After pressing the More button, we can enter the reference number, the file mark and other information. The message is sent by pressing the envelope button.

Picture: Send through data box
A text message can also be added to the sent message using the Text message button. When sending, this message will be attached as the file Textová zpráva.PDF.

Picture: Text message
Multiple files can be attached to a message. Files can be selected from storage using the Attach documents button. Below this button there is also information about the size of the attached file and whether it is a high-volume message.

Picture: Attaching multiple files to a message
- A data message can be sent directly from the Inbox book using the Reply to received message - option: the data regarding reference marks, numbers and paragraphs are taken over, the sender and recipient data are swapped, and the prefix 'Re: ' is added to the subject text.

Picture: Reply to received message
- A data message can be sent directly from scripts that create export files. These are scripts that have the SendByDataBox parameter (send via data box after export) and some of them also the DataBox parameter (Recipient data box). When the SendByDataBox parameter is set to YES, a window for sending the file via data box opens immediately after the file is exported. In this case, the exported file will already be attached and it is only necessary to enter the Recipient of the message, if it is not filled in in the DataBox parameter.
- Sending any report via data box - in the bar above the report there is an icon for exporting the report to *.PDF and sending it via data box. After pressing this icon, the form for sending via data box opens, where the Recipient needs to be filled in and the report can be sent.

Picture: Icon for exporting a report to *.pdf and sending it via data box
- In selected reports, the functionality for bulk sending via data box can be used, which uses parameters from the Bulk sending by mail function. The functionality is available in the reports ZAK_DOK01.AM (sales order), OBP_DOK02.AM (proforma invoice), OBV_DOK01.AM (purchase order), PF_DOK01.AM (invoice in), ADVREC_DOK01 (advance received), REM_DOC01 (reminder), PDO_DOK01.AM (cash document), OFFSET.AM (offset).
Picture: Bulk sending via data box
- If the Export_TypeAm parameters are set in the report, sending per document or per customer can be set.
Outbox
For situations where the data box is operated by a user or users who have login set up for this data box, but the files to be sent are created by another user who does not have login to the data box, the functionality of the Outbox book can be used.
A user can create a record in the Outbox book, and another user who has access to the data box then actually sends this mail.

Picture: Save to Outbox
Pressing the Save to Post to send button does not send the data message; instead, a new record is created in the Outbox book.

Picture: Message about record creation
The record can then be sent from the Outbox book. Before sending, the first confirmation must be performed on the record. The record can then be sent using the Send message function. The window for sending the message is displayed and the message is sent by pressing the envelope. Sending the message automatically performs the second confirmation of the record, so records that are confirmed twice have already been sent.

Picture: Send message
Records in the Outbox book can also be sent in bulk using the Send via data box bulk action:

Picture: Bulk sending of messages
Loading and Saving Data Messages Using a Script
The link between the data box and K2 is provided by the DataBoxMessages.pas script, which can be run manually or as a scheduled task. The login credentials are looked up according to the User running the script and the Contact person linked to them. Messages from all data boxes available to the given user according to the login are then gradually downloaded to K2. The document type must be DS_DOC.
Received messages are downloaded from data boxes into the corresponding Received letter mail book. Delivery receipts are also downloaded for all messages, with individual records/statuses in the delivery receipt being downloaded as message events. When a message is received, the message itself and three events (data about the sending, delivery and pick-up of the data message) are therefore usually downloaded.
The script downloads messages according to the user's own companies display settings. If one user (contact person) has several data boxes set up for different own companies, messages are downloaded into the books of letter mail that have an own company whose data the user displays. The script therefore takes into account the user's selection of displayed companies.
Depending on the parameter settings, all/some new messages and events are downloaded, while the message ID is used to check that the same message is not loaded again (only any new events in the delivery receipt). After going through all messages of the data box and processing them, the script disconnects from the data box. In the event of an error connecting to the data box, failure to find the Books of letter and parcel services or any other errors, this is (depending on the script parameter settings) written to an error file, the error file is displayed, or it is written to the task scheduler history; it is always written to the K2 recalculation error log.
Principle of saving a message:
Most of the header data of the data message and some details are saved as a letter mail record. The message itself in the form of a physical file (file type according to the script parameter), including attachments, is saved on the External Documents and Documents (9th Page) tab of this record in the .fo format (unencrypted) or DocK2 (encrypted with the certificate distributed with IS K2), which is an encrypted version of the original .fo file. Delivery receipts are then saved as items (Letter mail letters) on the Items page of the record.
Specifically, the data from the data message are filled into the K2 fields as follows:
Letter mail field name and its use for the data message
Description |
Matter. |
Received by |
The contact person who downloaded the message. |
Received on |
Date and time of delivery. |
Status |
Not implemented for a data message. |
Kind |
Not implemented for a data message. |
Recipient data box |
The data box into which the message was received. |
Sender data box |
The data box from which the data message was received. |

Picture: Basic data tab
On the Items tab of Letter mail, one item is created for the message itself, followed by several items with delivery receipt events.

Picture: Row 1 with the message, further rows with delivery receipt events
Description of selected fields on the item in the case of a data message (i.e. row 1)
Received on |
Event date of reading the message in the data box. |
Abbreviation |
Message ID. |
Brand |
Sender's reference number. |
Description |
Message description (Matter). |
Accepted by |
The contact person who downloaded the message. |
Description of selected fields on the item in the case of delivery receipts:
Received on |
Date and time of the delivery receipt event (typically posting, delivery, receipt of the message). |
Abbreviation |
Generated number containing the date and time of the event (in the YYMMDDHHMMSS format) and the message type designation (from the delivery receipt text - the beginning up to the colon). |
Brand |
Message type (from the delivery receipt text - the beginning up to the colon). |
Description |
The beginning of the delivery receipt text truncated to the maximum length of this field. |
Accepted by |
The contact person who downloaded the message. |

Picture: Delivery receipt event detail - message pick-up
Data Box - Reading and Writing Messages
Process number: CRM011 |
Script ident. no.: FCRM034 |
File: DataboxMessages.pas |
Script description: The script allows messages (including delivery receipts) to be downloaded from a data box and saved to K2 - the Letter mail book. |
||
Address in the tree: [Communication] [Data box] |
||
Script parameters:
K2DocType - DS_DOC The document type in which the data message will be saved as a full-text file with attachments. |
DocAbbrPrefix - DS_ Prefix of the message file name. |
MaxMsgCount - -1 Maximum number of downloaded messages. The default value -1 means all messages. |
DateFrom - 1.8.2009 "Date from" for downloading messages. Determines the oldest messages to be downloaded. |
DeliveredFilesDocType - Document type for saving files as separate documents. It is set if the SaveDeliveredFiles parameter is set to YES. If the parameter is not set, the attachments are set with the same type as the message itself. |
CertificateName - K2UniversalED Name of the certificate for encrypting the message. Empty = the message file is not encrypted. |
LoginCertificateThumbPrint - Cryptographic thumbprint of the login certificate, if a certificate is used to log in to the data box. This thumbprint can be obtained in the details of the given certificate in Windows; however, it must be copied via e.g. Notepad because invisible characters get inserted, which make it invalid. |
LoginIdIO - 2000034154 Number of the web record with the login credentials for the data box. The default value sets the standard system record ISDS. |
ReceiveSenMessages - No The parameter determines whether sent messages are also to be downloaded from the data box (Yes) or not (No). |
ErrorLogShow - No The parameter determines whether the error log of message processing is to be displayed on the screen (Yes) or whether it is sufficient to save it to the recalculation error log - type 15 (No). |
ErrorLogFileName - File name including the path for saving the message processing error log, if a file is to be created. |
ReceiveDeliveryInfo - |
SaveDeliveredFiles - No Yes - Attach attachments as separate documents. When set to YES, the files contained in the message are attached to this message (record) on the Attachments page in the Letter mail book when the message is downloaded to K2. |
K2DelInfoType - |
CounterpartyDataBox - Identifier of the counterparty's data box The data box identifier is entered in the parameter value. Only received messages from this sender are then downloaded to Letter mail. |
Encryption of data messages saved to disk via K2
Without encryption, a file with the .fo extension is created and saved to disk when a data message is downloaded. This file can be read using the 602XML filler application or plug-in by anyone who has access to the file and to the application. If we want access to data messages saved in this way to be restricted, we use the K2Universal.cer certificate (read only)/K2Univesal.pfx (read and encryption): The certificate must be included in the personal certificates and must be set (it is by default) in the CertificateName parameter - it is then used for encrypting the saved files. The attachments themselves are then opened with the K2/ed_app.exe application, i.e. this application "decrypts" the file, which is then displayed using the 602XML filler application or plug-in.
Note: If we do not want to use encryption, we must set the CertificateName parameter to an empty value.
Testing the connection between K2 and the data box
For testing purposes, you can have a free data message Statement from public registers (e.g. from the Trade Register) generated at https://portal.gov.cz/formulare/vypis-z-zivnostenskeho-rejstriku. Click the Fill in the form button for the required register, fill in the Reg. No. of the subject whose record we are requesting and press Next. We will be prompted to log in to the data box through which we want to send the request (and whose connection to K2 we now want to test). The request is then passed to an "automaton" which processes it. Simply by sending the request, a new sent message - Request for a statement from the register is created in the data box. Usually within a few minutes (up to an hour), a received message - the requested Statement from the register arrives in the data box. We can then download only the received message / both messages to K2 by running the script. Delivery receipts are downloaded as well.
Electronic submission
The Electronic submission module mediates electronic communication - electronic submissions. It currently supports submissions to the Czech Social Security Administration (CSSA).
It can therefore be used to send data concerning:
- Notice of the commencement of employment
- Personal record for pension insurance
- Annex to the application for benefit
- Employer's report on termination of incapacity for work
- Overview of premiums
- Notification of intention to apply discount on insurance premium
The eSickNotes module is also connected to the Electronic submission module; it creates records in the Electronic submission book, but in the case of eSickNotes the user controls the communication with CSSA directly in the eSickNotes book, unlike other submissions, which are communicated directly in the Electronic submission book.

Picture: Tree menu - Electronic submission
Books for Electronic Submissions
To use the Electronic submission module, it is necessary to create a book or books for Electronic submissions.
Books for Electronic submission can be opened from the tree menu Basic data - Books for Electronic Submissions or Administrator - System - Administration of books - Electronic submission tab.

Picture: Administration of books - book for Electronic submission

Picture: Administration of books - Default setting
Description of fields:
Reference number |
Reference number of the organization for communication with CSSA. |
VREP service primary URL address |
The URL address of the VREP service is pre-filled automatically. |
Signature Certificate (Qualified) |
A qualified signature certificate issued by an accredited certification authority. It can be set directly on the book, as shown in the picture above (Picture: Default setting). This setting is suitable if the company has one payroll accountant who has one certificate registered with CSSA. After pressing the button, a Windows window with personal certificates is displayed, where the correct certificate can be selected (via Other options). It is then inserted into this field.
|
Encryption certificate (Commercial) |
A commercial encryption non-signature certificate with which the data of the CSSA reply will be encrypted. If the Signature certificate (Qualified) is also an encryption certificate, the encryption certificate does not need to be filled in and the qualified certificate is used for data encryption. |
CSSA certificate |
After pressing the button, a certificate selection window is displayed, where the correct certificate can be selected (via Other options). It is then inserted into this field. The certificate can be obtained here: https://www.cssz.cz/web/cz/ke-stazeni |
|
|
Protocol communication with the VREP service |
Communication with the VREP service will be logged and error logs will be saved to the book of error logs, from which they can be displayed later. Error logs can be displayed from the tree menu Communication - Electronic submission - VREP communication error logs. |
Take over the signature and encryption certificate from the contact person |
The user's signature and encryption certificates can also be set on the contact person (Contact persons book). This option is used when communication with CSSA is handled by several persons and each of them has their own certificate for communication. In this case, the signature and encryption certificates are not filled in in the book settings and are left empty; at the same time, the Take signature and encryption certificate from contact person check box is selected and the Web type is filled in.
Picture: Take personal certificate from contact person The certificate then needs to be filled in on the contact person of the user who handles communication with CSSA. If there are several such persons, the certificates need to be set for all persons who handle the communication.
Picture: Setting certificates on a contact person |
Web type |
If the Take signature and encryption certificate from contact person check box is selected, the Web type must also be filled in. The VREP type is used for this type of communication. If one contact person needs to have several certificates set, another WEB type needs to be created; it is advisable to create it as a copy of the VREP type (it must also have the Ignore WEB, Eshop field check box selected). This can happen if payroll is processed within one client for several companies and the person (or persons) responsible for communication with CSSA has a different certificate registered with CSSA for each company. Then a different web type will be filled in on each book for Electronic submission (for each company) and the contact person will have the corresponding certificate set for each web type:
Picture: Setting several certificates on one contact person |
Automatically pick up response when filing |
If selected, the submitted request is collected automatically after choosing Send submission in the Electronic submission book. |
Number of attempts to pick up answer |
This field specifies the number of collection attempts, which are performed at intervals defined by CSSA. |
Electronic Submission Book
Individual submissions to CSSA are recorded in the Electronic submission book. Records can be created here directly from scripts related to communication with CSSA, or exported files can be inserted into this book, thereby creating a new record in the book. Each record shows its status, whether it has already been submitted to CSSA, and whether the submission was successful or contains an error.

Picture: Electronic submission book
Creating a record directly from a script/report
Records can be created in the Electronic submission book via scripts/reports related to communication with CSSA. To create a record, the ElectronicSubmissionBook - Book of Electronic submissions parameter must be set wherever we want to create records in the Electronic submission book.
The parameter can be set on the scripts:
- Personal record for pension insurance (MZD_ELDP.PAS)
- Notice of the commencement of employment (MZD_ONZ.PAS)
- Annex to the application for benefit (MZD_NEM.PAS)
- Employer's report on termination of incapacity for work (MZD_HZUPN.PAS)
The parameter can be set on the report:
- Overview of premiums (MZD_VYSR.AM)
Setting the parameter ensures that a new record is created in the Electronic submission book when exporting to an *.XML file.
Example:
To create a record in the Electronic submission book from the Personal record for pension insurance script (MZD_ELDP.PAS), we set the ElectronicSubmissionBook parameter, in which we enter the abbreviation of the book for Electronic submission in which we want to create the records:

Picture: Setting the script parameter
When generating the *.XML file from this script using CTRL+F3, the window for saving the *.XML file to disk is not displayed; instead, after the message about the number of exported files, a message about the creation of a record in the Electronic submission book is also displayed:

Picture: Program message

Picture: Program message
A new record is created in the EP book for electronic submissions; it is ready for submission to CSSA and contains the exported *.XML file:

Picture: EP book for electronic submissions with a newly created record
By loading an XML file
The second way to create a record in the Electronic submission book is by loading an exported *.XML file using the Load XML file function:

Picture: Load XML file function
After starting the function, a window for selecting the *.XML file from the storage opens, and after the file is selected, a record is created in the Electronic submission book; it contains this *.XML file and is ready for submission to CSSA.
Electronic Submission - Basic Data
Basic data contain information related to individual submissions.

Electronic Submission - Basic Data
Description of fields:
Document |
Document No. - of the record in the Electronic submission book. The number is assigned by the program and cannot be edited. |
Blank form |
Identification of the CSSA form to which the submission relates. |
Status |
Code list of submission statuses. When a new record is created, the status is set to Ready for submission. During communication with CSSA, the program always changes the status according to the course of the communication. |
Submitted by |
Information about who sent this record to CSSA. |
Submitted |
If the submission to CSSA has already taken place, the date and time of this submission are inserted into the field. |
Submission number |
The Submission number field is empty until the submission to CSSA takes place. After the submission is sent, the number is filled in the field. It is a number assigned by CSSA. |
Collected |
After the submission is collected, the date and time of collection are written into the field. The status does not matter in this case, i.e. the date and time are saved even if the submission contains an error, because the collection of the submission itself has been performed. |
DZDPN |
If it is a DZDPN submission, the date range for which the query was submitted is also displayed.
|
Description |
The Description field is filled in by the program in the case of the Overview of premiums - where the month of submission is inserted into the description. For the OZUSPOJ submission, the employee's name is saved in the description. For other submissions, the Description field is empty. The user can enter anything in the field. |
The Messages section stores individual messages related to communication with CSSA. Messages are saved here by the program when the record is created and also during individual actions performed within communication with CSSA.
Electronic Submission - Persons
The Persons tab displays the employees and their employments that were sent within the submission. In the case of eSickNotes, the data are displayed here after the reply is collected, i.e. after the data have been loaded from CSSA.

Picture: Electronic submission - persons
Electronic Submission - Functions
The Electronic submission book contains the functions that handle the communication with CSSA itself. These are the functions:
- Send submission
- Collect reply
- Cancel submission
These functions are always run for one record, namely the record on which the cursor is positioned. The individual functions are always available according to the status of the particular record. It is therefore not possible to send a submission again where it has already been sent and, conversely, it is not possible to collect a reply where no submission has been sent.

Picture: Electronic submission - functions
Procedure of Electronic Submission to CSSA
The Send submission function is available if the cursor is on a record that has not been submitted yet, i.e. on a record with an empty Submission number field. Such a record is ready for submission and the function can be run on it. After running the function, the following message should appear:

Picture: Program message
At the same time, the value Submission sent will be saved in the Status field of this record. The submission number assigned by CSSA will be filled in the Submission number field.
On a record where the submission has been sent, this function will no longer be available; instead, the Collect reply and Cancel submission functions become available.
After the submission is sent, it is necessary to run the Collect reply function, which provides information on whether this submission was made correctly and thus whether it was accepted by CSSA. If the Collect reply function is run too early, CSSA may not have processed the submission yet. In this case, the following message appears:

Picture: Program message
The value Repeat reply collection is then set in the Status field. It is therefore advisable to run this function at least one minute after the Send submission function. Processing of the submission by CSSA takes some time, which may vary according to the current situation. If the submission has already been processed by CSSA and contains no errors, the following message is displayed after running the Collect reply function:

Picture: Program message
The value The answer is alright will be set in the Status field.
If the submission contained an error, this error will be displayed in the message when the reply is collected and the value Answer contains an error will be set in the Status field. The message may look like this, for example:

Picture: Program message
If the submission is rejected because it contains an error, the data in K2 or the settings must be corrected (i.e. the error must be corrected in the source data, not in the Electronic submission book), the record in the Electronic submission book must be created again and the submission repeated.
Instead of collecting the request, the submission can be cancelled using the Cancel submission function.
Using the Load XML file function, any form supported within this submission can be loaded into the Electronic submission book.
Using the Prepare again for submission function, which is available in the change mode of a record, an already submitted record can be set to a status in which it can be submitted again. The function can be used e.g. if the certificate was originally set incorrectly or if the submitted data sentence was edited manually.

Picture: Prepare again for submission function - original record before running the function

Picture: Record after running the function - data related to the previous submission are deleted
Automatic reply collection can be set in the book for electronic submissions:

Picture: Setting automatic reply collection
If automatic reply collection is set, a reply collection indicator showing the collection time starts after Sending the submission. Automatic reply collection can be interrupted at any time with the Interrupt button.

Picture: Automatic reply collection
The number of collection attempts is set in the book for electronic submissions. Collection attempts are performed at intervals defined by CSSA. If the reply is still not ready at CSSA even after the specified number of collection attempts, the collection must be performed manually later via the Collect reply function. If the collection is successful, a message about the successful collection of the reply is displayed.

Picture: Successful collection
Electronic Submission - Bulk Actions
The functions handling communication with CSSA can also be run as bulk actions. Within a bulk action, each request (each record) is submitted separately, so it is possible to submit different kinds of submissions - data sentences (PRPI, Overview of premiums, etc.) at once.
The bulk action can be run on records marked with an asterisk:

Picture: Electronic submission - bulk actions
If the selected action type is run on a record where this action can no longer be performed (it has already been performed earlier), the information will be stated in the error log.
External Documents and Documents (9th Page)
Any documents can be assigned on the Attachments tab.

Picture: Attachments
Certificate administration
The Certificate administration function is used to manage certificates that are uploaded to K2 and stored in the secret storage (OpenBao). The function is available in the tree menu Communication - Certificate administration.
A new certificate can be imported with the Insert key or the New item button.

Picture: Certificate administration
The following formats are supported:
- PKCS#12 (.pfx)
- PKCS#7 (.p7b)
- PEM (.pem, .crt)
- DER (.der, .crt)
The imported file may contain the public key, private key and certificate chain. If the private key is password-protected, we enter the corresponding password during the import.
The Default el. signature field contains the thumbprint (fingerprint) of the certificate. For electronic signing, we can select only a certificate imported including the private key, which is necessary to create a signature. Therefore, only certificates containing a private key are displayed in the selection.




