Pular para o conteúdo principal

Operators and single link through the API

Starting with Signer 3.4.0, a document can have operators: people who sign or approve on behalf of the participants. This page shows how to create those documents through the API, how to change or remove an operator, and how to generate a single link to act for several participants at once.

Overview​

An operator is a person, identified by e-mail, who acts on behalf of a participant of the document. Each participant can have one operator: this applies to signers, approvers and each person of a signature or approval rule.

AccessHow it works
Operator's linkSent by e-mail to the operator. Lists only their participants.
Single linkGenerated through the API for chosen participants, whether they have an operator or not. The API does not send this link: you hand it over.
Acting as the participantWhoever uses one of these links signs or approves on behalf of the participant, with the same powers as the participant's own link. Refusing is only possible when the organization allows it, and the electronic signature still asks for the e-mail authentication code.

Choosing a participant on the link's page opens the same signature or approval page the participant receives. The signature is recorded in the participant's name and, with a digital certificate, can only be completed with their certificate. The participants keep receiving their own link as usual.

Authentication codes

In the electronic signature, the authentication codes (e-mail, SMS, WhatsApp) go to the participant's contact, not to the operator. The participant's own link waives the e-mail code, because it arrived in their inbox. Through the operator's link or the single link, that code is still required.

Before you start​

  • Feature enabled on the instance. Operators and the single link are on by default. If the instance turns them off, the API rejects operators and single links with the error OperatorsDisabled. The instance settings are in the CentralizedLink section:

    SettingDefaultEffect
    EnabledtrueTurns on operators and the single link.
    RequireDigitalSignaturefalseThrough the links, only a digital certificate can sign. Each organization can override it. See Digital certificate only.
    AllowRefusalfalseAllows refusing through the links. Each organization can override it. See Refusal through the links.
  • The organization's API key, sent in every call in the X-Api-Key header, as in the rest of the Integration Guide. Documents are created in the key's organization. The calls in Through the API, without a browser are the exception: they take no key.

  • Permission to edit the flow of the document, to generate the single link and change operators. It is the same one used by POST /api/documents/{id}/flow.

  • Enums are sent as text, for example "Signer" and "Approver".

The feature's errors come back with status 422 and an ErrorModel, as described in Error responses:

{ "code": "OperatorsNotAllowedForDocument", "message": "...", "details": null }
Client libraries

The GetCentralizedLinkAsync method and the operator fields only exist in Lacuna.Signer.Client 1.26.0, which is not published on NuGet yet (the latest version there is 1.24.0). Until then, call the REST API directly, for example with the helper function described in Features newer than the client libraries.

1. Upload the file​

POST /api/uploads/bytes

{ "bytes": "<PDF content in Base64>" }

The response has the upload's id, used to create the document. See Create documents for the other ways to upload.

2. Create the document with operators​

POST /api/documents

Two fields make up the feature:

  • allowOperators: true on the document. Without it, any operator is rejected with OperatorsNotAllowedForDocument. The value can only be set at creation.

  • operatorEmail on each participant who will have an operator:

    • on the flowActions item itself, for a signer or an approver;
    • on each ruleUsers item, for signature or approval rules.

    The field is optional: a participant without an operator leaves it out.

{
"files": [
{ "displayName": "Service agreement", "id": "<upload id>", "name": "contract.pdf", "contentType": "application/pdf" }
],
"allowOperators": true,
"flowActions": [
{
"type": "Signer",
"step": 1,
"user": { "name": "Maria Souza", "identifier": "11122233344", "email": "maria@cliente.com.br" },
"operatorEmail": "assinaturas@cliente.com.br"
},
{
"type": "Approver",
"step": 1,
"user": { "name": "João Lima", "identifier": "55566677788", "email": "joao@cliente.com.br" },
"operatorEmail": "assinaturas@cliente.com.br"
},
{
"type": "SignRule",
"step": 2,
"numberRequiredActions": 1,
"ruleName": "Board",
"ruleUsers": [
{ "name": "Ana Prado", "identifier": "99988877766", "email": "ana@cliente.com.br", "operatorEmail": "secretaria@cliente.com.br" },
{ "name": "Pedro Reis", "identifier": "44433322211", "email": "pedro@cliente.com.br" }
]
},
{
"type": "Signer",
"step": 2,
"user": { "name": "Carla Dias", "identifier": "12312312312", "email": "carla@cliente.com.br" }
}
]
}

