@assinafy/sdk 2.11.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -1
- package/README.en.md +89 -1669
- package/README.md +87 -1628
- package/dist/index.d.mts +1549 -291
- package/dist/index.d.ts +1549 -291
- package/dist/index.js +1628 -263
- package/dist/index.mjs +1626 -263
- package/docs/API_COVERAGE.md +67 -20
- package/docs/COMPATIBILITY.md +97 -38
- package/docs/README.en.md +1863 -0
- package/docs/README.md +1818 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ type AssignmentMethod = 'virtual' | 'collect';
|
|
|
31
31
|
* | `Whatsapp` | One-time code sent over WhatsApp. | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
|
|
32
32
|
* | `DigitalCertificate` | The signer signs with their own ICP-Brasil certificate — **A1** (software, a file on the machine) or **A3** (hardware, a token or smartcard) — through the Web PKI browser extension, producing a qualified PAdES signature. | `method: 'virtual'`; Digital Certificate feature (Standard/Pro); `government_id`; the signer must be alone in their signing step. | 0.5 credits + notification |
|
|
33
33
|
* | `IdDocumentFaceMatchBasic` | Hosted identity-document and face verification, with explicit biometric consent. | ID Document + Face Match feature; valid CPF in `government_id`; account approval for any `InReview` result before certification. | Use cost estimation for current pricing. |
|
|
34
|
+
* | `Bypass` | No verification code. Enabled per account by Assinafy (`signing_features.VerificationBypass`); typically for `embedded` signers your app has already authenticated. | The Verification Bypass feature (`403 PlanRestricted` otherwise). | Notification only. |
|
|
34
35
|
*
|
|
35
36
|
* A1 and A3 are certificate *media*, chosen by the signer in their browser at
|
|
36
37
|
* signing time. The API models both as the single `DigitalCertificate` value —
|
|
@@ -41,13 +42,14 @@ type AssignmentMethod = 'virtual' | 'collect';
|
|
|
41
42
|
* verification code travels on the notification channel, so `Email` pairs only
|
|
42
43
|
* with `Email` and `Whatsapp` only with `Whatsapp`. `DigitalCertificate`
|
|
43
44
|
* and `IdDocumentFaceMatchBasic` carry no OTP and may be announced over either
|
|
44
|
-
* channel
|
|
45
|
-
* invalid pairing before the request; the API
|
|
45
|
+
* channel; `Bypass` may also use the `Bypass` notification, which sends no
|
|
46
|
+
* invitation. The SDK rejects an invalid pairing before the request; the API
|
|
47
|
+
* answers `400`. `embedded` signers use `Email`, `Whatsapp` or `Bypass`.
|
|
46
48
|
*
|
|
47
49
|
* Send neither field to get `Email`/`Email`; send one and the other is
|
|
48
50
|
* inferred from it.
|
|
49
51
|
*/
|
|
50
|
-
type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate' | 'IdDocumentFaceMatchBasic';
|
|
52
|
+
type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate' | 'IdDocumentFaceMatchBasic' | 'Bypass';
|
|
51
53
|
/** Provider session state; `InReview` permits signing but holds certification. */
|
|
52
54
|
type IdentityVerificationStatus = 'Pending' | 'InReview' | 'Approved' | 'Declined' | 'Expired' | 'Abandoned';
|
|
53
55
|
/** Evidence names accepted by the account review image endpoint. */
|
|
@@ -130,11 +132,12 @@ interface ISignerIdentityReview {
|
|
|
130
132
|
* | --- | --- | --- |
|
|
131
133
|
* | `Email` | An `email`. | 0 credits |
|
|
132
134
|
* | `Whatsapp` | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
|
|
135
|
+
* | `Bypass` | Sends nothing; only with `Bypass` verification (per-account feature). The signer is reached through your app, e.g. an embed session. | — |
|
|
133
136
|
*
|
|
134
137
|
* Notifications are charged when the assignment is created and again on every
|
|
135
138
|
* resend. See {@link AssignmentVerificationMethod} for the pairing rules.
|
|
136
139
|
*/
|
|
137
|
-
type AssignmentNotificationMethod = 'Email' | 'Whatsapp';
|
|
140
|
+
type AssignmentNotificationMethod = 'Email' | 'Whatsapp' | 'Bypass';
|
|
138
141
|
/** Minimal logger contract (compatible with console, pino, winston, etc.). */
|
|
139
142
|
interface Logger {
|
|
140
143
|
debug: (message: string, context?: Record<string, unknown>) => void;
|
|
@@ -202,18 +205,22 @@ interface ICreateSignerPayload {
|
|
|
202
205
|
}
|
|
203
206
|
/** Payload for updating a signer. */
|
|
204
207
|
interface IUpdateSignerPayload {
|
|
208
|
+
/** Cannot be cleared. */
|
|
205
209
|
full_name?: string;
|
|
206
|
-
|
|
207
|
-
|
|
210
|
+
/** `null` or `''` clears it. */
|
|
211
|
+
email?: string | null;
|
|
212
|
+
/** `null` or `''` clears it (stored as `null`). */
|
|
213
|
+
whatsapp_phone_number?: string | null;
|
|
208
214
|
/** Compatibility alias normalized to `whatsapp_phone_number` before sending. */
|
|
209
|
-
phone?: string;
|
|
215
|
+
phone?: string | null;
|
|
210
216
|
/** Compatibility extension. Brazilian CPF; non-digits are stripped. */
|
|
211
217
|
cpf?: string;
|
|
212
218
|
/**
|
|
213
219
|
* CPF (11 digits) or CNPJ (14 characters, letters allowed). Sent as given;
|
|
214
|
-
* the API strips formatting and returns the normalized value.
|
|
220
|
+
* the API strips formatting and returns the normalized value. `null` or `''`
|
|
221
|
+
* clears it.
|
|
215
222
|
*/
|
|
216
|
-
government_id?: string;
|
|
223
|
+
government_id?: string | null;
|
|
217
224
|
}
|
|
218
225
|
/** Signer object as returned by the API. */
|
|
219
226
|
interface ISigner {
|
|
@@ -251,29 +258,28 @@ interface ISignerSelf extends ISigner {
|
|
|
251
258
|
}
|
|
252
259
|
/** Official identity fields accepted by the signer `confirm-data` operation. */
|
|
253
260
|
interface IConfirmSignerDataPayload {
|
|
254
|
-
/** Signer's full name as it should appear on the signed document. */
|
|
255
|
-
full_name?: string;
|
|
256
|
-
email?: string;
|
|
257
|
-
/** Government-issued identifier recorded with the signature. */
|
|
258
|
-
government_id?: string;
|
|
259
261
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
+
* Required when the signer is verified or notified by e-mail. Saved when
|
|
263
|
+
* the signer has none; otherwise it must be theirs.
|
|
262
264
|
*/
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Compatibility input retained for integrations written against older
|
|
267
|
-
* Assinafy deployments. The extra phone property does not belong to the current
|
|
268
|
-
* `confirm-data` request schema.
|
|
269
|
-
*/
|
|
270
|
-
interface ILegacyConfirmSignerDataPayload extends IConfirmSignerDataPayload {
|
|
265
|
+
email?: string;
|
|
271
266
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
267
|
+
* Required when the signer is verified or notified by WhatsApp (E.164).
|
|
268
|
+
* Saved when the signer has none; otherwise it must be theirs.
|
|
274
269
|
*/
|
|
275
270
|
whatsapp_phone_number?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Accept terms atomically with the confirmation. Required before opening a
|
|
273
|
+
* DigitalCertificate assignment unless `acceptTerms()` was called.
|
|
274
|
+
*/
|
|
275
|
+
has_accepted_terms?: boolean;
|
|
276
|
+
/** @deprecated Ignored by production; read only by older deployments. */
|
|
277
|
+
full_name?: string;
|
|
278
|
+
/** @deprecated Ignored by production; read only by older deployments. */
|
|
279
|
+
government_id?: string;
|
|
276
280
|
}
|
|
281
|
+
/** @deprecated Identical to {@link IConfirmSignerDataPayload}; kept for existing imports. */
|
|
282
|
+
type ILegacyConfirmSignerDataPayload = IConfirmSignerDataPayload;
|
|
277
283
|
/** Official options for uploading the PNG signature image described by OpenAPI. */
|
|
278
284
|
interface IUploadSignatureOptions {
|
|
279
285
|
imageType?: SignatureImageType;
|
|
@@ -313,6 +319,12 @@ type SignerReference = string | {
|
|
|
313
319
|
/** `DigitalCertificate` is valid only when the assignment method is `virtual`. */
|
|
314
320
|
verification_method?: AssignmentVerificationMethod;
|
|
315
321
|
notification_methods?: AssignmentNotificationMethod[];
|
|
322
|
+
/**
|
|
323
|
+
* Sign inside your app through `embed.createSession()`: the signer gets
|
|
324
|
+
* no link in `signing_urls`. Needs the Embed feature and `Email`,
|
|
325
|
+
* `Whatsapp` or `Bypass` verification.
|
|
326
|
+
*/
|
|
327
|
+
embedded?: boolean;
|
|
316
328
|
/**
|
|
317
329
|
* Positive integer controlling signing order. Signers sharing a step
|
|
318
330
|
* sign in parallel; a step is activated (and its signers notified)
|
|
@@ -349,6 +361,8 @@ interface ICreateAssignmentPayload {
|
|
|
349
361
|
copy_receivers?: string[];
|
|
350
362
|
/** Field placement entries used when `method` is `collect`. */
|
|
351
363
|
entries?: IAssignmentEntry[];
|
|
364
|
+
/** Refuse with `409 CreditCeilingExceeded`, creating and charging nothing, above this many credits. */
|
|
365
|
+
max_total_credits?: number;
|
|
352
366
|
}
|
|
353
367
|
/**
|
|
354
368
|
* Field rectangle used by collect assignments. Coordinates are pixels in the
|
|
@@ -421,8 +435,10 @@ interface IAssignmentSigner extends ISigner {
|
|
|
421
435
|
/** Per-channel notification delivery history embedded in an assignment signer. */
|
|
422
436
|
interface INotificationHistoryEntry {
|
|
423
437
|
event: string;
|
|
424
|
-
|
|
425
|
-
|
|
438
|
+
/** Furthest delivery stage: `opened` means the e-mail was opened/clicked or the WhatsApp message read. */
|
|
439
|
+
status: 'sent' | 'delivered' | 'opened' | 'failed' | AnyString;
|
|
440
|
+
/** Set only when `status` is `failed`. */
|
|
441
|
+
error_code: 'MailboxFull' | 'AddressNotFound' | 'AddressSuppressed' | 'ContentRejected' | 'MarkedAsSpam' | 'NotOnWhatsapp' | 'RecipientRestricted' | 'NotSent' | 'Unknown' | AnyString | null;
|
|
426
442
|
error_message: string | null;
|
|
427
443
|
sent_at: string | null;
|
|
428
444
|
failed_at: string | null;
|
|
@@ -449,7 +465,10 @@ interface IAssignmentItem {
|
|
|
449
465
|
/** Per-signer browser URL returned with a created assignment. */
|
|
450
466
|
interface ISigningUrl {
|
|
451
467
|
signer_id: string;
|
|
452
|
-
|
|
468
|
+
/** `null` for an embedded signer (mint `embed.createSession()`) and a WhatsApp-only signer. */
|
|
469
|
+
url: string | null;
|
|
470
|
+
/** Whether the signer was created with `embedded: true`. */
|
|
471
|
+
embedded?: boolean;
|
|
453
472
|
}
|
|
454
473
|
/** Assignment object as returned by the API. */
|
|
455
474
|
interface IAssignment {
|
|
@@ -458,7 +477,8 @@ interface IAssignment {
|
|
|
458
477
|
/** The document this assignment belongs to; null only after document deletion. */
|
|
459
478
|
document_id?: string | null;
|
|
460
479
|
created_at?: string;
|
|
461
|
-
|
|
480
|
+
/** `null` once the sending user deleted their account. */
|
|
481
|
+
sender_email?: string | null;
|
|
462
482
|
method: AssignmentMethod;
|
|
463
483
|
expires_at?: string | null;
|
|
464
484
|
/** Compatibility extension; absent from the OpenAPI Assignment schema. */
|
|
@@ -475,7 +495,7 @@ interface IAssignment {
|
|
|
475
495
|
completed?: boolean;
|
|
476
496
|
}>;
|
|
477
497
|
};
|
|
478
|
-
/** Per-signer signing URLs. Array of `{ signer_id, url }` (not a map). */
|
|
498
|
+
/** Per-signer signing URLs. Array of `{ signer_id, url, embedded? }` (not a map). */
|
|
479
499
|
signing_urls?: ISigningUrl[];
|
|
480
500
|
}
|
|
481
501
|
/** Assignment returned after requesting signatures. */
|
|
@@ -503,18 +523,18 @@ interface ICostEstimate {
|
|
|
503
523
|
quantity?: number;
|
|
504
524
|
unit_cost?: number;
|
|
505
525
|
}>;
|
|
506
|
-
|
|
507
|
-
|
|
526
|
+
/** `null` when the account's documents are not limited. */
|
|
527
|
+
document_balance: number | null;
|
|
528
|
+
/** `null` when the account's credits are not limited. */
|
|
529
|
+
credit_balance: number | null;
|
|
508
530
|
has_sufficient_resources: boolean;
|
|
509
531
|
/** `null` when the operation can proceed; otherwise the documented reason code. */
|
|
510
532
|
blocking_reason: 'PendingPayment' | 'InsufficientDocuments' | 'InsufficientCredits' | null;
|
|
511
533
|
message: string | null;
|
|
512
534
|
}
|
|
513
535
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
* This smaller, resend-specific compatibility shape can be returned instead of
|
|
517
|
-
* {@link ICostEstimate}; the SDK models both wire formats.
|
|
536
|
+
* Resend-cost payload (`ResendCostEstimate`): `total`, not `total_credits`.
|
|
537
|
+
* The name is historical; this is the shape production documents.
|
|
518
538
|
*/
|
|
519
539
|
interface ILegacyResendCostEstimate {
|
|
520
540
|
total: number;
|
|
@@ -523,16 +543,20 @@ interface ILegacyResendCostEstimate {
|
|
|
523
543
|
name: string;
|
|
524
544
|
cost: number;
|
|
525
545
|
}>;
|
|
526
|
-
|
|
546
|
+
/** `null` when the account's credits are not limited. */
|
|
547
|
+
credit_balance: number | null;
|
|
527
548
|
has_sufficient_credits: boolean;
|
|
528
549
|
}
|
|
529
|
-
/**
|
|
530
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Cost estimate returned by `assignments.estimateResendCost`: the compact
|
|
552
|
+
* {@link ILegacyResendCostEstimate}, or {@link ICostEstimate} on older deployments.
|
|
553
|
+
*/
|
|
554
|
+
type IResendCostEstimate = ILegacyResendCostEstimate | ICostEstimate;
|
|
531
555
|
/** Webhook payload envelope. */
|
|
532
556
|
interface IWebhookPayload {
|
|
533
|
-
/**
|
|
557
|
+
/** Activity ID. To deduplicate retries prefer the `webhook-id` header, unique per endpoint. */
|
|
534
558
|
id?: number;
|
|
535
|
-
event?:
|
|
559
|
+
event?: WebhookDeliveryEventType | AnyString;
|
|
536
560
|
type?: string;
|
|
537
561
|
message?: string | null;
|
|
538
562
|
payload?: Record<string, unknown> | null;
|
|
@@ -550,6 +574,11 @@ interface IWebhookPayload {
|
|
|
550
574
|
};
|
|
551
575
|
[key: string]: unknown;
|
|
552
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Event names a delivery can carry: every subscribable {@link WebhookEventType}
|
|
579
|
+
* plus `webhook_test`, sent only by `webhooks.testEndpoint()` and never subscribable.
|
|
580
|
+
*/
|
|
581
|
+
type WebhookDeliveryEventType = WebhookEventType | 'webhook_test';
|
|
553
582
|
/** Known webhook event names. */
|
|
554
583
|
type WebhookEventType = 'document_uploaded' | 'document_metadata_ready' | 'document_prepared' | 'assignment_created' | 'document_ready' | 'signature_requested' | 'signer_created' | 'signer_email_verified' | 'signer_whatsapp_verified' | 'signer_data_confirmed' | 'signer_viewed_document' | 'signer_identity_verified' | 'signer_identity_verification_failed' | 'signer_identity_review_required' | 'signer_identity_review_approved' | 'signer_identity_review_rejected' | 'signer_signed_document' | 'signer_rejected_document' | 'user_rejected_document' | 'document_processing_failed' | 'template_created' | 'template_processed' | 'template_processing_failed' | 'document_contract_updated' | 'document_contract_renewal_notice' | 'document_contract_expiring' | 'document_contract_expired' | 'document_contract_renewed' | 'document_contract_terminated' | 'document_contract_amended' | 'document_contract_amendment_updated';
|
|
555
584
|
/** Document listing item (paginated). */
|
|
@@ -569,6 +598,10 @@ interface IDocumentListItem {
|
|
|
569
598
|
declined_by?: ISigner | null;
|
|
570
599
|
/** Tags attached to the document (inline `{ id, name, color }` shape). */
|
|
571
600
|
tags?: IInlineTag[];
|
|
601
|
+
/** Code printed on the certificate page; `null` until `certificated`. */
|
|
602
|
+
verification_code?: string | null;
|
|
603
|
+
/** Public verification page; `null` until `certificated`. */
|
|
604
|
+
verification_url?: string | null;
|
|
572
605
|
created_at: string;
|
|
573
606
|
updated_at?: string;
|
|
574
607
|
is_closed?: boolean;
|
|
@@ -704,6 +737,8 @@ interface IDocumentListParams extends IListParams {
|
|
|
704
737
|
method?: AssignmentMethod;
|
|
705
738
|
/** Comma-separated list of tag IDs (AND semantics). */
|
|
706
739
|
tags?: string;
|
|
740
|
+
/** Only the documents of this envelope. */
|
|
741
|
+
envelope_id?: string;
|
|
707
742
|
}
|
|
708
743
|
/**
|
|
709
744
|
* Response of `documents.rename` (`PATCH /documents/{documentId}`).
|
|
@@ -722,6 +757,10 @@ interface IDocumentSearchParams extends IListParams {
|
|
|
722
757
|
search?: string;
|
|
723
758
|
/** Filter by document status, e.g. `pending_signature`. */
|
|
724
759
|
status?: DocumentStatus | AnyString;
|
|
760
|
+
/** Only the documents of this envelope. */
|
|
761
|
+
envelope_id?: string;
|
|
762
|
+
/** `name` or `updated_at`, `-` prefix for descending (`-updated_at` is the default). */
|
|
763
|
+
sort?: 'name' | '-name' | 'updated_at' | '-updated_at' | AnyString;
|
|
725
764
|
/** Page number (1-based). */
|
|
726
765
|
page?: number;
|
|
727
766
|
/** Results per page. */
|
|
@@ -729,6 +768,8 @@ interface IDocumentSearchParams extends IListParams {
|
|
|
729
768
|
}
|
|
730
769
|
/** Query parameters accepted by `assignments.list`. */
|
|
731
770
|
interface IAssignmentListParams extends IListParams {
|
|
771
|
+
/** `created_at` (default, oldest first), `expires_at` or `id`; `-` prefix for descending. */
|
|
772
|
+
sort?: 'created_at' | '-created_at' | 'expires_at' | '-expires_at' | 'id' | '-id' | AnyString;
|
|
732
773
|
/** Page number (1-based). */
|
|
733
774
|
page?: number;
|
|
734
775
|
/** Results per page. */
|
|
@@ -789,6 +830,10 @@ interface IDocumentDetailsResponse {
|
|
|
789
830
|
verification_url?: string | null;
|
|
790
831
|
/** Present only on workspace detail reads when contract tracking is available. */
|
|
791
832
|
has_contract?: boolean;
|
|
833
|
+
/** Only with `expand: ['envelope_id']`: the envelope the document is in, or `null`. */
|
|
834
|
+
envelope_id?: string | null;
|
|
835
|
+
/** Only with `expand: ['envelope']`: the document's envelope, or `null`. */
|
|
836
|
+
envelope?: IDocumentEnvelopeRef | null;
|
|
792
837
|
artifacts?: {
|
|
793
838
|
original: string;
|
|
794
839
|
certificated?: string;
|
|
@@ -817,7 +862,7 @@ interface IDocumentActivity {
|
|
|
817
862
|
payload?: Record<string, unknown> | unknown[] | null;
|
|
818
863
|
/** Request origin (`ip` / `user-agent`) when available; `null` for system events. */
|
|
819
864
|
origin: {
|
|
820
|
-
ip?: string;
|
|
865
|
+
ip?: string | null;
|
|
821
866
|
'user-agent'?: string;
|
|
822
867
|
} | string | null;
|
|
823
868
|
created_at: string;
|
|
@@ -887,6 +932,10 @@ interface IWorkspaceResponse {
|
|
|
887
932
|
notification_sender_type?: NotificationSenderType;
|
|
888
933
|
roles?: string[];
|
|
889
934
|
is_delete_allowed?: boolean;
|
|
935
|
+
/** Returned by `workspaces.get()`, not in workspace lists. More keys may appear. */
|
|
936
|
+
limits?: IAccountLimits;
|
|
937
|
+
/** Only with `workspaces.get(accountId, { expand: 'signing_features' })`. */
|
|
938
|
+
signing_features?: IAccountSigningFeatures;
|
|
890
939
|
created_at: string;
|
|
891
940
|
}
|
|
892
941
|
/** Notification sender identity accepted by account create/update operations. */
|
|
@@ -901,11 +950,15 @@ type IWorkspaceListResponse = PaginatedResult<IWorkspaceListItem>;
|
|
|
901
950
|
/** Branding returned by `GET /accounts/{accountId}/theme`. */
|
|
902
951
|
interface IAccountTheme {
|
|
903
952
|
account_name: string;
|
|
904
|
-
/**
|
|
953
|
+
/** Button background: six-character hex colour without a leading `#`. */
|
|
905
954
|
primary_color: string;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
955
|
+
/** Button text: six-character hex colour without a leading `#`. */
|
|
956
|
+
secondary_color: string;
|
|
957
|
+
/**
|
|
958
|
+
* Absolute logo URL for the caller (`/accounts/{accountId}/logo` for members,
|
|
959
|
+
* `/sign/logo` for signers), or `null` when the account has none.
|
|
960
|
+
*/
|
|
961
|
+
logo: string | null;
|
|
909
962
|
}
|
|
910
963
|
/** Granularity accepted by account/user document-statistics endpoints. */
|
|
911
964
|
type DocumentStatsGranularity = 'monthly' | 'daily';
|
|
@@ -1013,6 +1066,11 @@ interface IWebhookEndpointSecret {
|
|
|
1013
1066
|
/** `whsec_` followed by the base64-encoded key. */
|
|
1014
1067
|
secret: string;
|
|
1015
1068
|
}
|
|
1069
|
+
/** Result of `webhooks.rotateEndpointSecret()`. */
|
|
1070
|
+
interface IWebhookEndpointSecretRotation extends IWebhookEndpointSecret {
|
|
1071
|
+
/** Only with `keep_previous: true`: when the previous secret stops signing (24 hours). */
|
|
1072
|
+
previous_secret_expires_at?: string;
|
|
1073
|
+
}
|
|
1016
1074
|
/** Event code and human-readable description from the webhook event catalog. */
|
|
1017
1075
|
interface IWebhookEventTypeInfo {
|
|
1018
1076
|
id: WebhookEventType | AnyString;
|
|
@@ -1022,7 +1080,7 @@ interface IWebhookEventTypeInfo {
|
|
|
1022
1080
|
interface IWebhookDispatch {
|
|
1023
1081
|
resource?: string;
|
|
1024
1082
|
id: string;
|
|
1025
|
-
event:
|
|
1083
|
+
event: WebhookDeliveryEventType | AnyString;
|
|
1026
1084
|
activity_id: number;
|
|
1027
1085
|
/** Endpoint the delivery went to; `null` once that endpoint is deleted. */
|
|
1028
1086
|
endpoint_id?: string | null;
|
|
@@ -1034,10 +1092,12 @@ interface IWebhookDispatch {
|
|
|
1034
1092
|
webhook_id?: string | null;
|
|
1035
1093
|
/** Attempt number for this event and endpoint, counted from 1. */
|
|
1036
1094
|
attempt?: number | null;
|
|
1037
|
-
/**
|
|
1095
|
+
/** `scheduled` delivery, recovery `probe` to a paused endpoint, or `manual` (retry or test delivery). */
|
|
1038
1096
|
kind?: 'scheduled' | 'probe' | 'manual' | AnyString;
|
|
1039
1097
|
/** Whether another automatic attempt follows this entry. */
|
|
1040
1098
|
will_retry?: boolean;
|
|
1099
|
+
/** Milliseconds the endpoint took; `null` when no request was sent or before it was measured. */
|
|
1100
|
+
duration_ms?: number | null;
|
|
1041
1101
|
http_status: number | null;
|
|
1042
1102
|
/** Receiving endpoint body, truncated by Assinafy to 2,000 characters. */
|
|
1043
1103
|
response_body: string | null;
|
|
@@ -1196,6 +1256,8 @@ interface ITemplateSigner {
|
|
|
1196
1256
|
whatsapp_phone_number?: string;
|
|
1197
1257
|
verification_method?: AssignmentVerificationMethod;
|
|
1198
1258
|
notification_methods?: AssignmentNotificationMethod[];
|
|
1259
|
+
/** Sign inside your app (see {@link SignerReference}); Email, Whatsapp or Bypass verification. */
|
|
1260
|
+
embedded?: boolean;
|
|
1199
1261
|
/** Positive integer controlling signing order (see {@link SignerReference}). */
|
|
1200
1262
|
step?: number;
|
|
1201
1263
|
}
|
|
@@ -1222,6 +1284,13 @@ interface ICreateDocumentFromTemplateOptions {
|
|
|
1222
1284
|
* auto-created; the template's default-document-tags are always merged in.
|
|
1223
1285
|
*/
|
|
1224
1286
|
tags?: string[];
|
|
1287
|
+
/**
|
|
1288
|
+
* Refuse with `409 CreditCeilingExceeded` above this many credits. A cost
|
|
1289
|
+
* that rises after acceptance ends the document `failed` instead.
|
|
1290
|
+
*/
|
|
1291
|
+
max_total_credits?: number;
|
|
1292
|
+
/** New per document; a retry with the same key returns the first document without charging again. */
|
|
1293
|
+
idempotencyKey?: string;
|
|
1225
1294
|
}
|
|
1226
1295
|
/**
|
|
1227
1296
|
* Item returned by `GET /documents/statuses`.
|
|
@@ -1259,6 +1328,8 @@ interface IDocumentVerification {
|
|
|
1259
1328
|
signer_count: string | null;
|
|
1260
1329
|
completed_count: number | null;
|
|
1261
1330
|
completed_at: string | null;
|
|
1331
|
+
/** When certification was first recorded. */
|
|
1332
|
+
certificated_at?: string | null;
|
|
1262
1333
|
verified_at: string;
|
|
1263
1334
|
is_valid: boolean;
|
|
1264
1335
|
message: string;
|
|
@@ -1466,10 +1537,11 @@ interface IFieldValidateMultipleEntry {
|
|
|
1466
1537
|
}
|
|
1467
1538
|
/** Item returned by `GET /documents/{id}/assignments/{id}/whatsapp-notifications`. */
|
|
1468
1539
|
interface IWhatsAppNotification {
|
|
1469
|
-
|
|
1540
|
+
/** ISO-8601 UTC timestamp. */
|
|
1541
|
+
sent_at: string;
|
|
1470
1542
|
header: string;
|
|
1471
1543
|
body: string;
|
|
1472
|
-
/**
|
|
1544
|
+
/** Production strips button URLs; sandbox includes them, and they carry access codes. */
|
|
1473
1545
|
buttons: Array<{
|
|
1474
1546
|
text: string;
|
|
1475
1547
|
url?: string;
|
|
@@ -1651,6 +1723,271 @@ interface IOAuthUserInfo {
|
|
|
1651
1723
|
/** Requires the `email` scope. */
|
|
1652
1724
|
email_verified?: boolean | null;
|
|
1653
1725
|
}
|
|
1726
|
+
/** Signing features a workspace's plan enables (`GET /accounts/{accountId}?expand=signing_features`). */
|
|
1727
|
+
interface IAccountSigningFeatures {
|
|
1728
|
+
/** `DigitalCertificate` verification (ICP-Brasil A1/A3). */
|
|
1729
|
+
DigitalCertificate: boolean;
|
|
1730
|
+
/** `IdDocumentFaceMatchBasic` verification. */
|
|
1731
|
+
VerificationIdDocumentFaceMatchBasic: boolean;
|
|
1732
|
+
/** The `Whatsapp` notification method, and therefore `Whatsapp` verification. */
|
|
1733
|
+
WhatsappNotification: boolean;
|
|
1734
|
+
/** The `Bypass` verification method, enabled per account by Assinafy. */
|
|
1735
|
+
VerificationBypass: boolean;
|
|
1736
|
+
/** Embedded signing: embed origins, `embedded` signers and embed sessions. */
|
|
1737
|
+
Embed: boolean;
|
|
1738
|
+
[feature: string]: boolean;
|
|
1739
|
+
}
|
|
1740
|
+
/** Plan limits returned on the workspace read. */
|
|
1741
|
+
interface IAccountLimits {
|
|
1742
|
+
/** Webhook endpoints the workspace may register (1, or 3 on paid plans). */
|
|
1743
|
+
webhook_endpoints: number;
|
|
1744
|
+
[limit: string]: number;
|
|
1745
|
+
}
|
|
1746
|
+
/** One plan meter in {@link IAccountUsage}. */
|
|
1747
|
+
interface IAccountUsageBalance {
|
|
1748
|
+
/** Remaining quantity; `null` for unlimited. */
|
|
1749
|
+
balance: number | null;
|
|
1750
|
+
/** Allowance per cycle or pool; `null` when not cycle-limited or unlimited. */
|
|
1751
|
+
limit: number | null;
|
|
1752
|
+
/** Quantity consumed in the current cycle. */
|
|
1753
|
+
spent: number;
|
|
1754
|
+
}
|
|
1755
|
+
/** Plan and balances returned by `GET /accounts/{accountId}/usage`. */
|
|
1756
|
+
interface IAccountUsage {
|
|
1757
|
+
/** Plan name; `null` when the subscription has no plan or it was retired. */
|
|
1758
|
+
plan: string | null;
|
|
1759
|
+
/** `YYYY-MM-DD` when the document allowance renews, or `null`. */
|
|
1760
|
+
documents_renewal_date: string | null;
|
|
1761
|
+
balances: {
|
|
1762
|
+
documents: IAccountUsageBalance;
|
|
1763
|
+
credits: IAccountUsageBalance;
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
/** Document alert codes governed by the workspace notification policy. */
|
|
1767
|
+
type NotificationPolicyEvent = 'DocumentCompleted' | 'SignerDeclined' | 'DocumentCancelled' | 'DocumentAboutToExpire' | 'DocumentExpired' | 'DocumentExpirationReset' | 'DocumentProcessingFailed' | 'TemplateProcessingFailed' | 'SignerWhatsappFailed' | 'ContractRenewalNotice' | 'ContractExpiring' | 'ContractExpired' | 'ContractRenewed' | 'SignerViewed' | 'SignerSigned' | 'SignerIdentityReviewRequired';
|
|
1768
|
+
/** Workspace-wide alert policy returned by `GET /accounts/{accountId}/notification-policy`. */
|
|
1769
|
+
interface INotificationPolicy {
|
|
1770
|
+
/** Whether the requesting user is an owner and can change the policy. */
|
|
1771
|
+
editable: boolean;
|
|
1772
|
+
/** Owners also receive push alerts for every member's documents. */
|
|
1773
|
+
owners_receive_all: boolean;
|
|
1774
|
+
/** `false` silences that alert for everyone in the workspace, on every channel. */
|
|
1775
|
+
events: Record<NotificationPolicyEvent, boolean> & Record<string, boolean>;
|
|
1776
|
+
}
|
|
1777
|
+
/** Partial policy accepted by `PUT /accounts/{accountId}/notification-policy`. */
|
|
1778
|
+
interface IUpdateNotificationPolicyPayload {
|
|
1779
|
+
events?: Partial<Record<NotificationPolicyEvent, boolean>>;
|
|
1780
|
+
owners_receive_all?: boolean;
|
|
1781
|
+
}
|
|
1782
|
+
/** Push-notification alert codes for the authenticated user. */
|
|
1783
|
+
type PushPreferenceEvent = 'SignerViewed' | 'SignerSigned' | 'DocumentCompleted' | 'SignerDeclined' | 'DocumentAboutToExpire' | 'DocumentExpired' | 'SignerIdentityReviewRequired' | 'SignerWhatsappFailed';
|
|
1784
|
+
/** Push preferences returned by `GET /users/self/push-preferences`; new keys may appear. */
|
|
1785
|
+
type IPushPreferences = Record<PushPreferenceEvent, boolean> & Record<string, boolean>;
|
|
1786
|
+
/** Partial map accepted by `PUT /users/self/push-preferences`. */
|
|
1787
|
+
type IUpdatePushPreferences = Partial<Record<PushPreferenceEvent, boolean>>;
|
|
1788
|
+
/** An origin allowed to embed the workspace's signing pages. */
|
|
1789
|
+
interface IEmbedOrigin {
|
|
1790
|
+
id: string;
|
|
1791
|
+
/** Exact `scheme://host[:port]`, lowercased, without a trailing `/` or default port. */
|
|
1792
|
+
origin: string;
|
|
1793
|
+
created_at: string;
|
|
1794
|
+
}
|
|
1795
|
+
/** Single-use embed session returned by `embed.createSession()`. */
|
|
1796
|
+
interface IEmbedSession {
|
|
1797
|
+
/** Load in an iframe within 5 minutes; opening it spends the token. Never store or log it. */
|
|
1798
|
+
url: string;
|
|
1799
|
+
expires_at: string;
|
|
1800
|
+
}
|
|
1801
|
+
/** Signer of one envelope document; a signer appears only on their documents. */
|
|
1802
|
+
interface IEnvelopeDocumentSigner {
|
|
1803
|
+
id: string;
|
|
1804
|
+
full_name: string;
|
|
1805
|
+
email: string | null;
|
|
1806
|
+
whatsapp_phone_number: string | null;
|
|
1807
|
+
/** Whether they signed this document. */
|
|
1808
|
+
completed: boolean;
|
|
1809
|
+
signed_at: string | null;
|
|
1810
|
+
}
|
|
1811
|
+
/** One document of an envelope, in envelope order. */
|
|
1812
|
+
interface IEnvelopeDocument {
|
|
1813
|
+
id: string;
|
|
1814
|
+
/** Position in the envelope, from 1. */
|
|
1815
|
+
position: number;
|
|
1816
|
+
name: string;
|
|
1817
|
+
status: DocumentStatus | AnyString;
|
|
1818
|
+
/** Download URLs keyed by artifact name, as on the document read. */
|
|
1819
|
+
artifacts: Partial<Record<DocumentArtifactName, string>> & Record<string, string>;
|
|
1820
|
+
signers: IEnvelopeDocumentSigner[];
|
|
1821
|
+
}
|
|
1822
|
+
/** Envelope returned by every envelope read and mutation. */
|
|
1823
|
+
interface IEnvelope {
|
|
1824
|
+
resource?: string;
|
|
1825
|
+
id: string;
|
|
1826
|
+
name: string;
|
|
1827
|
+
message: string | null;
|
|
1828
|
+
documents: IEnvelopeDocument[];
|
|
1829
|
+
/** Documents per status code (only statuses present); `null` once it lists no document. */
|
|
1830
|
+
counts: Record<string, number> | null;
|
|
1831
|
+
/** One entry per signer; `url` is `null` for embedded and WhatsApp-only signers. */
|
|
1832
|
+
signing_urls: ISigningUrl[];
|
|
1833
|
+
created_at: string;
|
|
1834
|
+
}
|
|
1835
|
+
/** Paginated envelope-list response. */
|
|
1836
|
+
type IEnvelopeListResponse = PaginatedResult<IEnvelope>;
|
|
1837
|
+
/** Filters accepted by `envelopes.list()`. */
|
|
1838
|
+
interface IEnvelopeListParams extends IListParams {
|
|
1839
|
+
/** Part of the envelope name. */
|
|
1840
|
+
search?: string;
|
|
1841
|
+
/** `open`: a document is still open; `closed`: every document is closed. */
|
|
1842
|
+
status?: 'open' | 'closed';
|
|
1843
|
+
}
|
|
1844
|
+
/** An envelope signer, listed once by ID. Envelope signers take no `step`. */
|
|
1845
|
+
interface IEnvelopeSignerInput {
|
|
1846
|
+
id: string;
|
|
1847
|
+
verification_method?: AssignmentVerificationMethod;
|
|
1848
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
1849
|
+
/** Sign inside your app through `embed.createSession()`; needs the Embed feature. */
|
|
1850
|
+
embedded?: boolean;
|
|
1851
|
+
}
|
|
1852
|
+
/** A `metadata_ready`, unassigned workspace document to put in an envelope. */
|
|
1853
|
+
interface IEnvelopeDocumentInput {
|
|
1854
|
+
id: string;
|
|
1855
|
+
method?: AssignmentMethod;
|
|
1856
|
+
/** Required for `collect`: its signers are exactly those on its fields. */
|
|
1857
|
+
entries?: IAssignmentEntry[];
|
|
1858
|
+
/** This document's signers, each listed once in the envelope's `signers`. */
|
|
1859
|
+
signer_ids: string[];
|
|
1860
|
+
/** At least one hour ahead; date-only means 23:59 UTC, no offset means UTC. `null` for none. */
|
|
1861
|
+
expires_at?: string | null;
|
|
1862
|
+
/** Signer IDs that only receive a copy of this document. */
|
|
1863
|
+
copy_receiver_ids?: string[];
|
|
1864
|
+
}
|
|
1865
|
+
/** Body for `POST /accounts/{accountId}/envelopes` and its cost estimate. */
|
|
1866
|
+
interface ICreateEnvelopePayload {
|
|
1867
|
+
/** 1–255 characters without `<`; replaces document names in invitations. */
|
|
1868
|
+
name: string;
|
|
1869
|
+
message?: string | null;
|
|
1870
|
+
/** Refuse with `409 CreditCeilingExceeded` when the total would exceed it. Ignored by the estimate. */
|
|
1871
|
+
max_total_credits?: number;
|
|
1872
|
+
/** 1–20 signers; each must be on at least one document. */
|
|
1873
|
+
signers: IEnvelopeSignerInput[];
|
|
1874
|
+
/** 1–20 documents, in envelope order. */
|
|
1875
|
+
documents: IEnvelopeDocumentInput[];
|
|
1876
|
+
}
|
|
1877
|
+
/** Body for `POST /accounts/{accountId}/envelopes/{envelopeId}/documents`. */
|
|
1878
|
+
interface IAddEnvelopeDocumentPayload extends IEnvelopeDocumentInput {
|
|
1879
|
+
/** Refuse with `409 CreditCeilingExceeded` when this document costs more. */
|
|
1880
|
+
max_total_credits?: number;
|
|
1881
|
+
}
|
|
1882
|
+
/** Body for `PATCH /accounts/{accountId}/envelopes/{envelopeId}`; send only what changes. */
|
|
1883
|
+
interface IUpdateEnvelopePayload {
|
|
1884
|
+
name?: string;
|
|
1885
|
+
/** `null` removes the message. */
|
|
1886
|
+
message?: string | null;
|
|
1887
|
+
/** Every document of the envelope, each once, in the new order. */
|
|
1888
|
+
document_ids?: string[];
|
|
1889
|
+
}
|
|
1890
|
+
/** Envelope activity: a document activity naming its document. */
|
|
1891
|
+
interface IEnvelopeActivity extends IDocumentActivity {
|
|
1892
|
+
document_id: string;
|
|
1893
|
+
document_name: string;
|
|
1894
|
+
}
|
|
1895
|
+
/** Per-document outcome of `envelopes.cancel()`. */
|
|
1896
|
+
interface IEnvelopeCancelResult {
|
|
1897
|
+
id: string;
|
|
1898
|
+
/** The document's status after the call. */
|
|
1899
|
+
status: DocumentStatus | AnyString;
|
|
1900
|
+
/** Whether this call cancelled it. */
|
|
1901
|
+
cancelled: boolean;
|
|
1902
|
+
}
|
|
1903
|
+
/** Acknowledgement of `envelopes.resendNotification()`. */
|
|
1904
|
+
interface IEnvelopeResendResponse {
|
|
1905
|
+
/** Whether every notification method sent it. */
|
|
1906
|
+
is_sent: boolean;
|
|
1907
|
+
envelope_id: string;
|
|
1908
|
+
signer_id: string;
|
|
1909
|
+
}
|
|
1910
|
+
/** Envelope a signer's code belongs to (`expand: 'envelope'`). */
|
|
1911
|
+
interface IDocumentEnvelopeRef {
|
|
1912
|
+
id: string;
|
|
1913
|
+
name: string;
|
|
1914
|
+
}
|
|
1915
|
+
/** Whether a signer can ask for the certified copy again. */
|
|
1916
|
+
interface ISignerCertifiedCopyStatus {
|
|
1917
|
+
available: boolean;
|
|
1918
|
+
notification_method: AssignmentNotificationMethod | null;
|
|
1919
|
+
/** WhatsApp re-sends left; `null` for e-mail. */
|
|
1920
|
+
resends_left: number | null;
|
|
1921
|
+
}
|
|
1922
|
+
/** Result of asking for the certified copy again. */
|
|
1923
|
+
interface ICertifiedCopyResendResult {
|
|
1924
|
+
/** Whether it can be asked for again. */
|
|
1925
|
+
available: boolean;
|
|
1926
|
+
notification_method: AssignmentNotificationMethod;
|
|
1927
|
+
/** WhatsApp re-sends left; `null` for e-mail. */
|
|
1928
|
+
resends_left: number | null;
|
|
1929
|
+
/** Masked contact it went to, e.g. `j***@example.com`. */
|
|
1930
|
+
sent_to: string;
|
|
1931
|
+
}
|
|
1932
|
+
/** Signer as `GET /sign` and `GET /signers/{signerId}/document` describe them. */
|
|
1933
|
+
type ISigningCurrentSigner = Partial<ISigner> & {
|
|
1934
|
+
id: string;
|
|
1935
|
+
verification_method: AssignmentVerificationMethod | AnyString;
|
|
1936
|
+
/** `null` on requests stored before they were recorded. */
|
|
1937
|
+
notification_methods: Array<AssignmentNotificationMethod | AnyString> | null;
|
|
1938
|
+
/** Whether this signer has signed. */
|
|
1939
|
+
completed: boolean;
|
|
1940
|
+
};
|
|
1941
|
+
/**
|
|
1942
|
+
* Document read with a signer access code. While the code is open it is the
|
|
1943
|
+
* full document, whose `assignment` carries only this signer's items (no other
|
|
1944
|
+
* signers, `signing_urls`, copy receivers or `summary`). Once the signer has
|
|
1945
|
+
* been done for 30 minutes the code closes: only `id`, `name`, `status`,
|
|
1946
|
+
* `current_signer`, `certified_copy` (and `envelope`, when asked for) remain,
|
|
1947
|
+
* with `is_signer_access_closed: true`.
|
|
1948
|
+
*/
|
|
1949
|
+
type ISigningDocument = Partial<Omit<IDocumentDetailsResponse, 'assignment'>> & {
|
|
1950
|
+
/** The signer's own items only: no `signers`, `signing_urls`, `copy_receivers` or `summary`. */
|
|
1951
|
+
assignment?: Omit<IAssignment, 'signers' | 'signing_urls' | 'copy_receivers' | 'summary'> | null;
|
|
1952
|
+
id: string;
|
|
1953
|
+
name: string;
|
|
1954
|
+
status: DocumentStatus | AnyString;
|
|
1955
|
+
current_signer: ISigningCurrentSigner;
|
|
1956
|
+
is_signer_access_closed: boolean;
|
|
1957
|
+
certified_copy: ISignerCertifiedCopyStatus;
|
|
1958
|
+
/** Only with `expand: ['envelope']`; `null` outside an envelope. */
|
|
1959
|
+
envelope?: IDocumentEnvelopeRef | null;
|
|
1960
|
+
};
|
|
1961
|
+
/** Signer state returned by `PUT /signers/accept-terms`. */
|
|
1962
|
+
interface IAcceptTermsResult {
|
|
1963
|
+
full_name: string;
|
|
1964
|
+
email: string | null;
|
|
1965
|
+
has_accepted_terms: boolean;
|
|
1966
|
+
}
|
|
1967
|
+
/** Filters accepted by the signer document list. */
|
|
1968
|
+
interface ISignerDocumentListParams extends IListParams {
|
|
1969
|
+
/** Only the documents of this envelope. */
|
|
1970
|
+
envelope_id?: string;
|
|
1971
|
+
}
|
|
1972
|
+
/** Options for reading the document to sign (`GET /sign`). */
|
|
1973
|
+
interface ISigningReadOptions {
|
|
1974
|
+
/** Sent as `has_accepted_terms`; records the signer's acceptance. */
|
|
1975
|
+
hasAcceptedTerms?: boolean;
|
|
1976
|
+
/** `['envelope']` adds the envelope the code belongs to. */
|
|
1977
|
+
expand?: Array<'envelope'>;
|
|
1978
|
+
/** With an envelope code: another document of that envelope the signer is on. */
|
|
1979
|
+
documentId?: string;
|
|
1980
|
+
}
|
|
1981
|
+
/** Options for `documents.details()` / `documents.get()`. */
|
|
1982
|
+
interface IDocumentDetailsOptions {
|
|
1983
|
+
/** `envelope_id` adds the document's envelope ID; `envelope` its `{ id, name }`. */
|
|
1984
|
+
expand?: Array<'envelope_id' | 'envelope'>;
|
|
1985
|
+
}
|
|
1986
|
+
/** Options for `documents.thumbnail()` / `documents.downloadPage()`. */
|
|
1987
|
+
interface IDocumentRenderOptions {
|
|
1988
|
+
/** `certificated`: render as in the signed document (`404` until certified, `503` while pending). */
|
|
1989
|
+
artifact?: 'certificated';
|
|
1990
|
+
}
|
|
1654
1991
|
|
|
1655
1992
|
/** Maximum upload size accepted by the API (hard limit, 25 MB). */
|
|
1656
1993
|
declare const MAX_UPLOAD_BYTES: number;
|
|
@@ -1958,7 +2295,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
1958
2295
|
* `null`), rendered `pages`, and `artifacts`. `decline_reason` is returned
|
|
1959
2296
|
* only when the access token belongs to the document creator.
|
|
1960
2297
|
*
|
|
2298
|
+
* `expand: ['envelope_id']` adds the envelope the document is in and
|
|
2299
|
+
* `expand: ['envelope']` its `{ id, name }` (each `null` outside one).
|
|
2300
|
+
*
|
|
1961
2301
|
* @param documentId - The document to fetch.
|
|
2302
|
+
* @param options - `expand`: `envelope_id` and/or `envelope`.
|
|
1962
2303
|
* @returns The document. Response shape (once `metadata_ready`):
|
|
1963
2304
|
* ```jsonc
|
|
1964
2305
|
* {
|
|
@@ -1987,37 +2328,44 @@ declare class DocumentResource extends BaseResource {
|
|
|
1987
2328
|
* "download_url": "https://…/documents/103ad216…/pages/103ad216…/download"
|
|
1988
2329
|
* }
|
|
1989
2330
|
* ],
|
|
2331
|
+
* "has_contract": false,
|
|
2332
|
+
* "envelope_id": null, // with expand: ['envelope_id']
|
|
2333
|
+
* "envelope": null, // with expand: ['envelope']
|
|
1990
2334
|
* "created_at": "2026-07-19T17:24:43Z",
|
|
1991
2335
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1992
2336
|
* }
|
|
1993
2337
|
* ```
|
|
1994
|
-
* @throws {ValidationError} If `documentId` is missing.
|
|
1995
|
-
* @throws {ApiError} `
|
|
2338
|
+
* @throws {ValidationError} If `documentId` is missing or `expand` is unknown.
|
|
2339
|
+
* @throws {ApiError} `403` when a role or OAuth scope refuses it, `404` if the
|
|
2340
|
+
* document does not exist.
|
|
1996
2341
|
*
|
|
1997
2342
|
* @example
|
|
1998
2343
|
* ```ts
|
|
1999
|
-
* const doc = await client.documents.details('103ad216846e6b90710cb9acef59'
|
|
2000
|
-
*
|
|
2344
|
+
* const doc = await client.documents.details('103ad216846e6b90710cb9acef59', {
|
|
2345
|
+
* expand: ['envelope'],
|
|
2346
|
+
* });
|
|
2347
|
+
* console.log(doc.status, doc.envelope?.name);
|
|
2001
2348
|
* ```
|
|
2002
2349
|
*/
|
|
2003
|
-
details(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
2350
|
+
details(documentId: string, options?: IDocumentDetailsOptions): Promise<IDocumentDetailsResponse>;
|
|
2004
2351
|
private fetchDetails;
|
|
2005
2352
|
/**
|
|
2006
2353
|
* Alias for {@link DocumentResource.details}
|
|
2007
2354
|
* (`GET /documents/{documentId}`).
|
|
2008
2355
|
*
|
|
2009
2356
|
* @param documentId - The document to fetch.
|
|
2357
|
+
* @param options - `expand`, as on {@link DocumentResource.details}.
|
|
2010
2358
|
* @returns The document details (see {@link DocumentResource.details} for
|
|
2011
2359
|
* the response shape).
|
|
2012
2360
|
* @throws {ValidationError} If `documentId` is missing.
|
|
2013
|
-
* @throws {ApiError} `
|
|
2361
|
+
* @throws {ApiError} `403` or `404`, as on {@link DocumentResource.details}.
|
|
2014
2362
|
*
|
|
2015
2363
|
* @example
|
|
2016
2364
|
* ```ts
|
|
2017
2365
|
* const doc = await client.documents.get('103ad216846e6b90710cb9acef59');
|
|
2018
2366
|
* ```
|
|
2019
2367
|
*/
|
|
2020
|
-
get(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
2368
|
+
get(documentId: string, options?: IDocumentDetailsOptions): Promise<IDocumentDetailsResponse>;
|
|
2021
2369
|
/**
|
|
2022
2370
|
* Poll {@link DocumentResource.details} until the document reaches a ready
|
|
2023
2371
|
* status (`metadata_ready`, `pending_signature`, `pending_identity_review`,
|
|
@@ -2084,10 +2432,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
2084
2432
|
* Download the document thumbnail image
|
|
2085
2433
|
* (`GET /documents/{documentId}/thumbnail`).
|
|
2086
2434
|
*
|
|
2435
|
+
* `artifact: 'certificated'` renders it as it is in the signed document.
|
|
2436
|
+
*
|
|
2087
2437
|
* @param documentId - The document whose thumbnail to fetch.
|
|
2088
|
-
* @
|
|
2089
|
-
* @
|
|
2090
|
-
* @throws {
|
|
2438
|
+
* @param options - `artifact: 'certificated'` for the signed render.
|
|
2439
|
+
* @returns A {@link Buffer} of the thumbnail image bytes (`image/*`).
|
|
2440
|
+
* @throws {ValidationError} If `documentId` is missing or `artifact` is unknown.
|
|
2441
|
+
* @throws {ApiError} `404` if the document, its thumbnail, or (with
|
|
2442
|
+
* `certificated`) its certification does not exist; `503` while the signed
|
|
2443
|
+
* render is still being produced — wait `rateLimit.retryAfter` seconds.
|
|
2091
2444
|
*
|
|
2092
2445
|
* @example
|
|
2093
2446
|
* ```ts
|
|
@@ -2095,19 +2448,22 @@ declare class DocumentResource extends BaseResource {
|
|
|
2095
2448
|
* await fs.promises.writeFile('thumb.jpg', thumb);
|
|
2096
2449
|
* ```
|
|
2097
2450
|
*/
|
|
2098
|
-
thumbnail(documentId: string): Promise<Buffer>;
|
|
2451
|
+
thumbnail(documentId: string, options?: IDocumentRenderOptions): Promise<Buffer>;
|
|
2099
2452
|
/**
|
|
2100
|
-
* Download a single rendered page
|
|
2453
|
+
* Download a single rendered page image
|
|
2101
2454
|
* (`GET /documents/{documentId}/pages/{pageId}/download`).
|
|
2102
2455
|
*
|
|
2103
2456
|
* The `pageId` comes from a page's `id` in {@link DocumentResource.details}
|
|
2104
|
-
* or {@link DocumentResource.list} (`pages[].id`).
|
|
2457
|
+
* or {@link DocumentResource.list} (`pages[].id`). `artifact: 'certificated'`
|
|
2458
|
+
* renders the page as it is in the signed document.
|
|
2105
2459
|
*
|
|
2106
2460
|
* @param documentId - The document the page belongs to.
|
|
2107
2461
|
* @param pageId - The page to download.
|
|
2108
|
-
* @
|
|
2109
|
-
* @
|
|
2110
|
-
* @throws {
|
|
2462
|
+
* @param options - `artifact: 'certificated'` for the signed render.
|
|
2463
|
+
* @returns A {@link Buffer} of the page image bytes (`image/*`).
|
|
2464
|
+
* @throws {ValidationError} If `documentId` or `pageId` is missing, or `artifact` is unknown.
|
|
2465
|
+
* @throws {ApiError} `404` if the document or page does not exist (or, with
|
|
2466
|
+
* `certificated`, is not certified); `503` while the signed render is pending.
|
|
2111
2467
|
*
|
|
2112
2468
|
* @example
|
|
2113
2469
|
* ```ts
|
|
@@ -2116,7 +2472,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2116
2472
|
* await fs.promises.writeFile('page-1.jpg', page);
|
|
2117
2473
|
* ```
|
|
2118
2474
|
*/
|
|
2119
|
-
downloadPage(documentId: string, pageId: string): Promise<Buffer>;
|
|
2475
|
+
downloadPage(documentId: string, pageId: string, options?: IDocumentRenderOptions): Promise<Buffer>;
|
|
2120
2476
|
/**
|
|
2121
2477
|
* Fetch a page of the document activity log
|
|
2122
2478
|
* (`GET /documents/{documentId}/activities`).
|
|
@@ -2130,7 +2486,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2130
2486
|
* @param documentId - The document whose activity log to fetch.
|
|
2131
2487
|
* @param params - Optional pagination and sorting parameters.
|
|
2132
2488
|
* @param params.page - Page number, starting at 1.
|
|
2133
|
-
* @param params.per-page - Entries per page (
|
|
2489
|
+
* @param params.per-page - Entries per page (default 20, at most 50; a larger value answers 50).
|
|
2134
2490
|
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2135
2491
|
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2136
2492
|
* @returns The requested page of activity entries, or `[]`:
|
|
@@ -2160,7 +2516,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2160
2516
|
* @example
|
|
2161
2517
|
* ```ts
|
|
2162
2518
|
* const events = await client.documents.activities('doc-1', {
|
|
2163
|
-
* page: 2, 'per-page':
|
|
2519
|
+
* page: 2, 'per-page': 50, sort: 'id',
|
|
2164
2520
|
* });
|
|
2165
2521
|
* console.log(events.map((e) => e.event));
|
|
2166
2522
|
* ```
|
|
@@ -2178,7 +2534,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2178
2534
|
* @param documentId - The document whose activity log to fetch.
|
|
2179
2535
|
* @param params - Optional pagination and sorting parameters.
|
|
2180
2536
|
* @param params.page - Page number, starting at 1.
|
|
2181
|
-
* @param params.per-page - Entries per page (
|
|
2537
|
+
* @param params.per-page - Entries per page (default 20, at most 50; a larger value answers 50).
|
|
2182
2538
|
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2183
2539
|
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2184
2540
|
* @returns Activity entries and pagination metadata when the server supplies it:
|
|
@@ -2210,13 +2566,16 @@ declare class DocumentResource extends BaseResource {
|
|
|
2210
2566
|
* Only documents in a deletable status can be removed — the API returns
|
|
2211
2567
|
* `400` while the document is still `uploading` / `metadata_processing`
|
|
2212
2568
|
* (await {@link DocumentResource.waitUntilReady} first) or once it has been
|
|
2213
|
-
* certificated.
|
|
2569
|
+
* certificated. Deleting a `pending_signature` or `pending_identity_review`
|
|
2570
|
+
* document cancels it and notifies its signers. A document of an envelope
|
|
2571
|
+
* with an open document cannot be deleted on its own: cancel the envelope.
|
|
2214
2572
|
*
|
|
2215
2573
|
* @param documentId - The document to delete.
|
|
2216
2574
|
* @returns Nothing; resolves when the document is deleted.
|
|
2217
2575
|
* @throws {ValidationError} If `documentId` is missing.
|
|
2218
2576
|
* @throws {ApiError} `400` if the document is not in a deletable status;
|
|
2219
|
-
* `404` if it does not exist
|
|
2577
|
+
* `403` when a role or OAuth scope refuses it; `404` if it does not exist;
|
|
2578
|
+
* `409` (`EnvelopeOpen`) while its envelope has an open document.
|
|
2220
2579
|
*
|
|
2221
2580
|
* @example
|
|
2222
2581
|
* ```ts
|
|
@@ -2571,13 +2930,14 @@ declare class DocumentResource extends BaseResource {
|
|
|
2571
2930
|
* { "code": "uploaded", "deletable": false },
|
|
2572
2931
|
* { "code": "metadata_processing", "deletable": false },
|
|
2573
2932
|
* { "code": "metadata_ready", "deletable": true },
|
|
2574
|
-
* { "code": "
|
|
2575
|
-
* { "code": "expired", "deletable": false },
|
|
2933
|
+
* { "code": "expired", "deletable": true },
|
|
2576
2934
|
* { "code": "certificating", "deletable": false },
|
|
2577
2935
|
* { "code": "certificated", "deletable": false },
|
|
2578
|
-
* { "code": "rejected_by_signer", "deletable":
|
|
2579
|
-
* { "code": "
|
|
2580
|
-
* { "code": "
|
|
2936
|
+
* { "code": "rejected_by_signer", "deletable": true },
|
|
2937
|
+
* { "code": "pending_signature", "deletable": true },
|
|
2938
|
+
* { "code": "pending_identity_review", "deletable": true }, // deleting cancels and notifies signers
|
|
2939
|
+
* { "code": "rejected_by_user", "deletable": true },
|
|
2940
|
+
* { "code": "failed", "deletable": true }
|
|
2581
2941
|
* ]
|
|
2582
2942
|
* ```
|
|
2583
2943
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -3055,7 +3415,13 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
3055
3415
|
/**
|
|
3056
3416
|
* Fetch a single workspace (`GET /accounts/{accountId}`).
|
|
3057
3417
|
*
|
|
3418
|
+
* `expand: 'signing_features'` adds which signing methods the plan allows
|
|
3419
|
+
* (OAuth: `account:read`). A `false` feature makes creating or estimating an
|
|
3420
|
+
* assignment, template document or envelope with that method answer `403`
|
|
3421
|
+
* (`PlanRestricted`); check it before offering the method.
|
|
3422
|
+
*
|
|
3058
3423
|
* @param accountId - The workspace to fetch.
|
|
3424
|
+
* @param options - `expand: 'signing_features'`.
|
|
3059
3425
|
* @returns The workspace. `primary_color` / `secondary_color` are `null`
|
|
3060
3426
|
* until brand colours are set (6-char hex, no `#`, when present):
|
|
3061
3427
|
* ```jsonc
|
|
@@ -3068,31 +3434,127 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
3068
3434
|
* "notification_sender_type": "User",
|
|
3069
3435
|
* "roles": ["owner"],
|
|
3070
3436
|
* "is_delete_allowed": true,
|
|
3437
|
+
* "limits": { "webhook_endpoints": 3 },
|
|
3438
|
+
* "signing_features": { // only with expand: 'signing_features'
|
|
3439
|
+
* "DigitalCertificate": true,
|
|
3440
|
+
* "VerificationIdDocumentFaceMatchBasic": true,
|
|
3441
|
+
* "WhatsappNotification": true,
|
|
3442
|
+
* "VerificationBypass": false,
|
|
3443
|
+
* "Embed": true
|
|
3444
|
+
* },
|
|
3071
3445
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
3072
3446
|
* }
|
|
3073
3447
|
* ```
|
|
3448
|
+
* @throws {ValidationError} If `accountId` is missing or `expand` is unknown.
|
|
3449
|
+
* @throws {ApiError} `403` for another workspace's token, `404` if the
|
|
3450
|
+
* workspace does not exist.
|
|
3451
|
+
*
|
|
3452
|
+
* @example
|
|
3453
|
+
* ```ts
|
|
3454
|
+
* const ws = await client.workspaces.get('acc_example', { expand: 'signing_features' });
|
|
3455
|
+
* if (ws.signing_features?.Embed) await client.embed.listOrigins();
|
|
3456
|
+
* ```
|
|
3457
|
+
*/
|
|
3458
|
+
get(accountId: string, options?: {
|
|
3459
|
+
expand?: 'signing_features';
|
|
3460
|
+
}): Promise<IWorkspaceResponse>;
|
|
3461
|
+
/**
|
|
3462
|
+
* Read the workspace's plan and balances (`GET /accounts/{accountId}/usage`).
|
|
3463
|
+
*
|
|
3464
|
+
* For a plan and credit meter; prices and payments are not included. Not
|
|
3465
|
+
* available to third-party OAuth applications (`403`), whatever their scopes.
|
|
3466
|
+
*
|
|
3467
|
+
* @param accountId - The workspace to read.
|
|
3468
|
+
* @returns The plan meter:
|
|
3469
|
+
* ```jsonc
|
|
3470
|
+
* {
|
|
3471
|
+
* "plan": "Pro", // null without a current plan
|
|
3472
|
+
* "documents_renewal_date": "2026-12-11",
|
|
3473
|
+
* "balances": {
|
|
3474
|
+
* "documents": { "balance": 97, "limit": 100, "spent": 3 },
|
|
3475
|
+
* "credits": { "balance": 12.5, "limit": null, "spent": 0.9 } // null: unlimited / not cycle-limited
|
|
3476
|
+
* }
|
|
3477
|
+
* }
|
|
3478
|
+
* ```
|
|
3479
|
+
* @throws {ValidationError} If `accountId` is missing.
|
|
3480
|
+
* @throws {ApiError} `403` for an OAuth application token, `404` for an unknown workspace.
|
|
3481
|
+
*
|
|
3482
|
+
* @example
|
|
3483
|
+
* ```ts
|
|
3484
|
+
* const { balances } = await client.workspaces.getUsage('acc_example');
|
|
3485
|
+
* ```
|
|
3486
|
+
*/
|
|
3487
|
+
getUsage(accountId: string): Promise<IAccountUsage>;
|
|
3488
|
+
/**
|
|
3489
|
+
* Read which document alerts the workspace sends
|
|
3490
|
+
* (`GET /accounts/{accountId}/notification-policy`).
|
|
3491
|
+
*
|
|
3492
|
+
* Every member can read it; `editable` says whether the caller (an owner)
|
|
3493
|
+
* can change it. Not available to third-party OAuth applications.
|
|
3494
|
+
*
|
|
3495
|
+
* @param accountId - The workspace to read.
|
|
3496
|
+
* @returns The policy; every event key is present:
|
|
3497
|
+
* ```jsonc
|
|
3498
|
+
* {
|
|
3499
|
+
* "editable": true,
|
|
3500
|
+
* "owners_receive_all": false, // owners also get push alerts for members' documents
|
|
3501
|
+
* "events": {
|
|
3502
|
+
* "DocumentCompleted": true, "SignerDeclined": true, "DocumentCancelled": true,
|
|
3503
|
+
* "DocumentAboutToExpire": true, "DocumentExpired": true, "DocumentExpirationReset": true,
|
|
3504
|
+
* "DocumentProcessingFailed": true, "TemplateProcessingFailed": true, "SignerWhatsappFailed": true,
|
|
3505
|
+
* "ContractRenewalNotice": true, "ContractExpiring": true, "ContractExpired": true,
|
|
3506
|
+
* "ContractRenewed": true, "SignerViewed": true, "SignerSigned": true,
|
|
3507
|
+
* "SignerIdentityReviewRequired": true
|
|
3508
|
+
* }
|
|
3509
|
+
* }
|
|
3510
|
+
* ```
|
|
3074
3511
|
* @throws {ValidationError} If `accountId` is missing.
|
|
3075
|
-
* @throws {ApiError} `
|
|
3512
|
+
* @throws {ApiError} `403` for an OAuth application token.
|
|
3513
|
+
*
|
|
3514
|
+
* @example
|
|
3515
|
+
* ```ts
|
|
3516
|
+
* const policy = await client.workspaces.getNotificationPolicy('acc_example');
|
|
3517
|
+
* ```
|
|
3518
|
+
*/
|
|
3519
|
+
getNotificationPolicy(accountId: string): Promise<INotificationPolicy>;
|
|
3520
|
+
/**
|
|
3521
|
+
* Change which document alerts the workspace sends
|
|
3522
|
+
* (`PUT /accounts/{accountId}/notification-policy`).
|
|
3523
|
+
*
|
|
3524
|
+
* Owners only. Merges what is sent: an event set to `false` reaches nobody
|
|
3525
|
+
* in the workspace on any channel, whatever each member's preferences. The
|
|
3526
|
+
* identity-review e-mail is always sent, because the signer cannot continue
|
|
3527
|
+
* without it.
|
|
3528
|
+
*
|
|
3529
|
+
* @param accountId - The workspace to change.
|
|
3530
|
+
* @param payload - `events` keys to change and/or `owners_receive_all`.
|
|
3531
|
+
* @returns The full policy, as {@link WorkspaceResource.getNotificationPolicy} returns.
|
|
3532
|
+
* @throws {ValidationError} If nothing would change or a value is not a boolean.
|
|
3533
|
+
* @throws {ApiError} `400` for an unknown event code, `403` for a non-owner or
|
|
3534
|
+
* an OAuth application token.
|
|
3076
3535
|
*
|
|
3077
3536
|
* @example
|
|
3078
3537
|
* ```ts
|
|
3079
|
-
*
|
|
3538
|
+
* await client.workspaces.updateNotificationPolicy('acc_example', {
|
|
3539
|
+
* events: { SignerViewed: false },
|
|
3540
|
+
* owners_receive_all: true,
|
|
3541
|
+
* });
|
|
3080
3542
|
* ```
|
|
3081
3543
|
*/
|
|
3082
|
-
|
|
3544
|
+
updateNotificationPolicy(accountId: string, payload: IUpdateNotificationPolicyPayload): Promise<INotificationPolicy>;
|
|
3083
3545
|
/**
|
|
3084
3546
|
* Fetch account branding (`GET /accounts/{accountId}/theme`).
|
|
3085
3547
|
*
|
|
3086
3548
|
* Request body/query: none.
|
|
3087
3549
|
*
|
|
3088
3550
|
* @param accountId - Account whose public branding should be returned.
|
|
3089
|
-
* @returns The unwrapped theme:
|
|
3551
|
+
* @returns The unwrapped theme. Colours fall back to the platform default:
|
|
3090
3552
|
* ```jsonc
|
|
3091
3553
|
* {
|
|
3092
3554
|
* "account_name": "Acme Inc.",
|
|
3093
|
-
* "primary_color": "aabbcc",
|
|
3094
|
-
* "secondary_color": "112233",
|
|
3095
|
-
* "logo": "https://api.assinafy.com.br/v1/accounts/account-id/logo"
|
|
3555
|
+
* "primary_color": "aabbcc", // button background
|
|
3556
|
+
* "secondary_color": "112233", // button text
|
|
3557
|
+
* "logo": "https://api.assinafy.com.br/v1/accounts/account-id/logo" // null without a logo
|
|
3096
3558
|
* }
|
|
3097
3559
|
* ```
|
|
3098
3560
|
* @throws {ValidationError} If `accountId` is empty.
|
|
@@ -3296,7 +3758,7 @@ declare const DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate
|
|
|
3296
3758
|
* @param payload - Assignment method, signer references, and optional message,
|
|
3297
3759
|
* expiration, copy-receiver signer IDs, or collect-field placements.
|
|
3298
3760
|
* @returns A JSON-ready body shaped as
|
|
3299
|
-
* `{ method, signers: [{ id, verification_method?, notification_methods?, step? }], message?, expires_at?, copy_receivers?, entries? }`.
|
|
3761
|
+
* `{ method, signers: [{ id, verification_method?, notification_methods?, embedded?, step? }], message?, expires_at?, copy_receivers?, entries?, max_total_credits? }`.
|
|
3300
3762
|
* @throws {ValidationError} If no signer is present, a signer reference is
|
|
3301
3763
|
* malformed, a collect assignment has no field-placement entries, or a
|
|
3302
3764
|
* `DigitalCertificate` signer is combined with `method: 'collect'`. The last
|
|
@@ -3317,12 +3779,13 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3317
3779
|
/**
|
|
3318
3780
|
* List assignments across the workspace (`GET /assignments`).
|
|
3319
3781
|
*
|
|
3320
|
-
* The account is passed as
|
|
3321
|
-
*
|
|
3322
|
-
*
|
|
3323
|
-
*
|
|
3782
|
+
* The account is passed as the camelCase `accountId` **query parameter**,
|
|
3783
|
+
* required unless an OAuth token names the workspace (the SDK always sends
|
|
3784
|
+
* it; for a token, its own workspace). `account_id` and an `X-Account-Id`
|
|
3785
|
+
* header are ignored.
|
|
3324
3786
|
*
|
|
3325
|
-
* @param params - `page`, `per-page
|
|
3787
|
+
* @param params - `page`, `per-page` (at most 50), and `sort`: `created_at`
|
|
3788
|
+
* (default, oldest first), `expires_at` or `id`, `-` prefix for descending.
|
|
3326
3789
|
* @param accountId - Override the client's default account ID.
|
|
3327
3790
|
* @returns Assignments, with pagination in `meta`. Each item is a full
|
|
3328
3791
|
* {@link IAssignment} (same shape as {@link AssignmentResource.create}
|
|
@@ -3390,13 +3853,15 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3390
3853
|
* "signing_urls": [
|
|
3391
3854
|
* {
|
|
3392
3855
|
* "signer_id": "19e6b92e7895332ed9708535d8c",
|
|
3393
|
-
* "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
|
|
3856
|
+
* "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com",
|
|
3857
|
+
* "embedded": false
|
|
3394
3858
|
* }
|
|
3395
3859
|
* ]
|
|
3396
3860
|
* }
|
|
3397
3861
|
* ```
|
|
3398
3862
|
* @throws {ValidationError} If no account ID is available.
|
|
3399
|
-
* @throws {ApiError}
|
|
3863
|
+
* @throws {ApiError} `400` when no workspace is named, `403` when a role or
|
|
3864
|
+
* OAuth scope refuses it, `404` for an unknown workspace.
|
|
3400
3865
|
*
|
|
3401
3866
|
* @example
|
|
3402
3867
|
* ```ts
|
|
@@ -3448,7 +3913,13 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3448
3913
|
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
3449
3914
|
* addresses), and `collect`-mode `entries` with page-image geometry.
|
|
3450
3915
|
* `expires_at` accepts a date (ending at 23:59 UTC), a date-time without
|
|
3451
|
-
* an offset (UTC), or an offset-aware date-time.
|
|
3916
|
+
* an offset (UTC), or an offset-aware date-time, at least one hour ahead.
|
|
3917
|
+
* `max_total_credits` refuses the send above that many credits. Signers may
|
|
3918
|
+
* set `embedded: true` (Embed feature; `Email`, `Whatsapp` or `Bypass`
|
|
3919
|
+
* verification) to sign in your app through `embed.createSession()`.
|
|
3920
|
+
* This route takes no `Idempotency-Key`: a document takes one assignment,
|
|
3921
|
+
* so a retry after a lost response answers `400` and charges nothing —
|
|
3922
|
+
* read the document to see whether the first request went through.
|
|
3452
3923
|
* @returns The created {@link IAssignment}: `signers` (rich, with `step` /
|
|
3453
3924
|
* `notified` / `verification_method`), `items` (one row per signer × field),
|
|
3454
3925
|
* a `summary` count block, and per-signer `signing_urls`. Response shape:
|
|
@@ -3513,7 +3984,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3513
3984
|
* "signing_urls": [
|
|
3514
3985
|
* {
|
|
3515
3986
|
* "signer_id": "19e6b92e7895332ed9708535d8c",
|
|
3516
|
-
* "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
|
|
3987
|
+
* "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com",
|
|
3988
|
+
* "embedded": false // an embedded signer has "url": null
|
|
3517
3989
|
* }
|
|
3518
3990
|
* ]
|
|
3519
3991
|
* }
|
|
@@ -3523,7 +3995,10 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3523
3995
|
* combined with `collect`. The last case has `errors.code ===
|
|
3524
3996
|
* 'digital_certificate_requires_virtual_method'`.
|
|
3525
3997
|
* @throws {ApiError} `400` for an invalid assignment or unmet verification
|
|
3526
|
-
* precondition;
|
|
3998
|
+
* precondition; `403` (`PlanRestricted` for a method or Embed the plan
|
|
3999
|
+
* lacks, `InsufficientScope`); `404` for a document outside the workspace;
|
|
4000
|
+
* `409` (`CreditCeilingExceeded`, with `total_credits` and
|
|
4001
|
+
* `max_total_credits` in `responseData`).
|
|
3527
4002
|
*
|
|
3528
4003
|
* @example
|
|
3529
4004
|
* ```ts
|
|
@@ -3532,7 +4007,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3532
4007
|
* message: 'Please sign this contract',
|
|
3533
4008
|
* });
|
|
3534
4009
|
* // → wire body: { method: 'virtual', signers: [{ id: '19e6…' }], message: 'Please sign this contract' }
|
|
3535
|
-
* console.log(assignment.signing_urls?.length); // one
|
|
4010
|
+
* console.log(assignment.signing_urls?.length); // one entry per notified signer; url is null for embedded or WhatsApp-only signers
|
|
3536
4011
|
* ```
|
|
3537
4012
|
*/
|
|
3538
4013
|
create(documentId: string, payload: ICreateAssignmentPayload): Promise<ICreateAssignmentResponse>;
|
|
@@ -3689,7 +4164,11 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3689
4164
|
* }
|
|
3690
4165
|
* ```
|
|
3691
4166
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
3692
|
-
* @throws {ApiError}
|
|
4167
|
+
* @throws {ApiError} `400` when the document is not pending signature, the
|
|
4168
|
+
* signer already signed or waits for an earlier step, or credits are short;
|
|
4169
|
+
* `403`; `404`. The same verification code is resent, so an open embed frame
|
|
4170
|
+
* keeps working; envelope signers can be reminded of every document at once
|
|
4171
|
+
* with `envelopes.resendNotification()`.
|
|
3693
4172
|
*
|
|
3694
4173
|
* @example
|
|
3695
4174
|
* ```ts
|
|
@@ -3708,26 +4187,20 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3708
4187
|
* @param documentId - The document the assignment belongs to.
|
|
3709
4188
|
* @param assignmentId - The assignment containing the signer.
|
|
3710
4189
|
* @param signerId - The signer whose notification would be resent.
|
|
3711
|
-
* @returns An {@link IResendCostEstimate}:
|
|
3712
|
-
*
|
|
3713
|
-
*
|
|
4190
|
+
* @returns An {@link IResendCostEstimate}: the compact `total` /
|
|
4191
|
+
* `has_sufficient_credits` shape production returns, or the full
|
|
4192
|
+
* {@link ICostEstimate} on older deployments:
|
|
3714
4193
|
* ```jsonc
|
|
3715
4194
|
* {
|
|
3716
|
-
* "
|
|
3717
|
-
* "
|
|
3718
|
-
* "
|
|
3719
|
-
* "
|
|
3720
|
-
* "total_credits": 0,
|
|
3721
|
-
* "breakdown": [],
|
|
3722
|
-
* "document_balance": 67,
|
|
3723
|
-
* "credit_balance": 0,
|
|
3724
|
-
* "has_sufficient_resources": true,
|
|
3725
|
-
* "blocking_reason": null,
|
|
3726
|
-
* "message": null
|
|
4195
|
+
* "total": 0.45,
|
|
4196
|
+
* "breakdown": [{ "code": "NotificationWhatsappResend", "name": "WhatsApp Notification Resend", "cost": 0.45 }],
|
|
4197
|
+
* "credit_balance": 10, // null when credits are not limited
|
|
4198
|
+
* "has_sufficient_credits": true
|
|
3727
4199
|
* }
|
|
3728
4200
|
* ```
|
|
3729
4201
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
3730
|
-
* @throws {ApiError}
|
|
4202
|
+
* @throws {ApiError} `400` when the signer cannot be reminded (signed, not
|
|
4203
|
+
* yet notified, or notified only by `Bypass`), `403`, `404`.
|
|
3731
4204
|
*
|
|
3732
4205
|
* @example
|
|
3733
4206
|
* ```ts
|
|
@@ -3755,11 +4228,11 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3755
4228
|
* ```jsonc
|
|
3756
4229
|
* [
|
|
3757
4230
|
* {
|
|
3758
|
-
* "sent_at":
|
|
4231
|
+
* "sent_at": "2026-10-19T19:05:48Z",
|
|
3759
4232
|
* "header": "Assinafy",
|
|
3760
4233
|
* "body": "Você tem um documento para assinar.",
|
|
3761
4234
|
* "buttons": [
|
|
3762
|
-
* { "text": "Assinar documento"
|
|
4235
|
+
* { "text": "Assinar documento" } // production strips button URLs
|
|
3763
4236
|
* ],
|
|
3764
4237
|
* "phone_number": "+5511999998888",
|
|
3765
4238
|
* "signer_id": "19e6b92e7895332ed9708535d8c"
|
|
@@ -4427,28 +4900,89 @@ declare class WebhookResource extends BaseResource {
|
|
|
4427
4900
|
/**
|
|
4428
4901
|
* Replace an endpoint's signing secret and return the new one
|
|
4429
4902
|
* (`POST /accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate`).
|
|
4430
|
-
*
|
|
4431
|
-
*
|
|
4432
|
-
*
|
|
4903
|
+
*
|
|
4904
|
+
* Without `keep_previous` the old secret stops at once: update the receiver
|
|
4905
|
+
* immediately. With `keep_previous: true` both secrets sign deliveries for
|
|
4906
|
+
* 24 hours (each delivery carries one `v1,` entry per secret, which
|
|
4907
|
+
* `webhookVerifier.verifySignature()` already accepts), so the receiver can
|
|
4908
|
+
* switch without dropping events; rotating again ends the overlap. OAuth
|
|
4909
|
+
* tokens need the `webhooks:write` scope.
|
|
4433
4910
|
*
|
|
4434
4911
|
* @param endpointId - The endpoint ID.
|
|
4435
4912
|
* @param accountId - Override the client's default account ID.
|
|
4913
|
+
* @param options - `keep_previous`: keep the old secret signing for 24 hours.
|
|
4436
4914
|
* @returns The new secret:
|
|
4437
4915
|
* ```jsonc
|
|
4438
|
-
* {
|
|
4916
|
+
* {
|
|
4917
|
+
* "secret": "whsec_bmV3LWtleS1iYXNlNjQtZW5jb2RlZA==",
|
|
4918
|
+
* "previous_secret_expires_at": "2026-11-12T14:00:00Z" // only with keep_previous: true
|
|
4919
|
+
* }
|
|
4439
4920
|
* ```
|
|
4440
|
-
* @throws {ValidationError} If `endpointId` is empty
|
|
4441
|
-
* available.
|
|
4921
|
+
* @throws {ValidationError} If `endpointId` is empty, no account ID is
|
|
4922
|
+
* available, or `keep_previous` is not a boolean.
|
|
4442
4923
|
* @throws {ApiError} `400` when signing is disabled on the endpoint; `404`
|
|
4443
4924
|
* if it does not exist.
|
|
4444
4925
|
*
|
|
4445
4926
|
* @example
|
|
4446
4927
|
* ```ts
|
|
4447
|
-
* const { secret } = await client.webhooks.rotateEndpointSecret(endpoint.id
|
|
4928
|
+
* const { secret } = await client.webhooks.rotateEndpointSecret(endpoint.id, undefined, {
|
|
4929
|
+
* keep_previous: true,
|
|
4930
|
+
* });
|
|
4448
4931
|
* await secretStore.put('assinafy-webhook-secret', secret);
|
|
4449
4932
|
* ```
|
|
4450
4933
|
*/
|
|
4451
|
-
rotateEndpointSecret(endpointId: string, accountId?: string
|
|
4934
|
+
rotateEndpointSecret(endpointId: string, accountId?: string, options?: {
|
|
4935
|
+
keep_previous?: boolean;
|
|
4936
|
+
}): Promise<IWebhookEndpointSecretRotation>;
|
|
4937
|
+
/**
|
|
4938
|
+
* Send the endpoint one `webhook_test` event now
|
|
4939
|
+
* (`POST /accounts/{accountId}/webhooks/endpoints/{endpointId}/test`).
|
|
4940
|
+
*
|
|
4941
|
+
* Signed and sent like any delivery, to this endpoint only, also while it is
|
|
4942
|
+
* paused or inactive; it neither lifts nor counts toward a pause. The
|
|
4943
|
+
* endpoint has 10 seconds to answer. The event's `payload` and `origin` are
|
|
4944
|
+
* `null`, and its `subject`/`object` describe the endpoint (never its
|
|
4945
|
+
* secret). Up to 10 tests per user every 10 minutes; OAuth tokens need
|
|
4946
|
+
* `webhooks:write`.
|
|
4947
|
+
*
|
|
4948
|
+
* @param endpointId - The endpoint ID.
|
|
4949
|
+
* @param accountId - Override the client's default account ID.
|
|
4950
|
+
* @returns The delivery attempt, also listed in the delivery history:
|
|
4951
|
+
* ```jsonc
|
|
4952
|
+
* {
|
|
4953
|
+
* "resource": "activity_dispatching_history",
|
|
4954
|
+
* "id": "1052b3c4d5e6f7a8b9c0d1e2f3a4",
|
|
4955
|
+
* "event": "webhook_test",
|
|
4956
|
+
* "activity_id": 8240001,
|
|
4957
|
+
* "endpoint_id": "1052b0e1f2a3b4c5d6e7f8a9b0c1",
|
|
4958
|
+
* "endpoint": "https://hooks.example.com/assinafy",
|
|
4959
|
+
* "payload": { // the event as delivered
|
|
4960
|
+
* "id": 8240001, "event": "webhook_test", "payload": null, "origin": null,
|
|
4961
|
+
* "account_id": "acc_example", "subject": { "type": "ActivityEventSubscription" }
|
|
4962
|
+
* },
|
|
4963
|
+
* "delivered": true,
|
|
4964
|
+
* "webhook_id": "msg_2v9TQ0a7",
|
|
4965
|
+
* "attempt": 1,
|
|
4966
|
+
* "kind": "manual",
|
|
4967
|
+
* "will_retry": false,
|
|
4968
|
+
* "duration_ms": 182,
|
|
4969
|
+
* "http_status": 200,
|
|
4970
|
+
* "response_body": "ok",
|
|
4971
|
+
* "error": null,
|
|
4972
|
+
* "created_at": "2026-11-11T14:00:00Z",
|
|
4973
|
+
* "updated_at": "2026-11-11T14:00:00Z"
|
|
4974
|
+
* }
|
|
4975
|
+
* ```
|
|
4976
|
+
* @throws {ValidationError} If `endpointId` is empty or no account ID is available.
|
|
4977
|
+
* @throws {ApiError} `404` for an unknown endpoint, `429` past 10 tests in 10 minutes.
|
|
4978
|
+
*
|
|
4979
|
+
* @example
|
|
4980
|
+
* ```ts
|
|
4981
|
+
* const attempt = await client.webhooks.testEndpoint(endpoint.id);
|
|
4982
|
+
* if (!attempt.delivered) console.warn(attempt.http_status, attempt.error);
|
|
4983
|
+
* ```
|
|
4984
|
+
*/
|
|
4985
|
+
testEndpoint(endpointId: string, accountId?: string): Promise<IWebhookDispatch>;
|
|
4452
4986
|
private endpointsPath;
|
|
4453
4987
|
private endpointPath;
|
|
4454
4988
|
}
|
|
@@ -5539,7 +6073,10 @@ declare class OAuthResource extends BaseResource {
|
|
|
5539
6073
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
5540
6074
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
5541
6075
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
5542
|
-
* `
|
|
6076
|
+
* `account:read` reads the workspace profile, theme, logo, KPIs, webhook
|
|
6077
|
+
* subscription and endpoints, and its signing features; `webhooks:write`
|
|
6078
|
+
* changes the subscription, manages endpoints, re-sends and tests
|
|
6079
|
+
* deliveries, and can obtain a new signing secret (signing on, or rotation).
|
|
5543
6080
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
5544
6081
|
* endpoint yourself. Defaults to the discovered
|
|
5545
6082
|
* `authorization_endpoint`.
|
|
@@ -5697,6 +6234,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
5697
6234
|
* @throws {OAuthError} `invalid_grant` for a spent, expired, replayed or
|
|
5698
6235
|
* mismatched code; `invalid_client` for a bad `client_id`/`client_secret`;
|
|
5699
6236
|
* `invalid_target` for a `resource` mismatch.
|
|
6237
|
+
* @throws {ApiError} `429` when the caller's IP is rate limited; token calls
|
|
6238
|
+
* are never retried automatically, so wait `rateLimit.retryAfter` seconds.
|
|
5700
6239
|
*
|
|
5701
6240
|
* @example
|
|
5702
6241
|
* ```ts
|
|
@@ -5763,6 +6302,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
5763
6302
|
* @throws {OAuthError} `invalid_grant` when the refresh token was already
|
|
5764
6303
|
* used, expired, or the user reconnected with different permissions — ask
|
|
5765
6304
|
* the user to reconnect. `invalid_client` for bad client credentials.
|
|
6305
|
+
* @throws {ApiError} `429` when the caller's IP is rate limited (not retried
|
|
6306
|
+
* automatically: a replayed refresh token ends the connection).
|
|
5766
6307
|
*
|
|
5767
6308
|
* @example
|
|
5768
6309
|
* ```ts
|
|
@@ -5891,11 +6432,18 @@ declare class OAuthResource extends BaseResource {
|
|
|
5891
6432
|
* - `GET /accounts/{id}/fields/{id}`
|
|
5892
6433
|
* - `PUT /accounts/{id}/fields/{id}`
|
|
5893
6434
|
* - `DELETE /accounts/{id}/fields/{id}`
|
|
5894
|
-
* - `POST /accounts/{id}/fields/{id}/validate
|
|
5895
|
-
* - `POST /accounts/{id}/fields/validate-multiple
|
|
6435
|
+
* - `POST /accounts/{id}/fields/{id}/validate`
|
|
6436
|
+
* - `POST /accounts/{id}/fields/validate-multiple`
|
|
5896
6437
|
* - `GET /field-types`
|
|
6438
|
+
*
|
|
6439
|
+
* Validation authenticates either with the workspace credentials or, during
|
|
6440
|
+
* the signing flow, with a signer access code alone: a code-authenticated call
|
|
6441
|
+
* runs on the credential-free transport, so the code never travels with the
|
|
6442
|
+
* API key or bearer token.
|
|
5897
6443
|
*/
|
|
5898
6444
|
declare class FieldsResource extends BaseResource {
|
|
6445
|
+
private readonly signerHttp;
|
|
6446
|
+
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
5899
6447
|
/**
|
|
5900
6448
|
* Create a field definition (`POST /accounts/{accountId}/fields`).
|
|
5901
6449
|
*
|
|
@@ -6081,9 +6629,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6081
6629
|
* Validate a single value against a field definition
|
|
6082
6630
|
* (`POST /accounts/{accountId}/fields/{fieldId}/validate`).
|
|
6083
6631
|
*
|
|
6084
|
-
*
|
|
6085
|
-
*
|
|
6086
|
-
*
|
|
6632
|
+
* Without `signerAccessCode` the call uses the workspace credentials. With
|
|
6633
|
+
* it, the code is sent as the `signer-access-code` query on the
|
|
6634
|
+
* credential-free transport, as a custom signing UI does.
|
|
6087
6635
|
*
|
|
6088
6636
|
* Request body (`application/json`):
|
|
6089
6637
|
* ```jsonc
|
|
@@ -6095,9 +6643,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6095
6643
|
* @param fieldId - The field definition to validate against.
|
|
6096
6644
|
* @param value - The value to check (validated against the field's
|
|
6097
6645
|
* type/regex). Sent as `{ value }` in the request body.
|
|
6098
|
-
* @param options - Account override and optional
|
|
6646
|
+
* @param options - Account override and optional `signerAccessCode`.
|
|
6099
6647
|
* @param options.accountId - Override the client's default workspace.
|
|
6100
|
-
* @param options.signerAccessCode -
|
|
6648
|
+
* @param options.signerAccessCode - Authenticate as the signer instead of the workspace.
|
|
6101
6649
|
* @returns The validation result. Response shape:
|
|
6102
6650
|
* ```jsonc
|
|
6103
6651
|
* {
|
|
@@ -6108,7 +6656,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6108
6656
|
* ```
|
|
6109
6657
|
* @throws {ValidationError} If `fieldId` or the account ID is missing, or
|
|
6110
6658
|
* `value` is `undefined`.
|
|
6111
|
-
* @throws {ApiError}
|
|
6659
|
+
* @throws {ApiError} `400` for a malformed request, `403` when the code or
|
|
6660
|
+
* credentials cannot reach the workspace, `404` for a field outside it, `410`
|
|
6661
|
+
* when the signer's access code is closed.
|
|
6112
6662
|
*
|
|
6113
6663
|
* @example
|
|
6114
6664
|
* ```ts
|
|
@@ -6128,9 +6678,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
6128
6678
|
* (`POST /accounts/{accountId}/fields/validate-multiple`).
|
|
6129
6679
|
*
|
|
6130
6680
|
* The request body is the array of `{ field_id, value }` entries itself
|
|
6131
|
-
* (not wrapped in an object).
|
|
6132
|
-
*
|
|
6133
|
-
* {@link FieldsResource.validate}.
|
|
6681
|
+
* (not wrapped in an object). `signerAccessCode` authenticates as described
|
|
6682
|
+
* on {@link FieldsResource.validate}.
|
|
6134
6683
|
*
|
|
6135
6684
|
* Request body (`application/json`):
|
|
6136
6685
|
* ```jsonc
|
|
@@ -6143,9 +6692,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6143
6692
|
* ```
|
|
6144
6693
|
*
|
|
6145
6694
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
6146
|
-
* @param options - Account override and optional
|
|
6695
|
+
* @param options - Account override and optional `signerAccessCode`.
|
|
6147
6696
|
* @param options.accountId - Override the client's default workspace.
|
|
6148
|
-
* @param options.signerAccessCode -
|
|
6697
|
+
* @param options.signerAccessCode - Authenticate as the signer instead of the workspace.
|
|
6149
6698
|
* @returns One validation result per entry. Response shape:
|
|
6150
6699
|
* ```jsonc
|
|
6151
6700
|
* [
|
|
@@ -6154,7 +6703,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
6154
6703
|
* ]
|
|
6155
6704
|
* ```
|
|
6156
6705
|
* @throws {ValidationError} If `entries` is empty or the account ID is missing.
|
|
6157
|
-
* @throws {ApiError}
|
|
6706
|
+
* @throws {ApiError} `400`, `403`, `404` or `410`, as for {@link FieldsResource.validate}.
|
|
6158
6707
|
*
|
|
6159
6708
|
* @example
|
|
6160
6709
|
* ```ts
|
|
@@ -6195,13 +6744,16 @@ declare class FieldsResource extends BaseResource {
|
|
|
6195
6744
|
* ```
|
|
6196
6745
|
*/
|
|
6197
6746
|
listTypes(): Promise<IFieldType[]>;
|
|
6747
|
+
/** A signer access code must never travel with the workspace credentials. */
|
|
6748
|
+
private transportFor;
|
|
6198
6749
|
}
|
|
6199
6750
|
|
|
6200
6751
|
/**
|
|
6201
|
-
* Signer-side endpoints for custom signing UIs.
|
|
6202
|
-
* `signer-access-code` (the
|
|
6203
|
-
* never the workspace API key
|
|
6204
|
-
*
|
|
6752
|
+
* Signer-side endpoints for custom signing UIs. Calls authenticate with
|
|
6753
|
+
* `signer-access-code` (from the link e-mailed or WhatsApp'd to the signer) on a
|
|
6754
|
+
* credential-free transport, never the workspace API key; the certified-copy
|
|
6755
|
+
* link routes use the link's token instead. Only the explicit `*AsWorkspace`
|
|
6756
|
+
* methods use the workspace credentials, and they never send a code.
|
|
6205
6757
|
*/
|
|
6206
6758
|
declare class SignerDocumentsResource extends BaseResource {
|
|
6207
6759
|
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
@@ -6216,11 +6768,17 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6216
6768
|
* (`GET /signers/{signer_id}/document?signer-access-code=…`).
|
|
6217
6769
|
*
|
|
6218
6770
|
* The signer-side counterpart of {@link DocumentResource.details}, authorised
|
|
6219
|
-
* by the signer's access code rather than the workspace API key.
|
|
6771
|
+
* by the signer's access code rather than the workspace API key. Unlike
|
|
6772
|
+
* {@link SignerDocumentsResource.getAssignment} it does not record a view and
|
|
6773
|
+
* answers before a certificate or identity-check signer confirms their data,
|
|
6774
|
+
* so a link learns its envelope here.
|
|
6220
6775
|
*
|
|
6221
6776
|
* @param signerId - The signer whose current document is fetched.
|
|
6222
6777
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6223
|
-
* @
|
|
6778
|
+
* @param options - `expand: ['envelope']` adds the code's envelope (`{ id, name }`, or `null`).
|
|
6779
|
+
* @returns The {@link ISigningDocument}. Once the code is closed (30 minutes
|
|
6780
|
+
* after the signer is done) only `id`, `name`, `status`, `current_signer`,
|
|
6781
|
+
* `certified_copy` and `envelope` remain, with `is_signer_access_closed: true`:
|
|
6224
6782
|
* ```jsonc
|
|
6225
6783
|
* {
|
|
6226
6784
|
* "resource": "document",
|
|
@@ -6243,20 +6801,32 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6243
6801
|
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
6244
6802
|
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
6245
6803
|
* ],
|
|
6804
|
+
* "current_signer": {
|
|
6805
|
+
* "id": "19e6b92e7895332ed9708535d8c",
|
|
6806
|
+
* "full_name": "Example Signer",
|
|
6807
|
+
* "email": "signer@example.com",
|
|
6808
|
+
* "verification_method": "Email",
|
|
6809
|
+
* "notification_methods": ["Email"],
|
|
6810
|
+
* "completed": false
|
|
6811
|
+
* },
|
|
6812
|
+
* "is_signer_access_closed": false,
|
|
6813
|
+
* "certified_copy": { "available": false, "notification_method": "Email", "resends_left": null },
|
|
6814
|
+
* "envelope": { "id": "1052a1f0c3d4e5f6a7b8c9d0e1f2", "name": "Admission kit" }, // with expand
|
|
6246
6815
|
* "created_at": "2026-07-19T14:56:54Z",
|
|
6247
6816
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6248
6817
|
* }
|
|
6249
6818
|
* ```
|
|
6250
6819
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6251
|
-
* @throws {ApiError}
|
|
6820
|
+
* @throws {ApiError} `400` while the signer's step has not started, `401` for an
|
|
6821
|
+
* invalid code, `404` for an unknown signer.
|
|
6252
6822
|
*
|
|
6253
6823
|
* @example
|
|
6254
6824
|
* ```ts
|
|
6255
|
-
* const doc = await client.signerDocuments.getCurrent(signerId, accessCode);
|
|
6256
|
-
* console.log(doc.
|
|
6825
|
+
* const doc = await client.signerDocuments.getCurrent(signerId, accessCode, { expand: ['envelope'] });
|
|
6826
|
+
* if (doc.is_signer_access_closed) console.log(doc.certified_copy.available);
|
|
6257
6827
|
* ```
|
|
6258
6828
|
*/
|
|
6259
|
-
getCurrent(signerId: string, signerAccessCode: string): Promise<
|
|
6829
|
+
getCurrent(signerId: string, signerAccessCode: string, options?: Pick<ISigningReadOptions, 'expand'>): Promise<ISigningDocument>;
|
|
6260
6830
|
/**
|
|
6261
6831
|
* List every document awaiting a given signer
|
|
6262
6832
|
* (`GET /signers/{signer_id}/documents?signer-access-code=…`).
|
|
@@ -6268,9 +6838,10 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6268
6838
|
*
|
|
6269
6839
|
* @param signerId - The signer whose documents are listed.
|
|
6270
6840
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6271
|
-
* @param params -
|
|
6272
|
-
*
|
|
6273
|
-
* with pagination in `meta
|
|
6841
|
+
* @param params - `envelope_id` (only that envelope's documents) and pagination:
|
|
6842
|
+
* `page`, `per-page` (also accepts `per_page`).
|
|
6843
|
+
* @returns Matching documents with pagination in `meta`. Each carries its
|
|
6844
|
+
* `assignment` (without `signing_urls` when read with a code) and `pages`:
|
|
6274
6845
|
* ```jsonc
|
|
6275
6846
|
* {
|
|
6276
6847
|
* "data": [
|
|
@@ -6294,16 +6865,18 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6294
6865
|
* }
|
|
6295
6866
|
* ```
|
|
6296
6867
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6297
|
-
* @throws {ApiError}
|
|
6868
|
+
* @throws {ApiError} `400` for a non-text `envelope_id` or a pending step,
|
|
6869
|
+
* `403` for another signer's code, `410` once the code is closed.
|
|
6298
6870
|
*
|
|
6299
6871
|
* @example
|
|
6300
6872
|
* ```ts
|
|
6301
6873
|
* const { data, meta } = await client.signerDocuments.list(signerId, accessCode, {
|
|
6874
|
+
* envelope_id: envelopeId,
|
|
6302
6875
|
* 'per-page': 20,
|
|
6303
6876
|
* });
|
|
6304
6877
|
* ```
|
|
6305
6878
|
*/
|
|
6306
|
-
list(signerId: string, signerAccessCode: string, params?:
|
|
6879
|
+
list(signerId: string, signerAccessCode: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
|
|
6307
6880
|
/**
|
|
6308
6881
|
* Search the documents awaiting a given signer
|
|
6309
6882
|
* (`GET /signers/{signer_id}/documents/search?signer-access-code=…`).
|
|
@@ -6316,8 +6889,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6316
6889
|
* @param signerId - The signer whose documents are searched.
|
|
6317
6890
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6318
6891
|
* @param search - Free-text term matched against the document name.
|
|
6319
|
-
* @
|
|
6320
|
-
*
|
|
6892
|
+
* @param params - `envelope_id`: only that envelope's documents.
|
|
6893
|
+
* @returns Matching documents for that signer, with pagination in `meta`:
|
|
6321
6894
|
* ```jsonc
|
|
6322
6895
|
* {
|
|
6323
6896
|
* "data": [
|
|
@@ -6341,7 +6914,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6341
6914
|
* }
|
|
6342
6915
|
* ```
|
|
6343
6916
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6344
|
-
* @throws {ApiError}
|
|
6917
|
+
* @throws {ApiError} `400`, `403` or `410`, as for {@link SignerDocumentsResource.list}.
|
|
6345
6918
|
*
|
|
6346
6919
|
* @example
|
|
6347
6920
|
* ```ts
|
|
@@ -6352,7 +6925,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6352
6925
|
* );
|
|
6353
6926
|
* ```
|
|
6354
6927
|
*/
|
|
6355
|
-
search(signerId: string, signerAccessCode: string, search?: string): Promise<IDocumentListResponse>;
|
|
6928
|
+
search(signerId: string, signerAccessCode: string, search?: string, params?: Pick<ISignerDocumentListParams, 'envelope_id'>): Promise<IDocumentListResponse>;
|
|
6356
6929
|
/**
|
|
6357
6930
|
* List a signer's documents with the workspace credentials
|
|
6358
6931
|
* (`GET /signers/{signer_id}/documents`).
|
|
@@ -6362,8 +6935,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6362
6935
|
* code. No `signer-access-code` is sent.
|
|
6363
6936
|
*
|
|
6364
6937
|
* @param signerId - The signer whose documents are listed.
|
|
6365
|
-
* @param params -
|
|
6366
|
-
* @returns Documents in the
|
|
6938
|
+
* @param params - `envelope_id` and pagination: `page`, `per-page` (also accepts `per_page`).
|
|
6939
|
+
* @returns Documents in the {@link IDocumentListItem} shape, with
|
|
6367
6940
|
* pagination in `meta` (same shape as {@link SignerDocumentsResource.list}):
|
|
6368
6941
|
* ```jsonc
|
|
6369
6942
|
* {
|
|
@@ -6372,14 +6945,15 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6372
6945
|
* }
|
|
6373
6946
|
* ```
|
|
6374
6947
|
* @throws {ValidationError} If `signerId` is missing.
|
|
6375
|
-
* @throws {ApiError} `401` if the workspace credentials are rejected
|
|
6948
|
+
* @throws {ApiError} `401` if the workspace credentials are rejected, `403` when a
|
|
6949
|
+
* role or OAuth scope refuses it, `404` for a signer outside the workspace.
|
|
6376
6950
|
*
|
|
6377
6951
|
* @example
|
|
6378
6952
|
* ```ts
|
|
6379
6953
|
* const { data } = await client.signerDocuments.listAsWorkspace(signerId, { page: 1 });
|
|
6380
6954
|
* ```
|
|
6381
6955
|
*/
|
|
6382
|
-
listAsWorkspace(signerId: string, params?:
|
|
6956
|
+
listAsWorkspace(signerId: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
|
|
6383
6957
|
/**
|
|
6384
6958
|
* Search a signer's documents with the workspace credentials
|
|
6385
6959
|
* (`GET /signers/{signer_id}/documents/search`).
|
|
@@ -6390,42 +6964,37 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6390
6964
|
*
|
|
6391
6965
|
* @param signerId - The signer whose documents are searched.
|
|
6392
6966
|
* @param search - Free-text term matched against the document name.
|
|
6967
|
+
* @param params - `envelope_id`: only that envelope's documents.
|
|
6393
6968
|
* @returns Matching documents with pagination in `meta`, as
|
|
6394
6969
|
* {@link SignerDocumentsResource.listAsWorkspace} returns.
|
|
6395
6970
|
* @throws {ValidationError} If `signerId` is missing or `search` is not a string.
|
|
6396
|
-
* @throws {ApiError} `401`
|
|
6971
|
+
* @throws {ApiError} `401`, `403` or `404`, as for {@link SignerDocumentsResource.listAsWorkspace}.
|
|
6397
6972
|
*
|
|
6398
6973
|
* @example
|
|
6399
6974
|
* ```ts
|
|
6400
6975
|
* const { data } = await client.signerDocuments.searchAsWorkspace(signerId, 'agreement');
|
|
6401
6976
|
* ```
|
|
6402
6977
|
*/
|
|
6403
|
-
searchAsWorkspace(signerId: string, search?: string): Promise<IDocumentListResponse>;
|
|
6978
|
+
searchAsWorkspace(signerId: string, search?: string, params?: Pick<ISignerDocumentListParams, 'envelope_id'>): Promise<IDocumentListResponse>;
|
|
6404
6979
|
/**
|
|
6405
|
-
* Download
|
|
6406
|
-
* (`GET /signers/{signer_id}/documents/{document_id}/download/
|
|
6980
|
+
* Download the original PDF a signer is asked to sign
|
|
6981
|
+
* (`GET /signers/{signer_id}/documents/{document_id}/download/original`).
|
|
6407
6982
|
*
|
|
6408
|
-
*
|
|
6409
|
-
*
|
|
6410
|
-
*
|
|
6411
|
-
*
|
|
6412
|
-
*
|
|
6413
|
-
* `pades` exists only when the document had a Digital Certificate signer.
|
|
6414
|
-
* A bundle contains original, certificated, and certificate-page artifacts,
|
|
6415
|
-
* plus PAdES when present.
|
|
6983
|
+
* Only `original` is available with an access code; the certified copy is
|
|
6984
|
+
* sent to the signer instead (see {@link SignerDocumentsResource.resendCertifiedCopy}).
|
|
6985
|
+
* The API redirects a request it cannot serve to its expired-link page, so
|
|
6986
|
+
* the SDK does not follow redirects here: that case throws instead of
|
|
6987
|
+
* returning the page's HTML.
|
|
6416
6988
|
*
|
|
6417
6989
|
* @param signerId - The signer requesting the download.
|
|
6418
6990
|
* @param documentId - The document to download.
|
|
6419
|
-
* @param artifactName -
|
|
6420
|
-
*
|
|
6421
|
-
* @
|
|
6422
|
-
*
|
|
6423
|
-
* @
|
|
6424
|
-
*
|
|
6425
|
-
*
|
|
6426
|
-
* `artifactName` is not one of the five documented names, or an explicitly
|
|
6427
|
-
* supplied legacy `signerAccessCode` is blank.
|
|
6428
|
-
* @throws {ApiError} `404` if the artifact does not exist yet.
|
|
6991
|
+
* @param artifactName - `original`, the only artifact a signer can download.
|
|
6992
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6993
|
+
* @returns The PDF bytes as a Node `Buffer`.
|
|
6994
|
+
* @throws {ValidationError} If an ID or the code is missing, or the artifact is not `original`.
|
|
6995
|
+
* @throws {ApiError} `302` when the code is missing or closed, `400` while the
|
|
6996
|
+
* signer's step has not started, `403` for another artifact, `404` for a
|
|
6997
|
+
* document the code does not reach, `410` once the code is closed.
|
|
6429
6998
|
*
|
|
6430
6999
|
* @example
|
|
6431
7000
|
* ```ts
|
|
@@ -6433,11 +7002,12 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6433
7002
|
* signerId,
|
|
6434
7003
|
* documentId,
|
|
6435
7004
|
* 'original',
|
|
7005
|
+
* accessCode,
|
|
6436
7006
|
* );
|
|
6437
7007
|
* await fs.promises.writeFile('to-sign.pdf', pdf);
|
|
6438
7008
|
* ```
|
|
6439
7009
|
*/
|
|
6440
|
-
download(signerId: string, documentId: string, artifactName:
|
|
7010
|
+
download(signerId: string, documentId: string, artifactName: 'original', signerAccessCode: string): Promise<Buffer>;
|
|
6441
7011
|
/**
|
|
6442
7012
|
* Sign several documents in one call
|
|
6443
7013
|
* (`PUT /signers/documents/sign-multiple?signer-access-code=…`).
|
|
@@ -6633,10 +7203,15 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6633
7203
|
* flag.
|
|
6634
7204
|
*
|
|
6635
7205
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6636
|
-
* @returns
|
|
6637
|
-
*
|
|
7206
|
+
* @returns The signer's acceptance state, or `null` from deployments that
|
|
7207
|
+
* acknowledge without data:
|
|
7208
|
+
* ```jsonc
|
|
7209
|
+
* { "full_name": "Example Signer", "email": "signer@example.com", "has_accepted_terms": true }
|
|
7210
|
+
* ```
|
|
6638
7211
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
6639
|
-
* @throws {ApiError}
|
|
7212
|
+
* @throws {ApiError} `400` while the signer's verification is not done (e.g.
|
|
7213
|
+
* the e-mail code) or their step has not started, `401` for an invalid code,
|
|
7214
|
+
* `410` once the code is closed.
|
|
6640
7215
|
*
|
|
6641
7216
|
* @example
|
|
6642
7217
|
* ```ts
|
|
@@ -6644,7 +7219,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6644
7219
|
* const assignment = await client.signerDocuments.getAssignment(accessCode, true);
|
|
6645
7220
|
* ```
|
|
6646
7221
|
*/
|
|
6647
|
-
acceptTerms(signerAccessCode: string): Promise<
|
|
7222
|
+
acceptTerms(signerAccessCode: string): Promise<IAcceptTermsResult | null>;
|
|
6648
7223
|
/**
|
|
6649
7224
|
* Verify the signer's email or WhatsApp one-time password
|
|
6650
7225
|
* (`POST /verify?signer-access-code=…`).
|
|
@@ -6686,79 +7261,50 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6686
7261
|
verificationCode: string;
|
|
6687
7262
|
}): Promise<void>;
|
|
6688
7263
|
/**
|
|
6689
|
-
* Confirm
|
|
7264
|
+
* Confirm the signer's contact data before signing
|
|
6690
7265
|
* (`PUT /documents/{documentId}/signers/confirm-data?signer-access-code=…`).
|
|
6691
7266
|
*
|
|
6692
|
-
*
|
|
6693
|
-
*
|
|
6694
|
-
*
|
|
6695
|
-
*
|
|
6696
|
-
*
|
|
6697
|
-
*
|
|
6698
|
-
*
|
|
7267
|
+
* Send the contact the signer's channel needs: `email` for e-mail
|
|
7268
|
+
* verification or notification, `whatsapp_phone_number` for WhatsApp. Each
|
|
7269
|
+
* is saved when the signer has none; otherwise it must be theirs, so it
|
|
7270
|
+
* cannot change the record. `has_accepted_terms: true` also records the
|
|
7271
|
+
* terms, which opens `getAssignment()` for a `DigitalCertificate` signer.
|
|
7272
|
+
* With an envelope code it acts on the document the route names. Only the
|
|
7273
|
+
* fields provided are sent.
|
|
6699
7274
|
*
|
|
6700
7275
|
* Request body (`application/json`):
|
|
6701
7276
|
* ```jsonc
|
|
6702
7277
|
* {
|
|
6703
|
-
* "full_name": "Example Signer",
|
|
6704
7278
|
* "email": "signer@example.com",
|
|
6705
|
-
* "government_id": "39053344705",
|
|
6706
7279
|
* "has_accepted_terms": true
|
|
6707
7280
|
* }
|
|
6708
7281
|
* ```
|
|
6709
7282
|
*
|
|
6710
7283
|
* @param documentId - The document the signer is confirming data for.
|
|
6711
7284
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6712
|
-
* @param payload -
|
|
6713
|
-
*
|
|
6714
|
-
*
|
|
6715
|
-
*
|
|
7285
|
+
* @param payload - `email`, `whatsapp_phone_number` and `has_accepted_terms`.
|
|
7286
|
+
* `full_name`/`government_id` are forwarded only for older deployments.
|
|
7287
|
+
* @returns `null` on production, which answers `data: []`; older deployments
|
|
7288
|
+
* return the signer:
|
|
6716
7289
|
* ```jsonc
|
|
6717
|
-
* {
|
|
6718
|
-
* "
|
|
6719
|
-
* "id": "19e6b92e7895332ed9708535d8c",
|
|
6720
|
-
* "full_name": "Example Signer",
|
|
6721
|
-
* "email": "signer@example.com",
|
|
6722
|
-
* "whatsapp_phone_number": null,
|
|
6723
|
-
* "has_accepted_terms": true
|
|
6724
|
-
* }
|
|
7290
|
+
* { "resource": "signer", "id": "19e6b92e7895332ed9708535d8c", "full_name": "Example Signer",
|
|
7291
|
+
* "email": "signer@example.com", "whatsapp_phone_number": null, "has_accepted_terms": true }
|
|
6725
7292
|
* ```
|
|
6726
7293
|
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
6727
|
-
* or a supplied
|
|
6728
|
-
* @throws {ApiError}
|
|
6729
|
-
*
|
|
7294
|
+
* or a supplied value is malformed.
|
|
7295
|
+
* @throws {ApiError} `400` when a contact the signer's methods need is missing,
|
|
7296
|
+
* invalid or not theirs, or their step has not started; `404` for a document
|
|
7297
|
+
* the code does not reach; `410` once the code is closed.
|
|
6730
7298
|
*
|
|
6731
7299
|
* @example
|
|
6732
7300
|
* ```ts
|
|
6733
|
-
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00', has_accepted_terms: true }
|
|
6734
7301
|
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
6735
|
-
*
|
|
6736
|
-
* government_id: '123.456.789-00',
|
|
7302
|
+
* email: 'signer@example.com',
|
|
6737
7303
|
* has_accepted_terms: true,
|
|
6738
7304
|
* });
|
|
6739
7305
|
* ```
|
|
6740
7306
|
*/
|
|
6741
|
-
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner>;
|
|
6742
|
-
/**
|
|
6743
|
-
* Confirm signer data with the compatibility phone field
|
|
6744
|
-
* (`PUT /documents/{documentId}/signers/confirm-data`).
|
|
6745
|
-
* @deprecated Compatibility overload preserving the previous wire shape.
|
|
6746
|
-
* `whatsapp_phone_number` is a compatibility pass-through field.
|
|
6747
|
-
* @param documentId - Document identifier.
|
|
6748
|
-
* @param signerAccessCode - Access code sent in the query string.
|
|
6749
|
-
* @param payload - Identity fields, including `whatsapp_phone_number`.
|
|
6750
|
-
* @returns The signer; see the primary overload for its response payload.
|
|
6751
|
-
* @throws {ValidationError} If identity fields or identifiers are invalid.
|
|
6752
|
-
* @throws {ApiError} If the API rejects the confirmation.
|
|
6753
|
-
* @example
|
|
6754
|
-
* ```ts
|
|
6755
|
-
* // JSON body: { "whatsapp_phone_number": "+5511999998888" }
|
|
6756
|
-
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
6757
|
-
* whatsapp_phone_number: '+5511999998888',
|
|
6758
|
-
* });
|
|
6759
|
-
* ```
|
|
6760
|
-
*/
|
|
6761
|
-
confirmData(documentId: string, signerAccessCode: string, payload: ILegacyConfirmSignerDataPayload): Promise<ISigner>;
|
|
7307
|
+
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner | null>;
|
|
6762
7308
|
/**
|
|
6763
7309
|
* Upload the signer's signature or initial image
|
|
6764
7310
|
* (`POST /signature?signer-access-code=…&type=…`).
|
|
@@ -6854,14 +7400,17 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6854
7400
|
* the SDK never automatically replays this particular `GET` after a `429`.
|
|
6855
7401
|
*
|
|
6856
7402
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6857
|
-
* @param
|
|
6858
|
-
*
|
|
6859
|
-
* `
|
|
6860
|
-
*
|
|
6861
|
-
*
|
|
6862
|
-
*
|
|
6863
|
-
*
|
|
6864
|
-
*
|
|
7403
|
+
* @param options - `true`/`false` (the `has_accepted_terms` query, kept for
|
|
7404
|
+
* existing calls) or an options object:
|
|
7405
|
+
* `hasAcceptedTerms` (an explicit `false` is still sent), `expand:
|
|
7406
|
+
* ['envelope']` (adds the code's envelope), and `documentId` (with an
|
|
7407
|
+
* envelope code, open another document of that envelope the signer is on).
|
|
7408
|
+
* @returns The {@link ISigningDocument}. Its `assignment` carries only this
|
|
7409
|
+
* signer's items — no other signers, `signing_urls`, copy receivers or
|
|
7410
|
+
* `summary` — from which the `itemId` / `fieldId` / `pageId` values for
|
|
7411
|
+
* {@link SignerDocumentsResource.sign} are read. A closed code returns
|
|
7412
|
+
* only `id`, `name`, `status`, `current_signer`, `certified_copy` and
|
|
7413
|
+
* `envelope`, with `is_signer_access_closed: true`:
|
|
6865
7414
|
* ```jsonc
|
|
6866
7415
|
* {
|
|
6867
7416
|
* "resource": "document",
|
|
@@ -6892,9 +7441,12 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6892
7441
|
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
6893
7442
|
* "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
|
|
6894
7443
|
* "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
|
|
6895
|
-
* ]
|
|
6896
|
-
* "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
|
|
7444
|
+
* ]
|
|
6897
7445
|
* },
|
|
7446
|
+
* "current_signer": { "id": "19e6b92e7895332ed9708535d8c", "verification_method": "Email",
|
|
7447
|
+
* "notification_methods": ["Email"], "completed": false },
|
|
7448
|
+
* "is_signer_access_closed": false,
|
|
7449
|
+
* "certified_copy": { "available": false, "notification_method": "Email", "resends_left": null },
|
|
6898
7450
|
* "pages": [
|
|
6899
7451
|
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
6900
7452
|
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
@@ -6903,46 +7455,163 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6903
7455
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6904
7456
|
* }
|
|
6905
7457
|
* ```
|
|
6906
|
-
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
6907
|
-
* @throws {ApiError} `400` when DigitalCertificate
|
|
6908
|
-
*
|
|
6909
|
-
*
|
|
7458
|
+
* @throws {ValidationError} If `signerAccessCode` is missing or an option is malformed.
|
|
7459
|
+
* @throws {ApiError} `400` when a DigitalCertificate signer has not confirmed
|
|
7460
|
+
* data and terms, the signer's step has not started, or `documentId` is
|
|
7461
|
+
* not an ID; `401` for an invalid code; `404` when `documentId` is outside
|
|
7462
|
+
* the code's envelope; `409` (`DocumentNotReady`) while the document is
|
|
7463
|
+
* still being prepared.
|
|
6910
7464
|
*
|
|
6911
7465
|
* @example
|
|
6912
7466
|
* ```ts
|
|
6913
|
-
* // query → ?signer-access-code=<code>&has_accepted_terms=true
|
|
6914
|
-
* const
|
|
7467
|
+
* // query → ?signer-access-code=<code>&has_accepted_terms=true&expand=envelope
|
|
7468
|
+
* const doc = await client.signerDocuments.getAssignment(accessCode, {
|
|
7469
|
+
* hasAcceptedTerms: true,
|
|
7470
|
+
* expand: ['envelope'],
|
|
7471
|
+
* });
|
|
6915
7472
|
* ```
|
|
6916
7473
|
*/
|
|
6917
|
-
getAssignment(signerAccessCode: string,
|
|
7474
|
+
getAssignment(signerAccessCode: string, options?: boolean | ISigningReadOptions): Promise<ISigningDocument>;
|
|
6918
7475
|
/**
|
|
6919
|
-
*
|
|
6920
|
-
* (`POST /documents/{documentId}/assignments/{assignmentId}?signer-access-code=…`).
|
|
7476
|
+
* Read the sending workspace's brand for the signing page (`GET /sign/theme`).
|
|
6921
7477
|
*
|
|
6922
|
-
*
|
|
6923
|
-
*
|
|
6924
|
-
*
|
|
6925
|
-
* {@link SignerDocumentsResource.
|
|
6926
|
-
* authenticates via the `signer-access-code` query param.
|
|
6927
|
-
* Virtual signers must call {@link SignerDocumentsResource.confirmData}
|
|
6928
|
-
* first. Digital Certificate signers cannot use this endpoint; use the
|
|
6929
|
-
* certificate start/complete API flow instead.
|
|
7478
|
+
* Available before verification and after the document is deleted.
|
|
7479
|
+
* `primary_color` is the button background and `secondary_color` its text
|
|
7480
|
+
* (6-digit hex without `#`). The `logo` URL carries no access code: fetch it
|
|
7481
|
+
* with {@link SignerDocumentsResource.downloadLogo}.
|
|
6930
7482
|
*
|
|
6931
|
-
*
|
|
7483
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
7484
|
+
* @returns The brand:
|
|
6932
7485
|
* ```jsonc
|
|
6933
|
-
*
|
|
6934
|
-
*
|
|
6935
|
-
*
|
|
6936
|
-
*
|
|
6937
|
-
*
|
|
6938
|
-
*
|
|
6939
|
-
* }
|
|
6940
|
-
* ]
|
|
7486
|
+
* {
|
|
7487
|
+
* "account_name": "Example Ltda",
|
|
7488
|
+
* "primary_color": "1F6FEB",
|
|
7489
|
+
* "secondary_color": "FFFFFF",
|
|
7490
|
+
* "logo": "https://api.assinafy.com.br/v1/sign/logo" // null when the account has none
|
|
7491
|
+
* }
|
|
6941
7492
|
* ```
|
|
7493
|
+
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
7494
|
+
* @throws {ApiError} `400` while the signer's step has not started, `401` for an invalid code.
|
|
6942
7495
|
*
|
|
6943
|
-
* @
|
|
6944
|
-
*
|
|
6945
|
-
*
|
|
7496
|
+
* @example
|
|
7497
|
+
* ```ts
|
|
7498
|
+
* const theme = await client.signerDocuments.getTheme(accessCode);
|
|
7499
|
+
* ```
|
|
7500
|
+
*/
|
|
7501
|
+
getTheme(signerAccessCode: string): Promise<IAccountTheme>;
|
|
7502
|
+
/**
|
|
7503
|
+
* Download the sending workspace's logo for the signing page (`GET /sign/logo`).
|
|
7504
|
+
*
|
|
7505
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
7506
|
+
* @returns The image bytes (`image/*`).
|
|
7507
|
+
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
7508
|
+
* @throws {ApiError} `400` while the signer's step has not started, `401` for an
|
|
7509
|
+
* invalid code, `404` when the workspace has no logo.
|
|
7510
|
+
*
|
|
7511
|
+
* @example
|
|
7512
|
+
* ```ts
|
|
7513
|
+
* const logo = await client.signerDocuments.downloadLogo(accessCode);
|
|
7514
|
+
* ```
|
|
7515
|
+
*/
|
|
7516
|
+
downloadLogo(signerAccessCode: string): Promise<Buffer>;
|
|
7517
|
+
/**
|
|
7518
|
+
* Send the signer their certified copy again (`POST /sign/certified-copy`).
|
|
7519
|
+
*
|
|
7520
|
+
* The copy goes, with a download link valid for 30 minutes, on the signature
|
|
7521
|
+
* request's channel and only to the contact the signing messages went to.
|
|
7522
|
+
* Works after the signer signed, also once the code is closed. E-mail: once
|
|
7523
|
+
* every 2 minutes and 10 times a day; WhatsApp: once per request.
|
|
7524
|
+
* `certified_copy` on {@link SignerDocumentsResource.getAssignment} says
|
|
7525
|
+
* whether it is available.
|
|
7526
|
+
*
|
|
7527
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
7528
|
+
* @param documentId - With an envelope code, another document of that envelope.
|
|
7529
|
+
* @returns What was sent:
|
|
7530
|
+
* ```jsonc
|
|
7531
|
+
* { "available": true, "notification_method": "Email", "resends_left": null, "sent_to": "j***@example.com" }
|
|
7532
|
+
* ```
|
|
7533
|
+
* @throws {ValidationError} If the code or `documentId` is blank.
|
|
7534
|
+
* @throws {ApiError} `400` while the signer's step has not started, `404` for a
|
|
7535
|
+
* document outside the envelope, `409` when the signer has not signed or the
|
|
7536
|
+
* document is not certified, `429` within the resend limits, `500` when the
|
|
7537
|
+
* message could not be sent (nothing used up; ask again).
|
|
7538
|
+
*
|
|
7539
|
+
* @example
|
|
7540
|
+
* ```ts
|
|
7541
|
+
* const { sent_to } = await client.signerDocuments.resendCertifiedCopy(accessCode);
|
|
7542
|
+
* ```
|
|
7543
|
+
*/
|
|
7544
|
+
resendCertifiedCopy(signerAccessCode: string, documentId?: string): Promise<ICertifiedCopyResendResult>;
|
|
7545
|
+
/**
|
|
7546
|
+
* Download the certified copy from a sent link (`GET /signers/downloads/{token}`).
|
|
7547
|
+
*
|
|
7548
|
+
* The token is the last path segment of the link in the completion and
|
|
7549
|
+
* re-send messages; it is a credential. Links last 7 days (completion) or
|
|
7550
|
+
* 30 minutes (re-send). An expired or unknown link redirects to the
|
|
7551
|
+
* expired-link page; the SDK does not follow it and throws instead.
|
|
7552
|
+
*
|
|
7553
|
+
* @param token - Link token.
|
|
7554
|
+
* @param artifact - `pades` for the PAdES version, when the document has one.
|
|
7555
|
+
* @returns The PDF bytes.
|
|
7556
|
+
* @throws {ValidationError} If `token` is blank or `artifact` is not `pades`.
|
|
7557
|
+
* @throws {ApiError} `302` for an expired or unknown link (ask for a new one
|
|
7558
|
+
* with {@link SignerDocumentsResource.resendCertifiedCopyFromLink}), `404`
|
|
7559
|
+
* for `pades` on a document without it.
|
|
7560
|
+
*
|
|
7561
|
+
* @example
|
|
7562
|
+
* ```ts
|
|
7563
|
+
* const pdf = await client.signerDocuments.downloadCertifiedCopy(token);
|
|
7564
|
+
* ```
|
|
7565
|
+
*/
|
|
7566
|
+
downloadCertifiedCopy(token: string, artifact?: 'pades'): Promise<Buffer>;
|
|
7567
|
+
/**
|
|
7568
|
+
* Send the certified copy again from an expired link
|
|
7569
|
+
* (`POST /signers/downloads/{token}/resend`).
|
|
7570
|
+
*
|
|
7571
|
+
* Works with the link's token after it expired, on the same terms as
|
|
7572
|
+
* {@link SignerDocumentsResource.resendCertifiedCopy}.
|
|
7573
|
+
*
|
|
7574
|
+
* @param token - Link token, from the expired link.
|
|
7575
|
+
* @returns What was sent, as {@link SignerDocumentsResource.resendCertifiedCopy} returns.
|
|
7576
|
+
* @throws {ValidationError} If `token` is blank.
|
|
7577
|
+
* @throws {ApiError} `404` for an unknown link, `409` when nothing can be sent
|
|
7578
|
+
* from it (copy receiver, Bypass signer, no contact, not certified), `429`
|
|
7579
|
+
* within the resend limits.
|
|
7580
|
+
*
|
|
7581
|
+
* @example
|
|
7582
|
+
* ```ts
|
|
7583
|
+
* await client.signerDocuments.resendCertifiedCopyFromLink(token);
|
|
7584
|
+
* ```
|
|
7585
|
+
*/
|
|
7586
|
+
resendCertifiedCopyFromLink(token: string): Promise<ICertifiedCopyResendResult>;
|
|
7587
|
+
/**
|
|
7588
|
+
* Submit the signer's field values to sign an assignment
|
|
7589
|
+
* (`POST /documents/{documentId}/assignments/{assignmentId}?signer-access-code=…`).
|
|
7590
|
+
*
|
|
7591
|
+
* The precise, field-by-field counterpart of
|
|
7592
|
+
* {@link SignerDocumentsResource.signMultiple}: the `entries` array is sent as
|
|
7593
|
+
* the request body, each entry addressing one item resolved from
|
|
7594
|
+
* {@link SignerDocumentsResource.getAssignment}. The access code
|
|
7595
|
+
* authenticates via the `signer-access-code` query param.
|
|
7596
|
+
* Virtual signers must call {@link SignerDocumentsResource.confirmData}
|
|
7597
|
+
* first. Digital Certificate signers cannot use this endpoint; use the
|
|
7598
|
+
* certificate start/complete API flow instead.
|
|
7599
|
+
*
|
|
7600
|
+
* Request body (`application/json`):
|
|
7601
|
+
* ```jsonc
|
|
7602
|
+
* [
|
|
7603
|
+
* {
|
|
7604
|
+
* "itemId": "item_example",
|
|
7605
|
+
* "fieldId": "field_example",
|
|
7606
|
+
* "pageId": "page_example",
|
|
7607
|
+
* "value": "Example Signer"
|
|
7608
|
+
* }
|
|
7609
|
+
* ]
|
|
7610
|
+
* ```
|
|
7611
|
+
*
|
|
7612
|
+
* @param documentId - The document being signed.
|
|
7613
|
+
* @param assignmentId - The assignment within that document.
|
|
7614
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6946
7615
|
* @param entries - Non-empty array of {@link ISignFieldEntry}
|
|
6947
7616
|
* (`itemId`, `fieldId`, `pageId`, `value`) — the body sent to the API.
|
|
6948
7617
|
* @returns The API's signing result object. Its keys are operation-specific,
|
|
@@ -7180,6 +7849,53 @@ declare class UserResource extends BaseResource {
|
|
|
7180
7849
|
* ```
|
|
7181
7850
|
*/
|
|
7182
7851
|
updateNotificationPreferences(preferences: IUpdateNotificationPreferences): Promise<INotificationPreferences>;
|
|
7852
|
+
/**
|
|
7853
|
+
* Read which document alerts reach the user as push notifications
|
|
7854
|
+
* (`GET /users/self/push-preferences`).
|
|
7855
|
+
*
|
|
7856
|
+
* Separate from the e-mail preferences. Every key is returned and defaults
|
|
7857
|
+
* to `true`; new keys may be added. Not available to third-party OAuth
|
|
7858
|
+
* applications (`403`).
|
|
7859
|
+
*
|
|
7860
|
+
* @returns The push preferences:
|
|
7861
|
+
* ```jsonc
|
|
7862
|
+
* {
|
|
7863
|
+
* "SignerViewed": true,
|
|
7864
|
+
* "SignerSigned": true,
|
|
7865
|
+
* "DocumentCompleted": true,
|
|
7866
|
+
* "SignerDeclined": true,
|
|
7867
|
+
* "DocumentAboutToExpire": true,
|
|
7868
|
+
* "DocumentExpired": true,
|
|
7869
|
+
* "SignerIdentityReviewRequired": true, // the review e-mail is always sent
|
|
7870
|
+
* "SignerWhatsappFailed": true
|
|
7871
|
+
* }
|
|
7872
|
+
* ```
|
|
7873
|
+
* @throws {ApiError} `401` for invalid credentials, `403` for an OAuth application token.
|
|
7874
|
+
*
|
|
7875
|
+
* @example
|
|
7876
|
+
* ```ts
|
|
7877
|
+
* const push = await client.users.getPushPreferences();
|
|
7878
|
+
* ```
|
|
7879
|
+
*/
|
|
7880
|
+
getPushPreferences(): Promise<IPushPreferences>;
|
|
7881
|
+
/**
|
|
7882
|
+
* Change which document alerts reach the user as push notifications
|
|
7883
|
+
* (`PUT /users/self/push-preferences`).
|
|
7884
|
+
*
|
|
7885
|
+
* Merges the keys sent; `false` stops that push in every workspace the user
|
|
7886
|
+
* belongs to. E-mail is not affected.
|
|
7887
|
+
*
|
|
7888
|
+
* @param preferences - Keys to change, e.g. `{ SignerViewed: false }`.
|
|
7889
|
+
* @returns The full map, as {@link UserResource.getPushPreferences} returns.
|
|
7890
|
+
* @throws {ValidationError} If the map is empty or a value is not a boolean.
|
|
7891
|
+
* @throws {ApiError} `400` for an unknown code, `403` for an OAuth application token.
|
|
7892
|
+
*
|
|
7893
|
+
* @example
|
|
7894
|
+
* ```ts
|
|
7895
|
+
* await client.users.updatePushPreferences({ SignerViewed: false });
|
|
7896
|
+
* ```
|
|
7897
|
+
*/
|
|
7898
|
+
updatePushPreferences(preferences: IUpdatePushPreferences): Promise<IPushPreferences>;
|
|
7183
7899
|
/**
|
|
7184
7900
|
* List the user's enrolled two-factor methods (`GET /users/self/mfa`).
|
|
7185
7901
|
*
|
|
@@ -7422,14 +8138,14 @@ declare class ContractResource extends BaseResource {
|
|
|
7422
8138
|
* }
|
|
7423
8139
|
* ```
|
|
7424
8140
|
* @throws {ValidationError} If an ID is missing or invalid.
|
|
7425
|
-
* @throws {ApiError} `401` for invalid credentials, `404`
|
|
7426
|
-
*
|
|
8141
|
+
* @throws {ApiError} `401` for invalid credentials, `404` (`code:
|
|
8142
|
+
* 'NoContractTerms'` when the document exists without terms), or `500`.
|
|
7427
8143
|
*
|
|
7428
8144
|
* @example
|
|
7429
8145
|
* ```ts
|
|
7430
8146
|
* const contract = await client.contracts.get(document.id);
|
|
7431
|
-
* if (
|
|
7432
|
-
* console.log(contract.parent_document_id);
|
|
8147
|
+
* if ('parent_document_id' in contract) {
|
|
8148
|
+
* console.log(contract.parent_document_id); // an amendment, renewal or termination
|
|
7433
8149
|
* }
|
|
7434
8150
|
* ```
|
|
7435
8151
|
*/
|
|
@@ -7483,9 +8199,10 @@ declare class ContractResource extends BaseResource {
|
|
|
7483
8199
|
* }
|
|
7484
8200
|
* ```
|
|
7485
8201
|
* @throws {ValidationError} If the payload or an ID is malformed.
|
|
7486
|
-
* @throws {ApiError} `400` for invalid terms, `403`
|
|
7487
|
-
* include tracking, `404` for an
|
|
7488
|
-
*
|
|
8202
|
+
* @throws {ApiError} `400` for invalid terms (each in `fieldErrors`), `403`
|
|
8203
|
+
* (`PlanRestricted`) when the plan does not include tracking, `404` for an
|
|
8204
|
+
* unknown document or a `parent_document_id` outside the workspace, `409`
|
|
8205
|
+
* (`ContractChanged`) after a concurrent change, or `500` on a server error.
|
|
7489
8206
|
*
|
|
7490
8207
|
* @example
|
|
7491
8208
|
* ```ts
|
|
@@ -7509,6 +8226,7 @@ declare class ContractResource extends BaseResource {
|
|
|
7509
8226
|
*
|
|
7510
8227
|
* @param documentId - Any document in the contract family.
|
|
7511
8228
|
* @param accountId - Override the client's default account ID.
|
|
8229
|
+
* @param params - `expand: 'document'` embeds the root contract's document.
|
|
7512
8230
|
* @returns The root contract and ordered instruments:
|
|
7513
8231
|
* ```jsonc
|
|
7514
8232
|
* {
|
|
@@ -7560,7 +8278,9 @@ declare class ContractResource extends BaseResource {
|
|
|
7560
8278
|
* const family = await client.contracts.listRelated(amendmentDocument.id);
|
|
7561
8279
|
* ```
|
|
7562
8280
|
*/
|
|
7563
|
-
listRelated(documentId: string, accountId?: string
|
|
8281
|
+
listRelated(documentId: string, accountId?: string, params?: {
|
|
8282
|
+
expand?: 'document';
|
|
8283
|
+
}): Promise<IDocumentContract>;
|
|
7564
8284
|
/**
|
|
7565
8285
|
* Start a contract's next term
|
|
7566
8286
|
* (`POST /accounts/{accountId}/documents/{documentId}/contract/renew`).
|
|
@@ -7665,6 +8385,515 @@ declare class ContractResource extends BaseResource {
|
|
|
7665
8385
|
private contractPath;
|
|
7666
8386
|
}
|
|
7667
8387
|
|
|
8388
|
+
/**
|
|
8389
|
+
* Envelopes send several documents to the same signers at once. Each document
|
|
8390
|
+
* keeps its own assignment, status, certificate, downloads and webhooks; each
|
|
8391
|
+
* signer receives one invitation for all of their documents, and the envelope
|
|
8392
|
+
* is charged as one document.
|
|
8393
|
+
*
|
|
8394
|
+
* Creating an envelope, adding a document and estimating the cost need the
|
|
8395
|
+
* Envelopes plan feature (`403 PlanRestricted`); every other route works for
|
|
8396
|
+
* every workspace. OAuth tokens need `documents:write` to change envelopes and
|
|
8397
|
+
* `documents:read` to read them.
|
|
8398
|
+
*/
|
|
8399
|
+
declare class EnvelopeResource extends BaseResource {
|
|
8400
|
+
/**
|
|
8401
|
+
* List the workspace's envelopes, most recent first
|
|
8402
|
+
* (`GET /accounts/{accountId}/envelopes`).
|
|
8403
|
+
*
|
|
8404
|
+
* @param params - Optional filters and pagination.
|
|
8405
|
+
* @param params.search - Part of the envelope name.
|
|
8406
|
+
* @param params.status - `open` (a document is still open) or `closed`
|
|
8407
|
+
* (every document signed, declined, cancelled, expired or failed).
|
|
8408
|
+
* @param params.page - One-based page number.
|
|
8409
|
+
* @param params.per-page - Page size: 20 by default, at most 50.
|
|
8410
|
+
* @param accountId - Override the client's default account ID.
|
|
8411
|
+
* @returns Envelopes and pagination metadata:
|
|
8412
|
+
* ```jsonc
|
|
8413
|
+
* {
|
|
8414
|
+
* "data": [{
|
|
8415
|
+
* "id": "1052a1f0c3d4e5f6a7b8c9d0e1f2",
|
|
8416
|
+
* "name": "Admission kit",
|
|
8417
|
+
* "message": "Please sign the documents below.",
|
|
8418
|
+
* "documents": [{
|
|
8419
|
+
* "id": "1052a1e9b8c7d6e5f4a3b2c1d0e9",
|
|
8420
|
+
* "position": 1,
|
|
8421
|
+
* "name": "contract.pdf",
|
|
8422
|
+
* "status": "pending_signature",
|
|
8423
|
+
* "artifacts": {
|
|
8424
|
+
* "original": "https://api.assinafy.com.br/v1/documents/1052a1e9b8c7d6e5f4a3b2c1d0e9/download/original",
|
|
8425
|
+
* "thumbnail": "https://api.assinafy.com.br/v1/documents/1052a1e9b8c7d6e5f4a3b2c1d0e9/thumbnail"
|
|
8426
|
+
* },
|
|
8427
|
+
* "signers": [{
|
|
8428
|
+
* "id": "1052a1d4c3b2a1f0e9d8c7b6a5f4",
|
|
8429
|
+
* "full_name": "Ana Souza",
|
|
8430
|
+
* "email": "ana@example.com",
|
|
8431
|
+
* "whatsapp_phone_number": null,
|
|
8432
|
+
* "completed": false,
|
|
8433
|
+
* "signed_at": null
|
|
8434
|
+
* }]
|
|
8435
|
+
* }],
|
|
8436
|
+
* "counts": { "pending_signature": 1 }, // documents per status; no envelope-level status
|
|
8437
|
+
* "signing_urls": [{
|
|
8438
|
+
* "signer_id": "1052a1d4c3b2a1f0e9d8c7b6a5f4",
|
|
8439
|
+
* "url": "https://app.assinafy.com.br/sign/1052a1e9b8c7d6e5f4a3b2c1d0e9?email=ana%40example.com",
|
|
8440
|
+
* "embedded": false
|
|
8441
|
+
* }],
|
|
8442
|
+
* "created_at": "2026-11-11T14:00:00Z"
|
|
8443
|
+
* }],
|
|
8444
|
+
* "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
|
|
8445
|
+
* }
|
|
8446
|
+
* ```
|
|
8447
|
+
* @throws {ValidationError} If no account ID is available.
|
|
8448
|
+
* @throws {ApiError} `400` for a filter of the wrong type, `403` for a token
|
|
8449
|
+
* without `documents:read`, `401` for invalid credentials.
|
|
8450
|
+
*
|
|
8451
|
+
* @example
|
|
8452
|
+
* ```ts
|
|
8453
|
+
* const { data: open } = await client.envelopes.list({ status: 'open' });
|
|
8454
|
+
* ```
|
|
8455
|
+
*/
|
|
8456
|
+
list(params?: IEnvelopeListParams, accountId?: string): Promise<IEnvelopeListResponse>;
|
|
8457
|
+
/**
|
|
8458
|
+
* Read one envelope (`GET /accounts/{accountId}/envelopes/{envelopeId}`).
|
|
8459
|
+
*
|
|
8460
|
+
* @param envelopeId - Envelope ID.
|
|
8461
|
+
* @param accountId - Override the client's default account ID.
|
|
8462
|
+
* @returns The envelope: its documents in order (`position`), each with its
|
|
8463
|
+
* status and signers, the per-status `counts` and one `signing_urls` entry
|
|
8464
|
+
* per signer. Same shape as each item of {@link EnvelopeResource.list}.
|
|
8465
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8466
|
+
* @throws {ApiError} `403` for a token without `documents:read`, `404` for an
|
|
8467
|
+
* unknown envelope.
|
|
8468
|
+
*
|
|
8469
|
+
* @example
|
|
8470
|
+
* ```ts
|
|
8471
|
+
* const envelope = await client.envelopes.get(envelopeId);
|
|
8472
|
+
* const pending = envelope.documents.filter((doc) => doc.status === 'pending_signature');
|
|
8473
|
+
* ```
|
|
8474
|
+
*/
|
|
8475
|
+
get(envelopeId: string, accountId?: string): Promise<IEnvelope>;
|
|
8476
|
+
/**
|
|
8477
|
+
* Send several documents to the same signers at once
|
|
8478
|
+
* (`POST /accounts/{accountId}/envelopes`).
|
|
8479
|
+
*
|
|
8480
|
+
* Every document must be uploaded, `metadata_ready` and unassigned; every
|
|
8481
|
+
* signer must be on at least one document. Signers all sign at once (no
|
|
8482
|
+
* `step`); a `DigitalCertificate` signer signs only `virtual` documents and
|
|
8483
|
+
* is alone on each. One invitation goes to each signer, and `200` means the
|
|
8484
|
+
* envelope exists even when a send fails (see each signer's
|
|
8485
|
+
* `notification_history`). The envelope is charged as one document, each
|
|
8486
|
+
* signer's notification and identity check once, and each certificate
|
|
8487
|
+
* signature on every document it is made on. A refused request creates and
|
|
8488
|
+
* charges nothing. Pass an `idempotencyKey` to retry safely after a lost
|
|
8489
|
+
* response; the SDK then also replays a `429`.
|
|
8490
|
+
*
|
|
8491
|
+
* @param payload - Envelope definition.
|
|
8492
|
+
* @param payload.name - 1–255 characters without `<`; invitations use it in
|
|
8493
|
+
* place of document names.
|
|
8494
|
+
* @param payload.message - Optional message for every signer.
|
|
8495
|
+
* @param payload.max_total_credits - Refuse with `409 CreditCeilingExceeded`
|
|
8496
|
+
* above this many credits.
|
|
8497
|
+
* @param payload.signers - 1–20 `{ id, verification_method?, notification_methods?, embedded? }`.
|
|
8498
|
+
* @param payload.documents - 1–20 `{ id, signer_ids, method?, entries?, expires_at?, copy_receiver_ids? }`,
|
|
8499
|
+
* in envelope order. `collect` documents need `entries` whose signers are
|
|
8500
|
+
* exactly `signer_ids`.
|
|
8501
|
+
* @param options - `idempotencyKey`: new for each envelope you mean to create.
|
|
8502
|
+
* @param accountId - Override the client's default account ID.
|
|
8503
|
+
* @returns The created envelope (see {@link EnvelopeResource.list}). An
|
|
8504
|
+
* embedded or WhatsApp-only signer has `url: null` in `signing_urls`.
|
|
8505
|
+
* @throws {ValidationError} If the payload is malformed, a signer's channels
|
|
8506
|
+
* do not pair, or a `collect` document has no `entries`.
|
|
8507
|
+
* @throws {ApiError} `400` with `fieldErrors` naming each field at fault, `403`
|
|
8508
|
+
* (`PlanRestricted` or `InsufficientScope`), `409` (`CreditCeilingExceeded`,
|
|
8509
|
+
* or `IdempotencyKeyInUse` while the first request with that key runs).
|
|
8510
|
+
*
|
|
8511
|
+
* @example
|
|
8512
|
+
* ```ts
|
|
8513
|
+
* const envelope = await client.envelopes.create({
|
|
8514
|
+
* name: 'Admission kit',
|
|
8515
|
+
* signers: [{ id: signerId }],
|
|
8516
|
+
* documents: [
|
|
8517
|
+
* { id: contractId, signer_ids: [signerId] },
|
|
8518
|
+
* { id: policyId, signer_ids: [signerId], expires_at: '2026-12-31' },
|
|
8519
|
+
* ],
|
|
8520
|
+
* }, { idempotencyKey: crypto.randomUUID() });
|
|
8521
|
+
* ```
|
|
8522
|
+
*/
|
|
8523
|
+
create(payload: ICreateEnvelopePayload, options?: {
|
|
8524
|
+
idempotencyKey?: string;
|
|
8525
|
+
}, accountId?: string): Promise<IEnvelope>;
|
|
8526
|
+
/**
|
|
8527
|
+
* Estimate what creating an envelope would cost
|
|
8528
|
+
* (`POST /accounts/{accountId}/envelopes/estimate-cost`).
|
|
8529
|
+
*
|
|
8530
|
+
* Takes the creation body and checks it the same way, creating and charging
|
|
8531
|
+
* nothing; `max_total_credits` is ignored. The envelope counts as one
|
|
8532
|
+
* document, each signer's notification and identity check once, and each
|
|
8533
|
+
* certificate signature per document.
|
|
8534
|
+
*
|
|
8535
|
+
* @param payload - The body {@link EnvelopeResource.create} would send.
|
|
8536
|
+
* @param accountId - Override the client's default account ID.
|
|
8537
|
+
* @returns A cost estimate:
|
|
8538
|
+
* ```jsonc
|
|
8539
|
+
* {
|
|
8540
|
+
* "documents": 1,
|
|
8541
|
+
* "credits": 1.45,
|
|
8542
|
+
* "needs_extra_document": false,
|
|
8543
|
+
* "extra_document_cost": 1,
|
|
8544
|
+
* "total_credits": 1.45,
|
|
8545
|
+
* "breakdown": [
|
|
8546
|
+
* { "code": "NotificationWhatsapp", "name": "WhatsApp notification", "cost": 0.45, "quantity": 1, "unit_cost": 0.45 },
|
|
8547
|
+
* { "code": "SignatureDigitalCertificate", "name": "Digital certificate signature", "cost": 1, "quantity": 2, "unit_cost": 0.5 }
|
|
8548
|
+
* ],
|
|
8549
|
+
* "document_balance": 97, // null when documents are not limited
|
|
8550
|
+
* "credit_balance": 10, // null when credits are not limited
|
|
8551
|
+
* "has_sufficient_resources": true,
|
|
8552
|
+
* "blocking_reason": null,
|
|
8553
|
+
* "message": null
|
|
8554
|
+
* }
|
|
8555
|
+
* ```
|
|
8556
|
+
* @throws {ValidationError} If the payload is malformed or a signer's channels do not pair.
|
|
8557
|
+
* @throws {ApiError} `400` for fields at fault, `403` (`PlanRestricted` or
|
|
8558
|
+
* `InsufficientScope`).
|
|
8559
|
+
*
|
|
8560
|
+
* @example
|
|
8561
|
+
* ```ts
|
|
8562
|
+
* const estimate = await client.envelopes.estimateCost(envelopeBody);
|
|
8563
|
+
* if (!estimate.has_sufficient_resources) console.warn(estimate.blocking_reason);
|
|
8564
|
+
* ```
|
|
8565
|
+
*/
|
|
8566
|
+
estimateCost(payload: ICreateEnvelopePayload, accountId?: string): Promise<ICostEstimate>;
|
|
8567
|
+
/**
|
|
8568
|
+
* Rename an envelope, change its message or reorder its documents
|
|
8569
|
+
* (`PATCH /accounts/{accountId}/envelopes/{envelopeId}`).
|
|
8570
|
+
*
|
|
8571
|
+
* Send only what changes. Nothing is sent to anyone; later reminders,
|
|
8572
|
+
* cancellations and additions use the new values. Works on closed envelopes.
|
|
8573
|
+
*
|
|
8574
|
+
* @param envelopeId - Envelope ID.
|
|
8575
|
+
* @param payload - At least one change.
|
|
8576
|
+
* @param payload.name - 1–255 characters without `<`.
|
|
8577
|
+
* @param payload.message - New message, or `null` for none.
|
|
8578
|
+
* @param payload.document_ids - Every document of the envelope, each once, in the new order.
|
|
8579
|
+
* @param accountId - Override the client's default account ID.
|
|
8580
|
+
* @returns The updated envelope (see {@link EnvelopeResource.list}).
|
|
8581
|
+
* @throws {ValidationError} If nothing would change or a value is malformed.
|
|
8582
|
+
* @throws {ApiError} `400` for fields at fault, `403` for a token without
|
|
8583
|
+
* `documents:write`, `404` for an unknown envelope.
|
|
8584
|
+
*
|
|
8585
|
+
* @example
|
|
8586
|
+
* ```ts
|
|
8587
|
+
* await client.envelopes.update(envelopeId, { name: 'Admission kit 2026', message: null });
|
|
8588
|
+
* ```
|
|
8589
|
+
*/
|
|
8590
|
+
update(envelopeId: string, payload: IUpdateEnvelopePayload, accountId?: string): Promise<IEnvelope>;
|
|
8591
|
+
/**
|
|
8592
|
+
* Delete a closed envelope (`DELETE /accounts/{accountId}/envelopes/{envelopeId}`).
|
|
8593
|
+
*
|
|
8594
|
+
* Allowed once every document is certificated, declined, cancelled, expired
|
|
8595
|
+
* or failed; cancel it first otherwise. Its documents remain as ordinary
|
|
8596
|
+
* documents, and its `Idempotency-Key` no longer answers it.
|
|
8597
|
+
*
|
|
8598
|
+
* @param envelopeId - Envelope ID.
|
|
8599
|
+
* @param accountId - Override the client's default account ID.
|
|
8600
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8601
|
+
* @throws {ApiError} `403` for a token without `documents:write`, `404` for an
|
|
8602
|
+
* unknown envelope, `409` (`EnvelopeOpen`) while a document is still open.
|
|
8603
|
+
*
|
|
8604
|
+
* @example
|
|
8605
|
+
* ```ts
|
|
8606
|
+
* await client.envelopes.cancel(envelopeId);
|
|
8607
|
+
* await client.envelopes.delete(envelopeId);
|
|
8608
|
+
* ```
|
|
8609
|
+
*/
|
|
8610
|
+
delete(envelopeId: string, accountId?: string): Promise<void>;
|
|
8611
|
+
/**
|
|
8612
|
+
* Cancel every document that can still be cancelled
|
|
8613
|
+
* (`PUT /accounts/{accountId}/envelopes/{envelopeId}/cancel`).
|
|
8614
|
+
*
|
|
8615
|
+
* Each owner, signer and copy receiver is told once for the whole envelope.
|
|
8616
|
+
* Documents already closed, fully signed or being certificated are left as
|
|
8617
|
+
* they are. Safe to repeat: a second call cancels nothing.
|
|
8618
|
+
*
|
|
8619
|
+
* @param envelopeId - Envelope ID.
|
|
8620
|
+
* @param accountId - Override the client's default account ID.
|
|
8621
|
+
* @returns What happened to each document:
|
|
8622
|
+
* ```jsonc
|
|
8623
|
+
* [
|
|
8624
|
+
* { "id": "1052a1e9b8c7d6e5f4a3b2c1d0e9", "status": "cancelled", "cancelled": true },
|
|
8625
|
+
* { "id": "1052a1eaf9e8d7c6b5a4f3e2d1c0", "status": "certificated", "cancelled": false }
|
|
8626
|
+
* ]
|
|
8627
|
+
* ```
|
|
8628
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8629
|
+
* @throws {ApiError} `403` for a token without `documents:write`, `404` for an
|
|
8630
|
+
* unknown envelope.
|
|
8631
|
+
*
|
|
8632
|
+
* @example
|
|
8633
|
+
* ```ts
|
|
8634
|
+
* const results = await client.envelopes.cancel(envelopeId);
|
|
8635
|
+
* ```
|
|
8636
|
+
*/
|
|
8637
|
+
cancel(envelopeId: string, accountId?: string): Promise<IEnvelopeCancelResult[]>;
|
|
8638
|
+
/**
|
|
8639
|
+
* Read the envelope's activity trail, newest first
|
|
8640
|
+
* (`GET /accounts/{accountId}/envelopes/{envelopeId}/activities`).
|
|
8641
|
+
*
|
|
8642
|
+
* Includes every document the envelope has had, including ones taken out;
|
|
8643
|
+
* each entry is a document activity that also names its document.
|
|
8644
|
+
*
|
|
8645
|
+
* @param envelopeId - Envelope ID.
|
|
8646
|
+
* @param params - `sort` (`-id`, the default, or `id` for oldest first),
|
|
8647
|
+
* `page`, and `per-page` (20 by default, at most 50).
|
|
8648
|
+
* @param accountId - Override the client's default account ID.
|
|
8649
|
+
* @returns Activity entries and pagination metadata:
|
|
8650
|
+
* ```jsonc
|
|
8651
|
+
* {
|
|
8652
|
+
* "data": [{
|
|
8653
|
+
* "id": 7731204,
|
|
8654
|
+
* "event": "signer_signed_document",
|
|
8655
|
+
* "message": "Ana Souza signed the document",
|
|
8656
|
+
* "payload": { "signer": { "id": "1052a1d4c3b2a1f0e9d8c7b6a5f4" } }, // same keys as that event's webhook
|
|
8657
|
+
* "origin": { "ip": "203.0.113.10", "user-agent": "Mozilla/5.0" },
|
|
8658
|
+
* "document_id": "1052a1e9b8c7d6e5f4a3b2c1d0e9",
|
|
8659
|
+
* "document_name": "contract.pdf",
|
|
8660
|
+
* "created_at": "2026-11-11T14:05:00Z"
|
|
8661
|
+
* }],
|
|
8662
|
+
* "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
|
|
8663
|
+
* }
|
|
8664
|
+
* ```
|
|
8665
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8666
|
+
* @throws {ApiError} `403` for a token without `documents:read`, `404` for an
|
|
8667
|
+
* unknown envelope.
|
|
8668
|
+
*
|
|
8669
|
+
* @example
|
|
8670
|
+
* ```ts
|
|
8671
|
+
* const { data } = await client.envelopes.listActivities(envelopeId, { sort: 'id' });
|
|
8672
|
+
* ```
|
|
8673
|
+
*/
|
|
8674
|
+
listActivities(envelopeId: string, params?: IListParams, accountId?: string): Promise<PaginatedResult<IEnvelopeActivity>>;
|
|
8675
|
+
/**
|
|
8676
|
+
* Download one artifact of every document as a zip
|
|
8677
|
+
* (`GET /accounts/{accountId}/envelopes/{envelopeId}/download/{artifactName}`).
|
|
8678
|
+
*
|
|
8679
|
+
* Files are named after their position (`1 - contract.pdf`); `bundle` gives
|
|
8680
|
+
* each document a folder. `certificated`, `certificate-page`, `pades` and
|
|
8681
|
+
* `bundle` include only the documents certified so far.
|
|
8682
|
+
*
|
|
8683
|
+
* @param envelopeId - Envelope ID.
|
|
8684
|
+
* @param artifactName - `original`, `certificated`, `certificate-page`, `pades` or `bundle`.
|
|
8685
|
+
* @param accountId - Override the client's default account ID.
|
|
8686
|
+
* @returns The zip archive bytes.
|
|
8687
|
+
* @throws {ValidationError} If an ID or the artifact name is invalid.
|
|
8688
|
+
* @throws {ApiError} `403` for a token without `documents:read`, `404` when no
|
|
8689
|
+
* document has the artifact.
|
|
8690
|
+
*
|
|
8691
|
+
* @example
|
|
8692
|
+
* ```ts
|
|
8693
|
+
* import { writeFile } from 'node:fs/promises';
|
|
8694
|
+
* await writeFile('envelope.zip', await client.envelopes.download(envelopeId, 'certificated'));
|
|
8695
|
+
* ```
|
|
8696
|
+
*/
|
|
8697
|
+
download(envelopeId: string, artifactName: DocumentArtifactName, accountId?: string): Promise<Buffer>;
|
|
8698
|
+
/**
|
|
8699
|
+
* Add a document to an open envelope for some of its signers
|
|
8700
|
+
* (`POST /accounts/{accountId}/envelopes/{envelopeId}/documents`).
|
|
8701
|
+
*
|
|
8702
|
+
* The document is checked as on creation and goes last. Only its
|
|
8703
|
+
* certificate signatures are charged; the chosen signers receive the
|
|
8704
|
+
* envelope invitation again, now listing it. No new signer can join, and an
|
|
8705
|
+
* envelope holds at most 20 documents.
|
|
8706
|
+
*
|
|
8707
|
+
* @param envelopeId - Envelope ID.
|
|
8708
|
+
* @param payload - `{ id, signer_ids, method?, entries?, expires_at?, copy_receiver_ids?, max_total_credits? }`.
|
|
8709
|
+
* @param accountId - Override the client's default account ID.
|
|
8710
|
+
* @returns The updated envelope (see {@link EnvelopeResource.list}).
|
|
8711
|
+
* @throws {ValidationError} If the document definition is malformed.
|
|
8712
|
+
* @throws {ApiError} `400` for fields at fault, `403` (`PlanRestricted` or
|
|
8713
|
+
* `InsufficientScope`), `409` (`EnvelopeClosed`, `CreditCeilingExceeded`).
|
|
8714
|
+
*
|
|
8715
|
+
* @example
|
|
8716
|
+
* ```ts
|
|
8717
|
+
* await client.envelopes.addDocument(envelopeId, { id: annexId, signer_ids: [signerId] });
|
|
8718
|
+
* ```
|
|
8719
|
+
*/
|
|
8720
|
+
addDocument(envelopeId: string, payload: IAddEnvelopeDocumentPayload, accountId?: string): Promise<IEnvelope>;
|
|
8721
|
+
/**
|
|
8722
|
+
* Take an open document out of the envelope
|
|
8723
|
+
* (`DELETE /accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}`).
|
|
8724
|
+
*
|
|
8725
|
+
* The document is cancelled and its people are told; the other documents
|
|
8726
|
+
* carry on, and links sent from it keep opening them.
|
|
8727
|
+
*
|
|
8728
|
+
* @param envelopeId - Envelope ID.
|
|
8729
|
+
* @param documentId - Document to take out.
|
|
8730
|
+
* @param accountId - Override the client's default account ID.
|
|
8731
|
+
* @returns The updated envelope (see {@link EnvelopeResource.list}).
|
|
8732
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8733
|
+
* @throws {ApiError} `403` for a token without `documents:write`, `404` when the
|
|
8734
|
+
* document is not in the envelope, `409` (`DocumentClosed`) when it can no
|
|
8735
|
+
* longer be cancelled.
|
|
8736
|
+
*
|
|
8737
|
+
* @example
|
|
8738
|
+
* ```ts
|
|
8739
|
+
* await client.envelopes.removeDocument(envelopeId, documentId);
|
|
8740
|
+
* ```
|
|
8741
|
+
*/
|
|
8742
|
+
removeDocument(envelopeId: string, documentId: string, accountId?: string): Promise<IEnvelope>;
|
|
8743
|
+
/**
|
|
8744
|
+
* Remind a signer of the whole envelope
|
|
8745
|
+
* (`PUT /accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/resend`).
|
|
8746
|
+
*
|
|
8747
|
+
* One message from their first link, listing the documents still to sign;
|
|
8748
|
+
* paid channels are charged once. A document's own reminder
|
|
8749
|
+
* (`assignments.resendNotification`) still goes per document.
|
|
8750
|
+
*
|
|
8751
|
+
* @param envelopeId - Envelope ID.
|
|
8752
|
+
* @param signerId - Signer of the envelope.
|
|
8753
|
+
* @param accountId - Override the client's default account ID.
|
|
8754
|
+
* @returns Delivery acknowledgement:
|
|
8755
|
+
* ```jsonc
|
|
8756
|
+
* { "is_sent": true, "envelope_id": "1052a1f0c3d4e5f6a7b8c9d0e1f2", "signer_id": "1052a1d4c3b2a1f0e9d8c7b6a5f4" }
|
|
8757
|
+
* ```
|
|
8758
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8759
|
+
* @throws {ApiError} `400` when the signer has nothing left to sign or credits
|
|
8760
|
+
* are short, `404` when the signer is not on the envelope, `409`
|
|
8761
|
+
* (`EnvelopeClosed`).
|
|
8762
|
+
*
|
|
8763
|
+
* @example
|
|
8764
|
+
* ```ts
|
|
8765
|
+
* await client.envelopes.resendNotification(envelopeId, signerId);
|
|
8766
|
+
* ```
|
|
8767
|
+
*/
|
|
8768
|
+
resendNotification(envelopeId: string, signerId: string, accountId?: string): Promise<IEnvelopeResendResponse>;
|
|
8769
|
+
private envelopesPath;
|
|
8770
|
+
private envelopePath;
|
|
8771
|
+
}
|
|
8772
|
+
|
|
8773
|
+
/**
|
|
8774
|
+
* Server-side half of embedded signing: register the origins allowed to frame
|
|
8775
|
+
* the signing page and mint single-use sessions for `embedded` signers. The
|
|
8776
|
+
* browser half (iframe, `postMessage` handshake) is outside this SDK.
|
|
8777
|
+
*
|
|
8778
|
+
* Needs the Embed plan feature (`403 PlanRestricted` otherwise) and an API key
|
|
8779
|
+
* or user token: OAuth application tokens cannot reach these routes. Keep
|
|
8780
|
+
* these calls on your backend.
|
|
8781
|
+
*/
|
|
8782
|
+
declare class EmbedResource extends BaseResource {
|
|
8783
|
+
/**
|
|
8784
|
+
* List the origins allowed to embed signing pages, oldest first
|
|
8785
|
+
* (`GET /accounts/{accountId}/embed-origins`).
|
|
8786
|
+
*
|
|
8787
|
+
* @param accountId - Override the client's default account ID.
|
|
8788
|
+
* @returns Registered origins:
|
|
8789
|
+
* ```jsonc
|
|
8790
|
+
* [{ "id": "1052c7d8e9f0a1b2c3d4e5f6a7b8", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }]
|
|
8791
|
+
* ```
|
|
8792
|
+
* @throws {ValidationError} If no account ID is available.
|
|
8793
|
+
* @throws {ApiError} `403` (`PlanRestricted`, or an OAuth application token).
|
|
8794
|
+
*
|
|
8795
|
+
* @example
|
|
8796
|
+
* ```ts
|
|
8797
|
+
* const origins = await client.embed.listOrigins();
|
|
8798
|
+
* ```
|
|
8799
|
+
*/
|
|
8800
|
+
listOrigins(accountId?: string): Promise<IEmbedOrigin[]>;
|
|
8801
|
+
/**
|
|
8802
|
+
* Allow one more origin to embed signing pages
|
|
8803
|
+
* (`POST /accounts/{accountId}/embed-origins`).
|
|
8804
|
+
*
|
|
8805
|
+
* An origin is an exact `https://host[:port]` (`http` only for `localhost`
|
|
8806
|
+
* and `127.0.0.1`) without path, query, fragment, credentials or wildcard;
|
|
8807
|
+
* the API lowercases the host and drops a default port. Up to 10 per account.
|
|
8808
|
+
*
|
|
8809
|
+
* @param origin - Origin of the page that will host the iframe.
|
|
8810
|
+
* @param accountId - Override the client's default account ID.
|
|
8811
|
+
* @returns The stored origin, e.g.
|
|
8812
|
+
* `{ "id": "1052c7d8e9f0a1b2c3d4e5f6a7b8", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }`.
|
|
8813
|
+
* @throws {ValidationError} If `origin` is blank.
|
|
8814
|
+
* @throws {ApiError} `400` when it is invalid, already registered, or the
|
|
8815
|
+
* account has 10; `403` (`PlanRestricted`, or an OAuth application token).
|
|
8816
|
+
*
|
|
8817
|
+
* @example
|
|
8818
|
+
* ```ts
|
|
8819
|
+
* await client.embed.addOrigin('https://app.example.com');
|
|
8820
|
+
* ```
|
|
8821
|
+
*/
|
|
8822
|
+
addOrigin(origin: string, accountId?: string): Promise<IEmbedOrigin>;
|
|
8823
|
+
/**
|
|
8824
|
+
* Replace an allowed origin, keeping its ID
|
|
8825
|
+
* (`PUT /accounts/{accountId}/embed-origins/{originId}`).
|
|
8826
|
+
*
|
|
8827
|
+
* @param originId - Embed origin ID.
|
|
8828
|
+
* @param origin - New origin, with the rules of {@link EmbedResource.addOrigin}.
|
|
8829
|
+
* @param accountId - Override the client's default account ID.
|
|
8830
|
+
* @returns The updated origin.
|
|
8831
|
+
* @throws {ValidationError} If an ID or the origin is blank.
|
|
8832
|
+
* @throws {ApiError} `400` for an invalid or duplicate origin, `403`, `404` for
|
|
8833
|
+
* an unknown origin ID.
|
|
8834
|
+
*
|
|
8835
|
+
* @example
|
|
8836
|
+
* ```ts
|
|
8837
|
+
* await client.embed.updateOrigin(originId, 'https://sign.example.com');
|
|
8838
|
+
* ```
|
|
8839
|
+
*/
|
|
8840
|
+
updateOrigin(originId: string, origin: string, accountId?: string): Promise<IEmbedOrigin>;
|
|
8841
|
+
/**
|
|
8842
|
+
* Stop allowing an origin (`DELETE /accounts/{accountId}/embed-origins/{originId}`).
|
|
8843
|
+
*
|
|
8844
|
+
* Removing the last origin disables embedding: new sessions answer `409`
|
|
8845
|
+
* (`embed_origins_missing`).
|
|
8846
|
+
*
|
|
8847
|
+
* @param originId - Embed origin ID.
|
|
8848
|
+
* @param accountId - Override the client's default account ID.
|
|
8849
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8850
|
+
* @throws {ApiError} `403`, or `404` for an unknown origin ID.
|
|
8851
|
+
*
|
|
8852
|
+
* @example
|
|
8853
|
+
* ```ts
|
|
8854
|
+
* await client.embed.deleteOrigin(originId);
|
|
8855
|
+
* ```
|
|
8856
|
+
*/
|
|
8857
|
+
deleteOrigin(originId: string, accountId?: string): Promise<void>;
|
|
8858
|
+
/**
|
|
8859
|
+
* Mint a single-use embed URL for an `embedded` signer
|
|
8860
|
+
* (`POST /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/embed-sessions`).
|
|
8861
|
+
*
|
|
8862
|
+
* Load the URL in an iframe on a registered origin within 5 minutes;
|
|
8863
|
+
* opening it spends the token, so mint a new one each time the frame is
|
|
8864
|
+
* shown, including reloads. Treat it as a credential: hand it only to that
|
|
8865
|
+
* signer's page and never store or log it. Limited to 30 sessions per signer
|
|
8866
|
+
* per hour. For an envelope signer, mint on any of their documents still
|
|
8867
|
+
* waiting for them; the frame lists every document they still have to sign.
|
|
8868
|
+
* Frame events are UI hints: confirm the outcome from webhooks.
|
|
8869
|
+
*
|
|
8870
|
+
* @param documentId - Document ID.
|
|
8871
|
+
* @param assignmentId - Assignment ID.
|
|
8872
|
+
* @param signerId - Signer created with `embedded: true`.
|
|
8873
|
+
* @returns The session:
|
|
8874
|
+
* ```jsonc
|
|
8875
|
+
* {
|
|
8876
|
+
* "url": "https://app.assinafy.com.br/embed/3b1f0c7e9a2d4c58b6e1f4a07d93c2e85a1b0f6d4c7e2a9183b5d6f0e4c8a712",
|
|
8877
|
+
* "expires_at": "2026-11-04T12:05:00Z"
|
|
8878
|
+
* }
|
|
8879
|
+
* ```
|
|
8880
|
+
* @throws {ValidationError} If an ID is missing or invalid.
|
|
8881
|
+
* @throws {ApiError} `400` (`embed_not_enabled_for_signer`), `403`
|
|
8882
|
+
* (`PlanRestricted`), `404` for an unknown document, assignment or signer,
|
|
8883
|
+
* `409` (`already_signed`, `document_not_ready` — retry shortly,
|
|
8884
|
+
* `document_unavailable`, `embed_origins_missing`), `429` past 30 per hour.
|
|
8885
|
+
*
|
|
8886
|
+
* @example
|
|
8887
|
+
* ```ts
|
|
8888
|
+
* const { url } = await client.embed.createSession(document.id, assignment.id, signer.id);
|
|
8889
|
+
* response.json({ url }); // to the signer's browser only
|
|
8890
|
+
* ```
|
|
8891
|
+
*/
|
|
8892
|
+
createSession(documentId: string, assignmentId: string, signerId: string): Promise<IEmbedSession>;
|
|
8893
|
+
private originsPath;
|
|
8894
|
+
private originPath;
|
|
8895
|
+
}
|
|
8896
|
+
|
|
7668
8897
|
/** Headers read by {@link WebhookVerifier.verifySignature}. */
|
|
7669
8898
|
type WebhookHeaders = {
|
|
7670
8899
|
get(name: string): string | null;
|
|
@@ -7681,9 +8910,10 @@ type WebhookHeaders = {
|
|
|
7681
8910
|
declare class WebhookVerifier {
|
|
7682
8911
|
private readonly webhookSecret;
|
|
7683
8912
|
/**
|
|
7684
|
-
* @param webhookSecret - The endpoint's `whsec_…` secret
|
|
7685
|
-
* `webhooks.
|
|
7686
|
-
* (
|
|
8913
|
+
* @param webhookSecret - The endpoint's `whsec_…` secret, as returned by
|
|
8914
|
+
* `webhooks.createEndpoint()` / `updateEndpoint()` when signing turns on,
|
|
8915
|
+
* `rotateEndpointSecret()`, or (API key only) `getEndpointSecret()`. Omit it
|
|
8916
|
+
* to keep verification disabled (every check returns `false`).
|
|
7687
8917
|
*
|
|
7688
8918
|
* @example
|
|
7689
8919
|
* ```ts
|
|
@@ -7835,6 +9065,8 @@ declare class AssinafyClient {
|
|
|
7835
9065
|
readonly signerDocuments: SignerDocumentsResource;
|
|
7836
9066
|
readonly users: UserResource;
|
|
7837
9067
|
readonly contracts: ContractResource;
|
|
9068
|
+
readonly envelopes: EnvelopeResource;
|
|
9069
|
+
readonly embed: EmbedResource;
|
|
7838
9070
|
readonly webhookVerifier: WebhookVerifier;
|
|
7839
9071
|
/**
|
|
7840
9072
|
* Create a client. Supply `apiKey` (preferred, sent as `X-Api-Key`) or a
|
|
@@ -8010,7 +9242,7 @@ declare class AssinafyClient {
|
|
|
8010
9242
|
* });
|
|
8011
9243
|
* console.log(document.status); // usually 'pending_signature'
|
|
8012
9244
|
* console.log(signer_ids.length); // 2
|
|
8013
|
-
* console.log(assignment.signing_urls?.length); // one
|
|
9245
|
+
* console.log(assignment.signing_urls?.length); // one entry per notified signer; url is null for embedded or WhatsApp-only signers
|
|
8014
9246
|
* ```
|
|
8015
9247
|
*/
|
|
8016
9248
|
uploadAndRequestSignatures(options: {
|
|
@@ -8130,10 +9362,36 @@ declare class AssinafyError extends Error {
|
|
|
8130
9362
|
*/
|
|
8131
9363
|
constructor(message: string, context?: Record<string, unknown>, options?: ErrorOptions);
|
|
8132
9364
|
}
|
|
9365
|
+
/** One field the API refused, from the `errors` list of a `400` body. */
|
|
9366
|
+
interface IApiFieldError {
|
|
9367
|
+
/** Field path, e.g. `documents[1].signer_ids`; `null` when the refusal names no field. */
|
|
9368
|
+
field: string | null;
|
|
9369
|
+
/** `Required`, `UnknownField`, `Invalid`, or a more specific code. */
|
|
9370
|
+
code: string;
|
|
9371
|
+
message: string;
|
|
9372
|
+
}
|
|
8133
9373
|
/** Thrown when the API returns a non-success HTTP status. */
|
|
8134
9374
|
declare class ApiError extends AssinafyError {
|
|
8135
9375
|
readonly statusCode: number;
|
|
8136
9376
|
readonly responseData: unknown;
|
|
9377
|
+
/**
|
|
9378
|
+
* Machine-readable refusal code from the error body, on the refusals a
|
|
9379
|
+
* client can act on: `PlanRestricted` (offer the upgrade, don't retry),
|
|
9380
|
+
* `InsufficientScope`, `DocumentNotReady`, `CreditCeilingExceeded`,
|
|
9381
|
+
* `IdempotencyKeyInUse`, `EnvelopeOpen`, `EnvelopeClosed`, `DocumentClosed`,
|
|
9382
|
+
* `ContractChanged`, `NoContractTerms`, `TagInUse`, `embed_origins_missing`, ….
|
|
9383
|
+
* `undefined` when the body has none.
|
|
9384
|
+
*
|
|
9385
|
+
* @example
|
|
9386
|
+
* ```ts
|
|
9387
|
+
* if (error instanceof ApiError && error.code === 'IdempotencyKeyInUse') {
|
|
9388
|
+
* await sleep(1000); // the first request with this key is still running
|
|
9389
|
+
* }
|
|
9390
|
+
* ```
|
|
9391
|
+
*/
|
|
9392
|
+
readonly code?: string;
|
|
9393
|
+
/** Each field a `400` refused, in the order the API reports them. */
|
|
9394
|
+
readonly fieldErrors?: IApiFieldError[];
|
|
8137
9395
|
/**
|
|
8138
9396
|
* Parsed `WWW-Authenticate` challenge, when the response carried one.
|
|
8139
9397
|
*
|
|
@@ -8141,8 +9399,8 @@ declare class ApiError extends AssinafyError {
|
|
|
8141
9399
|
* means the OAuth token is valid but was never granted that permission:
|
|
8142
9400
|
* send the user through the authorization flow again asking for the scope
|
|
8143
9401
|
* named in `scope`. A `403` without a challenge has a different cause —
|
|
8144
|
-
* another workspace, the user's role,
|
|
8145
|
-
* reach — and reconnecting will not fix it.
|
|
9402
|
+
* another workspace, the user's role, the plan (`code: 'PlanRestricted'`),
|
|
9403
|
+
* or a surface OAuth tokens never reach — and reconnecting will not fix it.
|
|
8146
9404
|
*
|
|
8147
9405
|
* @example
|
|
8148
9406
|
* ```ts
|
|
@@ -8315,4 +9573,4 @@ declare const MAX_LIST_PAGE_SIZE = 50;
|
|
|
8315
9573
|
|
|
8316
9574
|
declare const SDK_USER_AGENT: string;
|
|
8317
9575
|
|
|
8318
|
-
export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, type DocumentArtifactName, type DocumentContractRelationType, type DocumentContractStatus, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, FieldsResource, type IAccountTheme, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentContract, type IDocumentContractAmendment, type IDocumentContractExternalReference, type IDocumentContractInput, type IDocumentContractListParams, type IDocumentContractListResponse, type IDocumentDetailsResponse, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IRateLimitInfo, type IRenameDocumentResponse, type IRenewDocumentContractPayload, type IResendCostEstimate, type IResendEmailResponse, type IReviewIdentityVerificationPayload, type ISendTokenResult, type ISignFieldEntry, type ISigner, type ISignerIdentityReview, type ISignerIdentityVerification, type ISignerIdentityVerificationSession, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningProgress, type ISigningUrl, type IStartIdentityVerificationPayload, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITerminateDocumentContractPayload, type ITotpEnrollment, type IUpdateFieldPayload, type IUpdateNotificationPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointCreateResponse, type IWebhookEndpointSecret, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type IdentityVerificationImageName, type IdentityVerificationStatus, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
|
|
9576
|
+
export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, type DocumentArtifactName, type DocumentContractRelationType, type DocumentContractStatus, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, EmbedResource, EnvelopeResource, FieldsResource, type IAcceptTermsResult, type IAccountLimits, type IAccountSigningFeatures, type IAccountTheme, type IAccountUsage, type IAccountUsageBalance, type IAddEnvelopeDocumentPayload, type IApiFieldError, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type ICertifiedCopyResendResult, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateEnvelopePayload, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentContract, type IDocumentContractAmendment, type IDocumentContractExternalReference, type IDocumentContractInput, type IDocumentContractListParams, type IDocumentContractListResponse, type IDocumentDetailsOptions, type IDocumentDetailsResponse, type IDocumentEnvelopeRef, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentRenderOptions, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEmbedOrigin, type IEmbedSession, type IEnvelope, type IEnvelopeActivity, type IEnvelopeCancelResult, type IEnvelopeDocument, type IEnvelopeDocumentInput, type IEnvelopeDocumentSigner, type IEnvelopeListParams, type IEnvelopeListResponse, type IEnvelopeResendResponse, type IEnvelopeSignerInput, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPolicy, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IPushPreferences, type IRateLimitInfo, type IRenameDocumentResponse, type IRenewDocumentContractPayload, type IResendCostEstimate, type IResendEmailResponse, type IReviewIdentityVerificationPayload, type ISendTokenResult, type ISignFieldEntry, type ISigner, type ISignerCertifiedCopyStatus, type ISignerDocumentListParams, type ISignerIdentityReview, type ISignerIdentityVerification, type ISignerIdentityVerificationSession, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningCurrentSigner, type ISigningDocument, type ISigningProgress, type ISigningReadOptions, type ISigningUrl, type IStartIdentityVerificationPayload, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITerminateDocumentContractPayload, type ITotpEnrollment, type IUpdateEnvelopePayload, type IUpdateFieldPayload, type IUpdateNotificationPolicyPayload, type IUpdateNotificationPreferences, type IUpdatePushPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointCreateResponse, type IWebhookEndpointSecret, type IWebhookEndpointSecretRotation, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type IdentityVerificationImageName, type IdentityVerificationStatus, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationPolicyEvent, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, type PushPreferenceEvent, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookDeliveryEventType, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
|