Integrating systems with Lacuna Signer folders
A SignerFolder profile signs, with a
certificate held by Bulk Signer, every document that reaches a Lacuna Signer folder with the
certificate's holder in its flow. Any system that can put a document in that folder gets a server-held
ICP-Brasil signature, without calling Bulk Signer at all: the integration point is the Signer folder,
and the contract is the document's flow.
This page puts that together with the other tools around it:
- Lacuna Signer's API and client libraries, for a system that creates documents;
- Signer webhooks, for a system that waits for the signed document;
- the Signer web app and the Signer Printer, for people who send documents themselves;
- what Bulk Signer 2.21.0 added: several profiles on one folder, so one document carries more than one of this host's signatures; move after signing, so a document goes on to the next folder once this host has signed it; and the document check, which says why a document was not signed.
Each recipe states what to set up at Signer, at Bulk Signer and in the calling system, and links to the reference for the rules behind it. How a document is found, signed, and what each failure means is in Lacuna Signer integration; the host itself is deployed by Docker on Ubuntu + Lacuna Signer or Amazon ECS Fargate + Lacuna Signer.
One profile per folder, the sweep and the webhook: 2.16.0. Several profiles on one folder, move after
signing and the document check: 2.21.0. On an earlier image the seed refuses a second profile on a
folder, and ignores SignerFolder.MoveTo without a word.
What a document must carry
Bulk Signer signs a document only when all of the following are true. Every recipe on this page is a way of meeting them.
| Condition | Why |
|---|---|
| The document is in exactly the bound folder | A subfolder is not the profile's. A document created with newFolderName lands in a new folder, which nothing is bound to |
| The document is pending at Signer | A concluded, canceled, refused or expired document is never taken |
The flow has a signer action ("type": "Signer") whose participant identifier is the CPF the profile's certificate carries | That is how the holder is recognized. On an e-CNPJ it is the CPF of the person responsible for the certificate, not the CNPJ. An approver action naming the holder is not a signature this host can make |
| The holder's participant has an email address | Signer finds the holder's action by CPF and email together. An action with no email ends Failed with signer-folder.signature-failed; one whose CPF and email Signer does not match ends the same way, asking you to check both at Signer |
| It is the holder's turn | Bulk Signer acts on the document's current pending action. Earlier steps are Signer's to wait for, and the document is found again when its turn comes |
The API application behind Signer:ApiKey may list and read the folder's documents | Without that, Signer answers 403 and the sweep sees nothing. A profile that moves documents also needs to manage the documents of the destination folder |
Signer, not Bulk Signer, chooses the format: PAdES for a PDF, XAdES for XML and CAdES for anything else. See Signer chooses the format, not the profile.
Choosing the pieces
| Question | Options |
|---|---|
| Who puts the document in the folder? | A system, through the Signer API (recipe 1); a person in the Signer web app, or from any Windows program through the Signer Printer (recipe 4); another profile's move (recipe 3) |
| How does Bulk Signer notice it? | The sweep, every Signer:FolderSweepIntervalSeconds (default 300 seconds), always. The webhook cuts that to seconds where Signer can reach the host |
| How many of this host's signatures does the document need? | One: one profile. More than one: several profiles on the same folder (recipe 2) |
| Where does the document go after this host signs? | It stays in the folder, or the profile moves it to another folder (recipe 3) |
| How does the calling system learn the document is signed? | A Signer webhook of its own (DocumentSigned, DocumentConcluded), or polling the document at Signer. Bulk Signer does not call the calling system |
Recipe 1 — An ERP issues documents that the company's e-CNPJ signs
A system generates documents (contracts, receipts, reports) and wants each one signed with the company's e-CNPJ, with no person involved, and back in the system once signed.
ERP Lacuna Signer Bulk Signer
│ upload + create document │ │
│ folderId = "Company seal" │ │
│ flow: Signer, CPF of the │ ── webhook (optional) ───────────▶ │
│ e-CNPJ's responsible ────▶ │ ◀── sweep / check, then signature ─│ signs with the e-CNPJ
│ ◀── DocumentConcluded ──── │ │
│ download the signed file │ │
At Lacuna Signer.
- Create a folder for the profile, for example Company seal, and note its id.
GET /api/folders?q=Companylists the organization's folders by name; see Folders. - Give the ERP its own API application, and make sure the one behind Bulk Signer's
Signer:ApiKeymay list and read the documents in the folder. Two applications keep the ERP's credential out of Bulk Signer's configuration and the other way round.
At Bulk Signer. Create a profile on /profiles/_new with the method Lacuna Signer folder, the
e-CNPJ as its certificate and Company seal as its folder, or declare it in the seed — see
Configuration. The ERP
needs the CPF that certificate carries: on an e-CNPJ, the CPF of the person responsible for it, which
the certificate's owner knows.
In the ERP. Upload the file and create the document as Signer's guide describes,
with two differences: folderId names the bound folder, and the flow names the holder as a signer.
POST /api/documents
{
"files": [
{
"displayName": "Contract 2026-0042",
"id": "<upload id>",
"name": "contract-2026-0042.pdf",
"contentType": "application/pdf"
}
],
"folderId": "<id of the Company seal folder>",
"flowActions": [
{
"type": "Signer",
"step": 1,
"user": {
"name": "ACME Ltda (company seal)",
"identifier": "<CPF carried by the e-CNPJ>",
"email": "signature@acme.example"
}
}
]
}
With the C# client, the same request sets FolderId on CreateDocumentRequest.
var request = new CreateDocumentRequest
{
Files = new List<FileUploadModel> { new FileUploadModel(uploadModel) { DisplayName = "Contract 2026-0042" } },
FolderId = companySealFolderId,
FlowActions = new List<FlowActionCreateModel>
{
new FlowActionCreateModel
{
Type = FlowActionType.Signer,
Step = 1,
User = new ParticipantUserModel
{
Name = "ACME Ltda (company seal)",
Identifier = holderCpf, // the CPF the e-CNPJ carries, digits only
Email = "signature@acme.example",
},
},
},
};
var result = (await signerClient.CreateDocumentAsync(request)).First();
The participant needs an email address, but the same name and email on every document are fine: Bulk
Signer reads them from the document. Where the Signer instance accepts more than one identifier type,
add "identifierType": "Cpf" to user, as
Contacts and identifiers describes.
To keep Signer from emailing that address, disablePendingActionNotifications stops the notifications
to the first step's participants, which is enough when the holder is in step 1; disableNotifications
stops all of them.
Getting the signed document back. Register a webhook for the ERP
at Signer and act on DocumentConcluded when the company seal is the only participant, or on
DocumentSigned for this participant when others sign after it. Then download the signed version, as
Download and list documents describes. Signer
delivers every event to every webhook of the organization, so the ERP's webhook and Bulk Signer's
receive the same events; each ignores what it does not need.
Recipe 2 — The company's e-CNPJ and a director's e-CPF on one document
2.21.0 and later. Some documents need two of the organization's certificates — the company seal and a director, or two directors — and both keys are held by Bulk Signer. Bind two profiles to the same folder, each with one holder's certificate, and name both holders as signers in the flow.
At Bulk Signer. Two profiles, same folder, different certificates. In the seed:
{
"Signing": {
"Profiles": [
{
"Name": "company-seal",
"Method": "SignerFolder",
"SignerFolder": { "Id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "Name": "Board signatures" },
"Verify": false,
"ValidateCertificate": false,
"Certificate": { "Source": "Pfx", "Pfx": { "Path": "/etc/bulksigner/certificates/acme-ecnpj.pfx" } }
},
{
"Name": "director",
"Method": "SignerFolder",
"SignerFolder": { "Id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "Name": "Board signatures" },
"Verify": false,
"ValidateCertificate": false,
"Certificate": { "Source": "Pfx", "Pfx": { "Path": "/etc/bulksigner/certificates/director-ecpf.pfx" } }
}
]
}
}
The seed is read once, against an empty profile table; on a running host create the second profile from
/profiles/_new and choose the same folder. The PFX passwords go in the environment, never in
appsettings.json.
In the flow. The order is Signer's:
| Flow | What happens |
|---|---|
| Step 1 the e-CNPJ's CPF, step 2 the director's CPF | The company seal is signed first; the director's action becomes current, and the next pass (or the DocumentSigned webhook) signs it |
| Both CPFs in step 1 | Both are signed in the same pass |
| Step 1 the e-CNPJ, step 2 a person at Signer, step 3 the director | The person signs at Signer between the two; the director's signature waits for them |
What to know.
- Profiles share a folder, not a holder. Two profiles on one folder whose certificates carry the same
CPF are refused at
/profiles/_new; met any other way, both are reported degraded, naming each other, until one is changed. See the troubleshooting entry. - A document is a stranger only when it names none of the folder's holders. A document for the
director alone is the director profile's; it is not recorded as
signer-folder.no-holder-actionagainst the company seal. - A disabled profile still counts as a holder of the folder. A document waiting on its holder is left waiting, not recorded as a stranger.
Rules and edge cases: Two or more of this host's signatures on one document.
Recipe 3 — A staged flow across folders
2.21.0 and later. A profile may move each document it signed to another folder once Signer has
accepted the signature: After signing, move the document to on the profile's Certificate panel and
at /profiles/_new, or SignerFolder.MoveTo in the seed. Two uses:
- File finished work away from the inbox. The bound folder then holds only what is still waiting, which is what an operator looking at Signer wants to see.
- Hand the document to the next stage: a folder another profile signs in, on this host or another Bulk Signer host — the same shape a file pipeline has, where one stage's output is the next stage's input.
"1 · Company seal" ──signed──▶ "2 · Board" ──signed──▶ "3 · Done"
profile company-seal profile director (no profile)
MoveTo = 2 · Board MoveTo = 3 · Done
"SignerFolder": {
"Id": "<id of 1 · Company seal>",
"MoveTo": { "Id": "<id of 2 · Board>", "Name": "2 · Board" }
}
The document's flow still has to name every holder that signs it; the move only changes which folder, and therefore which profile, finds it. Compared with recipe 2, the stages keep each folder's contents meaningful at Signer (waiting for the seal, waiting for the board) and let the stages live on different hosts.
What to know.
- The job is
Completedbefore the move, and stays so. The move is recorded in the job's history:Moved to Lacuna Signer folder <id>., orNot moved … Code: signer-folder.move-failed.with Signer's reason. A Retry never repeats a move. - Signer sends no webhook for a move. When the destination is bound on the same host, Bulk Signer checks the document there at once; a destination bound on another host is found by that host's sweep.
- The key must be allowed both folders.
Signer:ApiKeyneeds to manage the documents of the bound folder and of the destination. A403, or a destination deleted at Signer, leaves the document where it was signed,not-moved; move it by hand at Signer. A401(Signer refusing the key itself) leaves the move pending, and it is made onceSigner:ApiKeyis fixed. - A move that cannot be made now is made later. An outage or a restart leaves it pending for the next
sweep; one that has failed every attempt for seven days is given up and recorded
Not moved. - On a shared folder the move waits while another profile bound to that folder on this host still has a signature to make on the document. Profiles on one folder that both move should name the same destination.
- The destination is fixed when the document is found. Editing the profile redirects only the documents found afterwards.
bulksigner_signer_folder_moves_total{outcome} counts moved, not-moved and deferred; a growing
deferred count is documents waiting in the folder they were signed in, where the next stage does not
see them. Rules and edge cases: Moving a signed document to another folder.
Recipe 4 — People send documents from the Signer web app or the Print dialog
Not every document comes from a system. A person can send one for the company seal from the Signer web app, or print it from any Windows program to the Signer Printer, which sends it to Signer.
Two things make this reliable for people who do not know the holder's CPF:
- A saved flow at Signer that names the holder as a signer, with the CPF, so nobody types it. Signer stores participants in a saved flow, not a folder; the person still chooses the folder.
- A folder name that says what it does, such as Company seal (signed automatically), so that the folder people pick is exactly the bound one.
In the Signer Printer, the send dialog chooses the organization and the folder, and Load a flow… fills the participants from the organization's saved flows. The Signer Printer signs in to Signer as the person who prints, so the document is theirs; its sign-in is registered once per Signer instance, as Registering the Signer Printer in GrantID describes.
Mistakes to expect, and where they show:
| Mistake | What Bulk Signer does | Where it shows |
|---|---|---|
| The document went to a subfolder, or to no folder | Nothing: it is not in the bound folder | The document check names the folder the document is in |
| The holder was added as an approver | Nothing it can sign; on a folder bound to one profile, recorded once as signer-folder.no-holder-action | The document check; the job, Failed |
| The holder's CPF was mistyped | On a folder bound to one profile, recorded once as signer-folder.no-holder-action | The job, Failed. Once the flow is corrected at Signer the next sweep finds the new action by itself |
| Another participant has not signed yet | Nothing yet: it is not the holder's turn | The document check names the participant to chase |
Checking an integration
Every integration fails the same few ways: the document is not where the profile looks, the flow does not name the holder as a signer, it is not the holder's turn yet, or Signer will not let the key see the folder. Bulk Signer 2.21.0 says which, from four places. To go from a symptom to its fix, see Troubleshooting Lacuna Signer folder integrations.
The document check
On a SignerFolder profile's page, /profiles/{name}, Document check takes a Lacuna Signer document
id and answers with the same verdict the sweep acts on: whether the document is in exactly the bound
folder and pending; every flow action, with its kind, status, masked CPF and whether it names a bound
holder; and one conclusion per profile bound to the folder — the next pass would enqueue it, a job that
already exists, the participant still to act, no signer action for any bound holder, and so on. It is
read-only and has no REST route. When somebody asks why a document was not signed, paste the document
id the calling system received from POST /api/documents.
What the last pass saw
The same page shows Last sweep pass over this folder (this instance's view): how many pending documents
Signer listed, how many were read, how many were the holder's, and why the rest were not — waiting on an
earlier participant, the holder's part already done, no signing action for any bound holder, and so on.
A folder whose documents are all waiting on people says so: they are waiting at Lacuna Signer, not stuck
in Bulk Signer. The same summary ends the signer-folder-sweep row on /api/ready/details.
Signer refusing the key
| Answer from Signer | What it means | Fix |
|---|---|---|
403 — the API application behind Signer:ApiKey is not allowed to … | The key authenticates, but its application may not list or read that folder or document | Grant the application access to the folder at Signer. The folder picker warns about this when the folder is chosen, but the save is never refused |
403 with nothing from Signer in it | Usually still the grant; if Signer's settings already allow it, a proxy, a firewall or a mis-aimed Signer:Endpoint may be answering | Check the grant first, then what stands between the host and Signer |
401 — Lacuna Signer refused the key itself | The key is revoked, mistyped or belongs to another organization | Fix Signer:ApiKey and restart |
Both show on the console and in the durable log at every pass, and as the signer-folder-sweep row on
/api/ready/details, which turns red after three failed passes in a row — see
the troubleshooting entry.
Logs and metrics
At every start, the durable log has one Information line per SignerFolder profile naming its bound
folder, its certificate source, whether the certificate opened with a CPF (never the CPF itself) and, if
the profile is degraded, why. A second Information line is written per folder whenever what a pass saw
there changes. For dashboards and alerts:
| Metric | Watch for |
|---|---|
bulksigner_signer_folder_jobs_enqueued_total{profile} | Flat while the calling system is creating documents: the documents are not reaching the profile. Start with the document check |
bulksigner_signer_folder_signatures_total{outcome} | refused and failed |
bulksigner_signer_folder_moves_total{outcome} | A growing deferred (recipe 3) |
bulksigner_signer_folder_sweep_errors_total{op} | Any growth; op="list" together with a 403 is the access fix above |
bulksigner_signer_notifications_total{outcome} | Nothing counted while the webhook is configured: Signer cannot reach the host. A growing unauthorized: the token differs from Signer:WebhookSecret, or the webhook is not set to Bearer |
The full list is in Metrics and audit, and what each job ending means in Troubleshooting.
Limits that shape an integration
- One Bulk Signer instance per folder, as the deployment pages state. A second host bound to the same folder is not supported, outside cluster mode on Azure App Service, where the instances share one store. Stages on different hosts (recipe 3) are fine, because each folder has one host.
- Bulk Signer changes nothing else at Signer. It never cancels, refuses or edits a document or its flow; moving it after signing (recipe 3) is the one change it makes to a document it did not create. A document that should not be signed is canceled at Signer, by the calling system or a person.
- Each (document, flow action) is signed at most once. A job that ended
FailedorCanceledcomes back only through Retry, and a document recorded assigner-folder.no-holder-actionis never retried: correct the flow at Signer and the sweep finds the new action. See Retry is the only way back. - A certificate change takes effect at the next restart, and with it the CPF the flows must name. When the company renews its e-CNPJ, check that the CPF of the person responsible did not change before the calling system keeps sending the old one.
Next: Troubleshooting Lacuna Signer folder integrations. Previous: Lacuna Signer integration.