Pereiti prie pagrindinio turinio

Įvesk.lt REST API

Everything you need to know how easily integrate your system with Įvesk.lt

Įvesk.lt provides a REST API (JSON) that allows you to:

  • Upload files for digitization.

  • Retrieve digitized document data.

  • Synchronize documents exported to an accounting system.

  • Report document synchronization errors.

  • Receive notifications about document updates through webhooks.

You can integrate with file uploading, document synchronization, or both.

Important: Document digitization can take up to 12 hours. File uploading and retrieving digitization results are therefore separate API operations.

API Authorization

Every API request must include the following HTTP header:

x-api-key: <your secret API key>

You can generate your API key in Įvesk.lt: https://app.ivesk.lt/settings/general

Note: API keys cannot be generated for DEMO accounts.

Upload file

Uploading a file requires two API requests:

  1. Request a temporary upload URL from Įvesk.lt.

  2. Upload the file using the returned URL.

Get an upload URL

Send a GET request to:

GET https://app.ivesk.lt/api/pub/uploadlocation/<yourFileName>

Example:

curl --request GET \
'https://app.ivesk.lt/api/pub/uploadlocation/somefile.pdf'\
--header 'x-api-key: <your secret API key>'

The API returns a temporary pre-signed Amazon S3 URL and the HTTP headers required to upload the file.

Example response:

{ 
"url": "https://app.ivesk.lt/public/21d6d167-edda-4a87-a701-0e040e50ecfd?AWSAccessKeyId=ASIAQDMJYDC73OP47GHF&Content-Dispositio[...]",
"Content-Type": "application/pdf",
"Content-Disposition": "filename=\"somefile.pdf\""
}

The response contains:

  • url - temporary URL used to upload the file.

  • Content-Type - MIME type of the file.

  • Content-Disposition - file name information required for the upload.

Associating uploaded files with your data

If you need to identify which uploaded file corresponds to a digitized invoice add the sourcedata query parameter to the upload URL request.

Įvesk.lt will return the supplied sourcedata value when you retrieve the digitization results.

This allows you to match processed invoices with your original files or records.

Upload the file

Send a PUT request to the URL returned in the previous step.

Use the Content-Type and Content-Disposition headers from the response.

Example:

curl --request PUT 'https://<url from response>' \ 
--header 'Content-Disposition: filename="failas.pdf"' \
--header 'Content-Type: application/pdf' \
--data-binary '@/path/to/somefile.pdf'

A successful upload returns HTTP status code 200.

If the upload fails, consult the Amazon S3 PutObject API documentation, because the file is uploaded directly to Amazon S3.

JavaScript upload example:

const fs = require('node:fs/promises');

async function index() {
const signedUrlResponse = await fetch('https://app.ivesk.lt/api/pub/uploadlocation/<your-file-name: test.pdf>', {
method: 'GET',
headers: { 'x-api-key': '<your api key>' },
});

if (signedUrlResponse.ok) {
const data = await signedUrlResponse.json();

const fileBody = await fs.readFile('<path-to-your-file>');

await fetch(data.url, {
method: 'PUT',
body: fileBody,
headers: {
'Content-Type': data['Content-Type'],
'Content-Disposition': data['Content-Disposition'],
},
});
}
}

index();

Synchronize digitized invoices

After a file is uploaded, Įvesk.lt digitizes it. Once digitization is complete, the document becomes available in the digitized queue.

There are two queues available for retrieving document data:

  • digitized - retrieves documents immediately after digitization.

  • exported - retrieves documents after an accountant exports them to an accounting system.

You must choose which queue to integrate with based on your workflow.

Which synchronization queue should you use?

Feature

exported queue

digitized queue

When data becomes available

After the accountant exports the invoice

Immediately after digitization

Automatic expense allocation

Supported by Įvesk.lt workflow

Not included in this workflow

Accountant review in Įvesk.lt

Supported

Not required

Multiple companies in one API response