The response is a list with the documentId of each document created.

One e-mail per operator

In the example, assinaturas@cliente.com.br operates Maria and João. They receive a single e-mail, listing both. The office manager only receives theirs once step 2 is released.

No notifications

With disableNotifications: true, no e-mail is sent, neither to the participants nor to the operators. In that case, use the single link to get the URLs and deliver them through your integration.

3. Read the operators​

GET /api/documents/{id}

The document details show:

FieldWhat it is
allowOperatorsWhether the document allows operators.
flowActions[].operatorEmailOperator of a signer or an approver.
flowActions[].user.idIdentifier of the signer or approver. Used in the single link.
flowActions[].ruleUsers[].operatorEmailOperator of each person of a rule.
flowActions[].ruleUsers[].idIdentifier of the user within the rule. Used to edit the rule and in the single link.
centralizedLinkRequiresDigitalSignatureWhether the organization requires a digital certificate through the links. See Digital certificate only.

4. Change or remove an operator​

POST /api/documents/{id}/flow

{
"editedFlowActions": [
{
"flowActionId": "<Maria's flow action id>",
"step": 1,
"participantEmailAddress": "maria@cliente.com.br",
"operatorEmail": "novo.operador@cliente.com.br"
},
{
"flowActionId": "<Board rule id>",
"step": 2,
"ruleName": "Board",
"ruleUsers": [
{ "userId": "<Ana's ruleUsers[].id>", "emailAddress": "ana@cliente.com.br", "operatorEmail": null }
]
}
]
}
The edit replaces the participant's settings

Send again the fields that must stay in effect, such as participantEmailAddress (or emailAddress in ruleUsers) and allowElectronicSignature. A missing participant e-mail counts as an e-mail change and triggers a new notification. An empty or missing operatorEmail removes the operator.

In a rule, only the users sent in ruleUsers change. The others stay as they are.

  • If the participant can already act (is Pending), the new operator receives the link right away.
  • The previous operator loses access immediately, even if their link is still valid: the tickets they already got start failing with InvalidTicket.
  • New people in a rule go in addedRuleUsers, each with their own operatorEmail.
  • The change is recorded in the flow edited event, with the previous and the new operator, for every kind of participant.
  • Only the participants whose operator changed, or who became able to sign electronically while having an operator, are checked against the operator rules. An edit that does not touch a participant with an operator works even if the instance or the organization changed the rules after the document was created.
  • With disableNotifications on the document, the new operator receives no e-mail.

POST /api/documents/{id}/centralized-link

Generates a link to act for chosen participants, whether they have an operator or not. The document does not need allowOperators; the feature only has to be enabled on the instance. Each participant is identified by the flow action and the user: user.id for a signer or an approver, or ruleUsers[].id for rules.

{
"participants": [
{ "flowActionId": "<Maria's flow action id>", "userId": "<Maria's user.id>" },
{ "flowActionId": "<Board rule id>", "userId": "<Pedro's ruleUsers[].id>" }
]
}

Response:

{ "url": "https://<your-instance>/document/key/<key>/centralized?ticket=central-..." }
  • Only participants who have not finished yet can be included: the released ones (Pending) and those waiting for a previous step (Created). A participant who already signed, approved or refused, who is not in the document, or an empty list is rejected with CentralizedLinkParticipantInvalid.
  • The API does not send this link by e-mail. Hand the URL over yourself.
  • The list of participants is fixed in the link. To change it, generate another one.
  • The link is valid for the same time as a participant's link (24 hours by default).
  • Generating it is recorded in the document's "Single link generated" event.

The single link and the operator's link work the same way. There are two paths: open it in a browser, or integrate directly through the API.

In the browser​

  1. Open the link's URL. The page shows the document, the progress and the link's participants, with the status of each one.
  2. Click Sign or Approve on the participant. The button is only active for those released in the current step.
  3. The participant's signature or approval page opens, the same one as their own link. There you can sign with the certificate installed on the computer (Web PKI), with a cloud certificate, or electronically when the participant allows it. Refusing only appears if the organization allows it through the links.
  4. Use Back to the list to move on to the next participant.

