Pular para o conteúdo principal

REST API Integration - Lacuna Scanner

The Lacuna Scanner API is a REST API with JSON messages, easily called from any programming language that can make HTTP requests.

tip

Before you start, see the integration overview.

See the API documentation.

Prefix every relative URL mentioned on this page with the endpoint communication parameter. Send the API key in the X-Api-Key header of every request:

X-Api-Key: ...

Call POST /api/v2/scan-sessions, passing the returnUrl, to start a session:

POST /api/v2/scan-sessions
{
"returnUrl": "https://your-return-url/"
}

Use the value returned in the redirectUrl field to redirect the user on the frontend:

location.href = scanSessionParams.redirectUrl;

When you detect that the user has returned to your site (look for the scanSessionId argument in the URL), call GET /api/scan-sessions/{id} to get the scanned documents:

GET /api/scan-sessions/{id}

For each document returned (the documents array), call GET /api/documents/{id}/content to get the file content:

GET /api/documents/{id}/content
note

The content is returned in binary format.

If you prefer, call GET /api/documents/{id}/file-link to get a temporary link that you can render as a link or button on the frontend, for the user to click and get the document:

GET /api/documents/{id}/file-link
note

The returned link can be accessed without authentication, so it can be used in an <a href=... or in a location.href = ....

Multifile sessions​

You can let the user scan multiple documents. To do so, pass the "multifile": true parameter when creating the session:

POST /api/v2/scan-sessions
{
"returnUrl": "https://your-return-url/",
"multifile": true
}

At the end of the process, instead of taking only the first document, iterate over the list of scanned documents.

Sessions with metadata input and/or signature​

To ask the person scanning to enter the metadata required by Decree 10,278/2020, pass the "metadataInputEnabled": true parameter:

POST /api/v2/scan-sessions
{
"returnUrl": "https://your-return-url/",
"metadataInputEnabled": true
}

To have the person scanning digitally sign the document at the end of the process, pass the "signatureEnabled": true parameter:

POST /api/v2/scan-sessions
{
"returnUrl": "https://your-return-url/",
"signatureEnabled": true
}
tip

To comply with Decree 10,278/2020, enable both metadata input and document signature.

View as Markdown