@assinafy/sdk 2.10.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 +126 -1
- package/README.en.md +89 -1649
- package/README.md +87 -1607
- package/dist/index.d.mts +1646 -340
- package/dist/index.d.ts +1646 -340
- package/dist/index.js +1740 -311
- package/dist/index.mjs +1738 -311
- package/docs/API_COVERAGE.md +67 -20
- package/docs/COMPATIBILITY.md +127 -64
- package/docs/README.en.md +1863 -0
- package/docs/README.md +1818 -0
- package/docs/RELEASING.md +1 -1
- package/package.json +3 -2
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';
|
|
@@ -956,7 +1009,7 @@ interface IWebhookRegisterPayload {
|
|
|
956
1009
|
}
|
|
957
1010
|
/**
|
|
958
1011
|
* The account's oldest webhook endpoint, as returned by the legacy
|
|
959
|
-
* subscription routes: `{ events, is_active, url, email, updated_at }`
|
|
1012
|
+
* subscription routes: `{ events, is_active, is_held, held_since, url, email, updated_at }`
|
|
960
1013
|
* (no `id` / `created_at`). Use {@link IWebhookEndpoint} for multi-endpoint
|
|
961
1014
|
* accounts.
|
|
962
1015
|
*/
|
|
@@ -965,6 +1018,10 @@ interface IWebhookSubscription {
|
|
|
965
1018
|
email: string | null;
|
|
966
1019
|
events: string[];
|
|
967
1020
|
is_active: boolean;
|
|
1021
|
+
/** Whether delivery is paused after repeated failures. */
|
|
1022
|
+
is_held?: boolean;
|
|
1023
|
+
/** Unix timestamp when delivery was paused; `null` while it is running. */
|
|
1024
|
+
held_since?: number | null;
|
|
968
1025
|
updated_at?: string | null;
|
|
969
1026
|
}
|
|
970
1027
|
/** Body for `webhooks.createEndpoint()`. */
|
|
@@ -981,12 +1038,17 @@ type IWebhookEndpointUpdatePayload = Partial<IWebhookEndpointCreatePayload>;
|
|
|
981
1038
|
* 3 on paid plans; every active endpoint subscribed to an event receives it.
|
|
982
1039
|
*/
|
|
983
1040
|
interface IWebhookEndpoint {
|
|
1041
|
+
resource?: string;
|
|
984
1042
|
id: string;
|
|
985
1043
|
name: string | null;
|
|
986
1044
|
url: string;
|
|
987
1045
|
email: string;
|
|
988
1046
|
events: (WebhookEventType | AnyString)[];
|
|
989
1047
|
is_active: boolean;
|
|
1048
|
+
/** Whether delivery is paused after repeated failures. */
|
|
1049
|
+
is_held?: boolean;
|
|
1050
|
+
/** Unix timestamp when delivery was paused; `null` while it is running. */
|
|
1051
|
+
held_since?: number | null;
|
|
990
1052
|
/** Whether deliveries carry a `webhook-signature` header. */
|
|
991
1053
|
signing_enabled: boolean;
|
|
992
1054
|
/** ISO-8601 UTC timestamp. */
|
|
@@ -994,9 +1056,9 @@ interface IWebhookEndpoint {
|
|
|
994
1056
|
/** ISO-8601 UTC timestamp. */
|
|
995
1057
|
updated_at: string;
|
|
996
1058
|
}
|
|
997
|
-
/** Endpoint creation also returns
|
|
1059
|
+
/** Endpoint creation/update also returns a newly generated signing secret. */
|
|
998
1060
|
interface IWebhookEndpointCreateResponse extends IWebhookEndpoint {
|
|
999
|
-
/** Store securely
|
|
1061
|
+
/** Store securely when returned; OAuth applications cannot read it later. */
|
|
1000
1062
|
secret?: string;
|
|
1001
1063
|
}
|
|
1002
1064
|
/** An endpoint's Standard Webhooks signing secret. */
|
|
@@ -1004,6 +1066,11 @@ interface IWebhookEndpointSecret {
|
|
|
1004
1066
|
/** `whsec_` followed by the base64-encoded key. */
|
|
1005
1067
|
secret: string;
|
|
1006
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
|
+
}
|
|
1007
1074
|
/** Event code and human-readable description from the webhook event catalog. */
|
|
1008
1075
|
interface IWebhookEventTypeInfo {
|
|
1009
1076
|
id: WebhookEventType | AnyString;
|
|
@@ -1013,7 +1080,7 @@ interface IWebhookEventTypeInfo {
|
|
|
1013
1080
|
interface IWebhookDispatch {
|
|
1014
1081
|
resource?: string;
|
|
1015
1082
|
id: string;
|
|
1016
|
-
event:
|
|
1083
|
+
event: WebhookDeliveryEventType | AnyString;
|
|
1017
1084
|
activity_id: number;
|
|
1018
1085
|
/** Endpoint the delivery went to; `null` once that endpoint is deleted. */
|
|
1019
1086
|
endpoint_id?: string | null;
|
|
@@ -1021,6 +1088,16 @@ interface IWebhookDispatch {
|
|
|
1021
1088
|
endpoint: string | null;
|
|
1022
1089
|
payload: IWebhookPayload | Record<string, unknown> | null;
|
|
1023
1090
|
delivered: boolean;
|
|
1091
|
+
/** Stable `webhook-id` header across attempts for this event and endpoint. */
|
|
1092
|
+
webhook_id?: string | null;
|
|
1093
|
+
/** Attempt number for this event and endpoint, counted from 1. */
|
|
1094
|
+
attempt?: number | null;
|
|
1095
|
+
/** `scheduled` delivery, recovery `probe` to a paused endpoint, or `manual` (retry or test delivery). */
|
|
1096
|
+
kind?: 'scheduled' | 'probe' | 'manual' | AnyString;
|
|
1097
|
+
/** Whether another automatic attempt follows this entry. */
|
|
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;
|
|
1024
1101
|
http_status: number | null;
|
|
1025
1102
|
/** Receiving endpoint body, truncated by Assinafy to 2,000 characters. */
|
|
1026
1103
|
response_body: string | null;
|
|
@@ -1166,26 +1243,27 @@ interface ITemplateDetailsResponse {
|
|
|
1166
1243
|
updated_at?: string;
|
|
1167
1244
|
[key: string]: unknown;
|
|
1168
1245
|
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Signer assignment for creating a document from a template.
|
|
1171
|
-
*
|
|
1172
|
-
* The SDK temporarily rejects `DigitalCertificate` because the server derives
|
|
1173
|
-
* the method from template fields and can create an unusable `collect`
|
|
1174
|
-
* assignment. Use a direct `virtual` assignment for certificate signers.
|
|
1175
|
-
*/
|
|
1246
|
+
/** Signer assignment for creating a document from a template. */
|
|
1176
1247
|
interface ITemplateSigner {
|
|
1177
1248
|
role_id: string;
|
|
1178
|
-
|
|
1249
|
+
/** Existing signer ID. Takes precedence over the email fields when present. */
|
|
1250
|
+
id?: string;
|
|
1251
|
+
/** Reuses the matching signer or creates one when `id` is omitted. */
|
|
1252
|
+
email?: string;
|
|
1253
|
+
/** Full name used when the email does not match an existing signer. */
|
|
1254
|
+
name?: string;
|
|
1255
|
+
/** E.164 number used when the email does not match an existing signer. */
|
|
1256
|
+
whatsapp_phone_number?: string;
|
|
1179
1257
|
verification_method?: AssignmentVerificationMethod;
|
|
1180
1258
|
notification_methods?: AssignmentNotificationMethod[];
|
|
1259
|
+
/** Sign inside your app (see {@link SignerReference}); Email, Whatsapp or Bypass verification. */
|
|
1260
|
+
embedded?: boolean;
|
|
1181
1261
|
/** Positive integer controlling signing order (see {@link SignerReference}). */
|
|
1182
1262
|
step?: number;
|
|
1183
1263
|
}
|
|
1184
1264
|
/**
|
|
1185
1265
|
* Role/channel descriptor used only for template cost estimation. The official
|
|
1186
|
-
* schema intentionally omits signer
|
|
1187
|
-
* temporarily rejects `DigitalCertificate`; use direct virtual-assignment cost
|
|
1188
|
-
* estimation instead.
|
|
1266
|
+
* schema intentionally omits signer identity and sequential-signing fields.
|
|
1189
1267
|
*/
|
|
1190
1268
|
interface ITemplateCostSigner {
|
|
1191
1269
|
role_id: string;
|
|
@@ -1206,6 +1284,13 @@ interface ICreateDocumentFromTemplateOptions {
|
|
|
1206
1284
|
* auto-created; the template's default-document-tags are always merged in.
|
|
1207
1285
|
*/
|
|
1208
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;
|
|
1209
1294
|
}
|
|
1210
1295
|
/**
|
|
1211
1296
|
* Item returned by `GET /documents/statuses`.
|
|
@@ -1243,6 +1328,8 @@ interface IDocumentVerification {
|
|
|
1243
1328
|
signer_count: string | null;
|
|
1244
1329
|
completed_count: number | null;
|
|
1245
1330
|
completed_at: string | null;
|
|
1331
|
+
/** When certification was first recorded. */
|
|
1332
|
+
certificated_at?: string | null;
|
|
1246
1333
|
verified_at: string;
|
|
1247
1334
|
is_valid: boolean;
|
|
1248
1335
|
message: string;
|
|
@@ -1450,10 +1537,11 @@ interface IFieldValidateMultipleEntry {
|
|
|
1450
1537
|
}
|
|
1451
1538
|
/** Item returned by `GET /documents/{id}/assignments/{id}/whatsapp-notifications`. */
|
|
1452
1539
|
interface IWhatsAppNotification {
|
|
1453
|
-
|
|
1540
|
+
/** ISO-8601 UTC timestamp. */
|
|
1541
|
+
sent_at: string;
|
|
1454
1542
|
header: string;
|
|
1455
1543
|
body: string;
|
|
1456
|
-
/**
|
|
1544
|
+
/** Production strips button URLs; sandbox includes them, and they carry access codes. */
|
|
1457
1545
|
buttons: Array<{
|
|
1458
1546
|
text: string;
|
|
1459
1547
|
url?: string;
|
|
@@ -1635,6 +1723,271 @@ interface IOAuthUserInfo {
|
|
|
1635
1723
|
/** Requires the `email` scope. */
|
|
1636
1724
|
email_verified?: boolean | null;
|
|
1637
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
|
+
}
|
|
1638
1991
|
|
|
1639
1992
|
/** Maximum upload size accepted by the API (hard limit, 25 MB). */
|
|
1640
1993
|
declare const MAX_UPLOAD_BYTES: number;
|
|
@@ -1845,7 +2198,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1845
2198
|
* a compact representation with no expanded `assignment` or `pages`, so
|
|
1846
2199
|
* prefer it for name lookups and pickers.
|
|
1847
2200
|
*
|
|
1848
|
-
* @param params - `search`, `status`, `page`, `per-page`.
|
|
2201
|
+
* @param params - `search`, `status`, `page`, `per-page`, and `sort`.
|
|
1849
2202
|
* @param accountId - Override the client's default account ID.
|
|
1850
2203
|
* @returns Matching documents, with pagination in `meta`. Each item:
|
|
1851
2204
|
* ```jsonc
|
|
@@ -1942,7 +2295,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
1942
2295
|
* `null`), rendered `pages`, and `artifacts`. `decline_reason` is returned
|
|
1943
2296
|
* only when the access token belongs to the document creator.
|
|
1944
2297
|
*
|
|
2298
|
+
* `expand: ['envelope_id']` adds the envelope the document is in and
|
|
2299
|
+
* `expand: ['envelope']` its `{ id, name }` (each `null` outside one).
|
|
2300
|
+
*
|
|
1945
2301
|
* @param documentId - The document to fetch.
|
|
2302
|
+
* @param options - `expand`: `envelope_id` and/or `envelope`.
|
|
1946
2303
|
* @returns The document. Response shape (once `metadata_ready`):
|
|
1947
2304
|
* ```jsonc
|
|
1948
2305
|
* {
|
|
@@ -1971,37 +2328,44 @@ declare class DocumentResource extends BaseResource {
|
|
|
1971
2328
|
* "download_url": "https://…/documents/103ad216…/pages/103ad216…/download"
|
|
1972
2329
|
* }
|
|
1973
2330
|
* ],
|
|
2331
|
+
* "has_contract": false,
|
|
2332
|
+
* "envelope_id": null, // with expand: ['envelope_id']
|
|
2333
|
+
* "envelope": null, // with expand: ['envelope']
|
|
1974
2334
|
* "created_at": "2026-07-19T17:24:43Z",
|
|
1975
2335
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1976
2336
|
* }
|
|
1977
2337
|
* ```
|
|
1978
|
-
* @throws {ValidationError} If `documentId` is missing.
|
|
1979
|
-
* @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.
|
|
1980
2341
|
*
|
|
1981
2342
|
* @example
|
|
1982
2343
|
* ```ts
|
|
1983
|
-
* const doc = await client.documents.details('103ad216846e6b90710cb9acef59'
|
|
1984
|
-
*
|
|
2344
|
+
* const doc = await client.documents.details('103ad216846e6b90710cb9acef59', {
|
|
2345
|
+
* expand: ['envelope'],
|
|
2346
|
+
* });
|
|
2347
|
+
* console.log(doc.status, doc.envelope?.name);
|
|
1985
2348
|
* ```
|
|
1986
2349
|
*/
|
|
1987
|
-
details(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
2350
|
+
details(documentId: string, options?: IDocumentDetailsOptions): Promise<IDocumentDetailsResponse>;
|
|
1988
2351
|
private fetchDetails;
|
|
1989
2352
|
/**
|
|
1990
2353
|
* Alias for {@link DocumentResource.details}
|
|
1991
2354
|
* (`GET /documents/{documentId}`).
|
|
1992
2355
|
*
|
|
1993
2356
|
* @param documentId - The document to fetch.
|
|
2357
|
+
* @param options - `expand`, as on {@link DocumentResource.details}.
|
|
1994
2358
|
* @returns The document details (see {@link DocumentResource.details} for
|
|
1995
2359
|
* the response shape).
|
|
1996
2360
|
* @throws {ValidationError} If `documentId` is missing.
|
|
1997
|
-
* @throws {ApiError} `
|
|
2361
|
+
* @throws {ApiError} `403` or `404`, as on {@link DocumentResource.details}.
|
|
1998
2362
|
*
|
|
1999
2363
|
* @example
|
|
2000
2364
|
* ```ts
|
|
2001
2365
|
* const doc = await client.documents.get('103ad216846e6b90710cb9acef59');
|
|
2002
2366
|
* ```
|
|
2003
2367
|
*/
|
|
2004
|
-
get(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
2368
|
+
get(documentId: string, options?: IDocumentDetailsOptions): Promise<IDocumentDetailsResponse>;
|
|
2005
2369
|
/**
|
|
2006
2370
|
* Poll {@link DocumentResource.details} until the document reaches a ready
|
|
2007
2371
|
* status (`metadata_ready`, `pending_signature`, `pending_identity_review`,
|
|
@@ -2068,10 +2432,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
2068
2432
|
* Download the document thumbnail image
|
|
2069
2433
|
* (`GET /documents/{documentId}/thumbnail`).
|
|
2070
2434
|
*
|
|
2435
|
+
* `artifact: 'certificated'` renders it as it is in the signed document.
|
|
2436
|
+
*
|
|
2071
2437
|
* @param documentId - The document whose thumbnail to fetch.
|
|
2072
|
-
* @
|
|
2073
|
-
* @
|
|
2074
|
-
* @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.
|
|
2075
2444
|
*
|
|
2076
2445
|
* @example
|
|
2077
2446
|
* ```ts
|
|
@@ -2079,19 +2448,22 @@ declare class DocumentResource extends BaseResource {
|
|
|
2079
2448
|
* await fs.promises.writeFile('thumb.jpg', thumb);
|
|
2080
2449
|
* ```
|
|
2081
2450
|
*/
|
|
2082
|
-
thumbnail(documentId: string): Promise<Buffer>;
|
|
2451
|
+
thumbnail(documentId: string, options?: IDocumentRenderOptions): Promise<Buffer>;
|
|
2083
2452
|
/**
|
|
2084
|
-
* Download a single rendered page
|
|
2453
|
+
* Download a single rendered page image
|
|
2085
2454
|
* (`GET /documents/{documentId}/pages/{pageId}/download`).
|
|
2086
2455
|
*
|
|
2087
2456
|
* The `pageId` comes from a page's `id` in {@link DocumentResource.details}
|
|
2088
|
-
* 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.
|
|
2089
2459
|
*
|
|
2090
2460
|
* @param documentId - The document the page belongs to.
|
|
2091
2461
|
* @param pageId - The page to download.
|
|
2092
|
-
* @
|
|
2093
|
-
* @
|
|
2094
|
-
* @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.
|
|
2095
2467
|
*
|
|
2096
2468
|
* @example
|
|
2097
2469
|
* ```ts
|
|
@@ -2100,7 +2472,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2100
2472
|
* await fs.promises.writeFile('page-1.jpg', page);
|
|
2101
2473
|
* ```
|
|
2102
2474
|
*/
|
|
2103
|
-
downloadPage(documentId: string, pageId: string): Promise<Buffer>;
|
|
2475
|
+
downloadPage(documentId: string, pageId: string, options?: IDocumentRenderOptions): Promise<Buffer>;
|
|
2104
2476
|
/**
|
|
2105
2477
|
* Fetch a page of the document activity log
|
|
2106
2478
|
* (`GET /documents/{documentId}/activities`).
|
|
@@ -2114,7 +2486,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2114
2486
|
* @param documentId - The document whose activity log to fetch.
|
|
2115
2487
|
* @param params - Optional pagination and sorting parameters.
|
|
2116
2488
|
* @param params.page - Page number, starting at 1.
|
|
2117
|
-
* @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).
|
|
2118
2490
|
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2119
2491
|
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2120
2492
|
* @returns The requested page of activity entries, or `[]`:
|
|
@@ -2144,7 +2516,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2144
2516
|
* @example
|
|
2145
2517
|
* ```ts
|
|
2146
2518
|
* const events = await client.documents.activities('doc-1', {
|
|
2147
|
-
* page: 2, 'per-page':
|
|
2519
|
+
* page: 2, 'per-page': 50, sort: 'id',
|
|
2148
2520
|
* });
|
|
2149
2521
|
* console.log(events.map((e) => e.event));
|
|
2150
2522
|
* ```
|
|
@@ -2162,7 +2534,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
2162
2534
|
* @param documentId - The document whose activity log to fetch.
|
|
2163
2535
|
* @param params - Optional pagination and sorting parameters.
|
|
2164
2536
|
* @param params.page - Page number, starting at 1.
|
|
2165
|
-
* @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).
|
|
2166
2538
|
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2167
2539
|
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2168
2540
|
* @returns Activity entries and pagination metadata when the server supplies it:
|
|
@@ -2194,13 +2566,16 @@ declare class DocumentResource extends BaseResource {
|
|
|
2194
2566
|
* Only documents in a deletable status can be removed — the API returns
|
|
2195
2567
|
* `400` while the document is still `uploading` / `metadata_processing`
|
|
2196
2568
|
* (await {@link DocumentResource.waitUntilReady} first) or once it has been
|
|
2197
|
-
* 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.
|
|
2198
2572
|
*
|
|
2199
2573
|
* @param documentId - The document to delete.
|
|
2200
2574
|
* @returns Nothing; resolves when the document is deleted.
|
|
2201
2575
|
* @throws {ValidationError} If `documentId` is missing.
|
|
2202
2576
|
* @throws {ApiError} `400` if the document is not in a deletable status;
|
|
2203
|
-
* `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.
|
|
2204
2579
|
*
|
|
2205
2580
|
* @example
|
|
2206
2581
|
* ```ts
|
|
@@ -2346,9 +2721,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
2346
2721
|
*
|
|
2347
2722
|
* Instantiates the template, binding each role to a signer, and returns the
|
|
2348
2723
|
* new document. The request body is `{ signers, ...options }` — `signers`
|
|
2349
|
-
* maps every template `role_id` to an existing
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2724
|
+
* maps every template `role_id` to an existing signer `id` or an `email`.
|
|
2725
|
+
* An email reuses the matching account signer or creates one with `name`;
|
|
2726
|
+
* `id` wins when both are present. Options may add `name`, `message`,
|
|
2727
|
+
* `expires_at`, `editor_fields`, and tag names in `tags` (unknown names are
|
|
2728
|
+
* created automatically).
|
|
2352
2729
|
*
|
|
2353
2730
|
* Request body (`application/json`):
|
|
2354
2731
|
* ```jsonc
|
|
@@ -2356,7 +2733,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
2356
2733
|
* "signers": [
|
|
2357
2734
|
* {
|
|
2358
2735
|
* "role_id": "signing_role_example",
|
|
2359
|
-
* "
|
|
2736
|
+
* "email": "signer@example.com",
|
|
2737
|
+
* "name": "Example Signer",
|
|
2738
|
+
* "whatsapp_phone_number": "+15555550100",
|
|
2360
2739
|
* "verification_method": "Email",
|
|
2361
2740
|
* "notification_methods": [
|
|
2362
2741
|
* "Email"
|
|
@@ -2380,27 +2759,33 @@ declare class DocumentResource extends BaseResource {
|
|
|
2380
2759
|
* ```
|
|
2381
2760
|
*
|
|
2382
2761
|
* @param templateId - The template to instantiate.
|
|
2383
|
-
* @param signers - Role-to-signer bindings (each with `role_id` and
|
|
2384
|
-
*
|
|
2762
|
+
* @param signers - Role-to-signer bindings (each with `role_id` and either
|
|
2763
|
+
* an existing `id` or an `email`; email creation also accepts `name` and
|
|
2764
|
+
* `whatsapp_phone_number`). `verification_method`, `notification_methods`,
|
|
2765
|
+
* and `step` are optional.
|
|
2385
2766
|
* Only one notification method is allowed per signer; when only one of the
|
|
2386
2767
|
* verification/notification fields is supplied, the API infers the other.
|
|
2387
2768
|
* `DigitalCertificate` costs 0.5 credits, requires the feature plus a
|
|
2388
2769
|
* signer `government_id`, and that signer must be alone in its step. The
|
|
2389
|
-
* server derives the assignment method from placed template fields
|
|
2390
|
-
*
|
|
2391
|
-
*
|
|
2770
|
+
* server derives the assignment method from placed template fields and
|
|
2771
|
+
* rejects certificate signers when those fields produce a `collect`
|
|
2772
|
+
* assignment. Use a template without placed signer fields for certificate
|
|
2773
|
+
* signing.
|
|
2392
2774
|
* `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
|
|
2393
2775
|
* and a valid CPF in `government_id`; estimate the per-signer fee first.
|
|
2394
2776
|
* @param options - Optional `name`, `message`, `expires_at`,
|
|
2395
2777
|
* `editor_fields`, `tags`.
|
|
2396
2778
|
* @param options.name - Generated document display name.
|
|
2397
2779
|
* @param options.message - Signing invitation message.
|
|
2398
|
-
* @param options.expires_at - ISO-8601
|
|
2780
|
+
* @param options.expires_at - ISO-8601 deadline: date-only (ends at 23:59
|
|
2781
|
+
* UTC), date-time without an offset (treated as UTC), or an offset-aware
|
|
2782
|
+
* date-time.
|
|
2399
2783
|
* @param options.editor_fields - Template editor values as `{ field_id, value }` entries.
|
|
2400
2784
|
* @param options.tags - Tag names attached to the generated document.
|
|
2401
2785
|
* @param accountId - Override the client's default account ID.
|
|
2402
|
-
* @returns The
|
|
2403
|
-
* `
|
|
2786
|
+
* @returns The uploaded document. Assignment creation continues in the
|
|
2787
|
+
* background; follow `GET /documents/{documentId}` or webhooks until the
|
|
2788
|
+
* document becomes `pending_signature` or `failed`:
|
|
2404
2789
|
* ```jsonc
|
|
2405
2790
|
* {
|
|
2406
2791
|
* "resource": "document",
|
|
@@ -2408,22 +2793,21 @@ declare class DocumentResource extends BaseResource {
|
|
|
2408
2793
|
* "account_id": "acc_example",
|
|
2409
2794
|
* "template_id": "103a0991a5cde83518e5672aa9aa",
|
|
2410
2795
|
* "name": "Service agreement from template",
|
|
2411
|
-
* "status": "
|
|
2412
|
-
* "artifacts": { "original": "https://…/download/original"
|
|
2796
|
+
* "status": "uploaded",
|
|
2797
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
2413
2798
|
* "is_closed": false,
|
|
2414
2799
|
* "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
|
|
2415
2800
|
* "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
|
|
2416
|
-
* "assignment":
|
|
2417
|
-
* "pages": [
|
|
2801
|
+
* "assignment": null,
|
|
2802
|
+
* "pages": [],
|
|
2418
2803
|
* "created_at": "2026-07-15T19:57:55Z",
|
|
2419
2804
|
* "updated_at": "2026-07-15T19:59:33Z"
|
|
2420
2805
|
* }
|
|
2421
2806
|
* ```
|
|
2422
|
-
* @throws {ValidationError} If `templateId
|
|
2423
|
-
*
|
|
2424
|
-
*
|
|
2425
|
-
*
|
|
2426
|
-
* is not ready.
|
|
2807
|
+
* @throws {ValidationError} If `templateId`, an account ID, signer identity,
|
|
2808
|
+
* channel, order, deadline, editor field, or tag is invalid.
|
|
2809
|
+
* @throws {ApiError} `400` if the signers/roles are invalid, the template
|
|
2810
|
+
* is not ready, or placed signer fields conflict with `DigitalCertificate`.
|
|
2427
2811
|
*
|
|
2428
2812
|
* @example
|
|
2429
2813
|
* ```ts
|
|
@@ -2439,10 +2823,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2439
2823
|
*
|
|
2440
2824
|
* A dry run: sends only `{ signers }` and consumes nothing. Use it to check
|
|
2441
2825
|
* balances before calling {@link DocumentResource.createFromTemplate}.
|
|
2442
|
-
* `DigitalCertificate`
|
|
2443
|
-
*
|
|
2444
|
-
* refuses certificate signers instead of returning a price for an
|
|
2445
|
-
* assignment that may charge credits but cannot be completed.
|
|
2826
|
+
* `DigitalCertificate` adds 0.5 credits per signer plus notification cost;
|
|
2827
|
+
* the API returns `400` when the template has placed signer fields.
|
|
2446
2828
|
*
|
|
2447
2829
|
* Request body (`application/json`):
|
|
2448
2830
|
* ```jsonc
|
|
@@ -2484,10 +2866,10 @@ declare class DocumentResource extends BaseResource {
|
|
|
2484
2866
|
* "message": null
|
|
2485
2867
|
* }
|
|
2486
2868
|
* ```
|
|
2487
|
-
* @throws {ValidationError} If `templateId
|
|
2488
|
-
*
|
|
2489
|
-
*
|
|
2490
|
-
*
|
|
2869
|
+
* @throws {ValidationError} If `templateId`, an account ID, role, or
|
|
2870
|
+
* channel is invalid.
|
|
2871
|
+
* @throws {ApiError} `400` if the role is invalid or placed signer fields
|
|
2872
|
+
* conflict with `DigitalCertificate`; `403` when a feature is unavailable.
|
|
2491
2873
|
*
|
|
2492
2874
|
* @example
|
|
2493
2875
|
* ```ts
|
|
@@ -2548,13 +2930,14 @@ declare class DocumentResource extends BaseResource {
|
|
|
2548
2930
|
* { "code": "uploaded", "deletable": false },
|
|
2549
2931
|
* { "code": "metadata_processing", "deletable": false },
|
|
2550
2932
|
* { "code": "metadata_ready", "deletable": true },
|
|
2551
|
-
* { "code": "
|
|
2552
|
-
* { "code": "expired", "deletable": false },
|
|
2933
|
+
* { "code": "expired", "deletable": true },
|
|
2553
2934
|
* { "code": "certificating", "deletable": false },
|
|
2554
2935
|
* { "code": "certificated", "deletable": false },
|
|
2555
|
-
* { "code": "rejected_by_signer", "deletable":
|
|
2556
|
-
* { "code": "
|
|
2557
|
-
* { "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 }
|
|
2558
2941
|
* ]
|
|
2559
2942
|
* ```
|
|
2560
2943
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -3032,7 +3415,13 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
3032
3415
|
/**
|
|
3033
3416
|
* Fetch a single workspace (`GET /accounts/{accountId}`).
|
|
3034
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
|
+
*
|
|
3035
3423
|
* @param accountId - The workspace to fetch.
|
|
3424
|
+
* @param options - `expand: 'signing_features'`.
|
|
3036
3425
|
* @returns The workspace. `primary_color` / `secondary_color` are `null`
|
|
3037
3426
|
* until brand colours are set (6-char hex, no `#`, when present):
|
|
3038
3427
|
* ```jsonc
|
|
@@ -3045,31 +3434,127 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
3045
3434
|
* "notification_sender_type": "User",
|
|
3046
3435
|
* "roles": ["owner"],
|
|
3047
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
|
+
* },
|
|
3048
3445
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
3049
3446
|
* }
|
|
3050
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
|
+
* ```
|
|
3051
3511
|
* @throws {ValidationError} If `accountId` is missing.
|
|
3052
|
-
* @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.
|
|
3053
3535
|
*
|
|
3054
3536
|
* @example
|
|
3055
3537
|
* ```ts
|
|
3056
|
-
*
|
|
3538
|
+
* await client.workspaces.updateNotificationPolicy('acc_example', {
|
|
3539
|
+
* events: { SignerViewed: false },
|
|
3540
|
+
* owners_receive_all: true,
|
|
3541
|
+
* });
|
|
3057
3542
|
* ```
|
|
3058
3543
|
*/
|
|
3059
|
-
|
|
3544
|
+
updateNotificationPolicy(accountId: string, payload: IUpdateNotificationPolicyPayload): Promise<INotificationPolicy>;
|
|
3060
3545
|
/**
|
|
3061
3546
|
* Fetch account branding (`GET /accounts/{accountId}/theme`).
|
|
3062
3547
|
*
|
|
3063
3548
|
* Request body/query: none.
|
|
3064
3549
|
*
|
|
3065
3550
|
* @param accountId - Account whose public branding should be returned.
|
|
3066
|
-
* @returns The unwrapped theme:
|
|
3551
|
+
* @returns The unwrapped theme. Colours fall back to the platform default:
|
|
3067
3552
|
* ```jsonc
|
|
3068
3553
|
* {
|
|
3069
3554
|
* "account_name": "Acme Inc.",
|
|
3070
|
-
* "primary_color": "aabbcc",
|
|
3071
|
-
* "secondary_color": "112233",
|
|
3072
|
-
* "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
|
|
3073
3558
|
* }
|
|
3074
3559
|
* ```
|
|
3075
3560
|
* @throws {ValidationError} If `accountId` is empty.
|
|
@@ -3273,7 +3758,7 @@ declare const DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate
|
|
|
3273
3758
|
* @param payload - Assignment method, signer references, and optional message,
|
|
3274
3759
|
* expiration, copy-receiver signer IDs, or collect-field placements.
|
|
3275
3760
|
* @returns A JSON-ready body shaped as
|
|
3276
|
-
* `{ 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? }`.
|
|
3277
3762
|
* @throws {ValidationError} If no signer is present, a signer reference is
|
|
3278
3763
|
* malformed, a collect assignment has no field-placement entries, or a
|
|
3279
3764
|
* `DigitalCertificate` signer is combined with `method: 'collect'`. The last
|
|
@@ -3294,12 +3779,13 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3294
3779
|
/**
|
|
3295
3780
|
* List assignments across the workspace (`GET /assignments`).
|
|
3296
3781
|
*
|
|
3297
|
-
* The account is passed as
|
|
3298
|
-
*
|
|
3299
|
-
*
|
|
3300
|
-
*
|
|
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.
|
|
3301
3786
|
*
|
|
3302
|
-
* @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.
|
|
3303
3789
|
* @param accountId - Override the client's default account ID.
|
|
3304
3790
|
* @returns Assignments, with pagination in `meta`. Each item is a full
|
|
3305
3791
|
* {@link IAssignment} (same shape as {@link AssignmentResource.create}
|
|
@@ -3367,13 +3853,15 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3367
3853
|
* "signing_urls": [
|
|
3368
3854
|
* {
|
|
3369
3855
|
* "signer_id": "19e6b92e7895332ed9708535d8c",
|
|
3370
|
-
* "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
|
|
3371
3858
|
* }
|
|
3372
3859
|
* ]
|
|
3373
3860
|
* }
|
|
3374
3861
|
* ```
|
|
3375
3862
|
* @throws {ValidationError} If no account ID is available.
|
|
3376
|
-
* @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.
|
|
3377
3865
|
*
|
|
3378
3866
|
* @example
|
|
3379
3867
|
* ```ts
|
|
@@ -3424,6 +3912,14 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3424
3912
|
* @param payload - Signers plus optional `method` (defaults to `virtual`),
|
|
3425
3913
|
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
3426
3914
|
* addresses), and `collect`-mode `entries` with page-image geometry.
|
|
3915
|
+
* `expires_at` accepts a date (ending at 23:59 UTC), a date-time without
|
|
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.
|
|
3427
3923
|
* @returns The created {@link IAssignment}: `signers` (rich, with `step` /
|
|
3428
3924
|
* `notified` / `verification_method`), `items` (one row per signer × field),
|
|
3429
3925
|
* a `summary` count block, and per-signer `signing_urls`. Response shape:
|
|
@@ -3488,7 +3984,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3488
3984
|
* "signing_urls": [
|
|
3489
3985
|
* {
|
|
3490
3986
|
* "signer_id": "19e6b92e7895332ed9708535d8c",
|
|
3491
|
-
* "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
|
|
3492
3989
|
* }
|
|
3493
3990
|
* ]
|
|
3494
3991
|
* }
|
|
@@ -3498,7 +3995,10 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3498
3995
|
* combined with `collect`. The last case has `errors.code ===
|
|
3499
3996
|
* 'digital_certificate_requires_virtual_method'`.
|
|
3500
3997
|
* @throws {ApiError} `400` for an invalid assignment or unmet verification
|
|
3501
|
-
* 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`).
|
|
3502
4002
|
*
|
|
3503
4003
|
* @example
|
|
3504
4004
|
* ```ts
|
|
@@ -3507,7 +4007,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3507
4007
|
* message: 'Please sign this contract',
|
|
3508
4008
|
* });
|
|
3509
4009
|
* // → wire body: { method: 'virtual', signers: [{ id: '19e6…' }], message: 'Please sign this contract' }
|
|
3510
|
-
* 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
|
|
3511
4011
|
* ```
|
|
3512
4012
|
*/
|
|
3513
4013
|
create(documentId: string, payload: ICreateAssignmentPayload): Promise<ICreateAssignmentResponse>;
|
|
@@ -3587,9 +4087,10 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3587
4087
|
* (`PUT /documents/{documentId}/assignments/{assignmentId}/reset-expiration`).
|
|
3588
4088
|
*
|
|
3589
4089
|
* Sends `{ expires_at }` verbatim; the key itself is required by the
|
|
3590
|
-
* contract. Use an ISO-8601 date
|
|
3591
|
-
*
|
|
3592
|
-
*
|
|
4090
|
+
* contract. Use an ISO-8601 date, a date-time with or without an offset,
|
|
4091
|
+
* or `null` to remove the expiration. Date-only values end at 23:59 UTC;
|
|
4092
|
+
* date-times without offsets are UTC. `null` is intentionally not stripped
|
|
4093
|
+
* from the body.
|
|
3593
4094
|
*
|
|
3594
4095
|
* Request body (`application/json`):
|
|
3595
4096
|
* ```jsonc
|
|
@@ -3600,8 +4101,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3600
4101
|
*
|
|
3601
4102
|
* @param documentId - The document the assignment belongs to.
|
|
3602
4103
|
* @param assignmentId - The assignment to update.
|
|
3603
|
-
* @param expiresAt - New expiry as an ISO-8601 date
|
|
3604
|
-
* to remove the expiration.
|
|
4104
|
+
* @param expiresAt - New expiry as an ISO-8601 date or date-time string,
|
|
4105
|
+
* or `null` to remove the expiration.
|
|
3605
4106
|
* @returns The updated {@link IAssignment} — the same full shape
|
|
3606
4107
|
* {@link AssignmentResource.create} returns (`signers`, `items`, `summary`,
|
|
3607
4108
|
* `signing_urls`), with `expires_at` reflecting the new value:
|
|
@@ -3663,7 +4164,11 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3663
4164
|
* }
|
|
3664
4165
|
* ```
|
|
3665
4166
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
3666
|
-
* @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()`.
|
|
3667
4172
|
*
|
|
3668
4173
|
* @example
|
|
3669
4174
|
* ```ts
|
|
@@ -3682,26 +4187,20 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3682
4187
|
* @param documentId - The document the assignment belongs to.
|
|
3683
4188
|
* @param assignmentId - The assignment containing the signer.
|
|
3684
4189
|
* @param signerId - The signer whose notification would be resent.
|
|
3685
|
-
* @returns An {@link IResendCostEstimate}:
|
|
3686
|
-
*
|
|
3687
|
-
*
|
|
4190
|
+
* @returns An {@link IResendCostEstimate}: the compact `total` /
|
|
4191
|
+
* `has_sufficient_credits` shape production returns, or the full
|
|
4192
|
+
* {@link ICostEstimate} on older deployments:
|
|
3688
4193
|
* ```jsonc
|
|
3689
4194
|
* {
|
|
3690
|
-
* "
|
|
3691
|
-
* "
|
|
3692
|
-
* "
|
|
3693
|
-
* "
|
|
3694
|
-
* "total_credits": 0,
|
|
3695
|
-
* "breakdown": [],
|
|
3696
|
-
* "document_balance": 67,
|
|
3697
|
-
* "credit_balance": 0,
|
|
3698
|
-
* "has_sufficient_resources": true,
|
|
3699
|
-
* "blocking_reason": null,
|
|
3700
|
-
* "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
|
|
3701
4199
|
* }
|
|
3702
4200
|
* ```
|
|
3703
4201
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
3704
|
-
* @throws {ApiError}
|
|
4202
|
+
* @throws {ApiError} `400` when the signer cannot be reminded (signed, not
|
|
4203
|
+
* yet notified, or notified only by `Bypass`), `403`, `404`.
|
|
3705
4204
|
*
|
|
3706
4205
|
* @example
|
|
3707
4206
|
* ```ts
|
|
@@ -3729,11 +4228,11 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3729
4228
|
* ```jsonc
|
|
3730
4229
|
* [
|
|
3731
4230
|
* {
|
|
3732
|
-
* "sent_at":
|
|
4231
|
+
* "sent_at": "2026-10-19T19:05:48Z",
|
|
3733
4232
|
* "header": "Assinafy",
|
|
3734
4233
|
* "body": "Você tem um documento para assinar.",
|
|
3735
4234
|
* "buttons": [
|
|
3736
|
-
* { "text": "Assinar documento"
|
|
4235
|
+
* { "text": "Assinar documento" } // production strips button URLs
|
|
3737
4236
|
* ],
|
|
3738
4237
|
* "phone_number": "+5511999998888",
|
|
3739
4238
|
* "signer_id": "19e6b92e7895332ed9708535d8c"
|
|
@@ -3909,6 +4408,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3909
4408
|
* "document_processing_failed"
|
|
3910
4409
|
* ],
|
|
3911
4410
|
* "is_active": true,
|
|
4411
|
+
* "is_held": false,
|
|
4412
|
+
* "held_since": null,
|
|
3912
4413
|
* "updated_at": "2026-07-18T02:36:02Z" // no `id` / `created_at` are returned
|
|
3913
4414
|
* }
|
|
3914
4415
|
* ```
|
|
@@ -4041,11 +4542,12 @@ declare class WebhookResource extends BaseResource {
|
|
|
4041
4542
|
* (`GET /accounts/{accountId}/webhooks`). Pagination info (if any) is
|
|
4042
4543
|
* attached in `meta`.
|
|
4043
4544
|
*
|
|
4044
|
-
* Assinafy treats any `2xx` response as success.
|
|
4045
|
-
*
|
|
4046
|
-
*
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4545
|
+
* Assinafy treats any `2xx` response as success. Retriable failures get up
|
|
4546
|
+
* to six attempts about ten minutes apart. After ten failed deliveries in
|
|
4547
|
+
* a row, the endpoint is paused and probed after 3, 15 and 60 minutes, then
|
|
4548
|
+
* every six hours. A successful delivery or probe resumes the endpoint and
|
|
4549
|
+
* replays missed events oldest first. Response bodies are truncated to
|
|
4550
|
+
* 2,000 characters and delivery entries are retained for seven days.
|
|
4049
4551
|
*
|
|
4050
4552
|
* @param params - Optional filters and pagination:
|
|
4051
4553
|
* - `endpoint_id` — only deliveries to this webhook endpoint.
|
|
@@ -4072,6 +4574,10 @@ declare class WebhookResource extends BaseResource {
|
|
|
4072
4574
|
* // subject: <User>, account_id, created_at }
|
|
4073
4575
|
* },
|
|
4074
4576
|
* "delivered": true,
|
|
4577
|
+
* "webhook_id": "9f86d081884c7d659a2feaa0c55ad015",
|
|
4578
|
+
* "attempt": 1,
|
|
4579
|
+
* "kind": "scheduled",
|
|
4580
|
+
* "will_retry": false,
|
|
4075
4581
|
* "http_status": 200,
|
|
4076
4582
|
* "response_body": "{ ... }", // receiving endpoint body, max 2,000 chars
|
|
4077
4583
|
* "error": null,
|
|
@@ -4147,11 +4653,14 @@ declare class WebhookResource extends BaseResource {
|
|
|
4147
4653
|
* [
|
|
4148
4654
|
* {
|
|
4149
4655
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4656
|
+
* "resource": "activity_event_subscription",
|
|
4150
4657
|
* "name": "ERP",
|
|
4151
4658
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4152
4659
|
* "email": "ops@example.com",
|
|
4153
4660
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4154
4661
|
* "is_active": true,
|
|
4662
|
+
* "is_held": false,
|
|
4663
|
+
* "held_since": null,
|
|
4155
4664
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4156
4665
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4157
4666
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
@@ -4177,8 +4686,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
4177
4686
|
* An account can have 1 endpoint, or up to 3 on paid plans. Each endpoint
|
|
4178
4687
|
* of a workspace needs a different `url`. With `signing_enabled: true` the
|
|
4179
4688
|
* API returns a signing `secret` in this creation response. Store it now:
|
|
4180
|
-
* OAuth applications cannot call {@link WebhookResource.getEndpointSecret}
|
|
4181
|
-
*
|
|
4689
|
+
* OAuth applications cannot call {@link WebhookResource.getEndpointSecret},
|
|
4690
|
+
* but they can rotate a lost secret. When `events` is omitted or
|
|
4182
4691
|
* empty, {@link DEFAULT_WEBHOOK_EVENTS} is sent. OAuth tokens need the
|
|
4183
4692
|
* `webhooks:write` scope.
|
|
4184
4693
|
*
|
|
@@ -4194,19 +4703,22 @@ declare class WebhookResource extends BaseResource {
|
|
|
4194
4703
|
* }
|
|
4195
4704
|
* ```
|
|
4196
4705
|
*
|
|
4197
|
-
* @param payload - Endpoint details. `url` (absolute
|
|
4706
|
+
* @param payload - Endpoint details. `url` (absolute HTTPS) and `email`
|
|
4198
4707
|
* are required; `events`, `name`, `is_active` and `signing_enabled` are
|
|
4199
4708
|
* optional.
|
|
4200
4709
|
* @param accountId - Override the client's default account ID.
|
|
4201
4710
|
* @returns The created endpoint:
|
|
4202
4711
|
* ```jsonc
|
|
4203
4712
|
* {
|
|
4713
|
+
* "resource": "activity_event_subscription",
|
|
4204
4714
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4205
4715
|
* "name": "ERP",
|
|
4206
4716
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4207
4717
|
* "email": "ops@example.com",
|
|
4208
4718
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4209
4719
|
* "is_active": true,
|
|
4720
|
+
* "is_held": false,
|
|
4721
|
+
* "held_since": null,
|
|
4210
4722
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4211
4723
|
* "secret": "whsec_c2VjcmV0", // only in this response when signing is enabled
|
|
4212
4724
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
@@ -4242,12 +4754,15 @@ declare class WebhookResource extends BaseResource {
|
|
|
4242
4754
|
* @returns The endpoint:
|
|
4243
4755
|
* ```jsonc
|
|
4244
4756
|
* {
|
|
4757
|
+
* "resource": "activity_event_subscription",
|
|
4245
4758
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4246
4759
|
* "name": "ERP",
|
|
4247
4760
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4248
4761
|
* "email": "ops@example.com",
|
|
4249
4762
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4250
4763
|
* "is_active": true,
|
|
4764
|
+
* "is_held": false,
|
|
4765
|
+
* "held_since": null,
|
|
4251
4766
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4252
4767
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4253
4768
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
@@ -4266,12 +4781,13 @@ declare class WebhookResource extends BaseResource {
|
|
|
4266
4781
|
/**
|
|
4267
4782
|
* Change a webhook endpoint
|
|
4268
4783
|
* (`PUT /accounts/{accountId}/webhooks/endpoints/{endpointId}`). Only the
|
|
4269
|
-
* fields sent are updated; `url`
|
|
4270
|
-
*
|
|
4784
|
+
* fields sent are updated; a changed `url` must be HTTPS, publicly
|
|
4785
|
+
* routable, and different from every other endpoint in the workspace.
|
|
4271
4786
|
*
|
|
4272
4787
|
* `signing_enabled: true` generates a secret if the endpoint has none and
|
|
4273
|
-
* keeps the current one otherwise; `false` discards the secret.
|
|
4274
|
-
*
|
|
4788
|
+
* keeps the current one otherwise; `false` discards the secret. When this
|
|
4789
|
+
* request turns signing on, the response includes the new `secret` once.
|
|
4790
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
4275
4791
|
*
|
|
4276
4792
|
* Request body (`application/json`, every field optional):
|
|
4277
4793
|
* ```jsonc
|
|
@@ -4291,13 +4807,17 @@ declare class WebhookResource extends BaseResource {
|
|
|
4291
4807
|
* @returns The updated endpoint:
|
|
4292
4808
|
* ```jsonc
|
|
4293
4809
|
* {
|
|
4810
|
+
* "resource": "activity_event_subscription",
|
|
4294
4811
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4295
4812
|
* "name": "ERP",
|
|
4296
4813
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4297
4814
|
* "email": "ops@example.com",
|
|
4298
4815
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4299
4816
|
* "is_active": true,
|
|
4817
|
+
* "is_held": false,
|
|
4818
|
+
* "held_since": null,
|
|
4300
4819
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4820
|
+
* "secret": "whsec_c2VjcmV0", // only when this request turned signing on
|
|
4301
4821
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4302
4822
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
4303
4823
|
* }
|
|
@@ -4313,7 +4833,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
4313
4833
|
* await client.webhooks.updateEndpoint(endpoint.id, { is_active: false });
|
|
4314
4834
|
* ```
|
|
4315
4835
|
*/
|
|
4316
|
-
updateEndpoint(endpointId: string, payload: IWebhookEndpointUpdatePayload, accountId?: string): Promise<
|
|
4836
|
+
updateEndpoint(endpointId: string, payload: IWebhookEndpointUpdatePayload, accountId?: string): Promise<IWebhookEndpointCreateResponse>;
|
|
4317
4837
|
/**
|
|
4318
4838
|
* Stop delivering events to an endpoint and free its plan slot
|
|
4319
4839
|
* (`DELETE /accounts/{accountId}/webhooks/endpoints/{endpointId}`). Its
|
|
@@ -4380,28 +4900,89 @@ declare class WebhookResource extends BaseResource {
|
|
|
4380
4900
|
/**
|
|
4381
4901
|
* Replace an endpoint's signing secret and return the new one
|
|
4382
4902
|
* (`POST /accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate`).
|
|
4383
|
-
*
|
|
4384
|
-
*
|
|
4385
|
-
*
|
|
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.
|
|
4386
4910
|
*
|
|
4387
4911
|
* @param endpointId - The endpoint ID.
|
|
4388
4912
|
* @param accountId - Override the client's default account ID.
|
|
4913
|
+
* @param options - `keep_previous`: keep the old secret signing for 24 hours.
|
|
4389
4914
|
* @returns The new secret:
|
|
4390
4915
|
* ```jsonc
|
|
4391
|
-
* {
|
|
4916
|
+
* {
|
|
4917
|
+
* "secret": "whsec_bmV3LWtleS1iYXNlNjQtZW5jb2RlZA==",
|
|
4918
|
+
* "previous_secret_expires_at": "2026-11-12T14:00:00Z" // only with keep_previous: true
|
|
4919
|
+
* }
|
|
4392
4920
|
* ```
|
|
4393
|
-
* @throws {ValidationError} If `endpointId` is empty
|
|
4394
|
-
* available.
|
|
4921
|
+
* @throws {ValidationError} If `endpointId` is empty, no account ID is
|
|
4922
|
+
* available, or `keep_previous` is not a boolean.
|
|
4395
4923
|
* @throws {ApiError} `400` when signing is disabled on the endpoint; `404`
|
|
4396
4924
|
* if it does not exist.
|
|
4397
4925
|
*
|
|
4398
4926
|
* @example
|
|
4399
4927
|
* ```ts
|
|
4400
|
-
* const { secret } = await client.webhooks.rotateEndpointSecret(endpoint.id
|
|
4928
|
+
* const { secret } = await client.webhooks.rotateEndpointSecret(endpoint.id, undefined, {
|
|
4929
|
+
* keep_previous: true,
|
|
4930
|
+
* });
|
|
4401
4931
|
* await secretStore.put('assinafy-webhook-secret', secret);
|
|
4402
4932
|
* ```
|
|
4403
4933
|
*/
|
|
4404
|
-
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>;
|
|
4405
4986
|
private endpointsPath;
|
|
4406
4987
|
private endpointPath;
|
|
4407
4988
|
}
|
|
@@ -5492,7 +6073,10 @@ declare class OAuthResource extends BaseResource {
|
|
|
5492
6073
|
* `['documents:read', 'documents:write', 'offline_access']`. Ask for the
|
|
5493
6074
|
* minimum: the user approves all of them or none. Add `offline_access` to
|
|
5494
6075
|
* receive a refresh token and `openid` to receive an `id_token`.
|
|
5495
|
-
* `
|
|
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).
|
|
5496
6080
|
* @param options.authorizationEndpoint - Skip discovery by supplying the
|
|
5497
6081
|
* endpoint yourself. Defaults to the discovered
|
|
5498
6082
|
* `authorization_endpoint`.
|
|
@@ -5650,6 +6234,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
5650
6234
|
* @throws {OAuthError} `invalid_grant` for a spent, expired, replayed or
|
|
5651
6235
|
* mismatched code; `invalid_client` for a bad `client_id`/`client_secret`;
|
|
5652
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.
|
|
5653
6239
|
*
|
|
5654
6240
|
* @example
|
|
5655
6241
|
* ```ts
|
|
@@ -5716,6 +6302,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
5716
6302
|
* @throws {OAuthError} `invalid_grant` when the refresh token was already
|
|
5717
6303
|
* used, expired, or the user reconnected with different permissions — ask
|
|
5718
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).
|
|
5719
6307
|
*
|
|
5720
6308
|
* @example
|
|
5721
6309
|
* ```ts
|
|
@@ -5844,11 +6432,18 @@ declare class OAuthResource extends BaseResource {
|
|
|
5844
6432
|
* - `GET /accounts/{id}/fields/{id}`
|
|
5845
6433
|
* - `PUT /accounts/{id}/fields/{id}`
|
|
5846
6434
|
* - `DELETE /accounts/{id}/fields/{id}`
|
|
5847
|
-
* - `POST /accounts/{id}/fields/{id}/validate
|
|
5848
|
-
* - `POST /accounts/{id}/fields/validate-multiple
|
|
6435
|
+
* - `POST /accounts/{id}/fields/{id}/validate`
|
|
6436
|
+
* - `POST /accounts/{id}/fields/validate-multiple`
|
|
5849
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.
|
|
5850
6443
|
*/
|
|
5851
6444
|
declare class FieldsResource extends BaseResource {
|
|
6445
|
+
private readonly signerHttp;
|
|
6446
|
+
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
5852
6447
|
/**
|
|
5853
6448
|
* Create a field definition (`POST /accounts/{accountId}/fields`).
|
|
5854
6449
|
*
|
|
@@ -6034,9 +6629,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6034
6629
|
* Validate a single value against a field definition
|
|
6035
6630
|
* (`POST /accounts/{accountId}/fields/{fieldId}/validate`).
|
|
6036
6631
|
*
|
|
6037
|
-
*
|
|
6038
|
-
*
|
|
6039
|
-
*
|
|
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.
|
|
6040
6635
|
*
|
|
6041
6636
|
* Request body (`application/json`):
|
|
6042
6637
|
* ```jsonc
|
|
@@ -6048,9 +6643,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6048
6643
|
* @param fieldId - The field definition to validate against.
|
|
6049
6644
|
* @param value - The value to check (validated against the field's
|
|
6050
6645
|
* type/regex). Sent as `{ value }` in the request body.
|
|
6051
|
-
* @param options - Account override and optional
|
|
6646
|
+
* @param options - Account override and optional `signerAccessCode`.
|
|
6052
6647
|
* @param options.accountId - Override the client's default workspace.
|
|
6053
|
-
* @param options.signerAccessCode -
|
|
6648
|
+
* @param options.signerAccessCode - Authenticate as the signer instead of the workspace.
|
|
6054
6649
|
* @returns The validation result. Response shape:
|
|
6055
6650
|
* ```jsonc
|
|
6056
6651
|
* {
|
|
@@ -6061,7 +6656,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6061
6656
|
* ```
|
|
6062
6657
|
* @throws {ValidationError} If `fieldId` or the account ID is missing, or
|
|
6063
6658
|
* `value` is `undefined`.
|
|
6064
|
-
* @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.
|
|
6065
6662
|
*
|
|
6066
6663
|
* @example
|
|
6067
6664
|
* ```ts
|
|
@@ -6081,9 +6678,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
6081
6678
|
* (`POST /accounts/{accountId}/fields/validate-multiple`).
|
|
6082
6679
|
*
|
|
6083
6680
|
* The request body is the array of `{ field_id, value }` entries itself
|
|
6084
|
-
* (not wrapped in an object).
|
|
6085
|
-
*
|
|
6086
|
-
* {@link FieldsResource.validate}.
|
|
6681
|
+
* (not wrapped in an object). `signerAccessCode` authenticates as described
|
|
6682
|
+
* on {@link FieldsResource.validate}.
|
|
6087
6683
|
*
|
|
6088
6684
|
* Request body (`application/json`):
|
|
6089
6685
|
* ```jsonc
|
|
@@ -6096,9 +6692,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
6096
6692
|
* ```
|
|
6097
6693
|
*
|
|
6098
6694
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
6099
|
-
* @param options - Account override and optional
|
|
6695
|
+
* @param options - Account override and optional `signerAccessCode`.
|
|
6100
6696
|
* @param options.accountId - Override the client's default workspace.
|
|
6101
|
-
* @param options.signerAccessCode -
|
|
6697
|
+
* @param options.signerAccessCode - Authenticate as the signer instead of the workspace.
|
|
6102
6698
|
* @returns One validation result per entry. Response shape:
|
|
6103
6699
|
* ```jsonc
|
|
6104
6700
|
* [
|
|
@@ -6107,7 +6703,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
6107
6703
|
* ]
|
|
6108
6704
|
* ```
|
|
6109
6705
|
* @throws {ValidationError} If `entries` is empty or the account ID is missing.
|
|
6110
|
-
* @throws {ApiError}
|
|
6706
|
+
* @throws {ApiError} `400`, `403`, `404` or `410`, as for {@link FieldsResource.validate}.
|
|
6111
6707
|
*
|
|
6112
6708
|
* @example
|
|
6113
6709
|
* ```ts
|
|
@@ -6148,13 +6744,16 @@ declare class FieldsResource extends BaseResource {
|
|
|
6148
6744
|
* ```
|
|
6149
6745
|
*/
|
|
6150
6746
|
listTypes(): Promise<IFieldType[]>;
|
|
6747
|
+
/** A signer access code must never travel with the workspace credentials. */
|
|
6748
|
+
private transportFor;
|
|
6151
6749
|
}
|
|
6152
6750
|
|
|
6153
6751
|
/**
|
|
6154
|
-
* Signer-side endpoints for custom signing UIs.
|
|
6155
|
-
* `signer-access-code` (the
|
|
6156
|
-
* never the workspace API key
|
|
6157
|
-
*
|
|
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.
|
|
6158
6757
|
*/
|
|
6159
6758
|
declare class SignerDocumentsResource extends BaseResource {
|
|
6160
6759
|
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
@@ -6169,11 +6768,17 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6169
6768
|
* (`GET /signers/{signer_id}/document?signer-access-code=…`).
|
|
6170
6769
|
*
|
|
6171
6770
|
* The signer-side counterpart of {@link DocumentResource.details}, authorised
|
|
6172
|
-
* 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.
|
|
6173
6775
|
*
|
|
6174
6776
|
* @param signerId - The signer whose current document is fetched.
|
|
6175
6777
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6176
|
-
* @
|
|
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`:
|
|
6177
6782
|
* ```jsonc
|
|
6178
6783
|
* {
|
|
6179
6784
|
* "resource": "document",
|
|
@@ -6196,20 +6801,32 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6196
6801
|
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
6197
6802
|
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
6198
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
|
|
6199
6815
|
* "created_at": "2026-07-19T14:56:54Z",
|
|
6200
6816
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6201
6817
|
* }
|
|
6202
6818
|
* ```
|
|
6203
6819
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6204
|
-
* @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.
|
|
6205
6822
|
*
|
|
6206
6823
|
* @example
|
|
6207
6824
|
* ```ts
|
|
6208
|
-
* const doc = await client.signerDocuments.getCurrent(signerId, accessCode);
|
|
6209
|
-
* 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);
|
|
6210
6827
|
* ```
|
|
6211
6828
|
*/
|
|
6212
|
-
getCurrent(signerId: string, signerAccessCode: string): Promise<
|
|
6829
|
+
getCurrent(signerId: string, signerAccessCode: string, options?: Pick<ISigningReadOptions, 'expand'>): Promise<ISigningDocument>;
|
|
6213
6830
|
/**
|
|
6214
6831
|
* List every document awaiting a given signer
|
|
6215
6832
|
* (`GET /signers/{signer_id}/documents?signer-access-code=…`).
|
|
@@ -6221,9 +6838,10 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6221
6838
|
*
|
|
6222
6839
|
* @param signerId - The signer whose documents are listed.
|
|
6223
6840
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6224
|
-
* @param params -
|
|
6225
|
-
*
|
|
6226
|
-
* 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`:
|
|
6227
6845
|
* ```jsonc
|
|
6228
6846
|
* {
|
|
6229
6847
|
* "data": [
|
|
@@ -6247,16 +6865,18 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6247
6865
|
* }
|
|
6248
6866
|
* ```
|
|
6249
6867
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6250
|
-
* @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.
|
|
6251
6870
|
*
|
|
6252
6871
|
* @example
|
|
6253
6872
|
* ```ts
|
|
6254
6873
|
* const { data, meta } = await client.signerDocuments.list(signerId, accessCode, {
|
|
6874
|
+
* envelope_id: envelopeId,
|
|
6255
6875
|
* 'per-page': 20,
|
|
6256
6876
|
* });
|
|
6257
6877
|
* ```
|
|
6258
6878
|
*/
|
|
6259
|
-
list(signerId: string, signerAccessCode: string, params?:
|
|
6879
|
+
list(signerId: string, signerAccessCode: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
|
|
6260
6880
|
/**
|
|
6261
6881
|
* Search the documents awaiting a given signer
|
|
6262
6882
|
* (`GET /signers/{signer_id}/documents/search?signer-access-code=…`).
|
|
@@ -6269,8 +6889,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6269
6889
|
* @param signerId - The signer whose documents are searched.
|
|
6270
6890
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6271
6891
|
* @param search - Free-text term matched against the document name.
|
|
6272
|
-
* @
|
|
6273
|
-
*
|
|
6892
|
+
* @param params - `envelope_id`: only that envelope's documents.
|
|
6893
|
+
* @returns Matching documents for that signer, with pagination in `meta`:
|
|
6274
6894
|
* ```jsonc
|
|
6275
6895
|
* {
|
|
6276
6896
|
* "data": [
|
|
@@ -6294,7 +6914,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6294
6914
|
* }
|
|
6295
6915
|
* ```
|
|
6296
6916
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
6297
|
-
* @throws {ApiError}
|
|
6917
|
+
* @throws {ApiError} `400`, `403` or `410`, as for {@link SignerDocumentsResource.list}.
|
|
6298
6918
|
*
|
|
6299
6919
|
* @example
|
|
6300
6920
|
* ```ts
|
|
@@ -6305,7 +6925,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6305
6925
|
* );
|
|
6306
6926
|
* ```
|
|
6307
6927
|
*/
|
|
6308
|
-
search(signerId: string, signerAccessCode: string, search?: string): Promise<IDocumentListResponse>;
|
|
6928
|
+
search(signerId: string, signerAccessCode: string, search?: string, params?: Pick<ISignerDocumentListParams, 'envelope_id'>): Promise<IDocumentListResponse>;
|
|
6309
6929
|
/**
|
|
6310
6930
|
* List a signer's documents with the workspace credentials
|
|
6311
6931
|
* (`GET /signers/{signer_id}/documents`).
|
|
@@ -6315,8 +6935,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6315
6935
|
* code. No `signer-access-code` is sent.
|
|
6316
6936
|
*
|
|
6317
6937
|
* @param signerId - The signer whose documents are listed.
|
|
6318
|
-
* @param params -
|
|
6319
|
-
* @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
|
|
6320
6940
|
* pagination in `meta` (same shape as {@link SignerDocumentsResource.list}):
|
|
6321
6941
|
* ```jsonc
|
|
6322
6942
|
* {
|
|
@@ -6325,14 +6945,15 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6325
6945
|
* }
|
|
6326
6946
|
* ```
|
|
6327
6947
|
* @throws {ValidationError} If `signerId` is missing.
|
|
6328
|
-
* @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.
|
|
6329
6950
|
*
|
|
6330
6951
|
* @example
|
|
6331
6952
|
* ```ts
|
|
6332
6953
|
* const { data } = await client.signerDocuments.listAsWorkspace(signerId, { page: 1 });
|
|
6333
6954
|
* ```
|
|
6334
6955
|
*/
|
|
6335
|
-
listAsWorkspace(signerId: string, params?:
|
|
6956
|
+
listAsWorkspace(signerId: string, params?: ISignerDocumentListParams): Promise<IDocumentListResponse>;
|
|
6336
6957
|
/**
|
|
6337
6958
|
* Search a signer's documents with the workspace credentials
|
|
6338
6959
|
* (`GET /signers/{signer_id}/documents/search`).
|
|
@@ -6343,42 +6964,37 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6343
6964
|
*
|
|
6344
6965
|
* @param signerId - The signer whose documents are searched.
|
|
6345
6966
|
* @param search - Free-text term matched against the document name.
|
|
6967
|
+
* @param params - `envelope_id`: only that envelope's documents.
|
|
6346
6968
|
* @returns Matching documents with pagination in `meta`, as
|
|
6347
6969
|
* {@link SignerDocumentsResource.listAsWorkspace} returns.
|
|
6348
6970
|
* @throws {ValidationError} If `signerId` is missing or `search` is not a string.
|
|
6349
|
-
* @throws {ApiError} `401`
|
|
6971
|
+
* @throws {ApiError} `401`, `403` or `404`, as for {@link SignerDocumentsResource.listAsWorkspace}.
|
|
6350
6972
|
*
|
|
6351
6973
|
* @example
|
|
6352
6974
|
* ```ts
|
|
6353
6975
|
* const { data } = await client.signerDocuments.searchAsWorkspace(signerId, 'agreement');
|
|
6354
6976
|
* ```
|
|
6355
6977
|
*/
|
|
6356
|
-
searchAsWorkspace(signerId: string, search?: string): Promise<IDocumentListResponse>;
|
|
6978
|
+
searchAsWorkspace(signerId: string, search?: string, params?: Pick<ISignerDocumentListParams, 'envelope_id'>): Promise<IDocumentListResponse>;
|
|
6357
6979
|
/**
|
|
6358
|
-
* Download
|
|
6359
|
-
* (`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`).
|
|
6360
6982
|
*
|
|
6361
|
-
*
|
|
6362
|
-
*
|
|
6363
|
-
*
|
|
6364
|
-
*
|
|
6365
|
-
*
|
|
6366
|
-
* `pades` exists only when the document had a Digital Certificate signer.
|
|
6367
|
-
* A bundle contains original, certificated, and certificate-page artifacts,
|
|
6368
|
-
* 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.
|
|
6369
6988
|
*
|
|
6370
6989
|
* @param signerId - The signer requesting the download.
|
|
6371
6990
|
* @param documentId - The document to download.
|
|
6372
|
-
* @param artifactName -
|
|
6373
|
-
*
|
|
6374
|
-
* @
|
|
6375
|
-
*
|
|
6376
|
-
* @
|
|
6377
|
-
*
|
|
6378
|
-
*
|
|
6379
|
-
* `artifactName` is not one of the five documented names, or an explicitly
|
|
6380
|
-
* supplied legacy `signerAccessCode` is blank.
|
|
6381
|
-
* @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.
|
|
6382
6998
|
*
|
|
6383
6999
|
* @example
|
|
6384
7000
|
* ```ts
|
|
@@ -6386,11 +7002,12 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6386
7002
|
* signerId,
|
|
6387
7003
|
* documentId,
|
|
6388
7004
|
* 'original',
|
|
7005
|
+
* accessCode,
|
|
6389
7006
|
* );
|
|
6390
7007
|
* await fs.promises.writeFile('to-sign.pdf', pdf);
|
|
6391
7008
|
* ```
|
|
6392
7009
|
*/
|
|
6393
|
-
download(signerId: string, documentId: string, artifactName:
|
|
7010
|
+
download(signerId: string, documentId: string, artifactName: 'original', signerAccessCode: string): Promise<Buffer>;
|
|
6394
7011
|
/**
|
|
6395
7012
|
* Sign several documents in one call
|
|
6396
7013
|
* (`PUT /signers/documents/sign-multiple?signer-access-code=…`).
|
|
@@ -6586,10 +7203,15 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6586
7203
|
* flag.
|
|
6587
7204
|
*
|
|
6588
7205
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6589
|
-
* @returns
|
|
6590
|
-
*
|
|
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
|
+
* ```
|
|
6591
7211
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
6592
|
-
* @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.
|
|
6593
7215
|
*
|
|
6594
7216
|
* @example
|
|
6595
7217
|
* ```ts
|
|
@@ -6597,7 +7219,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6597
7219
|
* const assignment = await client.signerDocuments.getAssignment(accessCode, true);
|
|
6598
7220
|
* ```
|
|
6599
7221
|
*/
|
|
6600
|
-
acceptTerms(signerAccessCode: string): Promise<
|
|
7222
|
+
acceptTerms(signerAccessCode: string): Promise<IAcceptTermsResult | null>;
|
|
6601
7223
|
/**
|
|
6602
7224
|
* Verify the signer's email or WhatsApp one-time password
|
|
6603
7225
|
* (`POST /verify?signer-access-code=…`).
|
|
@@ -6639,79 +7261,50 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6639
7261
|
verificationCode: string;
|
|
6640
7262
|
}): Promise<void>;
|
|
6641
7263
|
/**
|
|
6642
|
-
* Confirm
|
|
7264
|
+
* Confirm the signer's contact data before signing
|
|
6643
7265
|
* (`PUT /documents/{documentId}/signers/confirm-data?signer-access-code=…`).
|
|
6644
7266
|
*
|
|
6645
|
-
*
|
|
6646
|
-
*
|
|
6647
|
-
*
|
|
6648
|
-
*
|
|
6649
|
-
*
|
|
6650
|
-
*
|
|
6651
|
-
*
|
|
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.
|
|
6652
7274
|
*
|
|
6653
7275
|
* Request body (`application/json`):
|
|
6654
7276
|
* ```jsonc
|
|
6655
7277
|
* {
|
|
6656
|
-
* "full_name": "Example Signer",
|
|
6657
7278
|
* "email": "signer@example.com",
|
|
6658
|
-
* "government_id": "39053344705",
|
|
6659
7279
|
* "has_accepted_terms": true
|
|
6660
7280
|
* }
|
|
6661
7281
|
* ```
|
|
6662
7282
|
*
|
|
6663
7283
|
* @param documentId - The document the signer is confirming data for.
|
|
6664
7284
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6665
|
-
* @param payload -
|
|
6666
|
-
*
|
|
6667
|
-
*
|
|
6668
|
-
*
|
|
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:
|
|
6669
7289
|
* ```jsonc
|
|
6670
|
-
* {
|
|
6671
|
-
* "
|
|
6672
|
-
* "id": "19e6b92e7895332ed9708535d8c",
|
|
6673
|
-
* "full_name": "Example Signer",
|
|
6674
|
-
* "email": "signer@example.com",
|
|
6675
|
-
* "whatsapp_phone_number": null,
|
|
6676
|
-
* "has_accepted_terms": true
|
|
6677
|
-
* }
|
|
7290
|
+
* { "resource": "signer", "id": "19e6b92e7895332ed9708535d8c", "full_name": "Example Signer",
|
|
7291
|
+
* "email": "signer@example.com", "whatsapp_phone_number": null, "has_accepted_terms": true }
|
|
6678
7292
|
* ```
|
|
6679
7293
|
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
6680
|
-
* or a supplied
|
|
6681
|
-
* @throws {ApiError}
|
|
6682
|
-
*
|
|
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.
|
|
6683
7298
|
*
|
|
6684
7299
|
* @example
|
|
6685
7300
|
* ```ts
|
|
6686
|
-
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00', has_accepted_terms: true }
|
|
6687
7301
|
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
6688
|
-
*
|
|
6689
|
-
* government_id: '123.456.789-00',
|
|
7302
|
+
* email: 'signer@example.com',
|
|
6690
7303
|
* has_accepted_terms: true,
|
|
6691
7304
|
* });
|
|
6692
7305
|
* ```
|
|
6693
7306
|
*/
|
|
6694
|
-
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner>;
|
|
6695
|
-
/**
|
|
6696
|
-
* Confirm signer data with the compatibility phone field
|
|
6697
|
-
* (`PUT /documents/{documentId}/signers/confirm-data`).
|
|
6698
|
-
* @deprecated Compatibility overload preserving the previous wire shape.
|
|
6699
|
-
* `whatsapp_phone_number` is a compatibility pass-through field.
|
|
6700
|
-
* @param documentId - Document identifier.
|
|
6701
|
-
* @param signerAccessCode - Access code sent in the query string.
|
|
6702
|
-
* @param payload - Identity fields, including `whatsapp_phone_number`.
|
|
6703
|
-
* @returns The signer; see the primary overload for its response payload.
|
|
6704
|
-
* @throws {ValidationError} If identity fields or identifiers are invalid.
|
|
6705
|
-
* @throws {ApiError} If the API rejects the confirmation.
|
|
6706
|
-
* @example
|
|
6707
|
-
* ```ts
|
|
6708
|
-
* // JSON body: { "whatsapp_phone_number": "+5511999998888" }
|
|
6709
|
-
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
6710
|
-
* whatsapp_phone_number: '+5511999998888',
|
|
6711
|
-
* });
|
|
6712
|
-
* ```
|
|
6713
|
-
*/
|
|
6714
|
-
confirmData(documentId: string, signerAccessCode: string, payload: ILegacyConfirmSignerDataPayload): Promise<ISigner>;
|
|
7307
|
+
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner | null>;
|
|
6715
7308
|
/**
|
|
6716
7309
|
* Upload the signer's signature or initial image
|
|
6717
7310
|
* (`POST /signature?signer-access-code=…&type=…`).
|
|
@@ -6807,14 +7400,17 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6807
7400
|
* the SDK never automatically replays this particular `GET` after a `429`.
|
|
6808
7401
|
*
|
|
6809
7402
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
6810
|
-
* @param
|
|
6811
|
-
*
|
|
6812
|
-
* `
|
|
6813
|
-
*
|
|
6814
|
-
*
|
|
6815
|
-
*
|
|
6816
|
-
*
|
|
6817
|
-
*
|
|
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`:
|
|
6818
7414
|
* ```jsonc
|
|
6819
7415
|
* {
|
|
6820
7416
|
* "resource": "document",
|
|
@@ -6845,9 +7441,12 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6845
7441
|
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
6846
7442
|
* "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
|
|
6847
7443
|
* "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
|
|
6848
|
-
* ]
|
|
6849
|
-
* "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
|
|
7444
|
+
* ]
|
|
6850
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 },
|
|
6851
7450
|
* "pages": [
|
|
6852
7451
|
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
6853
7452
|
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
@@ -6856,29 +7455,146 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6856
7455
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
6857
7456
|
* }
|
|
6858
7457
|
* ```
|
|
6859
|
-
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
6860
|
-
* @throws {ApiError} `400` when DigitalCertificate
|
|
6861
|
-
*
|
|
6862
|
-
*
|
|
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.
|
|
6863
7464
|
*
|
|
6864
7465
|
* @example
|
|
6865
7466
|
* ```ts
|
|
6866
|
-
* // query → ?signer-access-code=<code>&has_accepted_terms=true
|
|
6867
|
-
* 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
|
+
* });
|
|
6868
7472
|
* ```
|
|
6869
7473
|
*/
|
|
6870
|
-
getAssignment(signerAccessCode: string,
|
|
7474
|
+
getAssignment(signerAccessCode: string, options?: boolean | ISigningReadOptions): Promise<ISigningDocument>;
|
|
6871
7475
|
/**
|
|
6872
|
-
*
|
|
6873
|
-
* (`POST /documents/{documentId}/assignments/{assignmentId}?signer-access-code=…`).
|
|
7476
|
+
* Read the sending workspace's brand for the signing page (`GET /sign/theme`).
|
|
6874
7477
|
*
|
|
6875
|
-
*
|
|
6876
|
-
*
|
|
6877
|
-
*
|
|
6878
|
-
* {@link SignerDocumentsResource.
|
|
6879
|
-
*
|
|
6880
|
-
*
|
|
6881
|
-
*
|
|
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}.
|
|
7482
|
+
*
|
|
7483
|
+
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
7484
|
+
* @returns The brand:
|
|
7485
|
+
* ```jsonc
|
|
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
|
+
* }
|
|
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.
|
|
7495
|
+
*
|
|
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
|
|
6882
7598
|
* certificate start/complete API flow instead.
|
|
6883
7599
|
*
|
|
6884
7600
|
* Request body (`application/json`):
|
|
@@ -7133,6 +7849,53 @@ declare class UserResource extends BaseResource {
|
|
|
7133
7849
|
* ```
|
|
7134
7850
|
*/
|
|
7135
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>;
|
|
7136
7899
|
/**
|
|
7137
7900
|
* List the user's enrolled two-factor methods (`GET /users/self/mfa`).
|
|
7138
7901
|
*
|
|
@@ -7375,14 +8138,14 @@ declare class ContractResource extends BaseResource {
|
|
|
7375
8138
|
* }
|
|
7376
8139
|
* ```
|
|
7377
8140
|
* @throws {ValidationError} If an ID is missing or invalid.
|
|
7378
|
-
* @throws {ApiError} `401` for invalid credentials, `404`
|
|
7379
|
-
*
|
|
8141
|
+
* @throws {ApiError} `401` for invalid credentials, `404` (`code:
|
|
8142
|
+
* 'NoContractTerms'` when the document exists without terms), or `500`.
|
|
7380
8143
|
*
|
|
7381
8144
|
* @example
|
|
7382
8145
|
* ```ts
|
|
7383
8146
|
* const contract = await client.contracts.get(document.id);
|
|
7384
|
-
* if (
|
|
7385
|
-
* 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
|
|
7386
8149
|
* }
|
|
7387
8150
|
* ```
|
|
7388
8151
|
*/
|
|
@@ -7436,9 +8199,10 @@ declare class ContractResource extends BaseResource {
|
|
|
7436
8199
|
* }
|
|
7437
8200
|
* ```
|
|
7438
8201
|
* @throws {ValidationError} If the payload or an ID is malformed.
|
|
7439
|
-
* @throws {ApiError} `400` for invalid terms, `403`
|
|
7440
|
-
* include tracking, `404` for an
|
|
7441
|
-
*
|
|
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.
|
|
7442
8206
|
*
|
|
7443
8207
|
* @example
|
|
7444
8208
|
* ```ts
|
|
@@ -7462,6 +8226,7 @@ declare class ContractResource extends BaseResource {
|
|
|
7462
8226
|
*
|
|
7463
8227
|
* @param documentId - Any document in the contract family.
|
|
7464
8228
|
* @param accountId - Override the client's default account ID.
|
|
8229
|
+
* @param params - `expand: 'document'` embeds the root contract's document.
|
|
7465
8230
|
* @returns The root contract and ordered instruments:
|
|
7466
8231
|
* ```jsonc
|
|
7467
8232
|
* {
|
|
@@ -7513,7 +8278,9 @@ declare class ContractResource extends BaseResource {
|
|
|
7513
8278
|
* const family = await client.contracts.listRelated(amendmentDocument.id);
|
|
7514
8279
|
* ```
|
|
7515
8280
|
*/
|
|
7516
|
-
listRelated(documentId: string, accountId?: string
|
|
8281
|
+
listRelated(documentId: string, accountId?: string, params?: {
|
|
8282
|
+
expand?: 'document';
|
|
8283
|
+
}): Promise<IDocumentContract>;
|
|
7517
8284
|
/**
|
|
7518
8285
|
* Start a contract's next term
|
|
7519
8286
|
* (`POST /accounts/{accountId}/documents/{documentId}/contract/renew`).
|
|
@@ -7618,6 +8385,515 @@ declare class ContractResource extends BaseResource {
|
|
|
7618
8385
|
private contractPath;
|
|
7619
8386
|
}
|
|
7620
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
|
+
|
|
7621
8897
|
/** Headers read by {@link WebhookVerifier.verifySignature}. */
|
|
7622
8898
|
type WebhookHeaders = {
|
|
7623
8899
|
get(name: string): string | null;
|
|
@@ -7634,9 +8910,10 @@ type WebhookHeaders = {
|
|
|
7634
8910
|
declare class WebhookVerifier {
|
|
7635
8911
|
private readonly webhookSecret;
|
|
7636
8912
|
/**
|
|
7637
|
-
* @param webhookSecret - The endpoint's `whsec_…` secret
|
|
7638
|
-
* `webhooks.
|
|
7639
|
-
* (
|
|
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`).
|
|
7640
8917
|
*
|
|
7641
8918
|
* @example
|
|
7642
8919
|
* ```ts
|
|
@@ -7788,6 +9065,8 @@ declare class AssinafyClient {
|
|
|
7788
9065
|
readonly signerDocuments: SignerDocumentsResource;
|
|
7789
9066
|
readonly users: UserResource;
|
|
7790
9067
|
readonly contracts: ContractResource;
|
|
9068
|
+
readonly envelopes: EnvelopeResource;
|
|
9069
|
+
readonly embed: EmbedResource;
|
|
7791
9070
|
readonly webhookVerifier: WebhookVerifier;
|
|
7792
9071
|
/**
|
|
7793
9072
|
* Create a client. Supply `apiKey` (preferred, sent as `X-Api-Key`) or a
|
|
@@ -7895,8 +9174,9 @@ declare class AssinafyClient {
|
|
|
7895
9174
|
* the API; only `collect` assignments require pre-rendered pages.
|
|
7896
9175
|
* @param options.waitOptions - Optional `maxWaitMs` / `pollIntervalMs`
|
|
7897
9176
|
* forwarded to {@link DocumentResource.waitUntilReady}.
|
|
7898
|
-
* @param options.expiresAt - Optional ISO-8601 assignment expiry
|
|
7899
|
-
*
|
|
9177
|
+
* @param options.expiresAt - Optional ISO-8601 assignment expiry. A date
|
|
9178
|
+
* ends at 23:59 UTC; a date-time without an offset is interpreted as UTC;
|
|
9179
|
+
* an explicit offset is honored.
|
|
7900
9180
|
* @param options.copyReceivers - Optional existing signer IDs (not email
|
|
7901
9181
|
* addresses) that receive a copy. See the caveat on
|
|
7902
9182
|
* {@link ICreateAssignmentPayload.copy_receivers}; some plans silently drop
|
|
@@ -7962,7 +9242,7 @@ declare class AssinafyClient {
|
|
|
7962
9242
|
* });
|
|
7963
9243
|
* console.log(document.status); // usually 'pending_signature'
|
|
7964
9244
|
* console.log(signer_ids.length); // 2
|
|
7965
|
-
* 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
|
|
7966
9246
|
* ```
|
|
7967
9247
|
*/
|
|
7968
9248
|
uploadAndRequestSignatures(options: {
|
|
@@ -8082,10 +9362,36 @@ declare class AssinafyError extends Error {
|
|
|
8082
9362
|
*/
|
|
8083
9363
|
constructor(message: string, context?: Record<string, unknown>, options?: ErrorOptions);
|
|
8084
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
|
+
}
|
|
8085
9373
|
/** Thrown when the API returns a non-success HTTP status. */
|
|
8086
9374
|
declare class ApiError extends AssinafyError {
|
|
8087
9375
|
readonly statusCode: number;
|
|
8088
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[];
|
|
8089
9395
|
/**
|
|
8090
9396
|
* Parsed `WWW-Authenticate` challenge, when the response carried one.
|
|
8091
9397
|
*
|
|
@@ -8093,8 +9399,8 @@ declare class ApiError extends AssinafyError {
|
|
|
8093
9399
|
* means the OAuth token is valid but was never granted that permission:
|
|
8094
9400
|
* send the user through the authorization flow again asking for the scope
|
|
8095
9401
|
* named in `scope`. A `403` without a challenge has a different cause —
|
|
8096
|
-
* another workspace, the user's role,
|
|
8097
|
-
* 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.
|
|
8098
9404
|
*
|
|
8099
9405
|
* @example
|
|
8100
9406
|
* ```ts
|
|
@@ -8267,4 +9573,4 @@ declare const MAX_LIST_PAGE_SIZE = 50;
|
|
|
8267
9573
|
|
|
8268
9574
|
declare const SDK_USER_AGENT: string;
|
|
8269
9575
|
|
|
8270
|
-
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 };
|