Through the API, without a browser​

These endpoints are public: they take no X-Api-Key, and the link's ticket is what authorizes them. The document key and the ticket come from the link's URL itself:

https://<your-instance>/document/key/{key}/centralized?ticket={ticket}

The two centralized calls are rate limited per IP.

GET /api/documents/keys/{key}/centralized?ticket={ticket}

{
"isTicketExpired": false,
"digitalSignatureOnly": false,
"document": { "...": "document data" },
"documentStatus": "Pending",
"isDocumentPaused": false,
"completedCount": 0,
"totalCount": 2,
"participants": [
{
"flowActionId": "<id>",
"ruleUserId": null,
"type": "Signer",
"step": 1,
"name": "Maria Souza",
"identifier": "11122233344",
"status": "Pending",
"requiresElectronicSignature": false
}
]
}
  • status is Pending for those who can act now, Created for those waiting for a previous step, and Completed or Refused for those who have finished.
  • requiresElectronicSignature is true for a participant who can only sign electronically. With digitalSignatureOnly, that participant cannot be signed through the link.
  • When isTicketExpired is true, only that field is filled in.
  • An operator's link whose operator no longer operates anyone in the document is rejected with InvalidTicket.

POST /api/documents/keys/{key}/centralized/ticket

{ "ticket": "<link ticket>", "flowActionId": "<flowActionId from the list>", "ruleUserId": null }

Response:

{ "ticket": "<participant ticket>", "url": "https://<your-instance>/document/key/{key}/sign?ticket=..." }
  • Pass on the ruleUserId that came in the list: it is filled in for people of a rule.
  • The participant must be Pending. A participant who is not in the link is rejected with DocumentFlowNotFound.
  • For an approver, the url is the participant's approval page.
  • The returned ticket acts as the participant and is valid for the same time as the other tickets (24 hours by default), never beyond the link's own validity. If it expires, exchange again.
  • If the operator is changed, the tickets they already got stop working.
  • Each exchange is recorded in the "Access through operator link or single link" event, with the participant and the operator (or a note that it was a single link).

The steps below use this ticket, never the link's ticket.

c) Sign with a digital certificate​

The signature takes two steps, and the private key never leaves your machine.

POST /api/documents/keys/{key}/signature/certificate

{ "ticket": "<participant ticket>", "flowActionId": "<id>", "certificate": "<participant's certificate in DER, Base64>" }

The response has success, token, toSignHash (Base64) and digestAlgorithm. Sign the toSignHash with the certificate's private key and complete:

POST /api/documents/keys/{key}/signature

{ "token": "<token from the previous step>", "signature": "<hash signature in Base64>" }

The flowActionId is optional, because the participant's ticket already points to the flow action. Example in C#, with Lacuna.Signer.Client and an RSA certificate:

var client = new SignerClient(endpoint); // no key: public endpoints
using var cert = new X509Certificate2("participant.pfx", password, X509KeyStorageFlags.EphemeralKeySet);

var start = await client.StartPublicSignatureAsync(key, new PublicStartSignatureRequest {
Ticket = participantTicket,
Certificate = cert.Export(X509ContentType.Cert),
});

using var rsa = cert.GetRSAPrivateKey();
var signature = rsa.SignHash(start.ToSignHash, new HashAlgorithmName(start.DigestAlgorithm), RSASignaturePadding.Pkcs1);

await client.CompletePublicSignatureAsync(key, new CompleteSignatureRequest { Token = start.Token, Signature = signature });

The certificate must belong to the participant, with their identifier (CPF): someone else's certificate is rejected with CpfMismatch. If the document asks the signer to position the signature, also send signaturePositions in the first step. See also Sign documents in a batch, which uses the same calls.

d) Approve​

POST /api/documents/keys/{key}/approval

{ "ticket": "<participant ticket>", "flowActionId": "<id>" }

e) Refuse​

POST /api/documents/keys/{key}/refusal

{ "ticket": "<participant ticket>", "flowActionId": "<id>", "reason": "Reason for the refusal" }