No, one company per request

Yes, multiple companies per request

Use the exported queue if:

  • You use Įvesk.lt as a complete invoice processing system.

  • The accountant can review digitized documents, allocate expenses, assign VAT classes, configure other parameters, and decide when to export documents to the accounting system.

  • The API returns document data only after the accountant clicks the "Eksportuoti į ..." button.

  • This is the recommended integration for most customers because it provides greater control over which documents are synchronized with the accounting system.

Use the digitized queue if:

  • You use Įvesk.lt only as a digitization service and manage the remaining processes in your own system.

  • The API returns document data immediately after digitization is complete, without waiting for an accountant to export the document.

  • You must handle expense allocation, missing accounting data, and other processing steps yourself.

  • This queue can return documents belonging to multiple companies in a single API response.

Retrieve synchronized documents

You can retrieve documents by sending a GET request to the selected queue endpoint.

For example, to retrieve exported documents:

GET https://app.ivesk.lt/api/pub/exported?from=<timestamp>

For digitized documents:

GET https://app.ivesk.lt/api/pub/digitized?from=<timestamp>

Every request must include the API authorization header:

x-api-key: <your secret API key>

Example request:

curl --request GET \
'https://app.ivesk.lt/api/pub/exported?from=2026-11-01T11:52:42.313Z' \
--header 'x-api-key: <your secret api key>'

Example response:

{
"$schema": "https://app.ivesk.lt/api/schema/jsonexport.json",
"documents": [...],
"next": "2026-11-05T12:30:47.373Z"
}

Retrieve all result pages

API responses contain approximately 100 documents per page.

To retrieve all available documents:

  1. Send a request using the from parameter.

  2. Process the returned documents.

  3. Check whether the response contains the next parameter.

  4. If next exists, send another request using its value as the new from parameter.

  5. Repeat until the response no longer contains next.

The next value represents the timestamp of the last document in the returned page.

Documents are returned in ascending order based on their digitizedat or exportedat timestamps.

Important: Save the last successfully processed timestamp (digitizedat or exportedat) or the next value. Use it as the starting point for your next synchronization request to avoid retrieving previously processed documents unnecessarily.

Document response schema

The complete JSON response schema, including descriptions of document attributes, is available here: https://app.ivesk.lt/api/schema/jsonexport.json

Download original PDF files

If you need to download the original PDF files associated with digitized documents, you can use the open-source tool IveskArchiver.

IveskArchiver downloads original PDF files to your computer or server.

Source code and instructions: https://github.com/DePaper/IveskArchiver

Report document synchronization errors

If your integration encounters an error while importing a document into an accounting system, report the error to Įvesk.lt.

This allows the accountant to:

  • Identify documents that failed to synchronize.

  • Filter documents with synchronization errors.

  • View the error messages returned by your integration.

To report an error, send a POST request to:

POST https://app.ivesk.lt/api/pub/syncerrors

Include the following information in the JSON request body:

Parameter

Description

documentid

Unique identifier of the document in Įvesk.lt.

companycode

Company code associated with the document.

message

Error message describing why synchronization failed.

Example request:

curl --request POST \
'https://app.ivesk.lt/api/pub/syncerrors' \
--header 'x-api-key: <your secret API key>' \
--data '{
"documentid": "7777707d-594d-420c-9174-ce278f823333",
"companycode": "302320404",
"message": "Country Japan does not exist in the list."
}'

After reporting the error, the document will be identifiable as a failed synchronization in Įvesk.lt.

Webhooks - receive automatic notifications

Webhooks allow your system to receive automatic notifications when specific events occur in Įvesk.lt.

Instead of repeatedly checking the API for new documents, you can subscribe to webhook events and receive HTTP POST requests whenever an event occurs.

Supported webhook events

Event

When it is triggered

Data included in Message

on_digitized

A document has finished digitization and its data is available.

Document data

on_exported

A user exports a document to an accounting system by clicking "Eksportuoti į ...".

