API best practices
Practical cURL examples of loading documents via export status or date range with consumption control.
When reusing the API, select only the data you need to process. Reloading the same documents counts consumption again, even if their contents have not changed.
Use the API fairly and sensibly. Adjust the frequency of calls to the actual need of your integration, use appropriate filters and do not needlessly load the same data or the entire history over and over again. Limit the number of retries for errors and avoid infinite loops.
The method of processing, data storage and management of further calls are entirely on the client's side. Doklado does not determine to which system you transfer the data. The following examples show two possible procedures when working with documents.
Choose a procedure
| Procedure | How you select data | What the client controls |
|---|---|---|
| According to the export status | You load isExported: false and after successful processing you call setExported. | Document storage, duplicate recognition and export confirmation. |
| By date range | You load a specific period through dateFrom, dateTo and dateType. Calling setExported it is not necessary. | Processed periods, paging, repeats and late change capture. |
Choose the approach that fits your integration. You can combine the export-status filter with a date range. To retrieve documents for a specific counterparty, add an optional field to data: identificationNumber, containing that counterparty's company identification number (IČO) as a string. This field filters the counterparty; organizationId still identifies your own company by its company identification number (IČO).
Prepare the API key
Each example is a separate cURL command. Replace the value YOUR_API_KEY, sample company identification number (IČO) 12345678, document identifiers and dates with your own data. For access details, see Authentication.
Option 1: Use export state
1. Load non-exported documents
Calling POST /v2/documents with filter isExported: false selects non-exported documents.
curl --request POST --fail-with-body --silent --show-error \
'https://api-gateway-prod-europe-west-1-7epuecvu.ew.gateway.dev/v2/documents' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"data": {
"organizationId": "12345678",
"isExported": false,
"orderBy": "creation_date",
"orderByDescending": false
}
}'
Check the HTTP status as well as the success and code fields. You can find the documents in the field data. If the result continues on the next page, follow the Pagination section below.
2. Process and store data on your side
Store or process data according to the purpose of your application. Also keep the documentId from the Doklado response for your records so that you can recognize the already processed document during repeated delivery.
You implement this step in your own system. Proceed only after confirming that the data has been successfully and permanently saved or that the requested operation has been completed.
3. Mark successfully processed documents
Call POST /v2/documents/setExported only for documents that you have successfully processed. The following example uses the state sync_with_acc_soft from the API schema:
curl --request POST --fail-with-body --silent --show-error \
'https://api-gateway-prod-europe-west-1-7epuecvu.ew.gateway.dev/v2/documents/setExported' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"data": {
"documents": [
{
"documentId": "PROCESSED_DOCUMENT_ID_1",
"status": "sync_with_acc_soft"
},
{
"documentId": "PROCESSED_DOCUMENT_ID_2",
"status": "sync_with_acc_soft"
}
]
}
}'
The name of the sync_with_acc_soft value is a technical designation of the status in the API. You determine the way data is processed in your integration. For more states, see the REST API reference.
In addition to the total result, check data.results for each document. Item contains documentId, success and possibly code. The success of one document does not confirm the success of others.
Confirm the export only after successful processing on your side.
If you tag the data earlier and then save it fails, the next load with isExported: false may not return it. If, on the other hand, the saving succeeds and the export confirmation fails, the document can be loaded again. The client must recognize it according to the identifier and not create a duplicate.
You change the export status on the document in Doklado. If several integrations work with the same documents, agree on the use of this status or control the processing with your own date range.
4. Again limit the next request to non-exported documents
The next time you run, use the same fetch from step 1 with isExported: false. Documents successfully marked as exported will no longer be included in this selection.
Loading itself does not change the export status. This procedure also does not serve to track later modifications of already exported documents.
Option 2: Use a date range
If you do not want to change the export status, select a specific period. The client will keep which periods and documents he has already successfully processed.
1. Load the selected period
The example selects by creation date in Doklado (dateType: "create"). The isExported filter is intentionally omitted so that the selection is not limited to export status.
curl --request POST --fail-with-body --silent --show-error \
'https://api-gateway-prod-europe-west-1-7epuecvu.ew.gateway.dev/v2/documents' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"data": {
"organizationId": "12345678",
"dateFrom": "2026-09-14T00:00:00Z",
"dateTo": "2026-09-15T00:00:00Z",
"dateType": "create",
"orderBy": "creation_date",
"orderByDescending": false
}
}'
Select the date type as needed:
dateType | Meaning |
|---|---|
create | The date the document was created in the Doklado system |
issue | Issuing date |
delivery | Delivery date |
due | Due date |
The issuing date can belong to the past period even for a newly added document. If you want to continuously download newly created documents, take this difference into account when choosing a filter.
2. Process all pages and save the completed period
Process the data and any other pages of the result. Only after the successful completion of the entire period does the client save that it has been processed. In the event of an error, leave the option to continue or repeat the period with the recognition of already saved documents.
3. Move the scope of the next query
The following example continues with another period. Values are calculated by the client in real integration:
curl --request POST --fail-with-body --silent --show-error \
'https://api-gateway-prod-europe-west-1-7epuecvu.ew.gateway.dev/v2/documents' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"data": {
"organizationId": "12345678",
"dateFrom": "2026-09-15T00:00:00Z",
"dateTo": "2026-09-16T00:00:00Z",
"dateType": "create",
"orderBy": "creation_date",
"orderByDescending": false
}
}'
You do not have to call setExported with this procedure. However, each repeated loading of the same range counts the consumption again.
The filter according to the date of creation is used to load new documents. Handle later modifications of already created documents separately.
For dateType: "create", it is filtered according to the document creation date in the Doklado system. The new document is therefore included in the period of its creation in Doklado even if it has an older issuing date.
If a document created in an already processed period is modified later, its creation date does not change. Therefore, scrolling the range by create will not capture these modifications. If your integration also needs updates to existing documents, add separate change tracking.
The specification does not specify the exact inclusion of the dateFrom and dateTo cut-off times. When drafting subsequent periods, verify their behavior and use a controlled overlap with duplicate detection if needed for data completeness. Both the overlap and the repeated checks add consumption.
Paging
The following applies to both procedures:
- Load the first page without
searchAfter. - If the response contains a non-empty field
searchAfter, transfer it entirely todata.searchAfterof the next request. - Maintain organization, filters, date range and sort while paging.
- At
APP_NO_MORE_DATA, stop loading. A missing or repeating token must not lead to an infinite loop.
An example of the next page in the procedure with a date range:
curl --request POST --fail-with-body --silent --show-error \
'https://api-gateway-prod-europe-west-1-7epuecvu.ew.gateway.dev/v2/documents' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"data": {
"organizationId": "12345678",
"dateFrom": "2026-09-14T00:00:00Z",
"dateTo": "2026-09-15T00:00:00Z",
"dateType": "create",
"orderBy": "creation_date",
"orderByDescending": false,
"searchAfter": [
"2026-09-14T12:00:00.000",
"ID_FROM_SEARCH_AFTER_RESPONSE"
]
}
}'
Replace the sample field searchAfter with the exact field from the previous answer. Do not create it manually from the date and ID of the document.
For an easy procedure with isExported: false, first finish loading and saving all pages, then confirm the export of successfully processed documents. Thus, during pagination, you do not change the export status of the documents in the selection. On a new run, start without the old searchAfter.
See Paging and Errors.
Consumption for both procedures
| An example | API consumption |
|---|---|
| Loading 70 documents and marking these 70 documents as exported | 140 units: 70 for loading + 70 for labeling. |
Loading 70 documents for the selected period without setExported | 70 units for loading. |
| Reloading the same 70 documents | Another 70 units for each load. |
The examples assume successful calls, exactly 70 documents read and no other operations. Even documents discarded by additional filtering can affect the actual consumption.
Do not load the entire history unnecessarily at every start. Even a small number of documents can create high consumption during repeated calls.
By choosing suitable filters, storing processing status and checking repetitions, you will limit unnecessary loadings. Set a daily or monthly API key limit and track Activity History.
Detailed accounting of individual operations can be found on the page Pricing. Setting the limits is described in the API connections.
Source of technical parameters: Doklado OpenAPI specification.