The reason is required, up to 500 characters. Through the links, refusing is off by default: unless the organization allows it (see Refusal through the links), the call is rejected with CentralizedLinkRefusalDisabled. Even when it is allowed, a participant created with disableRefusal cannot be refused, and the call fails with RefusalDisabledForFlowAction.

Electronic signature

The electronic signature requires the authentication codes sent to the participant's contact (e-mail, SMS or WhatsApp). That is why the recommended path is the participant's page in a browser, opened from the url returned in step b.

What happens next​

MomentWhat Signer does
Participant releasedThe operator receives an e-mail with the link and the list of their participants, with the status of each one. There is one e-mail per operator, even with several participants. The participant keeps receiving their own link.
Operator chooses a participantThe standard signature or approval page of that participant opens, with a button to go back to the list.
Link expiredThe link is valid for the same time as the participant's link, 24 hours by default. To resend an operator's link, call POST /api/documents/public/action-ticket?ticket=<expired ticket>: the operator receives a new e-mail if the document is still pending and they still operate someone who has not finished. An expired single link cannot be resent: generate another one through the API.
Document concludedEach operator receives the document concluded e-mail once, when the instance notifies participants of the conclusion.

The document's events record:

  • "Single link generated", when a single link is generated;
  • "Operator link sent", each time the link is sent to an operator;
  • "Access through operator link or single link", each time a participant is chosen in a link, with the participant and the operator, or a note that it was a single link.

Signatures, approvals and refusals are recorded in the participant's name.

Digital certificate only​

The instance (CentralizedLink:RequireDigitalSignature), and each organization on top of it, can require operators and single links to sign only with the participant's digital certificate. The organization sets it in General Settings → Signature through operator's link and single link, or through the API in the centralizedLinkRequiresDigitalSignature field of the organization's general settings (null follows the instance). The effective value appears in the document details, in centralizedLinkRequiresDigitalSignature.

With the requirement on:

  • Creation and edit: a participant with an operator cannot be someone who signs electronically: a participant with allowElectronicSignature: true, a simple signature document, or a security context that does not accept certificates. These cases are rejected with CentralizedLinkRequiresDigitalSignature.
  • Single link: these participants cannot be included, with the same error.
  • Approvers are not affected.
  • Links generated before the requirement start allowing only the certificate signature: the electronic signature with the participant's ticket is rejected with CentralizedLinkRequiresDigitalSignature.

Refusal through the links​

By default, refusing through the operator's link or the single link is not possible. Whoever receives the link can only sign or approve. The participant can still refuse through their own link.

  • Setting: the instance sets the default in CentralizedLink:AllowRefusal. Each organization can follow that default or override it in General Settings → Refusal through operator's link and single link, or through the API in the centralizedLinkAllowsRefusal field of the organization's general settings (null follows the instance).
  • Participant page opened from the link: the Refuse button does not show. Through the API, the participant's public information (GET /api/documents/keys/{key}?ticket=...) comes back with pendingFlowAction.disableRefusal: true.
  • Refusal allowed: it still depends on the participant's own setting (disableRefusal) and is recorded in their name, with the link usage event showing the operator or the single link.
  • Setting changed: it applies to links already sent, from their next use.

Feature errors​

CodeWhen it happens
OperatorsDisabledThe instance turned off operators and the single link (CentralizedLink:Enabled false).
OperatorsNotAllowedForDocumentThere is an operator on a document created without allowOperators: true.
OperatorEmailInvalidThe operatorEmail is not a valid e-mail. A malformed e-mail can also be rejected earlier, in the request validation, with status 400.
CentralizedLinkRequiresDigitalSignatureWith the digital certificate requirement, there is an operator or a single link for someone who signs electronically, or an electronic signature attempt through the link.
CentralizedLinkParticipantInvalidThe single link's list is empty, or a requested participant is not in the document or has already finished.
CentralizedLinkRefusalDisabledRefusal through the operator's link or the single link without the organization allowing it.
RefusalDisabledForFlowActionRefusal of a participant created with disableRefusal.
DocumentFlowNotFoundIn the ticket exchange, the participant is not in the link, or the link belongs to another document.
InvalidTicketMissing or malformed link ticket, an operator who no longer operates that participant, or resending a single link.
ExpiredTicketLink or participant ticket expired. Generate another link or exchange the ticket again.

See also​

View as Markdown