Pular para o conteúdo principal

Document groups through the API

From Signer 3.5.0, a single call creates a document group: a set of documents and envelopes on the same subject, new or existing, each with its own participants. Whoever takes part in several documents of the group receives a single e-mail, and the operator receives a single link to act for all of their people in the group.

Overview​

  • Each document of the group keeps its own flow, participants, file and status. The group only brings them together.
  • A document may be in more than one group.
  • A new document is described with the same structure as POST /api/documents. An existing document enters by its id.
  • The rules of operators and single link apply to each document of the group. On top of them there is the group link: a single link to act for people of several documents.

Before you start​

  • The organization's API key, in the X-Api-Key header, as in the rest of the Integration Guide. The calls in Use the group link are the exception: they carry no key.
  • Operators enabled in the instance (CentralizedLink:Enabled, on by default), for the group link. See Operators and single link through the API.
  • Batch signature in the public area (General:PublicBatchSignatureEnabled), so that the e-mail of someone in several documents opens the group's batch page. Without it, the e-mail leads to the document list, which asks for login.
  • Enums are sent as text, for example "Signer" and "Approver".

1. Upload the files​

Upload each file of the new documents, as in Create documents:

POST /api/uploads/bytes

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

Existing documents need no upload.

2. Create the group​

POST /api/document-groups

{
"name": "November contracts",
"description": "Sample Customer's agreement, annex and terms",
"documents": [
{ "documentId": "<id of the power of attorney already created>" },
{
"document": {
"isEnvelope": true,
"envelopeName": "Agreement 123 with annex",
"files": [
{ "id": "<agreement upload>", "name": "agreement.pdf", "contentType": "application/pdf", "displayName": "Agreement" },
{ "id": "<annex upload>", "name": "annex.pdf", "contentType": "application/pdf", "displayName": "Annex" }
],
"flowActions": [
{ "type": "Signer", "step": 1, "user": { "name": "Company Representative", "identifier": "11122233344", "email": "representative@example.com" } },
{ "type": "Signer", "step": 2, "user": { "name": "Sample Customer", "identifier": "55566677788", "email": "customer@example.com" } }
]
}
},
{
"document": {
"files": [
{ "id": "<terms upload>", "name": "terms.pdf", "contentType": "application/pdf", "displayName": "Terms of adhesion" }
],
"flowActions": [
{ "type": "Signer", "step": 1, "user": { "name": "Sample Customer", "identifier": "55566677788", "email": "customer@example.com" } }
]
}
}
]
}
FieldDescription
nameOptional, up to 200 characters. Shown on the group link's page.
descriptionOptional, up to 600 characters. Shown in the operator's e-mail.
documentsList of entries, in the order the documents should appear. Each entry carries only one of these fields: documentId, of an existing document, or document, with the same structure as POST /api/documents (files, flowActions, observers, isEnvelope, envelopeName, allowOperators etc.).

Rules​

  • The group needs at least one entry, and each entry carries documentId or document, never both.
  • New document: follows every rule of POST /api/documents, including the General:MaxSignersPerDocument limit. An entry with several files and no isEnvelope creates one document per file, all in the group and with the same index in the response. Templates (templateId) are not accepted in a group.
  • Existing document: must belong to the key's organization, not be deleted and be pending, and you need permission to edit its flow. It may already be in other groups, but cannot repeat in the same call. Its flow and participants do not change.
  • All or nothing: one invalid entry prevents the whole group from being created. Uploads are only read, so they can be sent again with the same ids.

Response​

{
"id": "<group id>",
"name": "November contracts",
"description": "Sample Customer's agreement, annex and terms",
"documents": [
{ "index": 0, "documentId": "<power of attorney id>", "isExisting": true },
{ "index": 1, "documentId": "<envelope id>", "isExisting": false, "missingAnchors": [] },
{ "index": 2, "documentId": "<terms id>", "isExisting": false, "uploadId": "<terms upload>", "missingAnchors": [] }
]
}

There is one row per document created or included. index is the entry's position, from 0; an entry that produced several documents shows in several rows with the same index. Existing documents carry only index, documentId and isExisting.

What happens after creation​

  • Participants' e-mail: whoever is in a single new document receives the document's usual e-mail. Whoever is in two or more new documents receives a single e-mail listing the documents, with the link to the group's batch page. Existing documents send no new e-mail. Only e-mail is grouped: SMS and WhatsApp still send one message per action.
  • Participant's batch page: shows the person's actions on the group's documents the link was issued for, even after they are done, so the person can still see the documents. Actions of the same person released later (a later step, for instance), addressed to the same e-mail, show up too. Deleted documents leave; documents of other groups never show.
  • Webhook: the call raises a single DocumentsCreated event with the group's new documents. Existing documents raise no creation event. The other events (concluded, refused etc.) stay per document.
  • Billing: only new documents are billed, as in a standalone creation: one ENV transaction per envelope and DOC per document. The notifications sent (to participants and operators) are billed too.