Company code indicating that new exported invoices are available

on_column_update

A custom column item is created or updated.

Column data

on_export_error

Exporting a document to an accounting system fails.

Document ID and error message

To get webhook events you have to subscribe and confirm your subscription.

Subscribe to a webhook event

Send a POST request to:

POST https://app.ivesk.lt/api/pub/subscriptions

Include the following JSON parameters:

Parameter

Description

name

Name of your webhook subscription.

eventType

Event you want to receive, such as on_exported.

target

URL of your server that will receive webhook notifications.

Example:

curl --request POST \
'https://app.ivesk.lt/api/pub/subscriptions' \
--header 'x-api-key: <your secret API key>' \
--data '{
"name": "SubscriptionName",
"eventType": "on_exported",
"target": "https://mydomain.com?secret=wehwev67sadv56"
}'

Confirm the webhook subscription

After creating the subscription, Įvesk.lt sends an initial HTTP POST request to your target URL.

The request body contains:

{
"Type": "SubscriptionConfirmation",
"SubscribeURL": "http<...>"
}

Subscribe to webhook:

curl --request POST "https://app.ivesk.lt/api/pub/subscriptions"
--header 'x-api-key: <your secret api key>'
--data "{\"name\":\"SubscriptionName\",\"eventType\":\"on_exported\",\"target\":\"https://mydomain.com?secret=wehwev67sadv56\"}"

To confirm the subscription, your server must send an HTTP GET request to the URL provided in SubscribeURL.

After confirmation, Įvesk.lt starts sending webhook notifications to your target URL.

Process webhook notifications

After confirmation, your server receives HTTP POST requests when the subscribed event occurs.

Example notification:

{
"Type": "Notification",
"MessageId": "403d0b09-f7de-556b-9961-537552b84bb0",
"TopicArn": "arn:aws:sns:eu-west-1:007272210889:DPWebHook_onexport",
"Message": "{\"companyCode\":\"302320404\"}",
"Timestamp": "2021-01-16T08:26:14.705Z",
"SignatureVersion": "1",
"Signature": "<signature>",
"SigningCertURL": "<certificate URL>",
"UnsubscribeURL": "<unsubscribe URL>",
"MessageAttributes": {
"account": {
"Type": "String",
"Value": "777756e2-a246-4031-93e2-5dcace3ccccc"
}
}
}

The Message field contains event-specific information:

  • on_digitized – digitized document data.

  • on_exported – company code indicating that new exported invoices are available.

  • on_column_update – updated custom column data.

  • on_export_error – document ID and error message.

Webhook delivery retries

If your server does not successfully receive a webhook notification, Įvesk.lt retries delivery up to 10 times.

Retries use exponential backoff, starting at approximately 20 seconds and increasing to a maximum of 10 minutes.

After 10 unsuccessful attempts, the notification is discarded.

Integration recommendations and best practices

  1. Upload files as soon as possible. Upload documents to Įvesk.lt immediately after receiving them so digitization can start earlier.

  2. Use sourcedata. Include your original file or record ID in the sourcedata parameter to match digitized results with your internal records.

  3. Automate synchronization. Create an hourly scheduled job or subscribe to webhooks to check for new documents.

  4. Retrieve all pages. When synchronizing documents, continue requesting pages until the response no longer contains next.

  5. Remember the last synchronization timestamp. Store the last successfully processed exportedat or digitizedat value, or the last page's next value.

  6. Use database transactions. Process each page or document within a transaction. Update the stored synchronization timestamp immediately before committing the transaction.

  7. Report synchronization errors. Use the /api/pub/syncerrors endpoint whenever a document fails to import into your accounting system.

  8. Test with realistic documents. Use valid invoice documents when testing the integration. Otherwise, documents may be rejected during processing.

  9. Test webhooks before production. You can use services such as https://requestbin.com/ to inspect incoming webhook requests.

Ar gavote atsakymą į savo klausimą?