3. Read the group​

GET /api/document-groups/{id}

{
"id": "<group id>",
"name": "November contracts",
"description": "Sample Customer's agreement, annex and terms",
"creationDate": "2026-11-23T14:02:00+00:00",
"documents": [
{
"id": "<id>",
"key": "ABCD-1234-EFGH-5678",
"name": "Agreement 123 with annex",
"isEnvelope": true,
"status": "Pending",
"creationDate": "2026-11-23T14:02:00+00:00",
"flowActions": [ "..." ]
}
]
}
  • Documents come in the order of the entries. Deleted documents do not show.
  • You need permission to view each document of the group; without it, the call is refused.
  • With General:HideParticipantsListAndOrderOfActionsForNonManagers on, whoever does not manage the document sees only their own action.
  • A group that does not exist, or has no document left, returns DocumentGroupNotFound.

4. Group with operators​

For an operator to act for the participants, each new document carries allowOperators: true and each participant's operatorEmail, in flowActions or on each person of ruleUsers, as in Create the document with operators. Existing documents enter with the operators they already have.

{
"name": "November contracts",
"documents": [
{
"document": {
"allowOperators": true,
"files": [ "..." ],
"flowActions": [
{
"type": "Signer", "step": 1,
"user": { "name": "Sample Customer", "identifier": "55566677788", "email": "customer@example.com" },
"operatorEmail": "operator@example.com"
}
]
}
}
]
}
  • An operator error on any document undoes the whole group. With the organization on "digital certificate only", an operator for someone who can only sign electronically is refused with CentralizedLinkRequiresDigitalSignature.
  • Operator's e-mail: at creation, each operatorEmail receives a single e-mail for the group, instead of one per document. It lists the people and the documents they still have to act on, says who sent them, and has the button that opens the group link.
  • The operator's link follows the operators at the time it is used: if you change a participant's operator, the former operator's link no longer reaches them.
  • There is no group e-mail when the new document has disablePendingActionNotifications or the existing one has disableNotifications.
  • After creation, each document notifies the operator when one of their people can act, as outside a group.
  • Each document's Events record the operator link sent, the single link generated and each access through an operator link or single link.

POST /api/document-groups/{id}/centralized-link

Generates, on demand, a group link for chosen participants, whether or not they have an operator. Each participant is identified by the document, the flow action and the user (user.id for signers and approvers, or ruleUsers[].id for rules).

{
"participants": [
{ "documentId": "<envelope id>", "flowActionId": "<id>", "userId": "<Sample Customer's user.id>" },
{ "documentId": "<terms id>", "flowActionId": "<id>", "userId": "<Sample Customer's user.id>" }
]
}

Response:

{ "url": "https://<your-instance>/document-group/centralized?ticket=group-..." }
  • Only participants of the group's documents who have not concluded yet (Pending or Created) may be included. An invalid participant or an empty list refuses the whole request with CentralizedLinkParticipantInvalid.
  • You need permission to edit the flow of each document involved.
  • The API does not e-mail this link: pass the URL on yourself.
  • The participant list is fixed in the link. To change it, generate another one.
  • The link is valid for 24 hours by default (General:FlowActionTicketValidityMinutes). Tickets obtained from it never outlive it.

The operator's link and the link generated in the previous step work the same way. In the browser, the page shows the group's documents, the people and, for each person, the Sign or Approve buttons per document and Sign all of person's documents. See Document group in the user guide.

To integrate without a browser, use the calls below. They are public: they carry no X-Api-Key, and the link's ticket (group-...), taken from the URL, is what authorizes them.

a) List the group​

GET /api/document-groups/public/centralized?ticket={ticket}

{
"isTicketExpired": false,
"digitalSignatureOnly": false,
"groupName": "November contracts",
"documents": [
{ "id": "<envelope id>", "key": "ABCD-1234-EFGH-5678", "name": "Agreement 123 with annex", "mimeType": "application/pdf", "isEnvelope": true, "status": "Pending", "isPaused": false },
{ "id": "<terms id>", "key": "WXYZ-9876-JKLM-5432", "name": "Terms of adhesion", "mimeType": "application/pdf", "isEnvelope": false, "status": "Pending", "isPaused": false }
],
"participants": [
{
"userId": "<Sample Customer's user.id>", "name": "Sample Customer", "identifier": "55566677788", "pendingCount": 1,
"actions": [
{ "documentId": "<terms id>", "flowActionId": "<id>", "ruleUserId": null, "type": "Signer", "step": 1, "status": "Pending", "concludedByAnotherRuleUser": false, "requiresElectronicSignature": false },
{ "documentId": "<envelope id>", "flowActionId": "<id>", "ruleUserId": null, "type": "Signer", "step": 2, "status": "Created", "concludedByAnotherRuleUser": false, "requiresElectronicSignature": false }
]
}
],
"completedCount": 0,
"totalCount": 2
}
  • An action's status is Pending for whoever can act now, Created for whoever waits for an earlier step, and Completed or Refused for whoever has concluded.
  • isPaused flags a paused document: nobody acts on it until it is resumed. pendingCount counts the Pending actions of pending documents, paused ones included; leave those out if you show the number.
  • concludedByAnotherRuleUser is true when the person is in a rule another member already concluded; status is then the rule's.
  • requiresElectronicSignature is true for someone who can only sign electronically. With digitalSignatureOnly, that person cannot sign through the link.
  • mimeType says whether the document can be previewed (PDF only). The group ticket gives access to the files of the documents the link reaches.
  • When isTicketExpired is true, only that field is filled in. A link that no longer reaches anyone is refused with InvalidTicket.

b) Sign or approve a document​

Each document's public routes accept the group ticket, together with the person's userId and the action's flowActionId: approval, certificate signature, authentication code, Pix, biometrics, electronic signature and refusal. They are the same as in Through the API, without a browser, plus userId. For example:

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

{ "ticket": "group-...", "userId": "<Sample Customer's user.id>", "flowActionId": "<id of the action on the terms>", "emailCode": "<code received by Sample Customer>" }
  • The digital certificate must belong to the person.
  • Refusal is only accepted when the organization allows it through the links; otherwise it returns CentralizedLinkRefusalDisabled.

To use Signer's own pages for one person, exchange the group ticket for that person's ticket:

POST /api/document-groups/public/centralized/ticket

{ "ticket": "group-...", "userId": "<Sample Customer's user.id>", "flowActionId": "<action id>" }

Response:

{ "ticket": "<the person's ticket>", "url": "https://<your-instance>/document/key/{key}/sign?ticket=..." }
  • With flowActionId, it returns the ticket and the signature or approval page of that action. The page also opens for an action already concluded or refused, only to view the document.
  • Without flowActionId, it returns the ticket and the batch page with all of the person's pending actions in the group.
  • Each use is recorded in the document's Events.

c) Sign all of a person's documents​

With the group ticket, the batch gathers the person's pending actions in the group. Signing is one person at a time.

POST /api/batches/public/electronic-signatures

{ "ticket": "group-...", "userId": "<Sample Customer's user.id>" }

Then request the code (POST /api/batches/electronic-signatures/{id}/authentication-code) and finish with PUT /api/batches/electronic-signatures/{id}, sending the same group ticket. With a digital certificate, use POST /api/batches/public/signatures with ticket, userId and the person's certificate. See the full flow in Sign documents in batch.

  • With no pending action for the person, the batch is refused with SignatureNotPending.
  • With "digital certificate only", the electronic batch is refused with CentralizedLinkRequiresDigitalSignature if any pending action requires electronic signature.
  • If the link no longer reaches the batch (for instance, the operator was changed), the PUT returns InvalidTicket.

Feature errors​

Creation validation errors come back with status 400, grouped by the field's path:

{
"errors": { "Documents[1].Document.FlowActions[0]": [ "..." ] },
"title": "One or more validation errors occurred.",
"status": 400
}
PathSituation
DocumentsNo entry.
Documents[i]Entry with neither documentId nor document, or with both.
Documents[i].DocumentIdExisting document not found, deleted, not pending or repeated.
Documents[i].Document.FilesSame upload used in more than one entry.
Documents[i].Document.TemplateIdTemplates are not accepted in a group.
Documents[i].Document.<field>Any validation rule of POST /api/documents for that document.

The other errors come back with status 422 and an ErrorModel, as in Error responses, and undo the whole group when they happen at creation (for instance, the participant limit or an operator error):

CodeWhen
DocumentGroupNotFoundGroup does not exist or has no documents left.
OperatorsDisabledOperators turned off in the instance.
CentralizedLinkParticipantInvalidInvalid participant or empty list when generating the group link.
CentralizedLinkRequiresDigitalSignatureThe organization only allows digital certificates through the links.
CentralizedLinkRefusalDisabledRefusal through the link not allowed.
InvalidTicket / ExpiredTicketInvalid ticket, one that no longer reaches anyone, or expired.
DocumentFlowNotFoundThe action is not in the link.
SignatureNotPendingNothing pending to sign.
InvalidAuthenticationCodeWrong authentication code.

See also​

View as Markdown