@assinafy/sdk 3.1.0 → 4.0.1

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/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ type SignatureImageType = 'signature' | 'initial' | AnyString;
15
15
  * suggested while staying assignable from any string, so a value the API adds
16
16
  * later still type-checks.
17
17
  *
18
- * This deliberately does **not** reject unknown strings — these fields mirror
18
+ * This deliberately does **not** reject unknown strings — these fields carry
19
19
  * server-controlled vocabularies, so forward-compatibility is worth more than
20
20
  * rejecting a typo at compile time.
21
21
  */
@@ -28,7 +28,7 @@ type AssignmentMethod = 'virtual' | 'collect';
28
28
  * | Value | How the signer is verified | Requirements | Cost per signer |
29
29
  * | --- | --- | --- | --- |
30
30
  * | `Email` | One-time code sent by e-mail (the default). | An `email`. | 0 credits |
31
- * | `Whatsapp` | One-time code sent over WhatsApp. | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
31
+ * | `Whatsapp` | One-time code sent over WhatsApp. | A `whatsapp_phone_number`; paid plan. | Use the current cost estimate |
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. | Use the current cost estimate |
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
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. |
@@ -131,7 +131,7 @@ interface ISignerIdentityReview {
131
131
  * | Value | Requirements | Cost per signer |
132
132
  * | --- | --- | --- |
133
133
  * | `Email` | An `email`. | 0 credits |
134
- * | `Whatsapp` | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
134
+ * | `Whatsapp` | A `whatsapp_phone_number`; paid plan. | Use the current cost estimate |
135
135
  * | `Bypass` | Sends nothing; with `Bypass`, `DigitalCertificate` or `IdDocumentFaceMatchBasic` verification. Your app delivers the link, e.g. an embed session. | — |
136
136
  *
137
137
  * Notifications are charged when the assignment is created and again on every
@@ -200,8 +200,6 @@ interface ICreateSignerPayload {
200
200
  * the API strips formatting and returns the normalized value.
201
201
  */
202
202
  government_id?: string;
203
- /** Compatibility extension retained for existing integrations. */
204
- metadata?: Record<string, unknown>;
205
203
  }
206
204
  /** Payload for updating a signer. */
207
205
  interface IUpdateSignerPayload {
@@ -243,17 +241,16 @@ interface ISigner {
243
241
  has_initial?: boolean;
244
242
  /** Only returned by `GET /signers/self`. */
245
243
  is_signature_reusable?: boolean;
246
- metadata?: Record<string, unknown>;
247
244
  }
248
245
  /** Signer profile returned by the signer-code-authenticated `GET /signers/self`. */
249
246
  interface ISignerSelf extends ISigner {
250
247
  /** Available before verification so the signing UI can select OTP, certificate or identity capture. */
251
248
  verification_method?: AssignmentVerificationMethod | AnyString;
252
- /** Optional for compatibility with deployments that omit this field. */
249
+ /** Optional for compatibility with API versions that omit this field. */
253
250
  has_signature?: boolean;
254
- /** Optional for compatibility with deployments that omit this field. */
251
+ /** Optional for compatibility with API versions that omit this field. */
255
252
  has_initial?: boolean;
256
- /** Optional for compatibility with deployments that omit this field. */
253
+ /** Optional for compatibility with API versions that omit this field. */
257
254
  is_signature_reusable?: boolean;
258
255
  }
259
256
  /** Official identity fields accepted by the signer `confirm-data` operation. */
@@ -273,28 +270,22 @@ interface IConfirmSignerDataPayload {
273
270
  * DigitalCertificate assignment unless `acceptTerms()` was called.
274
271
  */
275
272
  has_accepted_terms?: boolean;
276
- /** @deprecated Ignored by production; read only by older deployments. */
273
+ /** @deprecated Ignored by production; read only by older API versions. */
277
274
  full_name?: string;
278
- /** @deprecated Ignored by production; read only by older deployments. */
275
+ /** @deprecated Ignored by production; read only by older API versions. */
279
276
  government_id?: string;
280
277
  }
281
- /** @deprecated Identical to {@link IConfirmSignerDataPayload}; kept for existing imports. */
282
- type ILegacyConfirmSignerDataPayload = IConfirmSignerDataPayload;
283
- /** Options for uploading a signature image; staging also supports JPEG. */
278
+ /** Options for uploading a signature image (PNG or JPEG). */
284
279
  interface IUploadSignatureOptions {
285
280
  imageType?: SignatureImageType;
286
281
  /** Raw image media type; defaults to image/png. */
287
282
  contentType?: 'image/png' | 'image/jpeg';
288
- /** Persist this image so it is reused on future documents. */
289
- reuse?: boolean;
290
- }
291
- /** Source-compatible options for older deployments that accepted other media types. */
292
- interface ILegacyUploadSignatureOptions extends Omit<IUploadSignatureOptions, 'contentType'> {
293
283
  /**
294
- * @deprecated Use IUploadSignatureOptions for PNG/JPEG. Other media types
295
- * remain a compatibility escape hatch for older deployments.
284
+ * Mark the signer's stored image reusable on future documents. The upload
285
+ * always replaces the stored image of that type; omitting `reuse` leaves
286
+ * the flag as it was.
296
287
  */
297
- contentType?: string;
288
+ reuse?: boolean;
298
289
  }
299
290
  /** Signer returned after create or update. */
300
291
  type ICreateSignerResponse = ISigner;
@@ -310,11 +301,9 @@ interface PaginatedResult<T> {
310
301
  data: T[];
311
302
  meta?: PaginationMeta;
312
303
  }
313
- /** @deprecated use {@link PaginatedResult} — retained for existing type imports. */
314
- type IPaginatedResponse<T> = PaginatedResult<T>;
315
304
  /** Paginated signer-list response. */
316
305
  type ISignerListResponse = PaginatedResult<ISigner>;
317
- /** Sender-stated capacity printed on the certificate page; available on staging. */
306
+ /** Sender-stated capacity printed on the certificate page; it does not change verification. */
318
307
  type SignerCapacity = 'Sign' | 'Approve' | 'Acknowledge' | 'Party' | 'Witness' | 'Intervening' | 'Receipt' | 'IssuerEndorserGuarantor' | 'IssuerEndorserGuarantorSurety' | 'Surety' | 'PartySurety' | 'JointDebtor' | 'PartyJointDebtor' | 'ContractingParty' | 'ContractedParty' | 'Landlord' | 'Tenant' | 'Buyer' | 'Seller' | 'AttorneyInFact' | 'LegalRepresentative' | 'Employer' | 'Employee';
319
308
  /** Capacity stated by the sender; returned separately from the assignment. */
320
309
  interface ISignerCapacity {
@@ -363,11 +352,9 @@ interface ICreateAssignmentPayload {
363
352
  message?: string;
364
353
  expires_at?: string;
365
354
  /**
366
- * Existing signer IDs to CC on the signature request (not email addresses).
367
- *
368
- * This can be plan-dependent. Confirm that returned assignment data retains
369
- * the IDs before treating a copy as delivered; unsupported plans may accept
370
- * the field but return an empty array.
355
+ * Existing signer IDs that receive a copy of the signed document (not
356
+ * email addresses). Sent on the wire as `copy_receiver_ids`, the field the
357
+ * API reads; the response lists them as `copy_receivers`.
371
358
  */
372
359
  copy_receivers?: string[];
373
360
  /** Field placement entries used when `method` is `collect`. */
@@ -437,7 +424,7 @@ interface IAssignmentSigner extends ISigner {
437
424
  identity_verification_status?: IdentityVerificationStatus | AnyString | null;
438
425
  /** Only present in account-owner contexts; omitted from signer-code responses. */
439
426
  completed?: boolean | null;
440
- /** Optional because some deployments omit notification history. */
427
+ /** Optional because some API versions omit notification history. */
441
428
  notification_history?: INotificationHistoryEntry[] | null;
442
429
  /** Server-controlled response value; request payloads use the strict request enum. */
443
430
  verification_method: AssignmentVerificationMethod | AnyString | null;
@@ -474,9 +461,16 @@ interface IScheduledSend {
474
461
  type: 'assignment' | 'envelope';
475
462
  document_ids: string[];
476
463
  status: 'pending' | 'processing' | 'sent' | 'cancelled' | 'failed';
464
+ /** The scheduled time; it stays as scheduled when the send is postponed. */
477
465
  send_at: string;
466
+ /**
467
+ * When a `pending` send postponed by the free plan's daily signer e-mail
468
+ * limit is tried again; `null` for a send never held back.
469
+ */
470
+ next_attempt_at: string | null;
478
471
  assignment_id: string | null;
479
472
  envelope_id: string | null;
473
+ /** Why it was not sent, once `failed` (Portuguese text, not a code). */
480
474
  failure_reason: string | null;
481
475
  created_at: string;
482
476
  processed_at: string | null;
@@ -587,10 +581,11 @@ interface ICostEstimate {
587
581
  message: string | null;
588
582
  }
589
583
  /**
590
- * Resend-cost payload (`ResendCostEstimate`): `total`, not `total_credits`.
591
- * The name is historical; this is the shape production documents.
584
+ * Reminder cost returned by `assignments.estimateResendCost()` and
585
+ * `envelopes.estimateResendCost()` (`ResendCostEstimate`): `total`, not
586
+ * `total_credits`.
592
587
  */
593
- interface ILegacyResendCostEstimate {
588
+ interface IResendCostEstimate {
594
589
  total: number;
595
590
  breakdown: Array<{
596
591
  code: string;
@@ -601,26 +596,26 @@ interface ILegacyResendCostEstimate {
601
596
  credit_balance: number | null;
602
597
  has_sufficient_credits: boolean;
603
598
  }
604
- /**
605
- * Cost estimate returned by `assignments.estimateResendCost`: the compact
606
- * {@link ILegacyResendCostEstimate}, or {@link ICostEstimate} on older deployments.
607
- */
608
- type IResendCostEstimate = ILegacyResendCostEstimate | ICostEstimate;
609
599
  /** Webhook payload envelope. */
610
600
  interface IWebhookPayload {
611
601
  /** Activity ID. To deduplicate retries prefer the `webhook-id` header, unique per endpoint. */
612
602
  id?: number;
613
603
  event?: WebhookDeliveryEventType | AnyString;
604
+ /** @deprecated Part of a legacy envelope the API never sends; read `event`. */
614
605
  type?: string;
615
606
  message?: string | null;
616
607
  payload?: Record<string, unknown> | null;
617
608
  origin?: Record<string, unknown> | null;
618
- /** Unix timestamp in seconds. */
609
+ /**
610
+ * Unix timestamp in seconds on a delivery. The delivery-history
611
+ * endpoints return the stored payload with every `*_at` as an ISO string.
612
+ */
619
613
  created_at?: number;
614
+ /** Who acted: a `User`, `Signer`, `Account` or, for events nobody triggered, the `Document`. */
620
615
  subject?: Record<string, unknown>;
621
616
  object?: Record<string, unknown>;
622
617
  account_id?: string;
623
- /** Legacy envelope accepted by the verifier for backwards compatibility. */
618
+ /** @deprecated Part of a legacy envelope the API never sends; read `object`. */
624
619
  data?: {
625
620
  document_uuid?: string;
626
621
  document_id?: string;
@@ -634,7 +629,7 @@ interface IWebhookPayload {
634
629
  */
635
630
  type WebhookDeliveryEventType = WebhookEventType | 'webhook_test';
636
631
  /** Known webhook event names. */
637
- 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';
632
+ type WebhookEventType = 'document_uploaded' | 'document_metadata_ready' | 'document_prepared' | 'assignment_created' | 'document_ready' | 'signature_requested' | 'signature_reminder_sent' | 'signature_request_delivery_failed' | '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_expiring' | 'document_expired' | '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';
638
633
  /** Document listing item (paginated). */
639
634
  interface IDocumentListItem {
640
635
  id: string;
@@ -852,6 +847,10 @@ interface IDocumentUploadResponse {
852
847
  };
853
848
  /** Public signing-portal URL for the document (always returned by the upload endpoint). */
854
849
  signing_url?: string;
850
+ /** Code printed on the certificate page; `null` until `certificated`. */
851
+ verification_code?: string | null;
852
+ /** Public verification page; `null` until `certificated`. */
853
+ verification_url?: string | null;
855
854
  /** Empty (`[]`) on fresh upload (status `uploaded`); populated once `metadata_ready`. */
856
855
  pages: Array<{
857
856
  id: string;
@@ -938,7 +937,7 @@ interface IListParams {
938
937
  search?: string;
939
938
  /** Compatibility sort expression retained for existing integrations. */
940
939
  sort?: string;
941
- /** Deployment-specific list filters retained for backwards compatibility. */
940
+ /** Additional list filters retained for backwards compatibility. */
942
941
  [key: string]: string | number | boolean | undefined;
943
942
  }
944
943
  /** Query parameters accepted by `signers.list`. */
@@ -1027,7 +1026,8 @@ interface IDocumentStatsParams {
1027
1026
  /**
1028
1027
  * One zero-filled document-funnel KPI period. Notification counters are not
1029
1028
  * mutually exclusive; verification counters are and sum to
1030
- * `signature_requests`.
1029
+ * `signature_requests` minus the `IdDocumentFaceMatchBasic` requests, which
1030
+ * have no counter.
1031
1031
  */
1032
1032
  interface IDocumentStatsRow {
1033
1033
  /** `YYYY-MM` for monthly results or `YYYY-MM-DD` for daily results. */
@@ -1045,9 +1045,9 @@ interface IDocumentStatsRow {
1045
1045
  signature_requests_viewed: number;
1046
1046
  signature_requests_completed: number;
1047
1047
  documents_certified: number;
1048
- /** @deprecated Older deployment field; use `signature_requests_notification_email`. */
1048
+ /** @deprecated Older API field; use `signature_requests_notification_email`. */
1049
1049
  signature_requests_email?: number;
1050
- /** @deprecated Older deployment field; use `signature_requests_notification_whatsapp`. */
1050
+ /** @deprecated Older API field; use `signature_requests_notification_whatsapp`. */
1051
1051
  signature_requests_whatsapp?: number;
1052
1052
  }
1053
1053
  /** Webhook subscription payload. */
@@ -1086,8 +1086,10 @@ interface IWebhookEndpointCreatePayload extends IWebhookRegisterPayload {
1086
1086
  /** Sign deliveries with a Standard Webhooks signature. Defaults to `false`. */
1087
1087
  signing_enabled?: boolean;
1088
1088
  }
1089
- /** Body for `webhooks.updateEndpoint()`; only the fields sent are changed. */
1090
- type IWebhookEndpointUpdatePayload = Partial<IWebhookEndpointCreatePayload>;
1089
+ /** Body for `webhooks.updateEndpoint()`; only the fields sent are changed. `name: null` clears the label. */
1090
+ type IWebhookEndpointUpdatePayload = Partial<Omit<IWebhookEndpointCreatePayload, 'name'>> & {
1091
+ name?: string | null;
1092
+ };
1091
1093
  /**
1092
1094
  * One of the account's webhook endpoints. Accounts have 1 endpoint, or up to
1093
1095
  * 3 on paid plans; every active endpoint subscribed to an event receives it.
@@ -1096,8 +1098,12 @@ interface IWebhookEndpoint {
1096
1098
  resource?: string;
1097
1099
  id: string;
1098
1100
  name: string | null;
1099
- url: string;
1100
- email: string;
1101
+ /**
1102
+ * Delivery URL; `null` (as `email`) only on an endpoint the legacy
1103
+ * `register()`/`inactivate()` routes created without a valid URL.
1104
+ */
1105
+ url: string | null;
1106
+ email: string | null;
1101
1107
  events: (WebhookEventType | AnyString)[];
1102
1108
  is_active: boolean;
1103
1109
  /** Whether delivery is paused after repeated failures. */
@@ -1193,7 +1199,6 @@ interface IUploadAndRequestSignaturesSigner {
1193
1199
  phone?: string;
1194
1200
  /** Brazilian tax ID (CPF). Non-digits are stripped before sending. */
1195
1201
  cpf?: string;
1196
- metadata?: Record<string, unknown>;
1197
1202
  }
1198
1203
  /** Template role definition. */
1199
1204
  interface ITemplateRole {
@@ -1213,7 +1218,7 @@ interface IUpdateTemplatePayload {
1213
1218
  }
1214
1219
  /** Template list item (paginated). */
1215
1220
  interface ITemplateListItem {
1216
- /** Always `template`. */
1221
+ /** `template` on a single read; absent on list rows. */
1217
1222
  resource?: string;
1218
1223
  id: string;
1219
1224
  name: string;
@@ -1246,7 +1251,7 @@ type ITemplateListResponse = PaginatedResult<ITemplateListItem>;
1246
1251
  * @example
1247
1252
  * ```jsonc
1248
1253
  * {
1249
- * "id": "e5f6a7b8c9d0e1f2a3b4c5d6e7f8",
1254
+ * "id": "100000000000000000000000001c",
1250
1255
  * "number": 1,
1251
1256
  * "height": 1651,
1252
1257
  * "width": 1275,
@@ -1305,9 +1310,12 @@ interface ITemplateSigner {
1305
1310
  id?: string;
1306
1311
  /** Reuses the matching signer or creates one when `id` is omitted. */
1307
1312
  email?: string;
1308
- /** Full name used when the email does not match an existing signer. */
1313
+ /**
1314
+ * Full name; required with `email` (the API answers `400 "Name is
1315
+ * required."` without it, even when the e-mail matches an existing signer).
1316
+ */
1309
1317
  name?: string;
1310
- /** E.164 number used when the email does not match an existing signer. */
1318
+ /** E.164 number, or a Brazilian one without `+`, used when the email does not match an existing signer. */
1311
1319
  whatsapp_phone_number?: string;
1312
1320
  verification_method?: AssignmentVerificationMethod;
1313
1321
  notification_methods?: AssignmentNotificationMethod[];
@@ -1352,12 +1360,12 @@ interface ICreateDocumentFromTemplateOptions {
1352
1360
  /**
1353
1361
  * Item returned by `GET /documents/statuses`.
1354
1362
  *
1355
- * The API uses `code` (the status name); we mirror that field. `description`
1356
- * is optional because responses can omit it.
1363
+ * The API uses `code` (the status name), and so does this type.
1357
1364
  */
1358
1365
  interface IDocumentStatusInfo {
1359
1366
  code: DocumentStatus | AnyString;
1360
1367
  deletable: boolean;
1368
+ /** @deprecated Not returned by the API. */
1361
1369
  description?: string;
1362
1370
  }
1363
1371
  /** Item returned by `GET /public/documents/{id}`. */
@@ -1377,7 +1385,7 @@ interface IDocumentVerification {
1377
1385
  id: string | null;
1378
1386
  /**
1379
1387
  * Agreement code printed on the document certificate; `null` when the hash
1380
- * does not verify. Absent from deployments that predate the field.
1388
+ * does not verify. Absent from API versions that predate the field.
1381
1389
  */
1382
1390
  agreement_code?: string | null;
1383
1391
  status: DocumentStatus | AnyString | null;
@@ -1391,8 +1399,6 @@ interface IDocumentVerification {
1391
1399
  is_valid: boolean;
1392
1400
  message: string;
1393
1401
  }
1394
- /** Channel accepted by the `send-token` endpoint; the contract allows only `email`. */
1395
- type SendTokenChannel = 'email';
1396
1402
  /**
1397
1403
  * `data` returned by `PUT /public/documents/{documentId}/send-token`.
1398
1404
  *
@@ -1418,7 +1424,7 @@ interface ISendTokenResult {
1418
1424
  /** Address the token was sent to. */
1419
1425
  recipient: string;
1420
1426
  }
1421
- /** Authenticated user profile returned by login and `users.getCurrent()`. */
1427
+ /** Authenticated user profile returned by `users.getCurrent()`. */
1422
1428
  interface IAuthenticatedUser {
1423
1429
  id: string;
1424
1430
  name: string;
@@ -1427,7 +1433,9 @@ interface IAuthenticatedUser {
1427
1433
  government_id: string | null;
1428
1434
  is_email_verified: boolean;
1429
1435
  has_accepted_terms: boolean;
1430
- /** Compatibility field. */
1436
+ /** Whether two-factor authentication is enabled (managed in the Assinafy app). */
1437
+ is_mfa_enabled?: boolean;
1438
+ /** `false` for an account created through Google sign-in that never set a password. */
1431
1439
  is_password_set?: boolean;
1432
1440
  created_at: string;
1433
1441
  to_be_deleted_at: string | null;
@@ -1454,79 +1462,6 @@ interface INotificationPreferences {
1454
1462
  }
1455
1463
  /** Partial preference map accepted by `PUT /users/self/notification-preferences`. */
1456
1464
  type IUpdateNotificationPreferences = Partial<INotificationPreferences>;
1457
- /** Login/social-login response containing the bearer token, user, and accounts. */
1458
- interface ILoginResponse {
1459
- access_token: string;
1460
- /**
1461
- * Returned by `auth.login()` when the user has two-factor authentication
1462
- * enabled: exchange it with `auth.verifyMfa()` within 5 minutes.
1463
- */
1464
- mfa_token?: string;
1465
- user: IAuthenticatedUser;
1466
- accounts: Array<{
1467
- id: string;
1468
- name: string;
1469
- roles: string[];
1470
- is_delete_allowed: boolean;
1471
- created_at: string;
1472
- }>;
1473
- }
1474
- /** An enrolled two-factor method. */
1475
- interface IMfaMethod {
1476
- id: string;
1477
- /** `'Totp'` for authenticator apps. */
1478
- type: 'Totp' | AnyString;
1479
- label: string | null;
1480
- /** ISO-8601 UTC timestamp. */
1481
- confirmed_at: string | null;
1482
- /** ISO-8601 UTC timestamp. */
1483
- last_used_at: string | null;
1484
- }
1485
- /** Result of `users.getMfa()`. */
1486
- interface IMfaStatus {
1487
- methods: IMfaMethod[];
1488
- recovery_codes_remaining: number;
1489
- }
1490
- /** Unconfirmed authenticator enrollment from `users.startTotpEnrollment()`. */
1491
- interface ITotpEnrollment {
1492
- id: string;
1493
- /** Base32 shared secret; returned only by this call. */
1494
- secret: string;
1495
- /** `otpauth://` URI to render as a QR code. */
1496
- provisioning_uri: string;
1497
- }
1498
- /** Recovery codes; shown only once. */
1499
- interface IMfaRecoveryCodes {
1500
- recovery_codes: string[];
1501
- }
1502
- /**
1503
- * Re-authentication proof for sensitive two-factor changes: the current
1504
- * `password`, or `code` — a live authenticator code or an unused recovery
1505
- * code (which is then consumed).
1506
- */
1507
- interface IMfaReauth {
1508
- password?: string;
1509
- code?: string;
1510
- }
1511
- /** Body for `users.confirmTotpEnrollment()`. */
1512
- interface IConfirmTotpPayload {
1513
- /** Enrollment ID from `startTotpEnrollment()`. */
1514
- id: string;
1515
- /** Live code from the new device. */
1516
- code: string;
1517
- /** Current password; needed (or `reauth_code`) only when replacing a confirmed method. */
1518
- password?: string;
1519
- /** Alternative to `password`: a code from the current device, or a recovery code. */
1520
- reauth_code?: string;
1521
- }
1522
- /** Authentication: API key payload returned by `POST /users/api-keys`. */
1523
- interface IApiKeyResponse {
1524
- api_key: string | null;
1525
- }
1526
- /** Authentication: masked API key returned by `GET /users/api-keys`. */
1527
- type IMaskedApiKeyResponse = {
1528
- api_key: string | null;
1529
- } | null;
1530
1465
  /** Field definition object. */
1531
1466
  interface IFieldDefinition {
1532
1467
  resource?: string;
@@ -1565,26 +1500,14 @@ interface IFieldType {
1565
1500
  type: string;
1566
1501
  name: string;
1567
1502
  }
1568
- /**
1569
- * @deprecated Compatibility shape previously shared by both field-validation
1570
- * endpoints. Prefer {@link IFieldValidationResponse} for a single value or
1571
- * {@link IFieldValidationMultipleResult} for one item in a batch response.
1572
- */
1573
- interface IFieldValidationResult {
1574
- type?: string;
1575
- field_id?: string;
1576
- success: boolean;
1577
- error_message: string;
1578
- }
1579
1503
  /** Result returned by `POST /accounts/{id}/fields/{id}/validate`. */
1580
- interface IFieldValidationResponse extends IFieldValidationResult {
1504
+ interface IFieldValidationResponse {
1581
1505
  type: string;
1582
- /** The single-value endpoint does not return a field ID. */
1583
- field_id?: never;
1506
+ success: boolean;
1507
+ error_message: string;
1584
1508
  }
1585
1509
  /** One item returned by `POST /accounts/{id}/fields/validate-multiple`. */
1586
- interface IFieldValidationMultipleResult extends IFieldValidationResult {
1587
- type: string;
1510
+ interface IFieldValidationMultipleResult extends IFieldValidationResponse {
1588
1511
  field_id: string;
1589
1512
  }
1590
1513
  /** Payload entry for `POST /accounts/{id}/fields/validate-multiple`. */
@@ -1598,7 +1521,7 @@ interface IWhatsAppNotification {
1598
1521
  sent_at: string;
1599
1522
  header: string;
1600
1523
  body: string;
1601
- /** Production strips button URLs; sandbox includes them, and they carry access codes. */
1524
+ /** `url` is usually omitted; when present it carries the signer access code: treat it as a credential. */
1602
1525
  buttons: Array<{
1603
1526
  text: string;
1604
1527
  url?: string;
@@ -1736,7 +1659,7 @@ interface IOAuthAuthorizationCallback {
1736
1659
  /** The `state` value, already checked against the stored one. */
1737
1660
  state: string;
1738
1661
  /** The `iss` value, already checked against the expected issuer. */
1739
- issuer?: string;
1662
+ issuer: string;
1740
1663
  }
1741
1664
  /**
1742
1665
  * RFC 6749 §5.1 token response. Returned flat, without this API's
@@ -1914,8 +1837,11 @@ interface IEnvelopeDocumentInput {
1914
1837
  entries?: IAssignmentEntry[];
1915
1838
  /** This document's signers, each listed once in the envelope's `signers`. */
1916
1839
  signer_ids: string[];
1917
- /** At least one hour ahead; date-only means 23:59 UTC, no offset means UTC. `null` for none. */
1918
- expires_at?: string | null;
1840
+ /**
1841
+ * At least one hour ahead: ISO date (23:59 UTC), date-time (no offset
1842
+ * means UTC) or Unix seconds. `null` for none.
1843
+ */
1844
+ expires_at?: string | number | null;
1919
1845
  /** Signer IDs that only receive a copy of this document. */
1920
1846
  copy_receiver_ids?: string[];
1921
1847
  }
@@ -2056,7 +1982,7 @@ type FileUploadSource = {
2056
1982
  buffer: Buffer;
2057
1983
  fileName: string;
2058
1984
  };
2059
- /** Input accepted by PDF document/template uploads. */
1985
+ /** Input accepted by document/template uploads (PDF, DOC, DOCX or ODT). */
2060
1986
  type DocumentUploadSource = FileUploadSource;
2061
1987
 
2062
1988
  /**
@@ -2084,30 +2010,28 @@ declare abstract class BaseResource {
2084
2010
  protected pathSegment(value: string | undefined | null, name: string): string;
2085
2011
  /** Execute an HTTP call and return the unwrapped envelope body. */
2086
2012
  protected call<T>(label: string, request: RequestFn): Promise<T>;
2087
- /** Like {@link call} but returns `null` when the API responds with 404. */
2088
- protected callOptional<T>(label: string, request: RequestFn): Promise<T | null>;
2089
2013
  /** Execute an HTTP call that returns no body (DELETE / 204). */
2090
2014
  protected callVoid(label: string, request: RequestFn): Promise<void>;
2091
2015
  /** Execute an HTTP call that returns binary data (artifact downloads). */
2092
2016
  protected callBinary(label: string, request: () => Promise<AxiosResponse<ArrayBuffer>>): Promise<Buffer>;
2093
2017
  /**
2094
- * Upload a PDF as `multipart/form-data` and assert the API echoed an id.
2018
+ * Upload a PDF, DOC, DOCX or ODT file as `multipart/form-data` and assert
2019
+ * the API echoed an id.
2095
2020
  *
2096
2021
  * Shared by `documents.upload` and `templates.create`, which are the same
2097
2022
  * sequence over different paths: load → validate → build form → POST →
2098
2023
  * assert an id came back. Callers keep their own success logging.
2099
2024
  *
2100
2025
  * @param path - Account-scoped endpoint to POST to.
2101
- * @param source - The PDF, as a file path or in-memory buffer.
2102
- * @param formOptions - `name` (display name) and optional `metadata`.
2026
+ * @param source - The file, as a file path or in-memory buffer.
2027
+ * @param formOptions - `name` (display name).
2103
2028
  * @param labels - `errorLabel` for the request failure, `missingId` for a
2104
2029
  * `2xx` that returned no id.
2105
2030
  */
2106
- protected uploadPdf<T extends {
2031
+ protected uploadFile<T extends {
2107
2032
  id?: string;
2108
2033
  }>(path: string, source: DocumentUploadSource, formOptions: {
2109
2034
  name?: string;
2110
- metadata?: Record<string, unknown>;
2111
2035
  }, labels: {
2112
2036
  errorLabel: string;
2113
2037
  missingId: string;
@@ -2122,13 +2046,12 @@ interface IDocumentUploadOptions {
2122
2046
  /**
2123
2047
  * Display name for the document. Defaults to the uploaded file's own name.
2124
2048
  *
2125
- * `.pdf` is appended when absent, so `'Service agreement'` is stored as
2126
- * `'Service agreement.pdf'`. Accents are transliterated by the API
2127
- * (`'Contrato de Serviço'` → `'Contrato de Servico.pdf'`).
2049
+ * The source file's extension is appended when absent, so `'Service
2050
+ * agreement'` for `contract.pdf` is stored as `'Service agreement.pdf'`.
2051
+ * Accents are transliterated by the API (`'Contrato de Serviço'` →
2052
+ * `'Contrato de Servico.pdf'`).
2128
2053
  */
2129
2054
  name?: string;
2130
- /** Optional metadata sent alongside the file (JSON-encoded). */
2131
- metadata?: Record<string, unknown>;
2132
2055
  /** Override the default account ID configured on the client. */
2133
2056
  accountId?: string;
2134
2057
  }
@@ -2136,7 +2059,13 @@ declare class DocumentResource extends BaseResource {
2136
2059
  private readonly publicHttp;
2137
2060
  constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
2138
2061
  /**
2139
- * Upload a PDF to the workspace (`POST /accounts/{accountId}/documents`).
2062
+ * Upload a file to the workspace (`POST /accounts/{accountId}/documents`).
2063
+ *
2064
+ * Accepts a PDF, or a Word or OpenDocument text file (`.doc`, `.docx`,
2065
+ * `.odt`), which the API converts to PDF; the stored name then ends in
2066
+ * `.pdf`. The SDK checks the extension and the content's leading bytes
2067
+ * before sending, and keeps the real extension in the multipart filename
2068
+ * because the API recognises a DOCX only by its `.docx` suffix.
2140
2069
  *
2141
2070
  * The document is created in `uploaded` status and progresses through the
2142
2071
  * lifecycle `uploading` → `uploaded` → `metadata_processing` →
@@ -2145,24 +2074,24 @@ declare class DocumentResource extends BaseResource {
2145
2074
  * that {@link DocumentResource.rename} and {@link DocumentResource.delete}
2146
2075
  * return `400` while the document is still processing.
2147
2076
  *
2148
- * @param source - The PDF to upload, as a file path or an in-memory buffer.
2149
- * @param options - Display name, metadata, and account override.
2150
- * @param options.name - Multipart filename override; the API derives the display name from it.
2151
- * @param options.metadata - JSON metadata (compatibility multipart part).
2077
+ * @param source - The file to upload, as a file path or an in-memory buffer.
2078
+ * @param options - Display name and account override.
2079
+ * @param options.name - Multipart filename override; the API derives the
2080
+ * display name from it. The source file's extension is appended when absent.
2152
2081
  * @param options.accountId - Override the client's default workspace.
2153
2082
  * @returns The created document, freshly uploaded (`status: 'uploaded'`,
2154
2083
  * empty `pages` until `metadata_ready`). Response shape:
2155
2084
  * ```jsonc
2156
2085
  * {
2157
2086
  * "resource": "document",
2158
- * "id": "103ad216846e6b90710cb9acef59",
2087
+ * "id": "1000000000000000000000000001",
2159
2088
  * "account_id": "acc_example",
2160
2089
  * "template_id": null,
2161
2090
  * "name": "Service agreement.pdf",
2162
2091
  * "status": "uploaded", // NOT metadata_processing yet
2163
- * "artifacts": { "original": "https://…/documents/103ad216…/download/original" },
2092
+ * "artifacts": { "original": "https://…/documents/10000000…/download/original" },
2164
2093
  * "is_closed": false,
2165
- * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
2094
+ * "signing_url": "https://app.assinafy.com.br/sign/10000000…",
2166
2095
  * "decline_reason": null,
2167
2096
  * "declined_by": null,
2168
2097
  * "tags": [],
@@ -2171,17 +2100,21 @@ declare class DocumentResource extends BaseResource {
2171
2100
  * "updated_at": "2026-07-19T17:24:44Z"
2172
2101
  * }
2173
2102
  * ```
2174
- * @throws {ValidationError} If the file is empty, not a `.pdf`, exceeds
2175
- * 25 MB, or the API returns no document ID. The API rejects PDFs over
2176
- * 2,000 pages.
2177
- * @throws {ApiError} If the API rejects the upload.
2103
+ * @throws {ValidationError} If the file is empty, its name does not end in
2104
+ * `.pdf`, `.doc`, `.docx` or `.odt`, its content does not start with that
2105
+ * format's signature, it exceeds 25 MB, `name` is blank, no account ID is
2106
+ * available, or the API returns no document ID.
2107
+ * @throws {ApiError} `400` for a password-protected PDF or one over 2,000
2108
+ * pages; `415` for content the API does not recognise as one of the
2109
+ * accepted formats.
2178
2110
  *
2179
2111
  * @example
2180
2112
  * ```ts
2181
2113
  * await client.documents.upload({ filePath: './contract.pdf' });
2114
+ * await client.documents.upload({ filePath: './proposal.docx' });
2182
2115
  * await client.documents.upload(
2183
2116
  * { buffer, fileName: 'contract.pdf' },
2184
- * { name: 'Service agreement', metadata: { orderId: 'A-1' } },
2117
+ * { name: 'Service agreement' },
2185
2118
  * );
2186
2119
  * // → name is stored as 'Service agreement.pdf'
2187
2120
  * ```
@@ -2196,37 +2129,39 @@ declare class DocumentResource extends BaseResource {
2196
2129
  * so prefer it when you need signing state or page geometry. Pagination
2197
2130
  * info (if any) is attached in `meta`.
2198
2131
  *
2199
- * @param params - Filters and pagination: `status`; `method` (`virtual` or
2200
- * `collect`); `tags` (comma-separated IDs, all of which must match);
2201
- * `search` (document name, signer name, or signer email); `sort` (`name` or
2202
- * `updated_at`); `page`; and `per-page` (the server clamps this to 50
2132
+ * @param params - Filters and pagination: `status`; `envelope_id` (only
2133
+ * the documents of that envelope); `method` (`virtual` or `collect`);
2134
+ * `tags` (comma-separated IDs, all of which must match); `search`
2135
+ * (document name, signer name, or signer email); `sort` (`name` or
2136
+ * `updated_at`, ascending; prefix `-` for descending, `-updated_at` being
2137
+ * the default); `page`; and `per-page` (the server clamps this to 50
2203
2138
  * rather than rejecting a larger value).
2204
2139
  * @param accountId - Override the client's default account ID.
2205
2140
  * @returns Matching documents, with pagination in `meta`. Each item:
2206
2141
  * ```jsonc
2207
2142
  * {
2208
- * "id": "103acccd24234c07858ffddf6d84",
2143
+ * "id": "1000000000000000000000000008",
2209
2144
  * "account_id": "acc_example",
2210
2145
  * "template_id": null,
2211
2146
  * "name": "sdk-smoke-rename-7b006e52.pdf",
2212
2147
  * "status": "metadata_ready",
2213
2148
  * "artifacts": {
2214
- * "original": "https://…/documents/103acccd…/download/original",
2215
- * "thumbnail": "https://…/documents/103acccd…/thumbnail"
2149
+ * "original": "https://…/documents/10000000…/download/original",
2150
+ * "thumbnail": "https://…/documents/10000000…/thumbnail"
2216
2151
  * },
2217
2152
  * "is_closed": false,
2218
- * "signing_url": "https://app.assinafy.com.br/sign/103acccd…",
2153
+ * "signing_url": "https://app.assinafy.com.br/sign/10000000…",
2219
2154
  * "decline_reason": null,
2220
2155
  * "declined_by": null,
2221
2156
  * "tags": [],
2222
2157
  * "assignment": null, // an IAssignment once signatures are requested
2223
2158
  * "pages": [
2224
2159
  * {
2225
- * "id": "103acccd5c73af8009c3644af591",
2160
+ * "id": "1000000000000000000000000009",
2226
2161
  * "number": 1,
2227
2162
  * "height": 1651,
2228
2163
  * "width": 1275,
2229
- * "download_url": "https://…/documents/103acccd…/pages/103acccd…/download"
2164
+ * "download_url": "https://…/documents/10000000…/pages/10000000…/download"
2230
2165
  * }
2231
2166
  * ],
2232
2167
  * "created_at": "2026-07-19T14:56:54Z",
@@ -2234,7 +2169,8 @@ declare class DocumentResource extends BaseResource {
2234
2169
  * }
2235
2170
  * ```
2236
2171
  * @throws {ValidationError} If no account ID is available.
2237
- * @throws {ApiError} If the API rejects the request.
2172
+ * @throws {ApiError} `400` when `envelope_id` is not text; `403` when a
2173
+ * role or OAuth scope refuses it; `404` if the workspace does not exist.
2238
2174
  *
2239
2175
  * @example
2240
2176
  * ```ts
@@ -2255,13 +2191,15 @@ declare class DocumentResource extends BaseResource {
2255
2191
  * a compact representation with no expanded `assignment` or `pages`, so
2256
2192
  * prefer it for name lookups and pickers.
2257
2193
  *
2258
- * @param params - `search`, `status`, `page`, `per-page`, and `sort`.
2194
+ * @param params - `search`, `status`, `envelope_id` (only the documents of
2195
+ * that envelope), `page`, `per-page`, and `sort` (`name` or `updated_at`,
2196
+ * ascending; prefix `-` for descending, `-updated_at` being the default).
2259
2197
  * @param accountId - Override the client's default account ID.
2260
2198
  * @returns Matching documents, with pagination in `meta`. Each item:
2261
2199
  * ```jsonc
2262
2200
  * {
2263
- * "id": "c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
2264
- * "account_id": "d4e5f6a7b8c9d0e1f2a3b4c5d6e7",
2201
+ * "id": "100000000000000000000000000a",
2202
+ * "account_id": "100000000000000000000000000b",
2265
2203
  * "template_id": null,
2266
2204
  * "name": "Service agreement.pdf",
2267
2205
  * "status": "pending_signature",
@@ -2276,7 +2214,8 @@ declare class DocumentResource extends BaseResource {
2276
2214
  * }
2277
2215
  * ```
2278
2216
  * @throws {ValidationError} If no account ID is available.
2279
- * @throws {ApiError} If the API rejects the request.
2217
+ * @throws {ApiError} `400` when `envelope_id` is not text; `403` when a
2218
+ * role or OAuth scope refuses it; `404` if the workspace does not exist.
2280
2219
  *
2281
2220
  * @example
2282
2221
  * ```ts
@@ -2318,13 +2257,13 @@ declare class DocumentResource extends BaseResource {
2318
2257
  * ```jsonc
2319
2258
  * {
2320
2259
  * "resource": "document",
2321
- * "id": "103ad216846e6b90710cb9acef59",
2260
+ * "id": "1000000000000000000000000001",
2322
2261
  * "account_id": "acc_example",
2323
2262
  * "template_id": null,
2324
2263
  * "name": "Service agreement.pdf",
2325
2264
  * "status": "metadata_ready",
2326
2265
  * "artifacts": { "original": "https://…/download/original" },
2327
- * "signing_url": "https://…/sign/103ad216…",
2266
+ * "signing_url": "https://…/sign/10000000…",
2328
2267
  * "is_closed": false,
2329
2268
  * "decline_reason": null,
2330
2269
  * "declined_by": null,
@@ -2361,28 +2300,28 @@ declare class DocumentResource extends BaseResource {
2361
2300
  * ```jsonc
2362
2301
  * {
2363
2302
  * "resource": "document",
2364
- * "id": "103ad216846e6b90710cb9acef59",
2303
+ * "id": "1000000000000000000000000001",
2365
2304
  * "account_id": "acc_example",
2366
2305
  * "template_id": null,
2367
2306
  * "name": "service-agreement.pdf",
2368
2307
  * "status": "metadata_ready",
2369
2308
  * "artifacts": {
2370
- * "original": "https://…/documents/103ad216…/download/original",
2371
- * "thumbnail": "https://…/documents/103ad216…/thumbnail"
2309
+ * "original": "https://…/documents/10000000…/download/original",
2310
+ * "thumbnail": "https://…/documents/10000000…/thumbnail"
2372
2311
  * },
2373
2312
  * "is_closed": false,
2374
- * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
2313
+ * "signing_url": "https://app.assinafy.com.br/sign/10000000…",
2375
2314
  * "decline_reason": null,
2376
2315
  * "declined_by": null,
2377
2316
  * "tags": [],
2378
2317
  * "assignment": null,
2379
2318
  * "pages": [
2380
2319
  * {
2381
- * "id": "103ad216be62159d3087452d7cf8",
2320
+ * "id": "1000000000000000000000000003",
2382
2321
  * "number": 1,
2383
2322
  * "height": 1651,
2384
2323
  * "width": 1275,
2385
- * "download_url": "https://…/documents/103ad216…/pages/103ad216…/download"
2324
+ * "download_url": "https://…/documents/10000000…/pages/10000000…/download"
2386
2325
  * }
2387
2326
  * ],
2388
2327
  * "has_contract": false,
@@ -2398,7 +2337,7 @@ declare class DocumentResource extends BaseResource {
2398
2337
  *
2399
2338
  * @example
2400
2339
  * ```ts
2401
- * const doc = await client.documents.details('103ad216846e6b90710cb9acef59', {
2340
+ * const doc = await client.documents.details('1000000000000000000000000001', {
2402
2341
  * expand: ['envelope'],
2403
2342
  * });
2404
2343
  * console.log(doc.status, doc.envelope?.name);
@@ -2419,7 +2358,7 @@ declare class DocumentResource extends BaseResource {
2419
2358
  *
2420
2359
  * @example
2421
2360
  * ```ts
2422
- * const doc = await client.documents.get('103ad216846e6b90710cb9acef59');
2361
+ * const doc = await client.documents.get('1000000000000000000000000001');
2423
2362
  * ```
2424
2363
  */
2425
2364
  get(documentId: string, options?: IDocumentDetailsOptions): Promise<IDocumentDetailsResponse>;
@@ -2535,8 +2474,8 @@ declare class DocumentResource extends BaseResource {
2535
2474
  * (`GET /documents/{documentId}/activities`).
2536
2475
  *
2537
2476
  * Production returns 20 entries per page by default, newest first. Request
2538
- * later pages explicitly; a page past the end returns `[]`. Sandbox still
2539
- * returns the full, unpaged log and may ignore these parameters. This method
2477
+ * later pages explicitly; a page past the end returns `[]`. A response
2478
+ * without pagination is the full log. This method
2540
2479
  * preserves its array return type; use {@link DocumentResource.listActivities}
2541
2480
  * for pagination metadata. Normalises an absent body to `[]`.
2542
2481
  *
@@ -2568,7 +2507,9 @@ declare class DocumentResource extends BaseResource {
2568
2507
  * ]
2569
2508
  * ```
2570
2509
  * @throws {ValidationError} If `documentId` is missing or invalid, or `params` is not an object.
2571
- * @throws {ApiError} If the API rejects the request (`401` for invalid credentials, `500` for a server error).
2510
+ * @throws {ApiError} `401` for invalid credentials; `403` when a role or
2511
+ * OAuth scope refuses it; `404` if the document is not in the workspace;
2512
+ * `500` for a server error.
2572
2513
  *
2573
2514
  * @example
2574
2515
  * ```ts
@@ -2585,7 +2526,8 @@ declare class DocumentResource extends BaseResource {
2585
2526
  *
2586
2527
  * Production defaults to 20 entries, newest first. `meta` comes from the
2587
2528
  * `X-Pagination-*` headers; use `last_page` to request the remaining pages.
2588
- * Sandbox returns the full unpaged log without `meta`: process it once.
2529
+ * A response without pagination headers is the full log, without `meta`:
2530
+ * process it once.
2589
2531
  * Normalises an absent body to an empty list. Makes exactly one request.
2590
2532
  *
2591
2533
  * @param documentId - The document whose activity log to fetch.
@@ -2609,7 +2551,9 @@ declare class DocumentResource extends BaseResource {
2609
2551
  * }
2610
2552
  * ```
2611
2553
  * @throws {ValidationError} If `documentId` is missing or invalid, or `params` is not an object.
2612
- * @throws {ApiError} If the API rejects the request (`401` for invalid credentials, `500` for a server error).
2554
+ * @throws {ApiError} `401` for invalid credentials; `403` when a role or
2555
+ * OAuth scope refuses it; `404` if the document is not in the workspace;
2556
+ * `500` for a server error.
2613
2557
  * @example
2614
2558
  * ```ts
2615
2559
  * const { data, meta } = await client.documents.listActivities('doc-1', { page: 2 });
@@ -2624,8 +2568,10 @@ declare class DocumentResource extends BaseResource {
2624
2568
  * `400` while the document is still `uploading` / `metadata_processing`
2625
2569
  * (await {@link DocumentResource.waitUntilReady} first) or once it has been
2626
2570
  * certificated. Deleting a `pending_signature` or `pending_identity_review`
2627
- * document cancels it and notifies its signers. A document of an envelope
2628
- * with an open document cannot be deleted on its own: cancel the envelope.
2571
+ * document first cancels it exactly as {@link DocumentResource.cancel}
2572
+ * does — signers and owner are told — then deletes it; use `cancel()` to
2573
+ * keep the document. A document of an envelope with an open document
2574
+ * cannot be deleted on its own: cancel the envelope.
2629
2575
  *
2630
2576
  * @param documentId - The document to delete.
2631
2577
  * @returns Nothing; resolves when the document is deleted.
@@ -2640,6 +2586,56 @@ declare class DocumentResource extends BaseResource {
2640
2586
  * ```
2641
2587
  */
2642
2588
  delete(documentId: string): Promise<void>;
2589
+ /**
2590
+ * Cancel a document and keep it (`PUT /documents/{documentId}/cancel`).
2591
+ *
2592
+ * Only a document out for signature (`pending_signature`) or held for an
2593
+ * identity review (`pending_identity_review`) can be cancelled. It moves to
2594
+ * `rejected_by_user`; its signers and owner are told and the cancellation
2595
+ * is recorded, while the document, its files and its history stay. Once
2596
+ * every signer has signed, certification is underway and the document can
2597
+ * no longer be cancelled. A document of an open envelope is cancelled with
2598
+ * {@link EnvelopeResource.cancel} or taken out with
2599
+ * {@link EnvelopeResource.removeDocument}, which also keeps it.
2600
+ *
2601
+ * Not retried automatically: it notifies people.
2602
+ *
2603
+ * @param documentId - The document to cancel.
2604
+ * @returns The cancelled document:
2605
+ * ```jsonc
2606
+ * {
2607
+ * "resource": "document",
2608
+ * "id": "1000000000000000000000000001",
2609
+ * "account_id": "acc_example",
2610
+ * "template_id": null,
2611
+ * "name": "Service agreement.pdf",
2612
+ * "status": "rejected_by_user",
2613
+ * "artifacts": { "original": "https://…/download/original" },
2614
+ * "is_closed": true,
2615
+ * "decline_reason": null,
2616
+ * "declined_by": null,
2617
+ * "tags": [],
2618
+ * "assignment": { "id": "100000…", "status": "rejected", "signers": [ … ] },
2619
+ * "pages": [ … ],
2620
+ * "created_at": "2026-07-19T17:24:43Z",
2621
+ * "updated_at": "2026-07-20T09:02:11Z"
2622
+ * }
2623
+ * ```
2624
+ * @throws {ValidationError} If `documentId` is missing or not a single path
2625
+ * segment.
2626
+ * @throws {ApiError} `400` when the document is not `pending_signature` or
2627
+ * `pending_identity_review`; `403` when a role or OAuth scope
2628
+ * (`documents:write`) refuses it; `404` if it does not exist; `409` with
2629
+ * `code` `EnvelopeOpen` for a document of an open envelope, or
2630
+ * `DocumentClosed` once every signer has signed.
2631
+ *
2632
+ * @example
2633
+ * ```ts
2634
+ * const cancelled = await client.documents.cancel('1000000000000000000000000001');
2635
+ * console.log(cancelled.status); // 'rejected_by_user'
2636
+ * ```
2637
+ */
2638
+ cancel(documentId: string): Promise<IDocumentDetailsResponse>;
2643
2639
  /**
2644
2640
  * List the tags attached to a document
2645
2641
  * (`GET /accounts/{accountId}/documents/{documentId}/tags`).
@@ -2651,7 +2647,7 @@ declare class DocumentResource extends BaseResource {
2651
2647
  * [
2652
2648
  * {
2653
2649
  * "resource": "tag",
2654
- * "id": "103aa252123d3bf1843a317ee0e6",
2650
+ * "id": "100000000000000000000000000c",
2655
2651
  * "name": "urgent",
2656
2652
  * "color": "ff8800",
2657
2653
  * "created_at": "2026-07-18T19:09:03Z",
@@ -2677,8 +2673,6 @@ declare class DocumentResource extends BaseResource {
2677
2673
  * names are not portable identifiers and should not be used here. This
2678
2674
  * overwrites the existing set — use
2679
2675
  * {@link DocumentResource.addTags} to append.
2680
- * Older sandbox deployments interpret these strings as names and create
2681
- * ID-named tags for ID inputs; pass existing names intentionally there.
2682
2676
  * Strings are sent unchanged. See `docs/COMPATIBILITY.md` for this variant.
2683
2677
  *
2684
2678
  * Request body (`application/json`):
@@ -2696,7 +2690,7 @@ declare class DocumentResource extends BaseResource {
2696
2690
  * @returns The document's tags after the replace:
2697
2691
  * ```jsonc
2698
2692
  * [
2699
- * { "resource": "tag", "id": "103aa252…", "name": "signed", "color": null,
2693
+ * { "resource": "tag", "id": "10000000…", "name": "signed", "color": null,
2700
2694
  * "created_at": "2026-07-18T19:09:03Z", "updated_at": "2026-07-18T19:09:03Z" }
2701
2695
  * ]
2702
2696
  * ```
@@ -2718,8 +2712,7 @@ declare class DocumentResource extends BaseResource {
2718
2712
  * `tags` is a non-empty array of tag **IDs**. Attaching an ID already
2719
2713
  * present is a no-op. To replace the whole set instead, use
2720
2714
  * {@link DocumentResource.replaceTags}.
2721
- * On older name-based sandbox deployments, pass existing tag names
2722
- * intentionally; ID inputs create ID-named tags. No automatic remapping occurs.
2715
+ * Strings are sent unchanged; no remapping occurs.
2723
2716
  *
2724
2717
  * Request body (`application/json`):
2725
2718
  * ```jsonc
@@ -2736,7 +2729,7 @@ declare class DocumentResource extends BaseResource {
2736
2729
  * @returns The document's tags after the attach:
2737
2730
  * ```jsonc
2738
2731
  * [
2739
- * { "resource": "tag", "id": "103aa252…", "name": "urgent", "color": null,
2732
+ * { "resource": "tag", "id": "10000000…", "name": "urgent", "color": null,
2740
2733
  * "created_at": "2026-07-18T19:09:03Z", "updated_at": "2026-07-18T19:09:03Z" }
2741
2734
  * ]
2742
2735
  * ```
@@ -2761,7 +2754,7 @@ declare class DocumentResource extends BaseResource {
2761
2754
  * @param documentId - The document to detach from.
2762
2755
  * @param tagId - The ID of the tag to detach.
2763
2756
  * @param accountId - Override the client's default account ID.
2764
- * @returns `{ detached: true }` when the association was removed.
2757
+ * @returns `{ detached: true }`, also when the tag was not attached.
2765
2758
  * @throws {ValidationError} If `documentId` or `tagId` is missing, or no
2766
2759
  * account ID is available.
2767
2760
  * @throws {ApiError} If the API rejects the request.
@@ -2779,10 +2772,12 @@ declare class DocumentResource extends BaseResource {
2779
2772
  * Instantiates the template, binding each role to a signer, and returns the
2780
2773
  * new document. The request body is `{ signers, ...options }` — `signers`
2781
2774
  * maps every template `role_id` to an existing signer `id` or an `email`.
2782
- * An email reuses the matching account signer or creates one with `name`;
2783
- * `id` wins when both are present. Options may add `name`, `message`,
2784
- * `expires_at`, `editor_fields`, and tag names in `tags` (unknown names are
2785
- * created automatically).
2775
+ * An email entry needs a non-blank `name`, even when the email matches an
2776
+ * existing account signer (the API answers `400 "Name is required."`
2777
+ * otherwise); it reuses that signer or creates one. `id` wins when both are
2778
+ * present. Options may add `name`, `message`, `expires_at`,
2779
+ * `editor_fields`, tag names in `tags` (unknown names are created
2780
+ * automatically), and a `max_total_credits` ceiling.
2786
2781
  *
2787
2782
  * Request body (`application/json`):
2788
2783
  * ```jsonc
@@ -2811,19 +2806,21 @@ declare class DocumentResource extends BaseResource {
2811
2806
  * ],
2812
2807
  * "tags": [
2813
2808
  * "Contracts"
2814
- * ]
2809
+ * ],
2810
+ * "max_total_credits": 5
2815
2811
  * }
2816
2812
  * ```
2817
2813
  *
2818
2814
  * @param templateId - The template to instantiate.
2819
2815
  * @param signers - Role-to-signer bindings (each with `role_id` and either
2820
- * an existing `id` or an `email`; email creation also accepts `name` and
2821
- * `whatsapp_phone_number`). `verification_method`, `notification_methods`,
2822
- * and `step` are optional.
2816
+ * an existing `id` or an `email` with a non-blank `name`; email creation
2817
+ * also accepts `whatsapp_phone_number`). `verification_method`,
2818
+ * `notification_methods`, and `step` are optional.
2823
2819
  * Only one notification method is allowed per signer; when only one of the
2824
2820
  * verification/notification fields is supplied, the API infers the other.
2825
- * `DigitalCertificate` costs 0.5 credits, requires the feature plus a
2826
- * signer `government_id`, and that signer must be alone in its step. The
2821
+ * `DigitalCertificate` requires the feature plus a signer `government_id`,
2822
+ * and that signer must be alone in its step; estimate the current fee with
2823
+ * `estimateCostFromTemplate()`. The
2827
2824
  * server derives the assignment method from placed template fields and
2828
2825
  * rejects certificate signers when those fields produce a `collect`
2829
2826
  * assignment. Use a template without placed signer fields for certificate
@@ -2831,7 +2828,7 @@ declare class DocumentResource extends BaseResource {
2831
2828
  * `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
2832
2829
  * and a valid CPF in `government_id`; estimate the per-signer fee first.
2833
2830
  * @param options - Optional `name`, `message`, `expires_at`,
2834
- * `editor_fields`, `tags`.
2831
+ * `editor_fields`, `tags`, `max_total_credits`, `idempotencyKey`.
2835
2832
  * @param options.name - Generated document display name.
2836
2833
  * @param options.message - Signing invitation message.
2837
2834
  * @param options.expires_at - ISO-8601 deadline: date-only (ends at 23:59
@@ -2839,6 +2836,12 @@ declare class DocumentResource extends BaseResource {
2839
2836
  * date-time.
2840
2837
  * @param options.editor_fields - Template editor values as `{ field_id, value }` entries.
2841
2838
  * @param options.tags - Tag names attached to the generated document.
2839
+ * @param options.max_total_credits - Credit ceiling: the API refuses with
2840
+ * `409 CreditCeilingExceeded` when the document would cost more. A cost
2841
+ * that rises after acceptance ends the document `failed` instead.
2842
+ * @param options.idempotencyKey - Sent as the `Idempotency-Key` header; a
2843
+ * retry with the same key returns the first document without charging
2844
+ * again. Use a new key per document.
2842
2845
  * @param accountId - Override the client's default account ID.
2843
2846
  * @returns The uploaded document. Assignment creation continues in the
2844
2847
  * background; follow `GET /documents/{documentId}` or webhooks until the
@@ -2846,25 +2849,33 @@ declare class DocumentResource extends BaseResource {
2846
2849
  * ```jsonc
2847
2850
  * {
2848
2851
  * "resource": "document",
2849
- * "id": "19f675b761b392a48b8642503bb",
2852
+ * "id": "100000000000000000000000a04",
2850
2853
  * "account_id": "acc_example",
2851
- * "template_id": "103a0991a5cde83518e5672aa9aa",
2854
+ * "template_id": "100000000000000000000000000d",
2852
2855
  * "name": "Service agreement from template",
2853
2856
  * "status": "uploaded",
2854
2857
  * "artifacts": { "original": "https://…/download/original" },
2855
2858
  * "is_closed": false,
2856
- * "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
2857
- * "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
2859
+ * "signing_url": "https://app.assinafy.com.br/sign/10000000…",
2860
+ * "tags": [{ "id": "10000000…", "name": "agreements", "color": null }],
2858
2861
  * "assignment": null,
2859
2862
  * "pages": [],
2860
2863
  * "created_at": "2026-07-15T19:57:55Z",
2861
2864
  * "updated_at": "2026-07-15T19:59:33Z"
2862
2865
  * }
2863
2866
  * ```
2864
- * @throws {ValidationError} If `templateId`, an account ID, signer identity,
2865
- * channel, order, deadline, editor field, or tag is invalid.
2867
+ * @throws {ValidationError} If `templateId`, an account ID, signer identity
2868
+ * (including an email entry without a non-blank `name`), channel, order,
2869
+ * deadline, editor field, tag, credit ceiling, or idempotency key is
2870
+ * invalid.
2866
2871
  * @throws {ApiError} `400` if the signers/roles are invalid, the template
2867
- * is not ready, or placed signer fields conflict with `DigitalCertificate`.
2872
+ * is not ready, or placed signer fields conflict with `DigitalCertificate`;
2873
+ * `403` with `code` `FreePlanSignerLimit` (a free workspace above three
2874
+ * signers), `PlanRestricted` (a verification or notification method the
2875
+ * plan lacks), or `InsufficientScope` (an OAuth token without
2876
+ * `documents:write`); `404` if the template does not exist; `409` with
2877
+ * `code` `CreditCeilingExceeded` (above `max_total_credits`) or
2878
+ * `IdempotencyKeyInUse` (a request with the same key is still running).
2868
2879
  *
2869
2880
  * @example
2870
2881
  * ```ts
@@ -2880,8 +2891,8 @@ declare class DocumentResource extends BaseResource {
2880
2891
  *
2881
2892
  * A dry run: sends only `{ signers }` and consumes nothing. Use it to check
2882
2893
  * balances before calling {@link DocumentResource.createFromTemplate}.
2883
- * `DigitalCertificate` adds 0.5 credits per signer plus notification cost;
2884
- * the API returns `400` when the template has placed signer fields.
2894
+ * Estimate the current `DigitalCertificate` fee here; the API returns `400`
2895
+ * for a certificate signer when the template has placed signer fields.
2885
2896
  *
2886
2897
  * Request body (`application/json`):
2887
2898
  * ```jsonc
@@ -2927,7 +2938,11 @@ declare class DocumentResource extends BaseResource {
2927
2938
  * @throws {ValidationError} If `templateId`, an account ID, role, or
2928
2939
  * channel is invalid.
2929
2940
  * @throws {ApiError} `400` if the role is invalid or placed signer fields
2930
- * conflict with `DigitalCertificate`; `403` when a feature is unavailable.
2941
+ * conflict with `DigitalCertificate`; `403` with `code`
2942
+ * `FreePlanSignerLimit` (a free workspace above three signers),
2943
+ * `PlanRestricted` (a verification or notification method the plan lacks),
2944
+ * or `InsufficientScope` (an OAuth token without `documents:write`);
2945
+ * `404` if the template or workspace does not exist.
2931
2946
  *
2932
2947
  * @example
2933
2948
  * ```ts
@@ -2951,8 +2966,8 @@ declare class DocumentResource extends BaseResource {
2951
2966
  * @returns The verification record:
2952
2967
  * ```jsonc
2953
2968
  * {
2954
- * "hash": "FE32EDDADE7CBDDCBB934E7402047450B0E59C02",
2955
- * "id": "63ddb172402799bfc991d10d",
2969
+ * "hash": "0123456789ABCDEF0123456789ABCDEF01234567",
2970
+ * "id": "0a1b2c3d4e5f60718293a4b5",
2956
2971
  * "agreement_code": "550E8400-E29B-41D4-A716-446655440000", // printed on the certificate
2957
2972
  * "status": "certificated",
2958
2973
  * "page_count": "1",
@@ -3019,14 +3034,14 @@ declare class DocumentResource extends BaseResource {
3019
3034
  * ```jsonc
3020
3035
  * {
3021
3036
  * "resource": "document",
3022
- * "id": "103ad216846e6b90710cb9acef59",
3037
+ * "id": "1000000000000000000000000001",
3023
3038
  * "account_id": "acc_example",
3024
3039
  * "template_id": null,
3025
3040
  * "name": "Service agreement.pdf",
3026
3041
  * "status": "pending_signature",
3027
3042
  * "artifacts": { "original": "https://…/download/original" },
3028
3043
  * "is_closed": false,
3029
- * "signing_url": "https://…/sign/103ad216…",
3044
+ * "signing_url": "https://…/sign/10000000…",
3030
3045
  * "decline_reason": null,
3031
3046
  * "declined_by": null,
3032
3047
  * "tags": [],
@@ -3041,18 +3056,26 @@ declare class DocumentResource extends BaseResource {
3041
3056
  *
3042
3057
  * @example
3043
3058
  * ```ts
3044
- * const info = await client.documents.getPublic('103ad216846e6b90710cb9acef59');
3059
+ * const info = await client.documents.getPublic('1000000000000000000000000001');
3045
3060
  * ```
3046
3061
  */
3047
3062
  getPublic(documentId: string): Promise<IPublicDocumentInfo>;
3048
3063
  /**
3049
- * Email the signer the verification token that unlocks a document
3064
+ * Email the signer the document's signature request again
3050
3065
  * (`PUT /public/documents/{documentId}/send-token`).
3051
3066
  *
3052
- * Part of the public signing flow: dispatches the 6-digit verification
3053
- * token the signer enters to view the document. Runs on the
3054
- * credential-free transport. The contract accepts only the `email`
3055
- * channel, and both body fields are required.
3067
+ * Part of the public signing flow: re-sends the signature request with its
3068
+ * existing link, plus the verification code when the signer's verification
3069
+ * method uses one; nothing is renewed. A `200` means the request was
3070
+ * accepted, not that the email was delivered. The document must be pending
3071
+ * signature and within its deadline, and `recipient` must be a signer who
3072
+ * has not signed yet and whose turn has come. A signer gets it at most once
3073
+ * every two minutes, whoever asks; an envelope's documents share that
3074
+ * interval. Runs on the credential-free transport. The contract accepts
3075
+ * only the `email` channel, and both body fields are required.
3076
+ *
3077
+ * The SDK never replays this `PUT` automatically, so a `429` reaches the
3078
+ * caller; wait `error.rateLimit?.retryAfter` seconds before asking again.
3056
3079
  *
3057
3080
  * Request body (`application/json`):
3058
3081
  * ```jsonc
@@ -3061,7 +3084,6 @@ declare class DocumentResource extends BaseResource {
3061
3084
  *
3062
3085
  * @param documentId - The document to send the token for.
3063
3086
  * @param recipient - The signer's email address.
3064
- * @param channel - Delivery channel; only `email` is accepted (default).
3065
3087
  * @returns The delivery confirmation (`data` of the envelope):
3066
3088
  * ```jsonc
3067
3089
  * {
@@ -3077,17 +3099,26 @@ declare class DocumentResource extends BaseResource {
3077
3099
  * }
3078
3100
  * ```
3079
3101
  * @throws {ValidationError} If `documentId` is missing, `recipient` is not
3080
- * a valid email address, or `channel` is not `email`.
3081
- * @throws {ApiError} `400` if validation fails; `404` if the document does
3082
- * not exist.
3102
+ * a valid email address.
3103
+ * @throws {ApiError} `400` if the document is not pending signature or its
3104
+ * deadline has passed, or the signer already signed, has not reached their
3105
+ * step, or is not notified by email; `404` if the document does not exist
3106
+ * or `recipient` is not one of its signers; `429` when the signer was sent
3107
+ * it less than two minutes ago (`Retry-After` gives the seconds left).
3083
3108
  *
3084
3109
  * @example
3085
3110
  * ```ts
3086
- * const sent = await client.documents.sendToken('doc-1', 'signer@example.com');
3087
- * console.log(sent.recipient);
3111
+ * try {
3112
+ * const sent = await client.documents.sendToken('doc-1', 'signer@example.com');
3113
+ * console.log(sent.recipient);
3114
+ * } catch (error) {
3115
+ * if (error instanceof ApiError && error.statusCode === 429) {
3116
+ * console.log(`retry in ${error.rateLimit?.retryAfter ?? 120}s`);
3117
+ * }
3118
+ * }
3088
3119
  * ```
3089
3120
  */
3090
- sendToken(documentId: string, recipient: string, channel?: SendTokenChannel): Promise<ISendTokenResult>;
3121
+ sendToken(documentId: string, recipient: string): Promise<ISendTokenResult>;
3091
3122
  /**
3092
3123
  * Quick boolean check (`GET /documents/{documentId}`): has every signer
3093
3124
  * completed their assignment?
@@ -3140,7 +3171,7 @@ declare class DocumentResource extends BaseResource {
3140
3171
  /**
3141
3172
  * List contacts watching a document (`GET /documents/{documentId}/watchers`).
3142
3173
  *
3143
- * Staging extension. Returns contacts in the order set, omitting deleted
3174
+ * Returns contacts in the order set, omitting deleted
3144
3175
  * contacts. API key or user token only; OAuth application tokens are refused.
3145
3176
  * @param documentId - Workspace document ID.
3146
3177
  * @returns Watcher contacts:
@@ -3150,7 +3181,7 @@ declare class DocumentResource extends BaseResource {
3150
3181
  * "government_id": null, "has_accepted_terms": false }]
3151
3182
  * ```
3152
3183
  * @throws {ValidationError} If the document ID is invalid.
3153
- * @throws {ApiError} `401`, `403`, or `404` for an unknown document or older deployment.
3184
+ * @throws {ApiError} `401`, `403`, or `404` for an unknown document.
3154
3185
  * @example
3155
3186
  * ```ts
3156
3187
  * const watchers = await client.documents.listWatchers(document.id);
@@ -3160,20 +3191,21 @@ declare class DocumentResource extends BaseResource {
3160
3191
  /**
3161
3192
  * Replace a document's watchers (`PUT /documents/{documentId}/watchers`).
3162
3193
  *
3163
- * Staging extension. Each contact must belong to the workspace and have an
3194
+ * Each contact must belong to the workspace and have an
3164
3195
  * email. Watchers get one queued email when the document ends, without a
3165
3196
  * document link or file. Workspace notification preferences do not suppress
3166
3197
  * it. Set before sending or while open; `[]` removes every watcher.
3167
3198
  * API key or user token only; OAuth application tokens are refused.
3168
3199
  * @param documentId - Workspace document ID.
3169
- * @param watcherIds - Up to ten contact IDs; duplicate IDs count once.
3200
+ * @param watcherIds - At most 10 entries; duplicates count toward the
3201
+ * limit and are stored once.
3170
3202
  * @returns The stored contacts:
3171
3203
  * ```jsonc
3172
3204
  * [{ "resource": "signer", "id": "signer-1", "full_name": "Example Watcher",
3173
3205
  * "email": "watcher@example.com", "whatsapp_phone_number": null,
3174
3206
  * "government_id": null, "has_accepted_terms": false }]
3175
3207
  * ```
3176
- * @throws {ValidationError} If an ID is invalid or more than ten distinct watchers are supplied.
3208
+ * @throws {ValidationError} If an ID is invalid or more than 10 entries are supplied.
3177
3209
  * @throws {ApiError} `400` for a closed document or invalid contact; `401`, `403`, `404`.
3178
3210
  * @example
3179
3211
  * ```ts
@@ -3195,7 +3227,7 @@ declare class SignerResource extends BaseResource {
3195
3227
  * duplicate POST is answered by the API with `400 "Um signatário com este
3196
3228
  * e-mail já existe."`, which this method recovers from transparently).
3197
3229
  * A reused signer is returned unchanged; this method does not overwrite its
3198
- * existing name, phone, CPF, or metadata with the create payload.
3230
+ * existing name, phone or CPF with the create payload.
3199
3231
  *
3200
3232
  * Request body (`application/json`):
3201
3233
  * ```jsonc
@@ -3203,25 +3235,23 @@ declare class SignerResource extends BaseResource {
3203
3235
  * "full_name": "Example Signer",
3204
3236
  * "email": "signer@example.com",
3205
3237
  * "whatsapp_phone_number": "+5548999990000",
3206
- * "government_id": "390.533.447-05",
3207
- * "metadata": {
3208
- * "reference": "customer_example"
3209
- * }
3238
+ * "government_id": "390.533.447-05"
3210
3239
  * }
3211
3240
  * ```
3212
3241
  *
3213
3242
  * @param payload - The signer to create. The official fields are required
3214
- * `full_name` plus optional `email`, E.164 `whatsapp_phone_number` and
3243
+ * `full_name` plus optional `email`, `whatsapp_phone_number` (E.164, or Brazilian without `+`) and
3215
3244
  * `government_id` (CPF, or a CNPJ that may contain letters; the API strips
3216
- * formatting). `phone`, `cpf`, and `metadata` are compatibility extensions;
3217
- * the SDK normalizes the phone alias and strips non-digits from CPF.
3245
+ * formatting). `phone` and `cpf` are compatibility extensions; the SDK
3246
+ * normalizes the phone alias and strips non-digits from CPF. The deprecated
3247
+ * `metadata` is not sent: the API neither stores nor returns it.
3218
3248
  * @param accountId - Override the client's default account ID.
3219
3249
  * @returns The created (or reused) signer. `government_id` comes back
3220
3250
  * normalized; `cpf` is **never echoed back**:
3221
3251
  * ```jsonc
3222
3252
  * {
3223
3253
  * "resource": "signer",
3224
- * "id": "19e6b92e7895332ed9708535d8c",
3254
+ * "id": "100000000000000000000000a01",
3225
3255
  * "full_name": "Ana Souza",
3226
3256
  * "email": "ana@example.com",
3227
3257
  * "whatsapp_phone_number": null,
@@ -3231,8 +3261,9 @@ declare class SignerResource extends BaseResource {
3231
3261
  * ```
3232
3262
  * @throws {ValidationError} If the name/contact values are malformed or no
3233
3263
  * account ID is available.
3234
- * @throws {ApiError} If the API rejects the request for a reason other than a
3235
- * recoverable duplicate email.
3264
+ * @throws {ApiError} `400` with `code` `InvalidEmail` when the API finds the
3265
+ * e-mail undeliverable, or `400` for another invalid field; a duplicate
3266
+ * e-mail is not an error (the existing signer is returned).
3236
3267
  *
3237
3268
  * @example
3238
3269
  * ```ts
@@ -3262,7 +3293,7 @@ declare class SignerResource extends BaseResource {
3262
3293
  * ```jsonc
3263
3294
  * {
3264
3295
  * "resource": "signer",
3265
- * "id": "19e6b92e7895332ed9708535d8c",
3296
+ * "id": "100000000000000000000000a01",
3266
3297
  * "full_name": "Example Signer",
3267
3298
  * "email": "signer@example.com",
3268
3299
  * "whatsapp_phone_number": null,
@@ -3275,7 +3306,7 @@ declare class SignerResource extends BaseResource {
3275
3306
  *
3276
3307
  * @example
3277
3308
  * ```ts
3278
- * const signer = await client.signers.get('19e6b92e7895332ed9708535d8c');
3309
+ * const signer = await client.signers.get('100000000000000000000000a01');
3279
3310
  * ```
3280
3311
  */
3281
3312
  get(signerId: string, accountId?: string): Promise<ISigner>;
@@ -3290,7 +3321,7 @@ declare class SignerResource extends BaseResource {
3290
3321
  * @returns The matching signers, with pagination in `meta`. Each item:
3291
3322
  * ```jsonc
3292
3323
  * {
3293
- * "id": "19e6b92e7895332ed9708535d8c",
3324
+ * "id": "100000000000000000000000a01",
3294
3325
  * "full_name": "Example Signer",
3295
3326
  * "email": "signer@example.com",
3296
3327
  * "whatsapp_phone_number": null,
@@ -3334,7 +3365,7 @@ declare class SignerResource extends BaseResource {
3334
3365
  * ```jsonc
3335
3366
  * {
3336
3367
  * "resource": "signer",
3337
- * "id": "19e6b92e7895332ed9708535d8c",
3368
+ * "id": "100000000000000000000000a01",
3338
3369
  * "full_name": "Ana Souza Lima",
3339
3370
  * "email": "ana@example.com",
3340
3371
  * "whatsapp_phone_number": null,
@@ -3342,13 +3373,17 @@ declare class SignerResource extends BaseResource {
3342
3373
  * "has_accepted_terms": false
3343
3374
  * }
3344
3375
  * ```
3345
- * @throws {ValidationError} If `signerId` is missing or no account ID is available.
3346
- * @throws {ApiError} `400` if a verified contact channel is in use by an
3347
- * in-flight document; `404` if the signer does not exist.
3376
+ * @throws {ValidationError} If `signerId` is missing, the payload changes no
3377
+ * field or carries a malformed value, or no account ID is available.
3378
+ * @throws {ApiError} `400` for an invalid field (`code` `InvalidEmail` for an
3379
+ * undeliverable new e-mail) or when the change would replace an e-mail or
3380
+ * WhatsApp number the signer verified on an in-flight document; `403` when a
3381
+ * role, membership or OAuth scope refuses it; `404` if the signer does not
3382
+ * exist.
3348
3383
  *
3349
3384
  * @example
3350
3385
  * ```ts
3351
- * await client.signers.update('19e6b92e7895332ed9708535d8c', {
3386
+ * await client.signers.update('100000000000000000000000a01', {
3352
3387
  * full_name: 'Ana Souza Lima',
3353
3388
  * government_id: '390.533.447-05',
3354
3389
  * });
@@ -3362,12 +3397,12 @@ declare class SignerResource extends BaseResource {
3362
3397
  * @param accountId - Override the client's default account ID.
3363
3398
  * @returns Nothing on success (resolves to `void`).
3364
3399
  * @throws {ValidationError} If `signerId` is missing or no account ID is available.
3365
- * @throws {ApiError} `404` if the signer does not exist; `400`/`409` if it
3366
- * still has active assignments.
3400
+ * @throws {ApiError} `400` once the signer is on any document, whatever the
3401
+ * document's status; `404` if the signer does not exist.
3367
3402
  *
3368
3403
  * @example
3369
3404
  * ```ts
3370
- * await client.signers.delete('19e6b92e7895332ed9708535d8c');
3405
+ * await client.signers.delete('100000000000000000000000a01');
3371
3406
  * ```
3372
3407
  */
3373
3408
  delete(signerId: string, accountId?: string): Promise<void>;
@@ -3392,7 +3427,7 @@ declare class SignerResource extends BaseResource {
3392
3427
  * looks like:
3393
3428
  * ```jsonc
3394
3429
  * {
3395
- * "id": "19e6b92e7895332ed9708535d8c",
3430
+ * "id": "100000000000000000000000a01",
3396
3431
  * "full_name": "Ana Souza",
3397
3432
  * "email": "ana@example.com",
3398
3433
  * "whatsapp_phone_number": null,
@@ -3441,6 +3476,10 @@ declare class WorkspaceResource extends BaseResource {
3441
3476
  /**
3442
3477
  * Create a new workspace (`POST /accounts`).
3443
3478
  *
3479
+ * The caller becomes its owner. A user can own one free workspace; more
3480
+ * require owning a workspace with an active paid subscription, or an
3481
+ * active user contract.
3482
+ *
3444
3483
  * Request body (`application/json`):
3445
3484
  * ```jsonc
3446
3485
  * {
@@ -3455,23 +3494,23 @@ declare class WorkspaceResource extends BaseResource {
3455
3494
  * optional `notification_sender_type` (`User` or `Account`). Optional brand
3456
3495
  * colours use six hex characters without
3457
3496
  * a leading `#`.
3458
- * @returns The created workspace. Response shape:
3497
+ * @returns The created workspace. Only these fields are returned; read
3498
+ * `roles`, `is_delete_allowed` and `limits` with {@link WorkspaceResource.get}:
3459
3499
  * ```jsonc
3460
3500
  * {
3461
- * "resource": "account",
3462
3501
  * "id": "acc_example",
3463
3502
  * "name": "Acme Legal",
3464
- * "notification_sender_type": "Account",
3465
3503
  * "primary_color": "ff0066",
3466
3504
  * "secondary_color": "0066ff",
3467
- * "roles": ["owner"],
3468
- * "is_delete_allowed": true,
3505
+ * "notification_sender_type": "Account",
3469
3506
  * "created_at": "2026-05-12T18:05:11Z"
3470
3507
  * }
3471
3508
  * ```
3472
3509
  * @throws {ValidationError} If `payload` is not an object.
3473
- * @throws {ApiError} If the API rejects the request — e.g. `400` when a
3474
- * colour is not exactly 6 hex characters (or carries a leading `#`).
3510
+ * @throws {ApiError} `400` when a colour is not exactly 6 hex characters
3511
+ * (or carries a leading `#`); `403` with `code` `FreeWorkspaceLimit` when
3512
+ * the user already owns a free workspace and neither owns a paid one nor
3513
+ * has a user contract.
3475
3514
  *
3476
3515
  * @example
3477
3516
  * ```ts
@@ -3687,18 +3726,21 @@ declare class WorkspaceResource extends BaseResource {
3687
3726
  /**
3688
3727
  * Upload or replace the account logo (`POST /accounts/{accountId}/logo`).
3689
3728
  *
3690
- * The request is `multipart/form-data` with exactly one `file` part. No
3691
- * response data is defined; the method resolves once the API acknowledges
3692
- * the update.
3729
+ * The request is `multipart/form-data` with exactly one `file` part. The
3730
+ * API accepts PNG, JPEG or WebP and detects the type from the file's bytes,
3731
+ * not from its name or the part's content type. Unlike PDF uploads, the
3732
+ * logo operation defines no 25 MB cap, so the SDK does not impose the
3733
+ * document limit here. Owners only.
3693
3734
  *
3694
3735
  * @param accountId - Account whose logo will be replaced.
3695
3736
  * @param source - File path or `{ buffer, fileName }`; optionally set an
3696
- * explicit MIME `contentType` for an in-memory image.
3737
+ * explicit MIME `contentType` for the part. Without one it is taken from
3738
+ * a `.png`, `.jpg`/`.jpeg` or `.webp` file name, else
3739
+ * `application/octet-stream`.
3697
3740
  * @returns Resolves when the API acknowledges the multipart upload.
3698
3741
  * @throws {ValidationError} If an id/file name is missing or the file is empty.
3699
- * Unlike PDF uploads, the official logo operation defines no 25 MB cap, so
3700
- * the SDK does not impose the document limit here.
3701
- * @throws {ApiError} `400`/`415` if the API rejects the image.
3742
+ * @throws {ApiError} `400` (`Wrong mime type.`) when the bytes are not a
3743
+ * PNG, JPEG or WebP image, or the `file` part is missing.
3702
3744
  *
3703
3745
  * @example
3704
3746
  * ```ts
@@ -3729,6 +3771,14 @@ declare class WorkspaceResource extends BaseResource {
3729
3771
  * Return this account's document-funnel KPIs
3730
3772
  * (`GET /accounts/{accountId}/stats`).
3731
3773
  *
3774
+ * Monthly rows cover the last 12 months, most recent first; daily rows
3775
+ * cover the requested month. The `signature_requests_notification_*`
3776
+ * counters can overlap (a signer reached on two channels counts twice).
3777
+ * The four `signature_requests_verification_*` counters do not overlap and
3778
+ * sum to `signature_requests` minus the requests verified by ID document
3779
+ * and face match (`IdDocumentFaceMatchBasic`), which have no counter.
3780
+ * OAuth tokens need the `account:read` scope.
3781
+ *
3732
3782
  * @param accountId - Account to aggregate.
3733
3783
  * @param params - Omit for 12 monthly rows, or request daily rows with
3734
3784
  * `{ granularity: 'daily', month: '2026-06' }`.
@@ -3753,10 +3803,10 @@ declare class WorkspaceResource extends BaseResource {
3753
3803
  * "documents_certified": 30
3754
3804
  * }]
3755
3805
  * ```
3756
- * @throws {ValidationError} For an empty account id, missing daily month,
3757
- * or a month not formatted as `YYYY-MM`.
3758
- * @throws {ApiError} `401` for invalid credentials or `404` when the route
3759
- * is not deployed in a lagging environment.
3806
+ * @throws {ValidationError} For an empty account id, an unknown
3807
+ * `granularity`, a missing daily month, or a month not formatted as `YYYY-MM`.
3808
+ * @throws {ApiError} `400` for an invalid `granularity` or `month`; `401`
3809
+ * for invalid credentials; `403` when an OAuth token lacks `account:read`.
3760
3810
  *
3761
3811
  * @example
3762
3812
  * ```ts
@@ -3786,17 +3836,15 @@ declare class WorkspaceResource extends BaseResource {
3786
3836
  * `notification_sender_type` (`User` or `Account`). Brand colours use six
3787
3837
  * hex characters without a leading `#`;
3788
3838
  * pass `null` to clear one.
3789
- * @returns The updated workspace. Response shape:
3839
+ * @returns The updated workspace, with the same fields as
3840
+ * {@link WorkspaceResource.create} returns:
3790
3841
  * ```jsonc
3791
3842
  * {
3792
- * "resource": "account",
3793
3843
  * "id": "acc_example",
3794
3844
  * "name": "Acme Legal (Renamed)",
3795
- * "notification_sender_type": "Account",
3796
3845
  * "primary_color": "ff0066",
3797
3846
  * "secondary_color": "0066ff",
3798
- * "roles": ["owner"],
3799
- * "is_delete_allowed": true,
3847
+ * "notification_sender_type": "Account",
3800
3848
  * "created_at": "2026-05-12T18:05:11Z"
3801
3849
  * }
3802
3850
  * ```
@@ -3818,10 +3866,15 @@ declare class WorkspaceResource extends BaseResource {
3818
3866
  /**
3819
3867
  * Delete a workspace (`DELETE /accounts/{accountId}`).
3820
3868
  *
3821
- * A workspace with an active paid subscription is rejected with `400` and
3822
- * a `restrictions` list. `{ force: true }` cancels that subscription and
3823
- * proceeds with deletion; it is not documented as a blanket override for
3824
- * unrelated restrictions. The flag is sent in the request body.
3869
+ * Owners only. A workspace with an active paid subscription is rejected
3870
+ * with `400` and a `restrictions` list (`ActivePaidSubscription`, plus
3871
+ * `PendingDocuments` when documents are still in progress). Without a paid
3872
+ * subscription, pending documents do not block deletion.
3873
+ *
3874
+ * `{ force: true }` skips that check: it cancels the active subscription
3875
+ * and also cancels every pending document of the workspace, notifying its
3876
+ * signers, before deleting. Neither can be undone. The flag is sent in the
3877
+ * request body.
3825
3878
  *
3826
3879
  * Request body (`application/json`):
3827
3880
  * ```jsonc
@@ -3831,18 +3884,20 @@ declare class WorkspaceResource extends BaseResource {
3831
3884
  * ```
3832
3885
  *
3833
3886
  * @param accountId - The workspace to delete.
3834
- * @param options - Set `force: true` to cancel an active paid subscription
3835
- * and proceed with deletion.
3836
- * @param options.force - Cancel an active subscription and bypass deletion restrictions.
3887
+ * @param options - Deletion options.
3888
+ * @param options.force - Cancel the active paid subscription and every
3889
+ * pending document (signers are notified), then delete.
3837
3890
  * @returns Nothing on success (`200` with no meaningful body).
3838
- * @throws {ValidationError} If `accountId` is missing.
3891
+ * @throws {ValidationError} If `accountId` is missing or `force` is not a boolean.
3839
3892
  * @throws {ApiError} `400` (with a `restrictions` list) when the workspace
3840
- * has restrictions and `force` was not set; `404` if it does not exist.
3893
+ * has an active paid subscription and `force` was not set; `403` for an
3894
+ * OAuth application token, a deactivated membership or a non-owner role;
3895
+ * `404` if it does not exist.
3841
3896
  *
3842
3897
  * @example
3843
3898
  * ```ts
3844
3899
  * await client.workspaces.delete('acc_example');
3845
- * // cancel an active paid subscription, then delete:
3900
+ * // cancel the paid subscription and pending documents, then delete:
3846
3901
  * await client.workspaces.delete('acc_example', { force: true });
3847
3902
  * ```
3848
3903
  */
@@ -3861,7 +3916,8 @@ declare const DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate
3861
3916
  * @param payload - Assignment method, signer references, and optional message,
3862
3917
  * expiration, copy-receiver signer IDs, or collect-field placements.
3863
3918
  * @returns A JSON-ready body shaped as
3864
- * `{ method, signers: [{ id, verification_method?, notification_methods?, embedded?, step? }], message?, expires_at?, copy_receivers?, entries?, max_total_credits? }`.
3919
+ * `{ method, signers: [{ id, verification_method?, notification_methods?, embedded?, step? }], message?, expires_at?, copy_receiver_ids?, entries?, max_total_credits? }`;
3920
+ * `copy_receivers` goes on the wire as `copy_receiver_ids`.
3865
3921
  * @throws {ValidationError} If no signer is present, a signer reference is
3866
3922
  * malformed, a collect assignment has no field-placement entries, or a
3867
3923
  * `DigitalCertificate` signer is combined with `method: 'collect'`. The last
@@ -3896,7 +3952,7 @@ declare class AssignmentResource extends BaseResource {
3896
3952
  * ```jsonc
3897
3953
  * {
3898
3954
  * "resource": "assignment",
3899
- * "id": "103033c9d2cec233bf65eea04999",
3955
+ * "id": "1000000000000000000000000005",
3900
3956
  * "sender_email": "sender@example.com",
3901
3957
  * "method": "virtual",
3902
3958
  * "expires_at": null,
@@ -3904,7 +3960,7 @@ declare class AssignmentResource extends BaseResource {
3904
3960
  * "copy_receivers": [],
3905
3961
  * "signers": [
3906
3962
  * {
3907
- * "id": "19e6b92e7895332ed9708535d8c",
3963
+ * "id": "100000000000000000000000a01",
3908
3964
  * "full_name": "Ana Souza",
3909
3965
  * "email": "signer@example.com",
3910
3966
  * "whatsapp_phone_number": null,
@@ -3919,10 +3975,10 @@ declare class AssignmentResource extends BaseResource {
3919
3975
  * ],
3920
3976
  * "items": [
3921
3977
  * {
3922
- * "id": "103033c9d33326458deb74fc3052",
3978
+ * "id": "1000000000000000000000000006",
3923
3979
  * "page": null,
3924
3980
  * "signer": {
3925
- * "id": "19e6b92e7895332ed9708535d8c",
3981
+ * "id": "100000000000000000000000a01",
3926
3982
  * "full_name": "Ana Souza",
3927
3983
  * "email": "signer@example.com",
3928
3984
  * "whatsapp_phone_number": null,
@@ -3944,7 +4000,7 @@ declare class AssignmentResource extends BaseResource {
3944
4000
  * "completed_count": 0,
3945
4001
  * "signers": [
3946
4002
  * {
3947
- * "id": "19e6b92e7895332ed9708535d8c",
4003
+ * "id": "100000000000000000000000a01",
3948
4004
  * "full_name": "Ana Souza",
3949
4005
  * "email": "signer@example.com",
3950
4006
  * "whatsapp_phone_number": null,
@@ -3955,8 +4011,8 @@ declare class AssignmentResource extends BaseResource {
3955
4011
  * },
3956
4012
  * "signing_urls": [
3957
4013
  * {
3958
- * "signer_id": "19e6b92e7895332ed9708535d8c",
3959
- * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com",
4014
+ * "signer_id": "100000000000000000000000a01",
4015
+ * "url": "https://app.assinafy.com.br/sign/1000000000000000000000000007?email=signer%40example.com",
3960
4016
  * "embedded": false
3961
4017
  * }
3962
4018
  * ]
@@ -3982,14 +4038,17 @@ declare class AssignmentResource extends BaseResource {
3982
4038
  * {@link buildAssignmentPayload}. A `virtual` assignment may be created at
3983
4039
  * `uploaded`, `metadata_processing`, or `metadata_ready` and is promoted
3984
4040
  * automatically; `collect` requires rendered pages at `metadata_ready`.
3985
- * `DigitalCertificate` costs 0.5 credits, requires the feature plus a
4041
+ * `DigitalCertificate` is charged per signer (estimate the current fee:
4042
+ * breakdown code `SignatureDigitalCertificate`), requires the feature plus a
3986
4043
  * signer `government_id`, that signer must be alone in its step, and the
3987
4044
  * assignment must use `method: 'virtual'`. Certificate completion marks a
3988
4045
  * virtual item complete; it cannot submit placed `collect` fields.
3989
4046
  * `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
3990
- * and a valid CPF in the signer's `government_id`; estimate its fee first.
4047
+ * and a valid CPF in the signer's `government_id`; estimate its fee first
4048
+ * (breakdown code `VerificationIdDocumentFaceMatchBasic`).
3991
4049
  *
3992
- * Request body (`application/json`):
4050
+ * Request body (`application/json`); `copy_receivers` is sent as
4051
+ * `copy_receiver_ids`, the key the API reads:
3993
4052
  * ```jsonc
3994
4053
  * {
3995
4054
  * "method": "virtual",
@@ -4005,7 +4064,7 @@ declare class AssignmentResource extends BaseResource {
4005
4064
  * ],
4006
4065
  * "message": "Please sign this document.",
4007
4066
  * "expires_at": "2027-12-31T23:59:59Z",
4008
- * "copy_receivers": [
4067
+ * "copy_receiver_ids": [
4009
4068
  * "copy_signer_example"
4010
4069
  * ]
4011
4070
  * }
@@ -4014,7 +4073,8 @@ declare class AssignmentResource extends BaseResource {
4014
4073
  * @param documentId - The document to request signatures on.
4015
4074
  * @param payload - Signers plus optional `method` (defaults to `virtual`),
4016
4075
  * `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
4017
- * addresses), and `collect`-mode `entries` with page-image geometry.
4076
+ * addresses; sent as `copy_receiver_ids`), and `collect`-mode `entries`
4077
+ * with page-image geometry.
4018
4078
  * `expires_at` accepts a date (ending at 23:59 UTC), a date-time without
4019
4079
  * an offset (UTC), or an offset-aware date-time, at least one hour ahead.
4020
4080
  * `max_total_credits` refuses the send above that many credits. Signers may
@@ -4023,14 +4083,14 @@ declare class AssignmentResource extends BaseResource {
4023
4083
  * This route takes no `Idempotency-Key`: a document takes one assignment,
4024
4084
  * so a retry after a lost response answers `400` and charges nothing —
4025
4085
  * read the document to see whether the first request went through.
4026
- * @param payload.signers[].sign_as - Staging capacity printed on the certificate; omitted/null means `Sign`.
4086
+ * @param payload.signers[].sign_as - Capacity printed on the certificate; omitted/null means `Sign`.
4027
4087
  * @returns The created {@link IAssignment}: `signers` (rich, with `step` /
4028
4088
  * `notified` / `verification_method`), `items` (one row per signer × field),
4029
4089
  * a `summary` count block, and per-signer `signing_urls`. Response shape:
4030
4090
  * ```jsonc
4031
4091
  * {
4032
4092
  * "resource": "assignment",
4033
- * "id": "103033c9d2cec233bf65eea04999",
4093
+ * "id": "1000000000000000000000000005",
4034
4094
  * "sender_email": "sender@example.com",
4035
4095
  * "method": "virtual",
4036
4096
  * "expires_at": null,
@@ -4038,7 +4098,7 @@ declare class AssignmentResource extends BaseResource {
4038
4098
  * "copy_receivers": [],
4039
4099
  * "signers": [
4040
4100
  * {
4041
- * "id": "19e6b92e7895332ed9708535d8c",
4101
+ * "id": "100000000000000000000000a01",
4042
4102
  * "full_name": "Ana Souza",
4043
4103
  * "email": "signer@example.com",
4044
4104
  * "whatsapp_phone_number": null,
@@ -4053,10 +4113,10 @@ declare class AssignmentResource extends BaseResource {
4053
4113
  * ],
4054
4114
  * "items": [
4055
4115
  * {
4056
- * "id": "103033c9d33326458deb74fc3052",
4116
+ * "id": "1000000000000000000000000006",
4057
4117
  * "page": null,
4058
4118
  * "signer": {
4059
- * "id": "19e6b92e7895332ed9708535d8c",
4119
+ * "id": "100000000000000000000000a01",
4060
4120
  * "full_name": "Ana Souza",
4061
4121
  * "email": "signer@example.com"
4062
4122
  * },
@@ -4076,7 +4136,7 @@ declare class AssignmentResource extends BaseResource {
4076
4136
  * "completed_count": 0,
4077
4137
  * "signers": [
4078
4138
  * {
4079
- * "id": "19e6b92e7895332ed9708535d8c",
4139
+ * "id": "100000000000000000000000a01",
4080
4140
  * "full_name": "Ana Souza",
4081
4141
  * "email": "signer@example.com",
4082
4142
  * "whatsapp_phone_number": null,
@@ -4087,8 +4147,8 @@ declare class AssignmentResource extends BaseResource {
4087
4147
  * },
4088
4148
  * "signing_urls": [
4089
4149
  * {
4090
- * "signer_id": "19e6b92e7895332ed9708535d8c",
4091
- * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com",
4150
+ * "signer_id": "100000000000000000000000a01",
4151
+ * "url": "https://app.assinafy.com.br/sign/1000000000000000000000000007?email=signer%40example.com",
4092
4152
  * "embedded": false // an embedded signer has "url": null
4093
4153
  * }
4094
4154
  * ]
@@ -4100,17 +4160,21 @@ declare class AssignmentResource extends BaseResource {
4100
4160
  * 'digital_certificate_requires_virtual_method'`.
4101
4161
  * @throws {ApiError} `400` for an invalid assignment or unmet verification
4102
4162
  * precondition; `403` (`PlanRestricted` for a method or Embed the plan
4103
- * lacks, `InsufficientScope`); `404` for a document outside the workspace;
4163
+ * lacks, `FreePlanSignerLimit` for a free workspace above three signers,
4164
+ * `InsufficientScope`); `404` for a document outside the workspace;
4104
4165
  * `409` (`CreditCeilingExceeded`, with `total_credits` and
4105
- * `max_total_credits` in `responseData`).
4166
+ * `max_total_credits` in `responseData`); `429` (`FreePlanEmailLimit`)
4167
+ * when the free plan's daily signer e-mail limit has no room for the
4168
+ * invitations: `Retry-After` gives the seconds until it has (often hours),
4169
+ * and nothing is created or charged.
4106
4170
  *
4107
4171
  * @example
4108
4172
  * ```ts
4109
4173
  * const assignment = await client.assignments.create('doc-1', {
4110
- * signers: ['19e6b92e7895332ed9708535d8c'],
4174
+ * signers: ['100000000000000000000000a01'],
4111
4175
  * message: 'Please sign this contract',
4112
4176
  * });
4113
- * // → wire body: { method: 'virtual', signers: [{ id: '19e6…' }], message: 'Please sign this contract' }
4177
+ * // → wire body: { method: 'virtual', signers: [{ id: '1000…' }], message: 'Please sign this contract' }
4114
4178
  * console.log(assignment.signing_urls?.length); // one entry per notified signer; url is null for embedded or WhatsApp-only signers
4115
4179
  * ```
4116
4180
  */
@@ -4123,13 +4187,14 @@ declare class AssignmentResource extends BaseResource {
4123
4187
  * only `verification_method` / `notification_methods` (or `{}` for the
4124
4188
  * default Email channel). {@link buildAssignmentEstimatePayload} projects
4125
4189
  * exactly the fields permitted by the estimate schema.
4126
- * `DigitalCertificate` is priced at 0.5 credits per signer and remains
4127
- * subject to the feature and identity requirements. It is valid only with
4128
- * `method: 'virtual'`; the SDK refuses to quote a certificate/`collect`
4129
- * request because that assignment cannot be completed.
4130
- * Current documented unit prices are 1 credit for an extra document, 0 for
4131
- * email notification, and 0.45 for WhatsApp notification; a digital
4132
- * certificate charge is added on top of its notification cost.
4190
+ * `DigitalCertificate` remains subject to the feature and identity
4191
+ * requirements. It is valid only with `method: 'virtual'`; the SDK refuses
4192
+ * to quote a certificate/`collect` request because that assignment cannot
4193
+ * be completed. Prices change with the plan, so estimate the current fee
4194
+ * rather than hardcoding it: each paid item is a `breakdown` line
4195
+ * (`NotificationWhatsapp`, `SignatureDigitalCertificate`,
4196
+ * `VerificationIdDocumentFaceMatchBasic`), e-mail notification is free, and
4197
+ * a certificate or identity check is charged on top of its notification.
4133
4198
  *
4134
4199
  * Request body (`application/json`):
4135
4200
  * ```jsonc
@@ -4151,7 +4216,7 @@ declare class AssignmentResource extends BaseResource {
4151
4216
  * `collect`-mode `entries`. Signer IDs are not part of this request. Send
4152
4217
  * each signer's creation `step` too: the API keeps every
4153
4218
  * `DigitalCertificate` signer alone in its step when it estimates.
4154
- * @param payload.signers[].sign_as - Optional staging capacity, validated as on creation; it does not change the cost.
4219
+ * @param payload.signers[].sign_as - Optional capacity, validated as on creation; it does not change the cost.
4155
4220
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
4156
4221
  * line-item `breakdown`, and a `has_sufficient_resources` gate.
4157
4222
  * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
@@ -4177,7 +4242,11 @@ declare class AssignmentResource extends BaseResource {
4177
4242
  * combines `DigitalCertificate` with `collect`.
4178
4243
  * The last case has `errors.code ===
4179
4244
  * 'digital_certificate_requires_virtual_method'`.
4180
- * @throws {ApiError} If the API rejects the request.
4245
+ * @throws {ApiError} `400` for signers, methods or steps creation would
4246
+ * refuse, or a document that cannot take an assignment; `403`
4247
+ * (`PlanRestricted` for a method the plan lacks, `FreePlanSignerLimit` for
4248
+ * a free workspace above three signers, `InsufficientScope`); `404` for a
4249
+ * document outside the workspace.
4181
4250
  *
4182
4251
  * @example
4183
4252
  * ```ts
@@ -4215,7 +4284,7 @@ declare class AssignmentResource extends BaseResource {
4215
4284
  * `signing_urls`), with `expires_at` reflecting the new value:
4216
4285
  * ```jsonc
4217
4286
  * {
4218
- * "id": "103033c9d2cec233bf65eea04999",
4287
+ * "id": "1000000000000000000000000005",
4219
4288
  * "sender_email": "sender@example.com",
4220
4289
  * "method": "virtual",
4221
4290
  * "expires_at": "2027-12-31T23:59:59Z",
@@ -4223,7 +4292,7 @@ declare class AssignmentResource extends BaseResource {
4223
4292
  * "copy_receivers": [],
4224
4293
  * "signers": [
4225
4294
  * {
4226
- * "id": "19e6b92e7895332ed9708535d8c",
4295
+ * "id": "100000000000000000000000a01",
4227
4296
  * "full_name": "Ana Souza",
4228
4297
  * "email": "signer@example.com",
4229
4298
  * "completed": false,
@@ -4235,7 +4304,7 @@ declare class AssignmentResource extends BaseResource {
4235
4304
  * ],
4236
4305
  * "summary": { "signer_count": 1, "completed_count": 0 },
4237
4306
  * "signing_urls": [
4238
- * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
4307
+ * { "signer_id": "100000000000000000000000a01", "url": "https://app.assinafy.com.br/sign/1000000000000000000000000007" }
4239
4308
  * ]
4240
4309
  * }
4241
4310
  * ```
@@ -4266,16 +4335,20 @@ declare class AssignmentResource extends BaseResource {
4266
4335
  * ```jsonc
4267
4336
  * {
4268
4337
  * "is_sent": true,
4269
- * "document_id": "103acccd24234c07858ffddf6d84",
4270
- * "signer_id": "19e6b92e7895332ed9708535d8c"
4338
+ * "document_id": "1000000000000000000000000008",
4339
+ * "signer_id": "100000000000000000000000a01"
4271
4340
  * }
4272
4341
  * ```
4273
4342
  * @throws {ValidationError} If any of the three IDs is missing.
4274
- * @throws {ApiError} `400` when the document is not pending signature, the
4275
- * signer already signed or waits for an earlier step, or credits are short;
4276
- * `403`; `404`. The same verification code is resent, so an open embed frame
4277
- * keeps working; envelope signers can be reminded of every document at once
4278
- * with `envelopes.resendNotification()`.
4343
+ * @throws {ApiError} `400` when the document is not pending signature or
4344
+ * its deadline has passed, the signer is not on the assignment, already
4345
+ * signed or waits for an earlier step, was reminded less than 2 minutes ago
4346
+ * or is being reminded now, was already reminded 10 times in the 24 hours
4347
+ * since the first of those reminders (for an envelope document, reminders
4348
+ * through the envelope or any of its documents count), or credits are
4349
+ * short; `403`; `404`. The same verification code is resent, so an open
4350
+ * embed frame keeps working; envelope signers can be reminded of every
4351
+ * document at once with `envelopes.resendNotification()`.
4279
4352
  *
4280
4353
  * @example
4281
4354
  * ```ts
@@ -4294,9 +4367,7 @@ declare class AssignmentResource extends BaseResource {
4294
4367
  * @param documentId - The document the assignment belongs to.
4295
4368
  * @param assignmentId - The assignment containing the signer.
4296
4369
  * @param signerId - The signer whose notification would be resent.
4297
- * @returns An {@link IResendCostEstimate}: the compact `total` /
4298
- * `has_sufficient_credits` shape production returns, or the full
4299
- * {@link ICostEstimate} on older deployments:
4370
+ * @returns An {@link IResendCostEstimate}:
4300
4371
  * ```jsonc
4301
4372
  * {
4302
4373
  * "total": 0.45,
@@ -4306,8 +4377,9 @@ declare class AssignmentResource extends BaseResource {
4306
4377
  * }
4307
4378
  * ```
4308
4379
  * @throws {ValidationError} If any of the three IDs is missing.
4309
- * @throws {ApiError} `400` when the signer cannot be reminded (signed, not
4310
- * yet notified, or notified only by `Bypass`), `403`, `404`.
4380
+ * @throws {ApiError} `404` for an unknown assignment or signer, or a signer
4381
+ * not on the assignment; it never checks whether the reminder would be
4382
+ * accepted now.
4311
4383
  *
4312
4384
  * @example
4313
4385
  * ```ts
@@ -4342,7 +4414,7 @@ declare class AssignmentResource extends BaseResource {
4342
4414
  * { "text": "Assinar documento" } // production strips button URLs
4343
4415
  * ],
4344
4416
  * "phone_number": "+5511999998888",
4345
- * "signer_id": "19e6b92e7895332ed9708535d8c"
4417
+ * "signer_id": "100000000000000000000000a01"
4346
4418
  * }
4347
4419
  * ]
4348
4420
  * ```
@@ -4468,7 +4540,7 @@ declare class AssignmentResource extends BaseResource {
4468
4540
  /**
4469
4541
  * Read the capacity each signer signs in (`GET /documents/{documentId}/signer-capacities`).
4470
4542
  *
4471
- * Staging extension. Order matches the assignment's signers; an unsent
4543
+ * Order matches the assignment's signers; an unsent
4472
4544
  * document returns an empty list. OAuth applications need `documents:read`.
4473
4545
  * @param documentId - Workspace document ID.
4474
4546
  * @returns Sender-stated capacities, defaulting to `Sign`:
@@ -4476,7 +4548,7 @@ declare class AssignmentResource extends BaseResource {
4476
4548
  * [{ "signer_id": "signer-1", "sign_as": "Witness" }]
4477
4549
  * ```
4478
4550
  * @throws {ValidationError} If the document ID is invalid.
4479
- * @throws {ApiError} `401`, `403`, or `404` for an unknown document or an older deployment.
4551
+ * @throws {ApiError} `401`, `403`, or `404` for an unknown document.
4480
4552
  * @example
4481
4553
  * ```ts
4482
4554
  * const capacities = await client.assignments.getSignerCapacities(document.id);
@@ -4486,7 +4558,7 @@ declare class AssignmentResource extends BaseResource {
4486
4558
  /**
4487
4559
  * Read delivery and open times (`GET /documents/{documentId}/notification-history`).
4488
4560
  *
4489
- * Staging extension. An open can come from a mail scanner; it is not proof
4561
+ * An open can come from a mail scanner; it is not proof
4490
4562
  * of human reading. An unsent document returns `[]`. Needs `documents:read`.
4491
4563
  * @param documentId - Workspace document ID.
4492
4564
  * @returns History in assignment-signer order:
@@ -4499,7 +4571,7 @@ declare class AssignmentResource extends BaseResource {
4499
4571
  * }] }]
4500
4572
  * ```
4501
4573
  * @throws {ValidationError} If the document ID is invalid.
4502
- * @throws {ApiError} `401`, `403`, or `404` for an unknown document or an older deployment.
4574
+ * @throws {ApiError} `401`, `403`, or `404` for an unknown document.
4503
4575
  * @example
4504
4576
  * ```ts
4505
4577
  * const history = await client.assignments.getNotificationHistory(document.id);
@@ -4526,6 +4598,11 @@ declare class WebhookResource extends BaseResource {
4526
4598
  * `signer_rejected_document`, `document_processing_failed`).
4527
4599
  * OAuth tokens need the `webhooks:write` scope.
4528
4600
  *
4601
+ * On a workspace with no endpoint the API inserts the endpoint row before it
4602
+ * checks `url` and `email`, so even a request answered with `400` leaves an
4603
+ * endpoint behind. That row takes the free plan's only slot and carries
4604
+ * `url`/`email` `null` until a valid registration fills them in.
4605
+ *
4529
4606
  * Request body (`application/json`):
4530
4607
  * ```jsonc
4531
4608
  * {
@@ -4584,11 +4661,13 @@ declare class WebhookResource extends BaseResource {
4584
4661
  * Fetch the account's oldest webhook endpoint in the legacy subscription
4585
4662
  * shape (`GET /accounts/{accountId}/webhooks/subscriptions`). Accounts with
4586
4663
  * several endpoints should use {@link WebhookResource.listEndpoints}.
4664
+ * OAuth tokens need the `account:read` scope.
4665
+ *
4666
+ * Reading never creates an endpoint: a workspace without one gets a blank
4667
+ * subscription with `url: null`, not a `404`.
4587
4668
  *
4588
4669
  * @param accountId - Override the client's default account ID.
4589
- * @returns The subscription, or `null` when the workspace has none (the API
4590
- * responds `404`, which is normalized to `null`). Response shape when
4591
- * present:
4670
+ * @returns The subscription. Response shape:
4592
4671
  * ```jsonc
4593
4672
  * {
4594
4673
  * "url": "https://webhooks.example.com/assinafy",
@@ -4599,23 +4678,38 @@ declare class WebhookResource extends BaseResource {
4599
4678
  * // …5 more (7 total)
4600
4679
  * ],
4601
4680
  * "is_active": false,
4681
+ * "is_held": false,
4682
+ * "held_since": null,
4602
4683
  * "updated_at": "2026-07-18T02:36:02Z"
4603
4684
  * }
4604
4685
  * ```
4686
+ * Blank shape when the workspace has no endpoint:
4687
+ * ```jsonc
4688
+ * {
4689
+ * "events": [],
4690
+ * "is_active": true,
4691
+ * "url": null,
4692
+ * "email": null,
4693
+ * "is_held": false,
4694
+ * "held_since": null,
4695
+ * "updated_at": null
4696
+ * }
4697
+ * ```
4605
4698
  * @throws {ValidationError} If no account ID is available.
4606
- * @throws {ApiError} If the API fails for a reason other than `404`.
4699
+ * @throws {ApiError} `401` for invalid credentials, `403` when an OAuth
4700
+ * token lacks `account:read`, `404` for an unknown workspace.
4607
4701
  *
4608
4702
  * @example
4609
4703
  * ```ts
4610
4704
  * const sub = await client.webhooks.get();
4611
- * if (sub === null) {
4705
+ * if (sub.url === null) {
4612
4706
  * // no subscription configured yet
4613
4707
  * } else if (!sub.is_active) {
4614
4708
  * // exists but deliveries are paused
4615
4709
  * }
4616
4710
  * ```
4617
4711
  */
4618
- get(accountId?: string): Promise<IWebhookSubscription | null>;
4712
+ get(accountId?: string): Promise<IWebhookSubscription>;
4619
4713
  /**
4620
4714
  * Deactivate the account's oldest webhook endpoint
4621
4715
  * (`PUT /accounts/{accountId}/webhooks/inactivate`). Other endpoints are
@@ -4623,10 +4717,15 @@ declare class WebhookResource extends BaseResource {
4623
4717
  * `is_active: false` to target a specific one.
4624
4718
  *
4625
4719
  * The endpoint is retained (with its `url` and `events`) and simply stops
4626
- * firing; re-enable it by calling {@link WebhookResource.register} again
4627
- * with `is_active: true`.
4720
+ * firing. Re-enable it with {@link WebhookResource.updateEndpoint} and
4721
+ * `{ is_active: true }`: that needs no URL and resets the failure count.
4722
+ * {@link WebhookResource.register} re-validates the URL as HTTPS, so it
4723
+ * cannot re-enable an endpoint whose stored URL is a legacy `http://` one.
4628
4724
  * OAuth tokens need the `webhooks:write` scope.
4629
4725
  *
4726
+ * On a workspace with no endpoint this creates an inactive one with `url`
4727
+ * and `email` `null`, which takes the free plan's only slot.
4728
+ *
4630
4729
  * @param accountId - Override the client's default account ID.
4631
4730
  * @returns The subscription with `is_active` flipped to `false`. Response
4632
4731
  * shape:
@@ -4642,6 +4741,8 @@ declare class WebhookResource extends BaseResource {
4642
4741
  * "document_processing_failed"
4643
4742
  * ],
4644
4743
  * "is_active": false,
4744
+ * "is_held": false,
4745
+ * "held_since": null,
4645
4746
  * "updated_at": "2026-07-18T02:36:02Z"
4646
4747
  * }
4647
4748
  * ```
@@ -4653,6 +4754,10 @@ declare class WebhookResource extends BaseResource {
4653
4754
  * ```ts
4654
4755
  * const sub = await client.webhooks.inactivate();
4655
4756
  * console.log(sub.is_active); // false
4757
+ *
4758
+ * // Later, re-enable the same endpoint:
4759
+ * const [endpoint] = await client.webhooks.listEndpoints();
4760
+ * if (endpoint) await client.webhooks.updateEndpoint(endpoint.id, { is_active: true });
4656
4761
  * ```
4657
4762
  */
4658
4763
  inactivate(accountId?: string): Promise<IWebhookSubscription>;
@@ -4673,9 +4778,33 @@ declare class WebhookResource extends BaseResource {
4673
4778
  * {
4674
4779
  * "id": "document_metadata_ready",
4675
4780
  * "description": "Triggered when the document is ready to be prepared. The document has been normalized to PDF and its pages are available."
4781
+ * },
4782
+ * {
4783
+ * "id": "signature_reminder_sent",
4784
+ * "description": "Triggered when a reminder went out to a Signer, beside signature_requested"
4785
+ * },
4786
+ * {
4787
+ * "id": "signature_request_delivery_failed",
4788
+ * "description": "Triggered when WhatsApp reports that an invitation or a reminder to a Signer could not be delivered"
4789
+ * },
4790
+ * {
4791
+ * "id": "document_expiring",
4792
+ * "description": "Triggered when the signing deadline is less than 24 hours away and the Signers still to sign are warned; once per deadline"
4793
+ * },
4794
+ * {
4795
+ * "id": "document_expired",
4796
+ * "description": "Triggered when the signing deadline passed with signatures missing; the document status becomes expired"
4676
4797
  * }
4677
4798
  * ]
4678
4799
  * ```
4800
+ * Reminder and deadline events (their `subject` is the Document):
4801
+ * - `signature_reminder_sent` — a reminder went out, alongside a
4802
+ * `signature_requested`; `payload.notification_method` is `email` or `whatsapp`.
4803
+ * - `signature_request_delivery_failed` — WhatsApp reported an invitation or
4804
+ * reminder as undeliverable.
4805
+ * - `document_expiring` — the deadline is under 24 hours away; pending
4806
+ * signers were warned.
4807
+ * - `document_expired` — the deadline passed; the document status is `expired`.
4679
4808
  * @throws {ApiError} If the API rejects the request.
4680
4809
  *
4681
4810
  * @example
@@ -4696,6 +4825,7 @@ declare class WebhookResource extends BaseResource {
4696
4825
  * every six hours. A successful delivery or probe resumes the endpoint and
4697
4826
  * replays missed events oldest first. Response bodies are truncated to
4698
4827
  * 2,000 characters and delivery entries are retained for seven days.
4828
+ * OAuth tokens need the `documents:read` scope.
4699
4829
  *
4700
4830
  * @param params - Optional filters and pagination:
4701
4831
  * - `endpoint_id` — only deliveries to this webhook endpoint.
@@ -4710,19 +4840,21 @@ declare class WebhookResource extends BaseResource {
4710
4840
  * ```jsonc
4711
4841
  * {
4712
4842
  * "resource": "activity_dispatching_history",
4713
- * "id": "103a09cfce51319dd3b3f72ffcdf",
4843
+ * "id": "1000000000000000000000000019",
4714
4844
  * "event": "signature_requested",
4715
4845
  * "activity_id": 8629,
4716
- * "endpoint_id": "65f1c2a9b3e4d5f60718293a4b5c6d7e", // null once the endpoint is deleted
4846
+ * "endpoint_id": "10000000000000000000000000000001", // null once the endpoint is deleted
4717
4847
  * "endpoint": "https://example.com/hook",
4718
4848
  * "payload": {
4719
4849
  * // the full event body that was POSTed to `endpoint`:
4720
4850
  * // { id, event, object: <document + assignment>, origin, message,
4721
4851
  * // payload: { signer_email, signer_full_name, notification_method, ... },
4722
- * // subject: <User>, account_id, created_at }
4852
+ * // subject: <User, Signer or Account; the Document for
4853
+ * // signature_reminder_sent, document_expiring, document_expired>,
4854
+ * // account_id, created_at } // every `*_at` here is an ISO string
4723
4855
  * },
4724
4856
  * "delivered": true,
4725
- * "webhook_id": "9f86d081884c7d659a2feaa0c55ad015",
4857
+ * "webhook_id": "10000000000000000000000000000002",
4726
4858
  * "attempt": 1,
4727
4859
  * "kind": "scheduled",
4728
4860
  * "will_retry": false,
@@ -4751,8 +4883,15 @@ declare class WebhookResource extends BaseResource {
4751
4883
  listDispatches(params?: IWebhookDispatchListParams, accountId?: string): Promise<PaginatedResult<IWebhookDispatch>>;
4752
4884
  /**
4753
4885
  * Retry delivery of a specific webhook dispatch
4754
- * (`POST /accounts/{accountId}/webhooks/{historyId}/retry`). Re-sends the
4755
- * original payload to the endpoint that received it.
4886
+ * (`POST /accounts/{accountId}/webhooks/{historyId}/retry`). Delivers the
4887
+ * entry's event once more to the endpoint that received it, now.
4888
+ *
4889
+ * The body is rebuilt from the current state of the event's `object` (the
4890
+ * document as it is today), not copied from the original delivery, so it
4891
+ * can differ from the stored `payload`. The `webhook-id` header matches the
4892
+ * original delivery's, so a receiver deduplicating on it sees the same event.
4893
+ * The attempt is never retried automatically. OAuth tokens need the
4894
+ * `webhooks:write` scope.
4756
4895
  *
4757
4896
  * @param dispatchId - The dispatch (delivery history) ID to re-send, as
4758
4897
  * returned by {@link WebhookResource.listDispatches}.
@@ -4763,13 +4902,17 @@ declare class WebhookResource extends BaseResource {
4763
4902
  * ```jsonc
4764
4903
  * {
4765
4904
  * "resource": "activity_dispatching_history",
4766
- * "id": "103a09cfce51319dd3b3f72ffcdf",
4905
+ * "id": "1000000000000000000000000019",
4767
4906
  * "event": "signature_requested",
4768
4907
  * "activity_id": 8629,
4769
- * "endpoint_id": "65f1c2a9b3e4d5f60718293a4b5c6d7e", // null once the endpoint is deleted
4908
+ * "endpoint_id": "10000000000000000000000000000001",
4770
4909
  * "endpoint": "https://example.com/hook",
4771
- * "payload": { }, // the original event body that was re-POSTed
4910
+ * "payload": { }, // the event body as re-sent, built from the object's current state
4772
4911
  * "delivered": true,
4912
+ * "webhook_id": "10000000000000000000000000000002", // same as the original delivery
4913
+ * "attempt": 2,
4914
+ * "kind": "manual",
4915
+ * "will_retry": false,
4773
4916
  * "http_status": 200,
4774
4917
  * "response_body": "{ ... }", // max 2,000 characters
4775
4918
  * "error": null,
@@ -4779,11 +4922,14 @@ declare class WebhookResource extends BaseResource {
4779
4922
  * ```
4780
4923
  * @throws {ValidationError} If `dispatchId` is empty or no account ID is
4781
4924
  * available.
4782
- * @throws {ApiError} If the dispatch is not found (`404`) or the retry fails.
4925
+ * @throws {ApiError} `400` when the endpoint is inactive, no longer
4926
+ * subscribes to the event, or the entry is a `webhook_test` delivery; `403`
4927
+ * when the entry belongs to another workspace, its endpoint was deleted, or
4928
+ * an OAuth token lacks `webhooks:write`; `404` for an unknown entry.
4783
4929
  *
4784
4930
  * @example
4785
4931
  * ```ts
4786
- * const dispatch = await client.webhooks.retryDispatch('103a09cfce51319dd3b3f72ffcdf');
4932
+ * const dispatch = await client.webhooks.retryDispatch('1000000000000000000000000019');
4787
4933
  * console.log(dispatch.delivered);
4788
4934
  * ```
4789
4935
  */
@@ -4800,7 +4946,7 @@ declare class WebhookResource extends BaseResource {
4800
4946
  * ```jsonc
4801
4947
  * [
4802
4948
  * {
4803
- * "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
4949
+ * "id": "10000000000000000000000000000001",
4804
4950
  * "resource": "activity_event_subscription",
4805
4951
  * "name": "ERP",
4806
4952
  * "url": "https://example.com/webhooks/assinafy",
@@ -4859,7 +5005,7 @@ declare class WebhookResource extends BaseResource {
4859
5005
  * ```jsonc
4860
5006
  * {
4861
5007
  * "resource": "activity_event_subscription",
4862
- * "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
5008
+ * "id": "10000000000000000000000000000001",
4863
5009
  * "name": "ERP",
4864
5010
  * "url": "https://example.com/webhooks/assinafy",
4865
5011
  * "email": "ops@example.com",
@@ -4876,8 +5022,8 @@ declare class WebhookResource extends BaseResource {
4876
5022
  * @throws {ValidationError} If a field is malformed or no account ID is
4877
5023
  * available.
4878
5024
  * @throws {ApiError} `400` if another endpoint already uses `url`; `403`
4879
- * when the plan's endpoint limit is reached or an OAuth token lacks
4880
- * `webhooks:write`.
5025
+ * with `code` `PlanRestricted` when the plan's endpoint limit is reached,
5026
+ * or `403` when an OAuth token lacks `webhooks:write`.
4881
5027
  *
4882
5028
  * @example
4883
5029
  * ```ts
@@ -4903,7 +5049,7 @@ declare class WebhookResource extends BaseResource {
4903
5049
  * ```jsonc
4904
5050
  * {
4905
5051
  * "resource": "activity_event_subscription",
4906
- * "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
5052
+ * "id": "10000000000000000000000000000001",
4907
5053
  * "name": "ERP",
4908
5054
  * "url": "https://example.com/webhooks/assinafy",
4909
5055
  * "email": "ops@example.com",
@@ -4922,7 +5068,7 @@ declare class WebhookResource extends BaseResource {
4922
5068
  *
4923
5069
  * @example
4924
5070
  * ```ts
4925
- * const endpoint = await client.webhooks.getEndpoint('65f1c2a9b3e4d5f60718293a4b5c6d7e');
5071
+ * const endpoint = await client.webhooks.getEndpoint('10000000000000000000000000000001');
4926
5072
  * ```
4927
5073
  */
4928
5074
  getEndpoint(endpointId: string, accountId?: string): Promise<IWebhookEndpoint>;
@@ -4935,6 +5081,9 @@ declare class WebhookResource extends BaseResource {
4935
5081
  * `signing_enabled: true` generates a secret if the endpoint has none and
4936
5082
  * keeps the current one otherwise; `false` discards the secret. When this
4937
5083
  * request turns signing on, the response includes the new `secret` once.
5084
+ * `is_active: true` (or a new `url`) ends a delivery pause and resets the
5085
+ * failure count; it needs no `url`, so it also re-enables an endpoint whose
5086
+ * stored URL is a legacy `http://` one. `name: null` clears the label.
4938
5087
  * OAuth tokens need the `webhooks:write` scope.
4939
5088
  *
4940
5089
  * Request body (`application/json`, every field optional):
@@ -4943,20 +5092,22 @@ declare class WebhookResource extends BaseResource {
4943
5092
  * "url": "https://example.com/webhooks/assinafy",
4944
5093
  * "email": "ops@example.com",
4945
5094
  * "events": ["document_ready"],
4946
- * "name": "ERP",
5095
+ * "name": "ERP", // null clears the label
4947
5096
  * "is_active": false,
4948
5097
  * "signing_enabled": true
4949
5098
  * }
4950
5099
  * ```
4951
5100
  *
4952
5101
  * @param endpointId - The endpoint ID.
4953
- * @param payload - Fields to change; at least one is required.
5102
+ * @param payload - Fields to change; at least one is required. `url`
5103
+ * (absolute HTTPS), `email`, `events`, `name` (string, or `null` to clear),
5104
+ * `is_active` and `signing_enabled`.
4954
5105
  * @param accountId - Override the client's default account ID.
4955
5106
  * @returns The updated endpoint:
4956
5107
  * ```jsonc
4957
5108
  * {
4958
5109
  * "resource": "activity_event_subscription",
4959
- * "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
5110
+ * "id": "10000000000000000000000000000001",
4960
5111
  * "name": "ERP",
4961
5112
  * "url": "https://example.com/webhooks/assinafy",
4962
5113
  * "email": "ops@example.com",
@@ -4997,7 +5148,7 @@ declare class WebhookResource extends BaseResource {
4997
5148
  *
4998
5149
  * @example
4999
5150
  * ```ts
5000
- * await client.webhooks.deleteEndpoint('65f1c2a9b3e4d5f60718293a4b5c6d7e');
5151
+ * await client.webhooks.deleteEndpoint('10000000000000000000000000000001');
5001
5152
  * ```
5002
5153
  */
5003
5154
  deleteEndpoint(endpointId: string, accountId?: string): Promise<void>;
@@ -5031,7 +5182,7 @@ declare class WebhookResource extends BaseResource {
5031
5182
  * @param accountId - Override the client's default account ID.
5032
5183
  * @returns The Standard Webhooks secret:
5033
5184
  * ```jsonc
5034
- * { "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw" }
5185
+ * { "secret": "whsec_ZXhhbXBsZS1zaWduaW5nLXNlY3JldA==" }
5035
5186
  * ```
5036
5187
  * @throws {ValidationError} If `endpointId` is empty or no account ID is
5037
5188
  * available.
@@ -5099,10 +5250,10 @@ declare class WebhookResource extends BaseResource {
5099
5250
  * ```jsonc
5100
5251
  * {
5101
5252
  * "resource": "activity_dispatching_history",
5102
- * "id": "1052b3c4d5e6f7a8b9c0d1e2f3a4",
5253
+ * "id": "100000000000000000000000001a",
5103
5254
  * "event": "webhook_test",
5104
5255
  * "activity_id": 8240001,
5105
- * "endpoint_id": "1052b0e1f2a3b4c5d6e7f8a9b0c1",
5256
+ * "endpoint_id": "100000000000000000000000001b",
5106
5257
  * "endpoint": "https://hooks.example.com/assinafy",
5107
5258
  * "payload": { // the event as delivered
5108
5259
  * "id": 8240001, "event": "webhook_test", "payload": null, "origin": null,
@@ -5144,26 +5295,30 @@ declare class WebhookResource extends BaseResource {
5144
5295
  */
5145
5296
  declare class TemplateResource extends BaseResource {
5146
5297
  /**
5147
- * Create a template by uploading a PDF (`POST /accounts/{id}/templates`).
5298
+ * Create a template by uploading a file (`POST /accounts/{id}/templates`).
5148
5299
  *
5149
5300
  * Compatibility endpoint; confirm availability on the configured host.
5150
5301
  *
5151
- * The template is created in `Uploaded` status and transitions to `Ready`
5152
- * once the platform finishes processing its pages (`pages` stays empty until
5153
- * then). Configure roles/fields afterwards in the Assinafy editor. As with
5154
- * document uploads, the API derives the display name from the file part's
5155
- * filename, so `options.name` is applied as the (`.pdf`-suffixed) filename
5156
- * rather than a separate form field.
5157
- *
5158
- * @param source - The PDF to upload, as a file path or an in-memory buffer.
5302
+ * Accepts a PDF, or a Word or OpenDocument text file (`.doc`, `.docx`,
5303
+ * `.odt`), which the API converts to PDF; the filename must carry one of
5304
+ * those extensions. The template is created in `Uploaded` status and
5305
+ * transitions to `Ready` once the platform finishes processing its pages
5306
+ * (`pages` stays empty until then). Configure roles/fields afterwards in the
5307
+ * Assinafy editor. As with document uploads, the API derives the display
5308
+ * name from the file part's filename, so `options.name` is applied as the
5309
+ * filename, with the source file's extension appended when absent, rather
5310
+ * than a separate form field.
5311
+ *
5312
+ * @param source - The file to upload, as a file path or an in-memory buffer.
5159
5313
  * @param options - `name` (display name) and an optional `accountId` override.
5160
- * @param options.name - Multipart filename override, with a `.pdf` extension.
5314
+ * @param options.name - Multipart filename override; the source file's
5315
+ * extension is appended when absent.
5161
5316
  * @param options.accountId - Override the client's default workspace.
5162
5317
  * @returns The created template (envelope unwrapped). Response shape:
5163
5318
  * ```jsonc
5164
5319
  * {
5165
5320
  * "resource": "template",
5166
- * "id": "103ad2171db7979468c3e97eb067",
5321
+ * "id": "1000000000000000000000000017",
5167
5322
  * "name": "NDA template.pdf",
5168
5323
  * "document_name": "NDA template.pdf",
5169
5324
  * "message": null,
@@ -5171,7 +5326,7 @@ declare class TemplateResource extends BaseResource {
5171
5326
  * "pages": [],
5172
5327
  * "roles": [
5173
5328
  * {
5174
- * "id": "19f7b68b811f8d1e1aeaf11178e",
5329
+ * "id": "100000000000000000000000a03",
5175
5330
  * "name": "TemplateEditor",
5176
5331
  * "assignment_type": "Editor",
5177
5332
  * "created_at": "2026-07-19T17:24:48Z",
@@ -5183,9 +5338,13 @@ declare class TemplateResource extends BaseResource {
5183
5338
  * "updated_at": "2026-07-19T17:24:48Z"
5184
5339
  * }
5185
5340
  * ```
5186
- * @throws {ValidationError} If the file is empty, not a `.pdf`, exceeds
5187
- * 25 MB, no account ID is available, or the API returns no template ID.
5188
- * @throws {ApiError} If the API rejects the upload.
5341
+ * @throws {ValidationError} If the file is empty, its name does not end in
5342
+ * `.pdf`, `.doc`, `.docx` or `.odt`, its content does not start with that
5343
+ * format's signature, it exceeds 25 MB, `name` is blank, no account ID is
5344
+ * available, or the API returns no template ID.
5345
+ * @throws {ApiError} `400` for a password-protected PDF or one over 2,000
5346
+ * pages; `415` for content the API does not recognise as one of the
5347
+ * accepted formats.
5189
5348
  *
5190
5349
  * @example
5191
5350
  * ```ts
@@ -5208,7 +5367,6 @@ declare class TemplateResource extends BaseResource {
5208
5367
  * API-key-authenticated `download_url`), so there is no need to `get()` a
5209
5368
  * template again just to read its rendered pages. Prefer
5210
5369
  * {@link TemplateResource.downloadPage} to download the image bytes.
5211
- * Lifecycle values may be lowercase or title case (`ready` / `Ready`).
5212
5370
  *
5213
5371
  * @param params - `search`, `page`, and `per-page` (the SDK normalizes
5214
5372
  * `per_page` → `per-page`, the only spelling the API honors).
@@ -5216,14 +5374,14 @@ declare class TemplateResource extends BaseResource {
5216
5374
  * @returns Matching templates, with pagination in `meta`. Each item:
5217
5375
  * ```jsonc
5218
5376
  * {
5219
- * "id": "103ad2171db7979468c3e97eb067",
5377
+ * "id": "1000000000000000000000000017",
5220
5378
  * "name": "NDA template.pdf",
5221
5379
  * "document_name": "nda.pdf",
5222
5380
  * "message": null,
5223
- * "status": "ready",
5381
+ * "status": "Ready",
5224
5382
  * "pages": [
5225
5383
  * {
5226
- * "id": "103ad217673e1f978cb86179e8f8",
5384
+ * "id": "1000000000000000000000000018",
5227
5385
  * "number": 1,
5228
5386
  * "height": 1651,
5229
5387
  * "width": 1275,
@@ -5232,7 +5390,7 @@ declare class TemplateResource extends BaseResource {
5232
5390
  * }
5233
5391
  * ],
5234
5392
  * "roles": [
5235
- * { "id": "19f7b68b811f8d1e1aeaf11178e", "name": "TemplateEditor", "assignment_type": "Editor" }
5393
+ * { "id": "100000000000000000000000a03", "name": "TemplateEditor", "assignment_type": "Editor" }
5236
5394
  * ],
5237
5395
  * "tags": [],
5238
5396
  * "created_at": "2026-07-19T17:24:47Z",
@@ -5266,14 +5424,14 @@ declare class TemplateResource extends BaseResource {
5266
5424
  * ```jsonc
5267
5425
  * {
5268
5426
  * "resource": "template",
5269
- * "id": "103ad2171db7979468c3e97eb067",
5427
+ * "id": "1000000000000000000000000017",
5270
5428
  * "name": "NDA template.pdf",
5271
5429
  * "document_name": "nda.pdf",
5272
5430
  * "message": null,
5273
5431
  * "status": "Ready",
5274
5432
  * "pages": [
5275
5433
  * {
5276
- * "id": "103ad217673e1f978cb86179e8f8",
5434
+ * "id": "1000000000000000000000000018",
5277
5435
  * "number": 1,
5278
5436
  * "height": 1651,
5279
5437
  * "width": 1275,
@@ -5283,7 +5441,7 @@ declare class TemplateResource extends BaseResource {
5283
5441
  * ],
5284
5442
  * "roles": [
5285
5443
  * {
5286
- * "id": "19f7b68b811f8d1e1aeaf11178e",
5444
+ * "id": "100000000000000000000000a03",
5287
5445
  * "name": "TemplateEditor",
5288
5446
  * "assignment_type": "Editor",
5289
5447
  * "created_at": "2026-07-19T17:24:48Z",
@@ -5301,7 +5459,7 @@ declare class TemplateResource extends BaseResource {
5301
5459
  *
5302
5460
  * @example
5303
5461
  * ```ts
5304
- * const tmpl = await client.templates.get('103ad2171db7979468c3e97eb067');
5462
+ * const tmpl = await client.templates.get('1000000000000000000000000017');
5305
5463
  * if (tmpl.status === 'Ready') console.log(tmpl.pages?.length ?? 0);
5306
5464
  * ```
5307
5465
  */
@@ -5333,16 +5491,16 @@ declare class TemplateResource extends BaseResource {
5333
5491
  * ```jsonc
5334
5492
  * {
5335
5493
  * "resource": "template",
5336
- * "id": "103ad2171db7979468c3e97eb067",
5494
+ * "id": "1000000000000000000000000017",
5337
5495
  * "name": "NDA v2",
5338
5496
  * "document_name": "nda.pdf",
5339
5497
  * "message": "Please sign",
5340
5498
  * "status": "Ready",
5341
5499
  * "pages": [
5342
- * { "id": "103ad217673e1f978cb86179e8f8", "number": 1, "height": 1651, "width": 1275, "download_url": "https://api.assinafy.com.br/v1/…/download", "fields": [] }
5500
+ * { "id": "1000000000000000000000000018", "number": 1, "height": 1651, "width": 1275, "download_url": "https://api.assinafy.com.br/v1/…/download", "fields": [] }
5343
5501
  * ],
5344
5502
  * "roles": [
5345
- * { "id": "19f7b68b811f8d1e1aeaf11178e", "name": "TemplateEditor", "assignment_type": "Editor" }
5503
+ * { "id": "100000000000000000000000a03", "name": "TemplateEditor", "assignment_type": "Editor" }
5346
5504
  * ],
5347
5505
  * "tags": [],
5348
5506
  * "created_at": "2026-07-19T17:24:47Z",
@@ -5370,11 +5528,13 @@ declare class TemplateResource extends BaseResource {
5370
5528
  * @param accountId - Override the client's default account ID.
5371
5529
  * @returns Nothing (`Promise<void>`) on success.
5372
5530
  * @throws {ValidationError} If `templateId` is missing or no account ID is available.
5373
- * @throws {ApiError} `404` if the template does not exist.
5531
+ * @throws {ApiError} `400` unless the template status is `Ready` or
5532
+ * `Failed`; `403` when the member's role refuses it; `404` if the template
5533
+ * does not exist.
5374
5534
  *
5375
5535
  * @example
5376
5536
  * ```ts
5377
- * await client.templates.delete('103ad2171db7979468c3e97eb067');
5537
+ * await client.templates.delete('1000000000000000000000000017');
5378
5538
  * ```
5379
5539
  */
5380
5540
  delete(templateId: string, accountId?: string): Promise<void>;
@@ -5398,7 +5558,7 @@ declare class TemplateResource extends BaseResource {
5398
5558
  *
5399
5559
  * @example
5400
5560
  * ```ts
5401
- * const tmpl = await client.templates.get('103ad2171db7979468c3e97eb067');
5561
+ * const tmpl = await client.templates.get('1000000000000000000000000017');
5402
5562
  * const jpeg = await client.templates.downloadPage(tmpl.id, tmpl.pages[0].id);
5403
5563
  * await fs.promises.writeFile('page-1.jpg', jpeg);
5404
5564
  * ```
@@ -5422,25 +5582,30 @@ declare class TagResource extends BaseResource {
5422
5582
  /**
5423
5583
  * List the workspace's tags (`GET /accounts/{accountId}/tags`).
5424
5584
  *
5425
- * Tags come back ordered alphabetically by name. Pass an optional
5426
- * case-insensitive `search` substring to filter by name.
5585
+ * Tags come back ordered alphabetically by name, 20 per page by default
5586
+ * (at most 50 with `per-page`). Pass an optional case-insensitive `search`
5587
+ * substring to filter by name. Only the requested page is returned: ask
5588
+ * for `page: 2`, `page: 3`, … until a page holds fewer tags than the page
5589
+ * size.
5427
5590
  *
5428
- * @param params - Optional filters. `search` matches tag names
5429
- * case-insensitively (substring).
5591
+ * @param params - Optional filters and paging.
5430
5592
  * @param params.search - Optional case-insensitive tag-name substring.
5593
+ * @param params.page - Page number, starting at 1.
5594
+ * @param params.per-page - Tags per page (default 20; a larger value than
5595
+ * 50 answers 50).
5431
5596
  * @param accountId - Override the client's default account ID.
5432
5597
  * @returns The matching tags (list items carry no `resource` field):
5433
5598
  * ```jsonc
5434
5599
  * [
5435
5600
  * {
5436
- * "id": "103aa221874346e6b3de41688526",
5601
+ * "id": "1000000000000000000000000015",
5437
5602
  * "name": "Contracts",
5438
5603
  * "color": "ff8800", // 6-char hex, no leading '#'
5439
5604
  * "created_at": "2026-07-18T19:03:45Z",
5440
5605
  * "updated_at": "2026-07-18T19:03:45Z"
5441
5606
  * },
5442
5607
  * {
5443
- * "id": "103aa252123d3bf1843a317ee0e6",
5608
+ * "id": "100000000000000000000000000c",
5444
5609
  * "name": "Invoices",
5445
5610
  * "color": null, // no color set
5446
5611
  * "created_at": "2026-07-18T19:09:03Z",
@@ -5453,12 +5618,21 @@ declare class TagResource extends BaseResource {
5453
5618
  *
5454
5619
  * @example
5455
5620
  * ```ts
5456
- * const all = await client.tags.list();
5621
+ * const firstPage = await client.tags.list();
5457
5622
  * const contracts = await client.tags.list({ search: 'contract' });
5623
+ *
5624
+ * const all: ITag[] = [];
5625
+ * for (let page = 1; ; page++) {
5626
+ * const tags = await client.tags.list({ page, 'per-page': 50 });
5627
+ * all.push(...tags);
5628
+ * if (tags.length < 50) break;
5629
+ * }
5458
5630
  * ```
5459
5631
  */
5460
5632
  list(params?: {
5461
5633
  search?: string;
5634
+ page?: number;
5635
+ 'per-page'?: number;
5462
5636
  }, accountId?: string): Promise<ITag[]>;
5463
5637
  /**
5464
5638
  * Create a tag (`POST /accounts/{accountId}/tags`).
@@ -5483,7 +5657,7 @@ declare class TagResource extends BaseResource {
5483
5657
  * ```jsonc
5484
5658
  * {
5485
5659
  * "resource": "tag",
5486
- * "id": "103ad216fdc641c8f0465678c813",
5660
+ * "id": "1000000000000000000000000016",
5487
5661
  * "name": "Contracts",
5488
5662
  * "color": "ff8800",
5489
5663
  * "created_at": "2026-07-19T17:24:46Z",
@@ -5527,7 +5701,7 @@ declare class TagResource extends BaseResource {
5527
5701
  * ```jsonc
5528
5702
  * {
5529
5703
  * "resource": "tag",
5530
- * "id": "103ad216fdc641c8f0465678c813",
5704
+ * "id": "1000000000000000000000000016",
5531
5705
  * "name": "Contracts",
5532
5706
  * "color": "112233",
5533
5707
  * "created_at": "2026-07-19T17:24:46Z",
@@ -5542,21 +5716,21 @@ declare class TagResource extends BaseResource {
5542
5716
  * @example
5543
5717
  * ```ts
5544
5718
  * // rename + recolor
5545
- * await client.tags.update('103ad216fdc641c8f0465678c813', {
5719
+ * await client.tags.update('1000000000000000000000000016', {
5546
5720
  * name: 'Signed contracts',
5547
5721
  * color: '112233',
5548
5722
  * });
5549
5723
  * // clear the color, keep the name
5550
- * await client.tags.update('103ad216fdc641c8f0465678c813', { color: null });
5724
+ * await client.tags.update('1000000000000000000000000016', { color: null });
5551
5725
  * ```
5552
5726
  */
5553
5727
  update(tagId: string, payload: IUpdateTagPayload, accountId?: string): Promise<ITag>;
5554
5728
  /**
5555
5729
  * Delete a tag (`DELETE /accounts/{accountId}/tags/{tagId}`).
5556
5730
  *
5557
- * By default the API returns `409` if the tag is still attached to any
5558
- * document or template. Pass `{ force: true }` to detach it everywhere
5559
- * first — that adds a `?force=true` query param.
5731
+ * By default the API returns `409` with `code` `TagInUse` if the tag is
5732
+ * still attached to any document or template. Pass `{ force: true }` to
5733
+ * detach it everywhere first — that adds a `?force=true` query param.
5560
5734
  *
5561
5735
  * @param tagId - The tag to delete.
5562
5736
  * @param options - `force` to detach-and-delete when the tag is still in
@@ -5565,14 +5739,15 @@ declare class TagResource extends BaseResource {
5565
5739
  * @param options.accountId - Override the client's default workspace.
5566
5740
  * @returns `{ deleted: true }` when the tag was deleted.
5567
5741
  * @throws {ValidationError} If `tagId` is missing, or no account ID is available.
5568
- * @throws {ApiError} `404` if the tag does not exist; `409` if the tag is
5569
- * still in use and `force` was not set.
5742
+ * @throws {ApiError} `404` if the tag does not exist; `409` with `code`
5743
+ * `TagInUse` if the tag is still in use and `force` was not set (retry with
5744
+ * `{ force: true }` to detach and delete).
5570
5745
  *
5571
5746
  * @example
5572
5747
  * ```ts
5573
- * const { deleted } = await client.tags.delete('103ad216fdc641c8f0465678c813');
5748
+ * const { deleted } = await client.tags.delete('1000000000000000000000000016');
5574
5749
  * // detach from every document/template, then delete
5575
- * await client.tags.delete('103ad216fdc641c8f0465678c813', { force: true });
5750
+ * await client.tags.delete('1000000000000000000000000016', { force: true });
5576
5751
  * ```
5577
5752
  */
5578
5753
  delete(tagId: string, options?: {
@@ -5581,467 +5756,6 @@ declare class TagResource extends BaseResource {
5581
5756
  }): Promise<IDeleteTagResponse>;
5582
5757
  }
5583
5758
 
5584
- /**
5585
- * Authentication endpoints (login, social login, password management) and
5586
- * personal API key management (`/users/api-keys`).
5587
- *
5588
- * Most of these endpoints are intended to bootstrap an authenticated session
5589
- * for a human user. Production server-to-server integrations should use
5590
- * `X-Api-Key` and skip this resource entirely.
5591
- */
5592
- declare class AuthenticationResource extends BaseResource {
5593
- private readonly publicHttp;
5594
- constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
5595
- /**
5596
- * Build the browser-facing OAuth start URL
5597
- * (`GET /auth/authenticate?authclient=…`).
5598
- *
5599
- * This is a compatibility browser route. Confirm availability on the
5600
- * configured host before exposing it in a login flow.
5601
- *
5602
- * This endpoint responds with `302` to the provider consent screen, so the
5603
- * SDK returns the URL for your web framework to redirect to instead of
5604
- * following the redirect inside the Node process.
5605
- *
5606
- * @param authClient - Provider key; currently `google`.
5607
- * @returns An absolute URL, for example
5608
- * `https://api.assinafy.com.br/v1/auth/authenticate?authclient=google`.
5609
- * @throws {ValidationError} If `authClient` is not `google`.
5610
- *
5611
- * @example
5612
- * ```ts
5613
- * response.redirect(client.auth.getSocialLoginUrl('google'));
5614
- * ```
5615
- */
5616
- getSocialLoginUrl(authClient?: 'google'): string;
5617
- /**
5618
- * Return the Assinafy browser callback URL (`GET /login-callback`).
5619
- *
5620
- * This is a compatibility browser route. Confirm availability on the
5621
- * configured host before use.
5622
- *
5623
- * The callback response payload is intentionally unspecified by the API;
5624
- * OAuth providers call it in a browser. Use this URL when a provider setup
5625
- * asks for Assinafy's callback/redirect URI.
5626
- *
5627
- * @returns The absolute Assinafy callback URL for the configured API host.
5628
- *
5629
- * @example
5630
- * ```ts
5631
- * console.log(client.auth.getSocialLoginCallbackUrl());
5632
- * ```
5633
- */
5634
- getSocialLoginCallbackUrl(): string;
5635
- /**
5636
- * Log in with email + password (`POST /login`).
5637
- *
5638
- * Exchanges credentials for a JWT `access_token` plus the authenticated
5639
- * user and the accounts they can act on. The token authenticates
5640
- * subsequent requests; long-lived integrations should prefer an
5641
- * `X-Api-Key` (see {@link AuthenticationResource.createApiKey}) instead of
5642
- * storing a password.
5643
- *
5644
- * Request body (`application/json`):
5645
- * ```jsonc
5646
- * {
5647
- * "email": "user@example.com",
5648
- * "password": "example-password"
5649
- * }
5650
- * ```
5651
- *
5652
- * @param email - The user's email address, e.g. `'user@example.com'`.
5653
- * @param password - The user's password.
5654
- * @returns An {@link ILoginResponse} with the access token, user, and
5655
- * accounts. Response shape:
5656
- * ```jsonc
5657
- * {
5658
- * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
5659
- * "user": {
5660
- * "id": "md3j6p9w8b7y6qvqaoy5er42",
5661
- * "name": "Empresa Exemplo",
5662
- * "email": "user@example.com",
5663
- * "telephone": null,
5664
- * "government_id": "",
5665
- * "is_email_verified": true,
5666
- * "has_accepted_terms": true,
5667
- * "created_at": "2026-05-12T13:45:11Z",
5668
- * "to_be_deleted_at": null
5669
- * },
5670
- * "accounts": [
5671
- * {
5672
- * "id": "acc_example",
5673
- * "name": "Empresa Exemplo",
5674
- * "roles": ["Owner"],
5675
- * "is_delete_allowed": true,
5676
- * "created_at": "2026-05-12T13:45:11Z"
5677
- * }
5678
- * ]
5679
- * }
5680
- * ```
5681
- * When the user has two-factor authentication enabled the response carries
5682
- * an `mfa_token` instead of a usable session; finish with
5683
- * {@link AuthenticationResource.verifyMfa}.
5684
- * @throws {ValidationError} If `email` or `password` is missing.
5685
- * @throws {ApiError} `400` if the credentials are rejected.
5686
- *
5687
- * @example
5688
- * ```ts
5689
- * const { access_token, accounts } = await client.auth.login(
5690
- * 'user@example.com',
5691
- * 's3cret',
5692
- * );
5693
- * ```
5694
- */
5695
- login(email: string, password: string): Promise<ILoginResponse>;
5696
- /**
5697
- * Complete a two-factor login (`POST /authentication/mfa/verify`). Sent
5698
- * without credentials.
5699
- *
5700
- * When the user has two-factor authentication enabled, `login()` returns
5701
- * an `mfa_token`; exchange it here, within 5 minutes, for the session. The
5702
- * challenge is single-use.
5703
- *
5704
- * Request body (`application/json`):
5705
- * ```jsonc
5706
- * {
5707
- * "mfa_token": "<token from login>",
5708
- * "code": "123456" // authenticator code, or a recovery code such as "ABCD-EFGH-JKMN"
5709
- * }
5710
- * ```
5711
- *
5712
- * @param mfaToken - The `mfa_token` returned by {@link AuthenticationResource.login}.
5713
- * @param code - A 6-digit authenticator code or an unused recovery code.
5714
- * @returns The same session as a password-only login:
5715
- * ```jsonc
5716
- * {
5717
- * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
5718
- * "user": { "id": "md3j6p9w8b7y6qvqaoy5er42", "email": "user@example.com" },
5719
- * "accounts": [{ "id": "acc_example", "name": "Empresa Exemplo", "roles": ["Owner"] }]
5720
- * }
5721
- * ```
5722
- * @throws {ValidationError} If either argument is empty.
5723
- * @throws {ApiError} `400` for an invalid or used code; `401` when the
5724
- * challenge expired, was used, or too many codes were tried.
5725
- *
5726
- * @example
5727
- * ```ts
5728
- * let session = await client.auth.login('user@example.com', password);
5729
- * if (session.mfa_token) {
5730
- * session = await client.auth.verifyMfa(session.mfa_token, await promptForCode());
5731
- * }
5732
- * ```
5733
- */
5734
- verifyMfa(mfaToken: string, code: string): Promise<ILoginResponse>;
5735
- /**
5736
- * Log in with a social provider (`POST /authentication/social-login`).
5737
- *
5738
- * Exchanges a provider-issued OAuth token (currently Google) for an
5739
- * Assinafy JWT. Returns the same {@link ILoginResponse} shape as
5740
- * {@link AuthenticationResource.login}.
5741
- *
5742
- * Request body (`application/json`):
5743
- * ```jsonc
5744
- * {
5745
- * "provider": "google",
5746
- * "token": "provider_token_example",
5747
- * "has_accepted_terms": true
5748
- * }
5749
- * ```
5750
- *
5751
- * @param payload - The social-login body.
5752
- * @param payload.provider - OAuth provider; currently exactly `'google'`.
5753
- * @param payload.token - The provider-issued OAuth/ID token.
5754
- * @param payload.has_accepted_terms - Whether the user has accepted the
5755
- * terms of service.
5756
- * @returns An {@link ILoginResponse} with the access token, user, and
5757
- * accounts. Response shape:
5758
- * ```jsonc
5759
- * {
5760
- * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
5761
- * "user": {
5762
- * "id": "md3j6p9w8b7y6qvqaoy5er42",
5763
- * "name": "Empresa Exemplo",
5764
- * "email": "user@example.com",
5765
- * "telephone": null,
5766
- * "government_id": "",
5767
- * "is_email_verified": true,
5768
- * "has_accepted_terms": true,
5769
- * "created_at": "2026-05-12T13:45:11Z",
5770
- * "to_be_deleted_at": null
5771
- * },
5772
- * "accounts": [
5773
- * {
5774
- * "id": "acc_example",
5775
- * "name": "Empresa Exemplo",
5776
- * "roles": ["Owner"],
5777
- * "is_delete_allowed": true,
5778
- * "created_at": "2026-05-12T13:45:11Z"
5779
- * }
5780
- * ]
5781
- * }
5782
- * ```
5783
- * @throws {ValidationError} If `provider` is not `google`, `token` is
5784
- * missing, or `has_accepted_terms` is not a boolean.
5785
- * @throws {ApiError} `400` if the provider token is rejected.
5786
- *
5787
- * @example
5788
- * ```ts
5789
- * const session = await client.auth.socialLogin({
5790
- * provider: 'google',
5791
- * token: googleIdToken,
5792
- * has_accepted_terms: true,
5793
- * });
5794
- * ```
5795
- */
5796
- socialLogin(payload: {
5797
- /** OAuth provider. The current API accepts only `google`. */
5798
- provider: 'google';
5799
- token: string;
5800
- has_accepted_terms: boolean;
5801
- }): Promise<ILoginResponse>;
5802
- /**
5803
- * Link a Google identity to the authenticated user
5804
- * (`POST /auth/link-social-login`).
5805
- *
5806
- * Request body (`application/json`):
5807
- * ```jsonc
5808
- * {
5809
- * "provider": "google",
5810
- * "token": "provider_token_example"
5811
- * }
5812
- * ```
5813
- * The response is the standard status/message acknowledgement with no data,
5814
- * so this method resolves to `void`.
5815
- *
5816
- * @param payload - Social provider and provider-issued access/ID token.
5817
- * @returns Resolves when the API acknowledges that the identity was linked.
5818
- * @throws {ValidationError} If `provider` is not `google` or `token` is empty.
5819
- * @throws {ApiError} `400` for an invalid provider token or `401` for
5820
- * missing/invalid Assinafy credentials.
5821
- *
5822
- * @example
5823
- * ```ts
5824
- * await client.auth.linkSocialLogin({
5825
- * provider: 'google',
5826
- * token: googleIdToken,
5827
- * });
5828
- * ```
5829
- */
5830
- linkSocialLogin(payload: {
5831
- provider: 'google';
5832
- token: string;
5833
- }): Promise<void>;
5834
- /**
5835
- * Create (or rotate) the current user's API key (`POST /users/api-keys`).
5836
- *
5837
- * Returns the **full, unmasked** key exactly once — store it securely, as
5838
- * subsequent reads via {@link AuthenticationResource.getApiKey} only return
5839
- * a masked value. Calling this again rotates the key, invalidating the
5840
- * previous one.
5841
- *
5842
- * Request body (`application/json`):
5843
- * ```jsonc
5844
- * {
5845
- * "password": "example-password"
5846
- * }
5847
- * ```
5848
- *
5849
- * @param password - The current user's password, required to authorize
5850
- * key generation.
5851
- * @returns An {@link IApiKeyResponse} containing the new key. Response
5852
- * shape:
5853
- * ```jsonc
5854
- * {
5855
- * "api_key": "Hf8s2Jd9KpQ1mZ4xVn7bLcR3tWy6aEu0oCiSgBvNEWq"
5856
- * }
5857
- * ```
5858
- * @throws {ValidationError} If `password` is missing.
5859
- * @throws {ApiError} If the API rejects the request (e.g. wrong password).
5860
- *
5861
- * @example
5862
- * ```ts
5863
- * const { api_key } = await client.auth.createApiKey('s3cret');
5864
- * if (!api_key) throw new Error('API returned no generated key');
5865
- * // Persist api_key now — it is not retrievable unmasked later.
5866
- * ```
5867
- */
5868
- createApiKey(password: string): Promise<IApiKeyResponse>;
5869
- /**
5870
- * Fetch a masked view of the current API key (`GET /users/api-keys`).
5871
- *
5872
- * Only the last few characters are revealed; the leading characters are
5873
- * masked with asterisks. The documented no-key form is
5874
- * `{ api_key: null }`; older deployments may return `null` for the entire
5875
- * data value.
5876
- * The unmasked key is only ever returned by
5877
- * {@link AuthenticationResource.createApiKey}.
5878
- *
5879
- * @returns An {@link IMaskedApiKeyResponse}: `{ api_key }` with a masked
5880
- * string or `null`, or the legacy top-level `null`. Response shape:
5881
- * ```jsonc
5882
- * {
5883
- * "api_key": "************************************************************NEWq"
5884
- * }
5885
- * ```
5886
- * @throws {ApiError} If the API rejects the request.
5887
- *
5888
- * @example
5889
- * ```ts
5890
- * const masked = await client.auth.getApiKey();
5891
- * if (masked?.api_key) console.log('Key ends with', masked.api_key.slice(-4));
5892
- * else console.log('No API key generated yet');
5893
- * ```
5894
- */
5895
- getApiKey(): Promise<IMaskedApiKeyResponse>;
5896
- /**
5897
- * Revoke the current API key (`DELETE /users/api-keys`).
5898
- *
5899
- * After this call any existing `X-Api-Key` using the deleted key stops
5900
- * working; generate a new one with
5901
- * {@link AuthenticationResource.createApiKey}.
5902
- *
5903
- * @returns Nothing; resolves once the key is revoked.
5904
- * @throws {ApiError} If the API rejects the request.
5905
- *
5906
- * @example
5907
- * ```ts
5908
- * await client.auth.deleteApiKey();
5909
- * ```
5910
- */
5911
- deleteApiKey(): Promise<void>;
5912
- /**
5913
- * Change the authenticated user's password
5914
- * (`PUT /authentication/change-password`).
5915
- *
5916
- * Requires the current password as a confirmation. On success the API
5917
- * echoes back the affected `email`.
5918
- *
5919
- * Request body (`application/json`):
5920
- * ```jsonc
5921
- * {
5922
- * "email": "user@example.com",
5923
- * "password": "example-password",
5924
- * "new_password": "new-example-password"
5925
- * }
5926
- * ```
5927
- *
5928
- * @param payload - The change-password body.
5929
- * @param payload.email - The user's email address.
5930
- * @param payload.password - The current password.
5931
- * @param payload.new_password - The new password to set.
5932
- * @returns `{ email }` — the address whose password was changed. Response
5933
- * shape:
5934
- * ```jsonc
5935
- * {
5936
- * "email": "user@example.com"
5937
- * }
5938
- * ```
5939
- * @throws {ValidationError} If `email`, `password`, or `new_password` is
5940
- * missing.
5941
- * @throws {ApiError} `400`/`401` if the current password is wrong or the
5942
- * new password is rejected.
5943
- *
5944
- * @example
5945
- * ```ts
5946
- * await client.auth.changePassword({
5947
- * email: 'user@example.com',
5948
- * password: 'old-s3cret',
5949
- * new_password: 'new-s3cret',
5950
- * });
5951
- * ```
5952
- */
5953
- changePassword(payload: {
5954
- email: string;
5955
- password: string;
5956
- new_password: string;
5957
- }): Promise<{
5958
- email: string;
5959
- }>;
5960
- /**
5961
- * Request a password-reset email
5962
- * (`PUT /authentication/request-password-reset`).
5963
- *
5964
- * Triggers Assinafy to email a reset link/token to the given address.
5965
- * Complete the flow with {@link AuthenticationResource.resetPassword}.
5966
- *
5967
- * Request body (`application/json`):
5968
- * ```jsonc
5969
- * {
5970
- * "email": "user@example.com"
5971
- * }
5972
- * ```
5973
- *
5974
- * @param email - The email address to send the reset link to.
5975
- * @returns `{ email }` — the address the reset link was sent to. Response
5976
- * shape:
5977
- * ```jsonc
5978
- * {
5979
- * "email": "user@example.com"
5980
- * }
5981
- * ```
5982
- * @throws {ValidationError} If `email` is missing.
5983
- * @throws {ApiError} If the API rejects the request.
5984
- *
5985
- * @example
5986
- * ```ts
5987
- * await client.auth.requestPasswordReset('user@example.com');
5988
- * ```
5989
- */
5990
- requestPasswordReset(email: string): Promise<{
5991
- email: string;
5992
- }>;
5993
- /**
5994
- * Complete a password reset using the emailed token
5995
- * (`PUT /authentication/reset-password`).
5996
- *
5997
- * Consumes the token delivered by
5998
- * {@link AuthenticationResource.requestPasswordReset} and sets the new
5999
- * password. On success the API echoes back the affected `email`.
6000
- *
6001
- * Request body (`application/json`):
6002
- * ```jsonc
6003
- * {
6004
- * "email": "user@example.com",
6005
- * "token": "reset_token_example",
6006
- * "new_password": "new-example-password"
6007
- * }
6008
- * ```
6009
- *
6010
- * @param payload - The reset-password body.
6011
- * @param payload.email - The user's email address.
6012
- * @param payload.token - The reset token from the emailed link. The current
6013
- * schema leaves it optional even though the operation description says the
6014
- * reset uses that token.
6015
- * @param payload.new_password - The new password to set.
6016
- * @returns `{ email }` — the address whose password was reset. Response
6017
- * shape:
6018
- * ```jsonc
6019
- * {
6020
- * "email": "user@example.com"
6021
- * }
6022
- * ```
6023
- * @throws {ValidationError} If `email` or `new_password` is missing.
6024
- * @throws {ApiError} `400` if the token is invalid or expired.
6025
- *
6026
- * @example
6027
- * ```ts
6028
- * await client.auth.resetPassword({
6029
- * email: 'user@example.com',
6030
- * token: 'reset-token-from-email',
6031
- * new_password: 'new-s3cret',
6032
- * });
6033
- * ```
6034
- */
6035
- resetPassword(payload: {
6036
- email: string;
6037
- token?: string;
6038
- new_password: string;
6039
- }): Promise<{
6040
- email: string;
6041
- }>;
6042
- private absoluteUrl;
6043
- }
6044
-
6045
5759
  /** Token-endpoint client authentication methods Assinafy accepts. */
6046
5760
  type TokenEndpointAuthOptions = {
6047
5761
  /** The application's `client_id` from Settings → OAuth applications. */
@@ -6072,6 +5786,10 @@ type TokenEndpointAuthOptions = {
6072
5786
  * 1. {@link OAuthResource.createAuthorizationUrl} — mint PKCE + `state`, build
6073
5787
  * the consent URL, store the returned request in the user's session.
6074
5788
  * 2. Redirect the browser there; the user picks **one** workspace and approves.
5789
+ * A user without an Assinafy account signs up in the Assinafy web app first
5790
+ * (signup is not an API call: a captcha protects it), then is sent to the
5791
+ * authorization URL again. Mobile apps open both in the system browser
5792
+ * (`ASWebAuthenticationSession`, Custom Tabs), never an embedded web view.
6075
5793
  * 3. {@link OAuthResource.readAuthorizationCallback} — check `state` and `iss`
6076
5794
  * on your redirect URI, and surface a declined consent as an
6077
5795
  * {@link OAuthError}.
@@ -6233,20 +5951,21 @@ declare class OAuthResource extends BaseResource {
6233
5951
  * @param options.resource - RFC 8707 resource indicator. Defaults to this
6234
5952
  * API's origin; pass `null` to omit it. It must match the value sent to the
6235
5953
  * token endpoint, or the exchange fails with `invalid_target`.
6236
- * @param options.state - Supply your own CSRF value instead of a generated
6237
- * one. Must be unique per attempt.
5954
+ * @param options.state - Supply your own CSRF value (at most 2048
5955
+ * characters) instead of a generated one. Must be unique per attempt.
6238
5956
  * @param options.codeVerifier - Supply your own RFC 7636 verifier (43–128
6239
5957
  * characters from `A-Z a-z 0-9 - . _ ~`) instead of a generated one.
6240
- * @param options.nonce - OIDC nonce echoed in the `id_token`. Generated
6241
- * automatically when `openid` is requested; pass a string to set it or
6242
- * `null` to omit it.
6243
- * @param options.prompt - Forwarded as the OIDC `prompt` parameter, e.g.
6244
- * `'consent'` to force the approval screen again.
5958
+ * @param options.nonce - OIDC nonce echoed in the `id_token`, at most 255
5959
+ * characters. Generated automatically when `openid` is requested; pass a
5960
+ * string to set it or `null` to omit it.
5961
+ * @param options.prompt - Forwarded as the OIDC `prompt` parameter. The
5962
+ * authorization server honours only `'login'`, and only from Assinafy's own
5963
+ * applications; for any other client it is ignored.
6245
5964
  * @returns The request to store and redirect with:
6246
5965
  * ```jsonc
6247
5966
  * {
6248
5967
  * "url": "https://auth.assinafy.com.br/oauth/authorize?response_type=code&client_id=…&redirect_uri=https%3A%2F%2Fmyapp.com%2Foauth%2Fcallback&scope=documents%3Aread+offline_access&state=8Xv…&code_challenge=E9M…&code_challenge_method=S256&resource=https%3A%2F%2Fapi.assinafy.com.br",
6249
- * "state": "8Xv2rQ7mJt0aLpKcWn4dZg",
5968
+ * "state": "example-state-value",
6250
5969
  * "codeVerifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
6251
5970
  * "issuer": "https://auth.assinafy.com.br",
6252
5971
  * "nonce": "n-0S6_WzA2Mj"
@@ -6302,12 +6021,12 @@ declare class OAuthResource extends BaseResource {
6302
6021
  * @param expected - The stored {@link IOAuthAuthorizationRequest} (or any
6303
6022
  * object carrying its `state` and `issuer`). Without `issuer`, `iss` must
6304
6023
  * equal `https://auth.assinafy.com.br`; pass the stored one for any other
6305
- * authorization server, such as the sandbox's.
6024
+ * authorization server.
6306
6025
  * @returns The validated response:
6307
6026
  * ```jsonc
6308
6027
  * {
6309
6028
  * "code": "def50200a1b2c3…",
6310
- * "state": "8Xv2rQ7mJt0aLpKcWn4dZg",
6029
+ * "state": "example-state-value",
6311
6030
  * "issuer": "https://auth.assinafy.com.br"
6312
6031
  * }
6313
6032
  * ```
@@ -6448,8 +6167,10 @@ declare class OAuthResource extends BaseResource {
6448
6167
  * @throws {ValidationError} If an argument is missing, or a `2xx` response
6449
6168
  * carries no `access_token`.
6450
6169
  * @throws {OAuthError} `invalid_grant` when the refresh token was already
6451
- * used, expired, or the user reconnected with different permissions — ask
6452
- * the user to reconnect. `invalid_client` for bad client credentials.
6170
+ * used or expired, the user revoked the application, reset their password
6171
+ * (a reset revokes every connected application), reconnected with
6172
+ * different permissions, or the grant no longer includes `offline_access`
6173
+ * — ask the user to reconnect. `invalid_client` for bad client credentials.
6453
6174
  * @throws {ApiError} `429` when the caller's IP is rate limited (not retried
6454
6175
  * automatically: a replayed refresh token ends the connection).
6455
6176
  *
@@ -6516,12 +6237,13 @@ declare class OAuthResource extends BaseResource {
6516
6237
  * `email`/`email_verified` require `email`. Per OIDC Core §5.3.2 the
6517
6238
  * response is a flat claims object, not this API's usual envelope.
6518
6239
  *
6519
- * @param accessToken - Token to introspect. Omit to use the credential the
6520
- * client was constructed with (`token` or `apiKey`).
6240
+ * @param accessToken - Token to introspect. Omit only when the client's
6241
+ * `token` is an OAuth access token with `openid`; an API key answers
6242
+ * `403`.
6521
6243
  * @returns The claims the granted scopes allow:
6522
6244
  * ```jsonc
6523
6245
  * {
6524
- * "sub": "d6zqpbyog2v3xvxerwn8la94",
6246
+ * "sub": "usr_example",
6525
6247
  * "name": "Maria Silva",
6526
6248
  * "email": "maria@example.com",
6527
6249
  * "email_verified": true
@@ -6608,14 +6330,15 @@ declare class FieldsResource extends BaseResource {
6608
6330
  *
6609
6331
  * @param payload - The field to create. `type` and `name` are required;
6610
6332
  * `type` must be one of the platform field types (see
6611
- * {@link FieldsResource.listTypes}); `regex` may be a string or `null`,
6612
- * and `is_required` is optional. `is_active` is a compatibility extension.
6333
+ * {@link FieldsResource.listTypes}); `regex` may be a string or `null`.
6334
+ * `is_required` and the compatibility extension `is_active` default to
6335
+ * `true` when omitted.
6613
6336
  * @param accountId - Override the client's default account ID.
6614
6337
  * @returns The created field definition. Response shape:
6615
6338
  * ```jsonc
6616
6339
  * {
6617
6340
  * "resource": "field_definition",
6618
- * "id": "103ad21709d15eca8c48085b5b8f",
6341
+ * "id": "1000000000000000000000000013",
6619
6342
  * "name": "Employee CPF",
6620
6343
  * "type": "cpf",
6621
6344
  * "regex": null,
@@ -6688,7 +6411,7 @@ declare class FieldsResource extends BaseResource {
6688
6411
  * ```jsonc
6689
6412
  * {
6690
6413
  * "resource": "field_definition",
6691
- * "id": "103ad21709d15eca8c48085b5b8f",
6414
+ * "id": "1000000000000000000000000013",
6692
6415
  * "name": "Employee CPF",
6693
6416
  * "type": "cpf",
6694
6417
  * "regex": null,
@@ -6705,7 +6428,7 @@ declare class FieldsResource extends BaseResource {
6705
6428
  *
6706
6429
  * @example
6707
6430
  * ```ts
6708
- * const field = await client.fields.get('103ad21709d15eca8c48085b5b8f');
6431
+ * const field = await client.fields.get('1000000000000000000000000013');
6709
6432
  * ```
6710
6433
  */
6711
6434
  get(fieldId: string, accountId?: string): Promise<IFieldDefinition>;
@@ -6724,13 +6447,15 @@ declare class FieldsResource extends BaseResource {
6724
6447
  *
6725
6448
  * @param fieldId - The field definition to update.
6726
6449
  * @param payload - Fields are `name`, nullable `regex`, and `is_active`;
6727
- * `type` and `is_required` are compatibility extensions.
6450
+ * `type` and `is_required` are compatibility extensions. A pre-defined
6451
+ * field (`is_pre_defined: true`) takes only `is_active`; the API silently
6452
+ * drops its other keys.
6728
6453
  * @param accountId - Override the client's default account ID.
6729
6454
  * @returns The updated field definition. Response shape:
6730
6455
  * ```jsonc
6731
6456
  * {
6732
6457
  * "resource": "field_definition",
6733
- * "id": "103ad21709d15eca8c48085b5b8f",
6458
+ * "id": "1000000000000000000000000013",
6734
6459
  * "name": "Employee CPF (renamed)",
6735
6460
  * "type": "cpf",
6736
6461
  * "regex": null,
@@ -6742,12 +6467,15 @@ declare class FieldsResource extends BaseResource {
6742
6467
  * "is_visible": true
6743
6468
  * }
6744
6469
  * ```
6745
- * @throws {ValidationError} If `fieldId` or the account ID is missing.
6746
- * @throws {ApiError} `404` if the field does not exist.
6470
+ * @throws {ValidationError} If `fieldId` or the account ID is missing, or a
6471
+ * value has the wrong type.
6472
+ * @throws {ApiError} `400` for a standard field (`signature`, `initial`,
6473
+ * `signatureDate`), which cannot be updated, or a `type` that is standard or
6474
+ * not a manageable type; `404` if the field does not exist.
6747
6475
  *
6748
6476
  * @example
6749
6477
  * ```ts
6750
- * await client.fields.update('103ad21709d15eca8c48085b5b8f', {
6478
+ * await client.fields.update('1000000000000000000000000013', {
6751
6479
  * name: 'Employee CPF (renamed)',
6752
6480
  * is_active: false,
6753
6481
  * });
@@ -6769,7 +6497,7 @@ declare class FieldsResource extends BaseResource {
6769
6497
  *
6770
6498
  * @example
6771
6499
  * ```ts
6772
- * await client.fields.delete('103ad21709d15eca8c48085b5b8f');
6500
+ * await client.fields.delete('1000000000000000000000000013');
6773
6501
  * ```
6774
6502
  */
6775
6503
  delete(fieldId: string, accountId?: string): Promise<void>;
@@ -6811,7 +6539,7 @@ declare class FieldsResource extends BaseResource {
6811
6539
  * @example
6812
6540
  * ```ts
6813
6541
  * const result = await client.fields.validate(
6814
- * '103ad21709d15eca8c48085b5b8f',
6542
+ * '1000000000000000000000000013',
6815
6543
  * '123.456.789-09',
6816
6544
  * );
6817
6545
  * if (!result.success) console.warn(result.error_message);
@@ -6930,7 +6658,7 @@ declare class SignerDocumentsResource extends BaseResource {
6930
6658
  * ```jsonc
6931
6659
  * {
6932
6660
  * "resource": "document",
6933
- * "id": "103acccd24234c07858ffddf6d84",
6661
+ * "id": "1000000000000000000000000008",
6934
6662
  * "account_id": "acc_example",
6935
6663
  * "template_id": null,
6936
6664
  * "name": "Service agreement.pdf",
@@ -6950,7 +6678,7 @@ declare class SignerDocumentsResource extends BaseResource {
6950
6678
  * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
6951
6679
  * ],
6952
6680
  * "current_signer": {
6953
- * "id": "19e6b92e7895332ed9708535d8c",
6681
+ * "id": "100000000000000000000000a01",
6954
6682
  * "full_name": "Example Signer",
6955
6683
  * "email": "signer@example.com",
6956
6684
  * "verification_method": "Email",
@@ -6959,14 +6687,15 @@ declare class SignerDocumentsResource extends BaseResource {
6959
6687
  * },
6960
6688
  * "is_signer_access_closed": false,
6961
6689
  * "certified_copy": { "available": false, "notification_method": "Email", "resends_left": null },
6962
- * "envelope": { "id": "1052a1f0c3d4e5f6a7b8c9d0e1f2", "name": "Admission kit" }, // with expand
6690
+ * "envelope": { "id": "100000000000000000000000000f", "name": "Admission kit" }, // with expand
6963
6691
  * "created_at": "2026-07-19T14:56:54Z",
6964
6692
  * "updated_at": "2026-07-19T14:56:56Z"
6965
6693
  * }
6966
6694
  * ```
6967
6695
  * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
6968
6696
  * @throws {ApiError} `400` while the signer's step has not started, `401` for an
6969
- * invalid code, `404` for an unknown signer.
6697
+ * invalid code, `404` when the signer is not the code's, the request has no
6698
+ * assignment, or the workspace deleted the document while the code is open.
6970
6699
  *
6971
6700
  * @example
6972
6701
  * ```ts
@@ -6994,7 +6723,7 @@ declare class SignerDocumentsResource extends BaseResource {
6994
6723
  * {
6995
6724
  * "data": [
6996
6725
  * {
6997
- * "id": "103acccd24234c07858ffddf6d84",
6726
+ * "id": "1000000000000000000000000008",
6998
6727
  * "account_id": "acc_example",
6999
6728
  * "template_id": null,
7000
6729
  * "name": "Service agreement.pdf",
@@ -7013,8 +6742,13 @@ declare class SignerDocumentsResource extends BaseResource {
7013
6742
  * }
7014
6743
  * ```
7015
6744
  * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
7016
- * @throws {ApiError} `400` for a non-text `envelope_id` or a pending step,
7017
- * `403` for another signer's code, `410` once the code is closed.
6745
+ * @throws {ApiError} `400` for a non-text `envelope_id`, while the signer's
6746
+ * step has not started, with `code` `EmailVerificationRequired`,
6747
+ * `WhatsappVerificationRequired` or `IdentityVerificationRequired` until the
6748
+ * signer's code or identity check is done, or `SignerDataUnconfirmed` /
6749
+ * `TermsNotAccepted` until a digital-certificate signer confirms their data
6750
+ * and accepts the terms; `401` for an invalid code; `403` for another
6751
+ * signer's code; `410` once the code is closed.
7018
6752
  *
7019
6753
  * @example
7020
6754
  * ```ts
@@ -7043,7 +6777,7 @@ declare class SignerDocumentsResource extends BaseResource {
7043
6777
  * {
7044
6778
  * "data": [
7045
6779
  * {
7046
- * "id": "103acccd24234c07858ffddf6d84",
6780
+ * "id": "1000000000000000000000000008",
7047
6781
  * "account_id": "acc_example",
7048
6782
  * "template_id": null,
7049
6783
  * "name": "Service agreement.pdf",
@@ -7062,7 +6796,8 @@ declare class SignerDocumentsResource extends BaseResource {
7062
6796
  * }
7063
6797
  * ```
7064
6798
  * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
7065
- * @throws {ApiError} `400`, `403` or `410`, as for {@link SignerDocumentsResource.list}.
6799
+ * @throws {ApiError} `400` (with the same `code` values), `401`, `403` or
6800
+ * `410`, as for {@link SignerDocumentsResource.list}.
7066
6801
  *
7067
6802
  * @example
7068
6803
  * ```ts
@@ -7088,7 +6823,7 @@ declare class SignerDocumentsResource extends BaseResource {
7088
6823
  * pagination in `meta` (same shape as {@link SignerDocumentsResource.list}):
7089
6824
  * ```jsonc
7090
6825
  * {
7091
- * "data": [{ "id": "103acccd24234c07858ffddf6d84", "name": "Service agreement.pdf", "status": "pending_signature" }],
6826
+ * "data": [{ "id": "1000000000000000000000000008", "name": "Service agreement.pdf", "status": "pending_signature" }],
7092
6827
  * "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
7093
6828
  * }
7094
6829
  * ```
@@ -7130,9 +6865,9 @@ declare class SignerDocumentsResource extends BaseResource {
7130
6865
  *
7131
6866
  * Only `original` is available with an access code; the certified copy is
7132
6867
  * sent to the signer instead (see {@link SignerDocumentsResource.resendCertifiedCopy}).
7133
- * The API redirects a request it cannot serve to its expired-link page, so
7134
- * the SDK does not follow redirects here: that case throws instead of
7135
- * returning the page's HTML.
6868
+ * The API redirects a request without a code to its expired-link page. The
6869
+ * SDK always sends the code and does not follow redirects here, so a
6870
+ * redirect throws instead of returning the page's HTML.
7136
6871
  *
7137
6872
  * @param signerId - The signer requesting the download.
7138
6873
  * @param documentId - The document to download.
@@ -7140,9 +6875,13 @@ declare class SignerDocumentsResource extends BaseResource {
7140
6875
  * @param signerAccessCode - The signer's access code, from their signing link.
7141
6876
  * @returns The PDF bytes as a Node `Buffer`.
7142
6877
  * @throws {ValidationError} If an ID or the code is missing, or the artifact is not `original`.
7143
- * @throws {ApiError} `302` when the code is missing or closed, `400` while the
7144
- * signer's step has not started, `403` for another artifact, `404` for a
7145
- * document the code does not reach, `410` once the code is closed.
6878
+ * @throws {ApiError} `400` while the signer's step has not started, with
6879
+ * `code` `SignerDataUnconfirmed` or `TermsNotAccepted` until a
6880
+ * `DigitalCertificate` signer confirms their data and accepts the terms, or
6881
+ * `IdentityVerificationRequired` until an `IdDocumentFaceMatchBasic`
6882
+ * signer's check passes; `401` for an invalid code; `404` when the signer or
6883
+ * document is not the code's; `410` once the code is closed (the signer
6884
+ * finished more than 30 minutes ago).
7146
6885
  *
7147
6886
  * @example
7148
6887
  * ```ts
@@ -7163,7 +6902,8 @@ declare class SignerDocumentsResource extends BaseResource {
7163
6902
  * Batch shortcut for a signer who has multiple pending documents under the
7164
6903
  * same access code — it signs each with their stored signature/initials
7165
6904
  * rather than field-by-field (contrast {@link SignerDocumentsResource.sign}).
7166
- * Every document must use the `virtual` assignment method.
6905
+ * Every document must use the `virtual` assignment method. A listed document
6906
+ * the signer already signed is left as it is.
7167
6907
  * The `document_ids` array goes in the request body; the access code
7168
6908
  * authenticates via the `signer-access-code` query param.
7169
6909
  *
@@ -7182,14 +6922,21 @@ declare class SignerDocumentsResource extends BaseResource {
7182
6922
  * empty-array response data is intentionally discarded.
7183
6923
  * @throws {ValidationError} If `documentIds` is empty/not an array, or
7184
6924
  * `signerAccessCode` is missing.
7185
- * @throws {ApiError} If the access code is invalid/expired or a document is
7186
- * not in a signable state.
6925
+ * @throws {ApiError} `400` when a listed document is not a virtual document
6926
+ * of this signer, is not pending signature, waits for an earlier step or
6927
+ * is outside the code's envelope, or with `code` `SignerDataUnconfirmed`
6928
+ * (confirm the data first), `EmailVerificationRequired`,
6929
+ * `WhatsappVerificationRequired`, `IdentityVerificationRequired`,
6930
+ * `TermsNotAccepted` (a digital-certificate signer) or
6931
+ * `DigitalCertificateRequired` (the signer signs with a certificate);
6932
+ * `401` for an invalid code; `404` naming listed IDs that do not exist;
6933
+ * `410` once the code is closed.
7187
6934
  *
7188
6935
  * @example
7189
6936
  * ```ts
7190
6937
  * // body → { document_ids: ['103acccd...', '103aa251...'] }
7191
6938
  * await client.signerDocuments.signMultiple(
7192
- * ['103acccd24234c07858ffddf6d84', '103aa251ccb4ee136e3fd5cc140b'],
6939
+ * ['1000000000000000000000000008', '1000000000000000000000000014'],
7193
6940
  * accessCode,
7194
6941
  * );
7195
6942
  * ```
@@ -7220,14 +6967,21 @@ declare class SignerDocumentsResource extends BaseResource {
7220
6967
  * @returns Resolves when the API acknowledges the operation. The documented
7221
6968
  * empty-array response data is intentionally discarded.
7222
6969
  * @throws {ValidationError} If `documentIds` is empty/not an array,
7223
- * `declineReason` is empty, or `signerAccessCode` is missing.
7224
- * @throws {ApiError} If the access code is invalid or expired.
6970
+ * `declineReason` is empty or longer than 2000 characters, or
6971
+ * `signerAccessCode` is missing.
6972
+ * @throws {ApiError} `400` when a listed document is not this signer's, is
6973
+ * not pending signature, waits for an earlier step or is outside the
6974
+ * code's envelope, or with `code` `EmailVerificationRequired`,
6975
+ * `WhatsappVerificationRequired`, `IdentityVerificationRequired`, or
6976
+ * `SignerDataUnconfirmed` / `TermsNotAccepted` (a digital-certificate
6977
+ * signer); nothing is declined then. `401` for an invalid code; `404`
6978
+ * naming listed IDs that do not exist; `410` once the code is closed.
7225
6979
  *
7226
6980
  * @example
7227
6981
  * ```ts
7228
6982
  * // body → { document_ids: ['103acccd...'], decline_reason: 'Wrong counterparty' }
7229
6983
  * await client.signerDocuments.declineMultiple(
7230
- * ['103acccd24234c07858ffddf6d84'],
6984
+ * ['1000000000000000000000000008'],
7231
6985
  * 'Wrong counterparty',
7232
6986
  * accessCode,
7233
6987
  * );
@@ -7248,7 +7002,7 @@ declare class SignerDocumentsResource extends BaseResource {
7248
7002
  * ```jsonc
7249
7003
  * {
7250
7004
  * "resource": "signer",
7251
- * "id": "19e6b92e7895332ed9708535d8c",
7005
+ * "id": "100000000000000000000000a01",
7252
7006
  * "full_name": "Example Signer",
7253
7007
  * "email": "signer@example.com",
7254
7008
  * "whatsapp_phone_number": null,
@@ -7260,7 +7014,8 @@ declare class SignerDocumentsResource extends BaseResource {
7260
7014
  * }
7261
7015
  * ```
7262
7016
  * @throws {ValidationError} If `signerAccessCode` is missing.
7263
- * @throws {ApiError} If the access code is invalid or expired.
7017
+ * @throws {ApiError} `400` while the signer's step has not started, `401` for
7018
+ * an invalid code, `410` once the code is closed.
7264
7019
  *
7265
7020
  * @example
7266
7021
  * ```ts
@@ -7293,7 +7048,8 @@ declare class SignerDocumentsResource extends BaseResource {
7293
7048
  * `url` exists only while Pending. It is a bearer link: open it intact,
7294
7049
  * including its fragment, and keep it out of logs and browser storage.
7295
7050
  * @throws {ValidationError} If the access code is blank.
7296
- * @throws {ApiError} `401` for an invalid/expired code; `500` for a server failure.
7051
+ * @throws {ApiError} `400` while the signer's step has not started; `401` for
7052
+ * an invalid code; `410` once the code is closed; `500` for a server failure.
7297
7053
  * @example
7298
7054
  * ```ts
7299
7055
  * const state = await client.signerDocuments.getIdentityVerification(accessCode);
@@ -7329,8 +7085,11 @@ declare class SignerDocumentsResource extends BaseResource {
7329
7085
  * and its fragment must survive navigation. Do not log or persist it in
7330
7086
  * browser storage. No workspace credential is attached to this call.
7331
7087
  * @throws {ValidationError} If the code is blank or consent is not `true`.
7332
- * @throws {ApiError} `400` when a non-expired session already exists;
7333
- * `401` for an invalid/expired code; `500` for a provider/server failure.
7088
+ * @throws {ApiError} `400` when a non-expired session already exists, the
7089
+ * signer can no longer verify, another start of their envelope check is
7090
+ * still running, the signer has no full name, or their step has not
7091
+ * started; `401` for an invalid code; `410` once the code is closed; `500`
7092
+ * for a provider/server failure.
7334
7093
  * @example
7335
7094
  * ```ts
7336
7095
  * // Inside the handler for the signer's explicit consent action:
@@ -7351,15 +7110,18 @@ declare class SignerDocumentsResource extends BaseResource {
7351
7110
  * flag.
7352
7111
  *
7353
7112
  * @param signerAccessCode - The signer's access code, from their signing link.
7354
- * @returns The signer's acceptance state, or `null` from deployments that
7113
+ * @returns The signer's acceptance state, or `null` from API versions that
7355
7114
  * acknowledge without data:
7356
7115
  * ```jsonc
7357
7116
  * { "full_name": "Example Signer", "email": "signer@example.com", "has_accepted_terms": true }
7358
7117
  * ```
7359
7118
  * @throws {ValidationError} If `signerAccessCode` is missing.
7360
- * @throws {ApiError} `400` while the signer's verification is not done (e.g.
7361
- * the e-mail code) or their step has not started, `401` for an invalid code,
7362
- * `410` once the code is closed.
7119
+ * @throws {ApiError} `400` while the signer's step has not started, with
7120
+ * `code` `EmailVerificationRequired`, `WhatsappVerificationRequired` or
7121
+ * `IdentityVerificationRequired` until the signer's code or identity check
7122
+ * is done, or `SignerDataUnconfirmed` until a digital-certificate signer
7123
+ * confirms their data; `401` for an invalid code; `410` once the code is
7124
+ * closed.
7363
7125
  *
7364
7126
  * @example
7365
7127
  * ```ts
@@ -7392,8 +7154,10 @@ declare class SignerDocumentsResource extends BaseResource {
7392
7154
  * envelope has no `data` field and is intentionally discarded.
7393
7155
  * @throws {ValidationError} If `signerAccessCode` or `verificationCode` is
7394
7156
  * missing.
7395
- * @throws {ApiError} `400`/`401` if the OTP is wrong or the access code is
7396
- * invalid or expired.
7157
+ * @throws {ApiError} `400` for a wrong OTP or while the signer's step has not
7158
+ * started; `401` for an invalid access code; `410` once the code is
7159
+ * closed; `429` once 5 wrong codes arrive within 15 minutes of the first,
7160
+ * until those 15 minutes end (the right code is refused meanwhile too).
7397
7161
  *
7398
7162
  * @example
7399
7163
  * ```ts
@@ -7431,18 +7195,20 @@ declare class SignerDocumentsResource extends BaseResource {
7431
7195
  * @param documentId - The document the signer is confirming data for.
7432
7196
  * @param signerAccessCode - The signer's access code, from their signing link.
7433
7197
  * @param payload - `email`, `whatsapp_phone_number` and `has_accepted_terms`.
7434
- * `full_name`/`government_id` are forwarded only for older deployments.
7435
- * @returns `null` on production, which answers `data: []`; older deployments
7198
+ * `full_name`/`government_id` are forwarded only for older API versions.
7199
+ * @returns `null` on production, which answers `data: []`; older API versions
7436
7200
  * return the signer:
7437
7201
  * ```jsonc
7438
- * { "resource": "signer", "id": "19e6b92e7895332ed9708535d8c", "full_name": "Example Signer",
7202
+ * { "resource": "signer", "id": "100000000000000000000000a01", "full_name": "Example Signer",
7439
7203
  * "email": "signer@example.com", "whatsapp_phone_number": null, "has_accepted_terms": true }
7440
7204
  * ```
7441
7205
  * @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
7442
7206
  * or a supplied value is malformed.
7443
7207
  * @throws {ApiError} `400` when a contact the signer's methods need is missing,
7444
- * invalid or not theirs, or their step has not started; `404` for a document
7445
- * the code does not reach; `410` once the code is closed.
7208
+ * invalid or not theirs (`code` `InvalidEmail` for a newly supplied
7209
+ * undeliverable e-mail), or their step has not started; `401` for an invalid
7210
+ * code; `404` for a document the code does not reach; `410` once the code is
7211
+ * closed.
7446
7212
  *
7447
7213
  * @example
7448
7214
  * ```ts
@@ -7460,21 +7226,31 @@ declare class SignerDocumentsResource extends BaseResource {
7460
7226
  * The image bytes are sent as the raw request body (default
7461
7227
  * `Content-Type: image/png`); `type` (`signature` or `initial`) and the
7462
7228
  * optional `reuse` flag are query params, alongside the authenticating
7463
- * `signer-access-code`. Set `reuse: true` to persist the image so it is
7464
- * applied automatically to the signer's future documents.
7229
+ * `signer-access-code`. The image is always stored on the signer, replacing
7230
+ * their previous image of that type; `reuse` only marks it reusable on
7231
+ * future documents, and omitting it leaves that flag unchanged. The API
7232
+ * checks the bytes, not the `Content-Type` header.
7465
7233
  *
7466
7234
  * @param signerAccessCode - The signer's access code, from their signing link.
7467
7235
  * @param image - The image bytes as a non-empty `Buffer`.
7468
7236
  * @param options - `imageType` (`'signature'` default, or `'initial'`) and
7469
- * `reuse` (persist for reuse). PNG is the default; staging also accepts JPEG.
7237
+ * `reuse`. PNG is the default; JPEG is also accepted.
7470
7238
  * @param options.contentType - Raw media type: `image/png` (default) or `image/jpeg`.
7471
7239
  * @param options.imageType - Signature image category; defaults to `signature`.
7472
- * @param options.reuse - Persist the image for future signing requests.
7240
+ * @param options.reuse - Mark the stored image reusable (or not) on future
7241
+ * documents; omitted, the flag is left unchanged.
7473
7242
  * @returns Resolves when the API acknowledges the upload. The response
7474
7243
  * envelope has no `data` field and is intentionally discarded.
7475
7244
  * @throws {ValidationError} If `signerAccessCode` is missing or `image` is not
7476
7245
  * a non-empty buffer.
7477
- * @throws {ApiError} If the access code is invalid or expired.
7246
+ * @throws {ApiError} `400` with `code` `SignatureImageInvalid` when the bytes
7247
+ * are not a PNG or JPEG image or `SignatureImageBlank` when it is blank,
7248
+ * with `EmailVerificationRequired`, `WhatsappVerificationRequired` or
7249
+ * `IdentityVerificationRequired` until the signer's code or identity check
7250
+ * is done, `SignerDataUnconfirmed` / `TermsNotAccepted` until a
7251
+ * digital-certificate signer confirms their data and accepts the terms, or
7252
+ * while their step has not started; `401` for an invalid code; `410` once
7253
+ * the code is closed.
7478
7254
  *
7479
7255
  * @example
7480
7256
  * ```ts
@@ -7487,28 +7263,6 @@ declare class SignerDocumentsResource extends BaseResource {
7487
7263
  * ```
7488
7264
  */
7489
7265
  uploadSignature(signerAccessCode: string, image: Buffer, options?: IUploadSignatureOptions): Promise<void>;
7490
- /**
7491
- * Upload a signature image using a compatibility content type
7492
- * (`POST /signature?signer-access-code=…&type=…`).
7493
- * @deprecated Compatibility overload for media types other than PNG/JPEG.
7494
- * Their acceptance depends on the deployment.
7495
- * @param signerAccessCode - Access code sent in the query string.
7496
- * @param image - Non-empty raw image bytes, without a JSON envelope.
7497
- * @param options - Image type, reuse preference and compatibility content type.
7498
- * @param options.imageType - Signature image category; defaults to `signature`.
7499
- * @param options.reuse - Persist the image for future signing requests.
7500
- * @param options.contentType - Compatibility media type; prefer `image/png` or `image/jpeg`.
7501
- * @returns Nothing; the acknowledgement body is discarded.
7502
- * @throws {ValidationError} If the code, image or options are invalid.
7503
- * @throws {ApiError} If the API rejects the upload.
7504
- * @example
7505
- * ```ts
7506
- * await client.signerDocuments.uploadSignature(accessCode, image, {
7507
- * imageType: 'signature', reuse: false, contentType: 'image/jpeg',
7508
- * });
7509
- * ```
7510
- */
7511
- uploadSignature(signerAccessCode: string, image: Buffer, options: ILegacyUploadSignatureOptions): Promise<void>;
7512
7266
  /**
7513
7267
  * Download the signer's stored signature or initial image
7514
7268
  * (`GET /signature/{type}?signer-access-code=…`).
@@ -7522,8 +7276,13 @@ declare class SignerDocumentsResource extends BaseResource {
7522
7276
  * `'signature'` (default) and `'initial'`.
7523
7277
  * @returns The image bytes as a Node `Buffer` (PNG by default).
7524
7278
  * @throws {ValidationError} If `signerAccessCode` is missing.
7525
- * @throws {ApiError} `404` if the signer has no such image stored; `401`/`403`
7526
- * if the access code is invalid or expired.
7279
+ * @throws {ApiError} `400` while the signer's step has not started, with
7280
+ * `code` `EmailVerificationRequired`, `WhatsappVerificationRequired` or
7281
+ * `IdentityVerificationRequired` until the signer's code or identity check
7282
+ * is done, or `SignerDataUnconfirmed` / `TermsNotAccepted` until a
7283
+ * digital-certificate signer confirms their data and accepts the terms;
7284
+ * `401` for an invalid code; `404` if the signer has no such image stored;
7285
+ * `410` once the code is closed.
7527
7286
  *
7528
7287
  * @example
7529
7288
  * ```ts
@@ -7538,8 +7297,10 @@ declare class SignerDocumentsResource extends BaseResource {
7538
7297
  *
7539
7298
  * The entry point for a custom signing UI: resolves the access code to the
7540
7299
  * document, its pages, and the {@link ISignFieldEntry}-addressable items the
7541
- * signer must fill. The server answers `409` while the document is still
7542
- * being prepared; retry that response with backoff. For ordinary signers,
7300
+ * signer must fill. The server answers `409` with `code` `DocumentNotReady`
7301
+ * while the document is still being prepared (retry with backoff) and
7302
+ * `DocumentClosed` once it was declined, cancelled, expired or failed (do
7303
+ * not retry). For ordinary signers,
7543
7304
  * `hasAcceptedTerms: true` records terms acceptance on this request.
7544
7305
  * Digital-certificate signers must confirm their data and accept terms
7545
7306
  * before this request; otherwise it returns `400`. The query flag is too
@@ -7563,7 +7324,7 @@ declare class SignerDocumentsResource extends BaseResource {
7563
7324
  * ```jsonc
7564
7325
  * {
7565
7326
  * "resource": "document",
7566
- * "id": "103acccd24234c07858ffddf6d84",
7327
+ * "id": "1000000000000000000000000008",
7567
7328
  * "account_id": "acc_example",
7568
7329
  * "template_id": null,
7569
7330
  * "name": "Service agreement.pdf",
@@ -7578,12 +7339,12 @@ declare class SignerDocumentsResource extends BaseResource {
7578
7339
  * "declined_by": null,
7579
7340
  * "tags": [],
7580
7341
  * "assignment": {
7581
- * "id": "1032c55c58bb00a8dc35db916751",
7342
+ * "id": "1000000000000000000000000002",
7582
7343
  * "method": "virtual",
7583
7344
  * "sender_email": "sender@example.com",
7584
7345
  * "expires_at": null,
7585
7346
  * "signers": [
7586
- * { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
7347
+ * { "id": "100000000000000000000000a01", "step": 1, "email": "signer@example.com",
7587
7348
  * "full_name": "Example Signer", "notified": true }
7588
7349
  * ],
7589
7350
  * "items": [
@@ -7592,7 +7353,7 @@ declare class SignerDocumentsResource extends BaseResource {
7592
7353
  * "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
7593
7354
  * ]
7594
7355
  * },
7595
- * "current_signer": { "id": "19e6b92e7895332ed9708535d8c", "verification_method": "Email",
7356
+ * "current_signer": { "id": "100000000000000000000000a01", "verification_method": "Email",
7596
7357
  * "notification_methods": ["Email"], "completed": false },
7597
7358
  * "is_signer_access_closed": false,
7598
7359
  * "certified_copy": { "available": false, "notification_method": "Email", "resends_left": null },
@@ -7605,11 +7366,17 @@ declare class SignerDocumentsResource extends BaseResource {
7605
7366
  * }
7606
7367
  * ```
7607
7368
  * @throws {ValidationError} If `signerAccessCode` is missing or an option is malformed.
7608
- * @throws {ApiError} `400` when a DigitalCertificate signer has not confirmed
7609
- * data and terms, the signer's step has not started, or `documentId` is
7610
- * not an ID; `401` for an invalid code; `404` when `documentId` is outside
7611
- * the code's envelope; `409` (`DocumentNotReady`) while the document is
7612
- * still being prepared.
7369
+ * @throws {ApiError} `400` with `code` `SignerDataUnconfirmed` or
7370
+ * `TermsNotAccepted` until a DigitalCertificate signer confirms their data
7371
+ * and accepts the terms, `EmailVerificationRequired`,
7372
+ * `WhatsappVerificationRequired` or `IdentityVerificationRequired` until
7373
+ * the signer's code or identity check is done, while the signer's step
7374
+ * has not started, or when `documentId` is not an ID; `401` for an invalid
7375
+ * code; `404` when `documentId` is outside the code's envelope or names a
7376
+ * document the signer is not on, the request has no assignment, or the
7377
+ * workspace deleted the document while the code is open; `409`
7378
+ * `DocumentNotReady` while the document is being prepared (retry with
7379
+ * backoff) or `DocumentClosed` once it closed (do not retry).
7613
7380
  *
7614
7381
  * @example
7615
7382
  * ```ts
@@ -7680,10 +7447,16 @@ declare class SignerDocumentsResource extends BaseResource {
7680
7447
  * { "available": true, "notification_method": "Email", "resends_left": null, "sent_to": "j***@example.com" }
7681
7448
  * ```
7682
7449
  * @throws {ValidationError} If the code or `documentId` is blank.
7683
- * @throws {ApiError} `400` while the signer's step has not started, `404` for a
7684
- * document outside the envelope, `409` when the signer has not signed or the
7685
- * document is not certified, `429` within the resend limits, `500` when the
7686
- * message could not be sent (nothing used up; ask again).
7450
+ * @throws {ApiError} `400` while the signer's step has not started, with
7451
+ * `code` `EmailVerificationRequired`, `WhatsappVerificationRequired` or
7452
+ * `IdentityVerificationRequired` until the signer's code or identity check
7453
+ * is done, `SignerDataUnconfirmed` / `TermsNotAccepted` until a
7454
+ * digital-certificate signer confirms their data and accepts the terms, or
7455
+ * when `documentId` is not an ID; `401` for an invalid code; `404` for a
7456
+ * document outside the envelope; `409` when the signer has not signed, the
7457
+ * document is not certified, or there is no contact to send to; `429` within
7458
+ * the resend limits; `500` when the message could not be sent (nothing used
7459
+ * up; ask again).
7687
7460
  *
7688
7461
  * @example
7689
7462
  * ```ts
@@ -7697,7 +7470,9 @@ declare class SignerDocumentsResource extends BaseResource {
7697
7470
  * The token is the last path segment of the link in the completion and
7698
7471
  * re-send messages; it is a credential. Links last 7 days (completion) or
7699
7472
  * 30 minutes (re-send). An expired or unknown link redirects to the
7700
- * expired-link page; the SDK does not follow it and throws instead.
7473
+ * expired-link page; the SDK does not follow it and throws instead. The
7474
+ * route matches only a 64-character lowercase hex token: any other token
7475
+ * gets the generic `404`.
7701
7476
  *
7702
7477
  * @param token - Link token.
7703
7478
  * @param artifact - `pades` for the PAdES version, when the document has one.
@@ -7705,7 +7480,8 @@ declare class SignerDocumentsResource extends BaseResource {
7705
7480
  * @throws {ValidationError} If `token` is blank or `artifact` is not `pades`.
7706
7481
  * @throws {ApiError} `302` for an expired or unknown link (ask for a new one
7707
7482
  * with {@link SignerDocumentsResource.resendCertifiedCopyFromLink}), `404`
7708
- * for `pades` on a document without it.
7483
+ * for `pades` on a document without it or a token that is not 64 lowercase
7484
+ * hex characters.
7709
7485
  *
7710
7486
  * @example
7711
7487
  * ```ts
@@ -7744,7 +7520,9 @@ declare class SignerDocumentsResource extends BaseResource {
7744
7520
  * authenticates via the `signer-access-code` query param.
7745
7521
  * Virtual signers must call {@link SignerDocumentsResource.confirmData}
7746
7522
  * first. Digital Certificate signers cannot use this endpoint; use the
7747
- * certificate start/complete API flow instead.
7523
+ * certificate start/complete API flow instead. Signing again after success
7524
+ * returns `200` with the current assignment, even after that signature
7525
+ * closed the document.
7748
7526
  *
7749
7527
  * Request body (`application/json`):
7750
7528
  * ```jsonc
@@ -7761,14 +7539,71 @@ declare class SignerDocumentsResource extends BaseResource {
7761
7539
  * @param documentId - The document being signed.
7762
7540
  * @param assignmentId - The assignment within that document.
7763
7541
  * @param signerAccessCode - The signer's access code, from their signing link.
7764
- * @param entries - Non-empty array of {@link ISignFieldEntry}
7765
- * (`itemId`, `fieldId`, `pageId`, `value`) — the body sent to the API.
7766
- * @returns The API's signing result object. Its keys are operation-specific,
7767
- * so the SDK preserves them as a {@link Record} without inventing fields.
7542
+ * @param entries - Array of {@link ISignFieldEntry} (`itemId`, `fieldId`,
7543
+ * `pageId`, `value`) — the body sent to the API; `[]` for a virtual
7544
+ * assignment, whose body the API ignores.
7545
+ * @returns The assignment as the signer reads it in their document list:
7546
+ * no `signing_urls`, only this signer's `items`, and the other parties'
7547
+ * contact details and ID number `null`. The SDK keeps it as a
7548
+ * {@link Record}:
7549
+ * ```jsonc
7550
+ * {
7551
+ * "id": "1000000000000000000000000002",
7552
+ * "document_id": "1000000000000000000000000008",
7553
+ * "created_at": "2026-07-19T14:56:56Z",
7554
+ * "sender_email": "sender@example.com",
7555
+ * "method": "collect",
7556
+ * "expires_at": null,
7557
+ * "message": null,
7558
+ * "signers": [
7559
+ * { "id": "100000000000000000000000a01", "full_name": "Example Signer",
7560
+ * "email": "signer@example.com", "whatsapp_phone_number": null, "government_id": null,
7561
+ * "has_accepted_terms": true, "verification_method": "Email",
7562
+ * "notification_methods": ["Email"], "step": 1, "notified": true },
7563
+ * // another party: name kept, contact details and ID number null
7564
+ * { "id": "100000000000000000000000a02", "full_name": "Other Signer",
7565
+ * "email": null, "whatsapp_phone_number": null, "government_id": null,
7566
+ * "has_accepted_terms": false, "verification_method": "Email",
7567
+ * "notification_methods": ["Email"], "step": 1, "notified": true }
7568
+ * ],
7569
+ * "copy_receivers": [],
7570
+ * "items": [ // this signer's only
7571
+ * { "id": "item-1",
7572
+ * "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275, "download_url": "https://..." },
7573
+ * "signer": { "id": "100000000000000000000000a01", "full_name": "Example Signer",
7574
+ * "email": "signer@example.com", "whatsapp_phone_number": null, "government_id": null,
7575
+ * "has_accepted_terms": true },
7576
+ * "field": { "id": "field-1", "name": "Nome", "type": "personName", "is_active": true },
7577
+ * "display_settings": { "left": 100, "top": 200, "width": 300, "height": 40, "fontSize": 12 },
7578
+ * "value": "Example Signer", "completed": true }
7579
+ * ],
7580
+ * "summary": {
7581
+ * "signer_count": 2,
7582
+ * "completed_count": 1,
7583
+ * "signers": [
7584
+ * { "id": "100000000000000000000000a01", "full_name": "Example Signer",
7585
+ * "email": "signer@example.com", "whatsapp_phone_number": null, "government_id": null,
7586
+ * "has_accepted_terms": true, "completed": true },
7587
+ * { "id": "100000000000000000000000a02", "full_name": "Other Signer",
7588
+ * "email": null, "whatsapp_phone_number": null, "government_id": null,
7589
+ * "has_accepted_terms": false, "completed": false }
7590
+ * ]
7591
+ * }
7592
+ * }
7593
+ * ```
7768
7594
  * @throws {ValidationError} If any of `documentId`, `assignmentId`, or
7769
- * `signerAccessCode` is missing, or `entries` is empty.
7770
- * @throws {ApiError} `400`/`409` if a value fails validation or the assignment
7771
- * is no longer signable; `401`/`403` if the access code is invalid/expired.
7595
+ * `signerAccessCode` is missing, or an entry is malformed.
7596
+ * @throws {ApiError} `400` with `code` `SignerDataUnconfirmed` (a virtual
7597
+ * signer has not confirmed their data), `DigitalCertificateRequired`,
7598
+ * `EmailVerificationRequired`, `WhatsappVerificationRequired`,
7599
+ * `IdentityVerificationRequired` or `TermsNotAccepted`, when a `collect`
7600
+ * signer has no stored signature or initial image, an entry names a page,
7601
+ * field or item that is not this signer's, a required field is left out,
7602
+ * or the signer's step has not started (nothing is signed then); `401`
7603
+ * for an invalid code; `404` when the assignment or document is not the
7604
+ * code's; `409` `DocumentNotReady` while the document cannot be signed yet
7605
+ * (retry with backoff) or `DocumentClosed` once it closed (do not retry);
7606
+ * `410` once the code is closed.
7772
7607
  *
7773
7608
  * @example
7774
7609
  * ```ts
@@ -7786,9 +7621,8 @@ declare class SignerDocumentsResource extends BaseResource {
7786
7621
  * The single-document counterpart of
7787
7622
  * {@link SignerDocumentsResource.declineMultiple}. The `decline_reason` is
7788
7623
  * sent in the request body; the access code authenticates via the
7789
- * `signer-access-code` query param. (The workspace-side equivalent is to
7790
- * delete the document via `documents.delete`; there is no workspace "cancel"
7791
- * endpoint.)
7624
+ * `signer-access-code` query param. The workspace-side equivalent is
7625
+ * `client.documents.cancel(documentId)`.
7792
7626
  *
7793
7627
  * Request body (`application/json`):
7794
7628
  * ```jsonc
@@ -7804,8 +7638,17 @@ declare class SignerDocumentsResource extends BaseResource {
7804
7638
  * @returns Resolves when the API acknowledges the operation. The documented
7805
7639
  * empty-array response data is intentionally discarded.
7806
7640
  * @throws {ValidationError} If any of `documentId`, `assignmentId`, or
7807
- * `signerAccessCode` is missing, or `declineReason` is empty.
7808
- * @throws {ApiError} If the access code is invalid or expired.
7641
+ * `signerAccessCode` is missing, or `declineReason` is empty or longer than
7642
+ * 2000 characters.
7643
+ * @throws {ApiError} `400` when `decline_reason` is missing or longer than
7644
+ * 2000 characters, the assignment or document is no longer pending, with
7645
+ * `code` `EmailVerificationRequired`, `WhatsappVerificationRequired` or
7646
+ * `IdentityVerificationRequired` until the signer's code or identity check
7647
+ * is done, `SignerDataUnconfirmed` / `TermsNotAccepted` until a
7648
+ * digital-certificate signer confirms their data and accepts the terms, or
7649
+ * while their step has not started; `401` for an invalid code; `404` when
7650
+ * the assignment is not the code's or the document is outside its
7651
+ * envelope; `410` once the code is closed.
7809
7652
  *
7810
7653
  * @example
7811
7654
  * ```ts
@@ -7831,7 +7674,7 @@ declare class UserResource extends BaseResource {
7831
7674
  * @returns The unwrapped user payload:
7832
7675
  * ```jsonc
7833
7676
  * {
7834
- * "id": "bgjazeo5r9v2lq7l36dx48np",
7677
+ * "id": "usr_example",
7835
7678
  * "name": "John Smith",
7836
7679
  * "email": "john@example.com",
7837
7680
  * "telephone": null,
@@ -7842,7 +7685,8 @@ declare class UserResource extends BaseResource {
7842
7685
  * "to_be_deleted_at": null
7843
7686
  * }
7844
7687
  * ```
7845
- * @throws {ApiError} `401` when credentials are missing/invalid, or `500`
7688
+ * @throws {ApiError} `401` when credentials are missing/invalid; `403` for
7689
+ * an OAuth access token (read the user from `oauth.getUserInfo()`); `500`
7846
7690
  * when the API cannot load the user.
7847
7691
  *
7848
7692
  * @example
@@ -7879,7 +7723,9 @@ declare class UserResource extends BaseResource {
7879
7723
  * ```
7880
7724
  * @throws {ValidationError} If daily granularity has no month or `month`
7881
7725
  * does not use `YYYY-MM`.
7882
- * @throws {ApiError} `400` for an invalid query or `401` for invalid auth.
7726
+ * @throws {ApiError} `400` for an invalid query, `401` for invalid auth, or
7727
+ * `403` for an OAuth access token (it is bound to one workspace: read
7728
+ * `workspaces.getStats()` instead).
7883
7729
  *
7884
7730
  * @example
7885
7731
  * ```ts
@@ -7915,8 +7761,9 @@ declare class UserResource extends BaseResource {
7915
7761
  * "ContractRenewed": true
7916
7762
  * }
7917
7763
  * ```
7918
- * @throws {ApiError} `401` when credentials are missing/invalid, or `500`
7919
- * when the API cannot load the preferences.
7764
+ * @throws {ApiError} `401` when credentials are missing/invalid; `403` for a
7765
+ * third-party OAuth application, whatever its scopes; `500` when the API
7766
+ * cannot load the preferences.
7920
7767
  *
7921
7768
  * @example
7922
7769
  * ```ts
@@ -7984,10 +7831,11 @@ declare class UserResource extends BaseResource {
7984
7831
  * "ContractRenewed": true
7985
7832
  * }
7986
7833
  * ```
7987
- * @throws {ValidationError} Before requesting when the map is empty, has an
7988
- * unknown key, or contains a non-boolean value.
7989
- * @throws {ApiError} `400` if the API rejects the map, `401` for invalid
7990
- * credentials, or `500` on a server error.
7834
+ * @throws {ValidationError} Before requesting when the map is empty or
7835
+ * contains a non-boolean value.
7836
+ * @throws {ApiError} `400` for an unknown key (nothing is written), `401`
7837
+ * for invalid credentials, `403` for a third-party OAuth application, or
7838
+ * `500` on a server error.
7991
7839
  *
7992
7840
  * @example
7993
7841
  * ```ts
@@ -8045,147 +7893,6 @@ declare class UserResource extends BaseResource {
8045
7893
  * ```
8046
7894
  */
8047
7895
  updatePushPreferences(preferences: IUpdatePushPreferences): Promise<IPushPreferences>;
8048
- /**
8049
- * List the user's enrolled two-factor methods (`GET /users/self/mfa`).
8050
- *
8051
- * @returns Methods and unused recovery-code count:
8052
- * ```jsonc
8053
- * {
8054
- * "methods": [
8055
- * {
8056
- * "id": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
8057
- * "type": "Totp",
8058
- * "label": "My phone",
8059
- * "confirmed_at": "2026-09-09T14:21:03Z",
8060
- * "last_used_at": "2026-09-09T18:02:44Z"
8061
- * }
8062
- * ],
8063
- * "recovery_codes_remaining": 8
8064
- * }
8065
- * ```
8066
- * @throws {ApiError} `401` when credentials are missing or invalid.
8067
- *
8068
- * @example
8069
- * ```ts
8070
- * const { methods } = await client.users.getMfa();
8071
- * const enabled = methods.some((method) => method.confirmed_at !== null);
8072
- * ```
8073
- */
8074
- getMfa(): Promise<IMfaStatus>;
8075
- /**
8076
- * Start authenticator-app enrollment (`POST /users/self/mfa/totp`).
8077
- * Two-factor authentication is not active until
8078
- * {@link UserResource.confirmTotpEnrollment} succeeds.
8079
- *
8080
- * Request body (`application/json`): `{ "label": "My phone" }` (optional).
8081
- *
8082
- * @param label - Optional name for the device.
8083
- * @returns The pending enrollment. `secret` is returned only here:
8084
- * ```jsonc
8085
- * {
8086
- * "id": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
8087
- * "secret": "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
8088
- * "provisioning_uri": "otpauth://totp/user%40example.com?issuer=Assinafy&secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"
8089
- * }
8090
- * ```
8091
- * @throws {ValidationError} If `label` is not a string.
8092
- * @throws {ApiError} `401` when credentials are missing or invalid.
8093
- *
8094
- * @example
8095
- * ```ts
8096
- * const enrollment = await client.users.startTotpEnrollment('My phone');
8097
- * showQrCode(enrollment.provisioning_uri);
8098
- * ```
8099
- */
8100
- startTotpEnrollment(label?: string): Promise<ITotpEnrollment>;
8101
- /**
8102
- * Activate an authenticator with a live code from the new device
8103
- * (`PUT /users/self/mfa/totp/confirm`). From then on every login needs a
8104
- * second factor.
8105
- *
8106
- * Replacing an already confirmed authenticator soft-deletes the old one,
8107
- * reissues recovery codes, and additionally requires `password` or
8108
- * `reauth_code`. First-time enrollment needs neither.
8109
- *
8110
- * Request body (`application/json`):
8111
- * ```jsonc
8112
- * {
8113
- * "id": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
8114
- * "code": "123456", // from the NEW device
8115
- * "password": "example-pass", // only when replacing; or:
8116
- * "reauth_code": "654321" // code from the CURRENT device, or a recovery code
8117
- * }
8118
- * ```
8119
- *
8120
- * @param payload - Enrollment `id`, new-device `code`, and re-authentication
8121
- * when replacing a method.
8122
- * @returns The recovery codes, shown only once:
8123
- * ```jsonc
8124
- * {
8125
- * "recovery_codes": ["ABCD-EFGH-JKMN", "PQRS-TUVW-XYZ2"] // ten in total
8126
- * }
8127
- * ```
8128
- * @throws {ValidationError} If `id` or `code` is empty.
8129
- * @throws {ApiError} `400` for a wrong code or missing re-authentication;
8130
- * `404` for an unknown enrollment.
8131
- *
8132
- * @example
8133
- * ```ts
8134
- * const { recovery_codes } = await client.users.confirmTotpEnrollment({
8135
- * id: enrollment.id,
8136
- * code: '123456',
8137
- * });
8138
- * ```
8139
- */
8140
- confirmTotpEnrollment(payload: IConfirmTotpPayload): Promise<IMfaRecoveryCodes>;
8141
- /**
8142
- * Issue ten fresh recovery codes and invalidate the previous set
8143
- * (`POST /users/self/mfa/recovery-codes`).
8144
- *
8145
- * Request body (`application/json`): `{ "password": "…" }` or
8146
- * `{ "code": "123456" }`.
8147
- *
8148
- * @param proof - Current password, or a live authenticator / recovery code.
8149
- * @returns The new codes, shown only once:
8150
- * ```jsonc
8151
- * {
8152
- * "recovery_codes": ["ABCD-EFGH-JKMN", "PQRS-TUVW-XYZ2"] // ten in total
8153
- * }
8154
- * ```
8155
- * @throws {ValidationError} If neither `password` nor `code` is given.
8156
- * @throws {ApiError} `400` when the proof is rejected.
8157
- *
8158
- * @example
8159
- * ```ts
8160
- * const { recovery_codes } = await client.users.regenerateRecoveryCodes({ code: '123456' });
8161
- * ```
8162
- */
8163
- regenerateRecoveryCodes(proof: IMfaReauth): Promise<IMfaRecoveryCodes>;
8164
- /**
8165
- * Remove an enrolled two-factor method (`DELETE /users/self/mfa/{id}`).
8166
- * Removing the last method also discards the recovery codes.
8167
- *
8168
- * Request body (`application/json`): `{ "password": "…" }` or
8169
- * `{ "code": "123456" }`.
8170
- *
8171
- * @param methodId - The method ID from {@link UserResource.getMfa}.
8172
- * @param proof - Current password, or a live authenticator / recovery code.
8173
- * @returns Whether two-factor authentication is still on:
8174
- * ```jsonc
8175
- * { "is_mfa_enabled": false }
8176
- * ```
8177
- * @throws {ValidationError} If `methodId` is empty or no proof is given.
8178
- * @throws {ApiError} `400` when the proof is rejected; `404` for an unknown
8179
- * method.
8180
- *
8181
- * @example
8182
- * ```ts
8183
- * await client.users.deleteMfaMethod(method.id, { password });
8184
- * ```
8185
- */
8186
- deleteMfaMethod(methodId: string, proof: IMfaReauth): Promise<{
8187
- is_mfa_enabled: boolean;
8188
- }>;
8189
7896
  }
8190
7897
 
8191
7898
  /** Operations for contract terms tracked on workspace documents. */
@@ -8217,7 +7924,7 @@ declare class ContractResource extends BaseResource {
8217
7924
  * ```jsonc
8218
7925
  * {
8219
7926
  * "data": [{
8220
- * "document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
7927
+ * "document_id": "100000000000000000000001",
8221
7928
  * "status": "active",
8222
7929
  * "counterparty_name": "Example Ltda",
8223
7930
  * "counterparty_taxpayer_id": "11222333000181",
@@ -8229,7 +7936,7 @@ declare class ContractResource extends BaseResource {
8229
7936
  * "renewal_term_months": 12,
8230
7937
  * "notice_period_days": 30,
8231
7938
  * "term": 1,
8232
- * "owner_id": "d6zqpbyog2v3xvxerwn8la94",
7939
+ * "owner_id": "usr_example",
8233
7940
  * "metadata": { "crm_stage": "won" },
8234
7941
  * "external_references": [{ "system": "crm", "id": "98765" }],
8235
7942
  * "created_at": "2026-10-23T12:00:00Z",
@@ -8266,7 +7973,7 @@ declare class ContractResource extends BaseResource {
8266
7973
  * ```jsonc
8267
7974
  * {
8268
7975
  * "resource": "document_contract",
8269
- * "document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
7976
+ * "document_id": "100000000000000000000001",
8270
7977
  * "status": "active",
8271
7978
  * "counterparty_name": "Example Ltda",
8272
7979
  * "counterparty_taxpayer_id": "11222333000181",
@@ -8308,9 +8015,23 @@ declare class ContractResource extends BaseResource {
8308
8015
  * `updated_at` previously read to reject concurrent changes with `409`.
8309
8016
  * OAuth tokens need `documents:write`; writes require a contract-tracking plan.
8310
8017
  *
8018
+ * `status` follows the lifecycle. When the terms are created any status is
8019
+ * accepted, so a contract that ended before it was tracked can be recorded:
8020
+ * `expired` needs an `end_date` in the past, `terminated` needs an
8021
+ * `end_date`. Afterwards the only change is `draft` to `active`; resending
8022
+ * the current status is not a change. An active contract cannot return to
8023
+ * `draft`, and an expired or terminated one is reopened with
8024
+ * {@link ContractResource.renew}, not here.
8025
+ *
8026
+ * An amendment, renewal or termination link (a payload with
8027
+ * `parent_document_id`, or a document already linked) carries only the
8028
+ * terms it changes: `status`, `owner_id` and `external_references` are
8029
+ * refused with `400` (`UnknownField`).
8030
+ *
8311
8031
  * @param documentId - Document whose terms or amendment link will change.
8312
8032
  * @param payload - At least one contract attribute.
8313
- * @param payload.status - `draft`, `active`, `expired`, or `terminated`.
8033
+ * @param payload.status - `draft` or `active`; `expired` or `terminated`
8034
+ * only when the terms are created. Not accepted on an amendment link.
8314
8035
  * @param payload.counterparty_name - Counterparty name; null clears it.
8315
8036
  * @param payload.counterparty_taxpayer_id - CPF/CNPJ; null clears it.
8316
8037
  * @param payload.value - Non-negative contract value; null clears it.
@@ -8332,9 +8053,9 @@ declare class ContractResource extends BaseResource {
8332
8053
  * ```jsonc
8333
8054
  * {
8334
8055
  * "resource": "document_contract_amendment",
8335
- * "document_id": "7c3d1e2f4a5b6c7d8e9f0a1b",
8056
+ * "document_id": "100000000000000000000002",
8336
8057
  * "document_name": "Amendment 1.pdf",
8337
- * "parent_document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
8058
+ * "parent_document_id": "100000000000000000000001",
8338
8059
  * "relation_type": "amendment",
8339
8060
  * "number": null,
8340
8061
  * "status": "pending",
@@ -8349,7 +8070,9 @@ declare class ContractResource extends BaseResource {
8349
8070
  * }
8350
8071
  * ```
8351
8072
  * @throws {ValidationError} If the payload or an ID is malformed.
8352
- * @throws {ApiError} `400` for invalid terms (each in `fieldErrors`), `403`
8073
+ * @throws {ApiError} `400` for invalid terms (each in `fieldErrors`, e.g.
8074
+ * `StatusNotSettable`, `CannotReturnToDraft`, `ExpiredNeedsPastEndDate`,
8075
+ * `TerminatedNeedsEndDate`, `UnknownField`), `403`
8353
8076
  * (`PlanRestricted`) when the plan does not include tracking, `404` for an
8354
8077
  * unknown document or a `parent_document_id` outside the workspace, `409`
8355
8078
  * (`ContractChanged`) after a concurrent change, or `500` on a server error.
@@ -8381,7 +8104,7 @@ declare class ContractResource extends BaseResource {
8381
8104
  * ```jsonc
8382
8105
  * {
8383
8106
  * "resource": "document_contract",
8384
- * "document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
8107
+ * "document_id": "100000000000000000000001",
8385
8108
  * "status": "active",
8386
8109
  * "counterparty_name": "Example Ltda",
8387
8110
  * "counterparty_taxpayer_id": "11222333000181",
@@ -8397,9 +8120,9 @@ declare class ContractResource extends BaseResource {
8397
8120
  * "metadata": null,
8398
8121
  * "external_references": [],
8399
8122
  * "amendments": [{
8400
- * "document_id": "7c3d1e2f4a5b6c7d8e9f0a1b",
8123
+ * "document_id": "100000000000000000000002",
8401
8124
  * "document_name": "Amendment 1.pdf",
8402
- * "parent_document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
8125
+ * "parent_document_id": "100000000000000000000001",
8403
8126
  * "relation_type": "amendment",
8404
8127
  * "status": "applied",
8405
8128
  * "number": 1,
@@ -8450,7 +8173,7 @@ declare class ContractResource extends BaseResource {
8450
8173
  * ```jsonc
8451
8174
  * {
8452
8175
  * "resource": "document_contract",
8453
- * "document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
8176
+ * "document_id": "100000000000000000000001",
8454
8177
  * "status": "active",
8455
8178
  * "counterparty_name": "Example Ltda",
8456
8179
  * "counterparty_taxpayer_id": "11222333000181",
@@ -8499,7 +8222,7 @@ declare class ContractResource extends BaseResource {
8499
8222
  * ```jsonc
8500
8223
  * {
8501
8224
  * "resource": "document_contract",
8502
- * "document_id": "66b2f0e1c3a4d5e6f7a8b9c0",
8225
+ * "document_id": "100000000000000000000001",
8503
8226
  * "status": "terminated",
8504
8227
  * "counterparty_name": "Example Ltda",
8505
8228
  * "counterparty_taxpayer_id": "11222333000181",
@@ -8562,20 +8285,20 @@ declare class EnvelopeResource extends BaseResource {
8562
8285
  * ```jsonc
8563
8286
  * {
8564
8287
  * "data": [{
8565
- * "id": "1052a1f0c3d4e5f6a7b8c9d0e1f2",
8288
+ * "id": "100000000000000000000000000f",
8566
8289
  * "name": "Admission kit",
8567
8290
  * "message": "Please sign the documents below.",
8568
8291
  * "documents": [{
8569
- * "id": "1052a1e9b8c7d6e5f4a3b2c1d0e9",
8292
+ * "id": "1000000000000000000000000010",
8570
8293
  * "position": 1,
8571
8294
  * "name": "contract.pdf",
8572
8295
  * "status": "pending_signature",
8573
8296
  * "artifacts": {
8574
- * "original": "https://api.assinafy.com.br/v1/documents/1052a1e9b8c7d6e5f4a3b2c1d0e9/download/original",
8575
- * "thumbnail": "https://api.assinafy.com.br/v1/documents/1052a1e9b8c7d6e5f4a3b2c1d0e9/thumbnail"
8297
+ * "original": "https://api.assinafy.com.br/v1/documents/1000000000000000000000000010/download/original",
8298
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/1000000000000000000000000010/thumbnail"
8576
8299
  * },
8577
8300
  * "signers": [{
8578
- * "id": "1052a1d4c3b2a1f0e9d8c7b6a5f4",
8301
+ * "id": "1000000000000000000000000011",
8579
8302
  * "full_name": "Ana Souza",
8580
8303
  * "email": "ana@example.com",
8581
8304
  * "whatsapp_phone_number": null,
@@ -8585,8 +8308,8 @@ declare class EnvelopeResource extends BaseResource {
8585
8308
  * }],
8586
8309
  * "counts": { "pending_signature": 1 }, // documents per status; no envelope-level status
8587
8310
  * "signing_urls": [{
8588
- * "signer_id": "1052a1d4c3b2a1f0e9d8c7b6a5f4",
8589
- * "url": "https://app.assinafy.com.br/sign/1052a1e9b8c7d6e5f4a3b2c1d0e9?email=ana%40example.com",
8311
+ * "signer_id": "1000000000000000000000000011",
8312
+ * "url": "https://app.assinafy.com.br/sign/1000000000000000000000000010?email=ana%40example.com",
8590
8313
  * "embedded": false
8591
8314
  * }],
8592
8315
  * "created_at": "2026-11-11T14:00:00Z"
@@ -8636,7 +8359,8 @@ declare class EnvelopeResource extends BaseResource {
8636
8359
  * signer's notification and identity check once, and each certificate
8637
8360
  * signature on every document it is made on. A refused request creates and
8638
8361
  * charges nothing. Pass an `idempotencyKey` to retry safely after a lost
8639
- * response; the SDK then also replays a `429`.
8362
+ * response; the SDK then also replays a `429` whose wait fits its retry cap
8363
+ * (not `FreePlanEmailLimit`, which waits hours).
8640
8364
  *
8641
8365
  * @param payload - Envelope definition.
8642
8366
  * @param payload.name - 1–255 characters without `<`; invitations use it in
@@ -8647,16 +8371,22 @@ declare class EnvelopeResource extends BaseResource {
8647
8371
  * @param payload.signers - 1–20 `{ id, verification_method?, notification_methods?, embedded? }`.
8648
8372
  * @param payload.documents - 1–20 `{ id, signer_ids, method?, entries?, expires_at?, copy_receiver_ids? }`,
8649
8373
  * in envelope order. `collect` documents need `entries` whose signers are
8650
- * exactly `signer_ids`.
8374
+ * exactly `signer_ids`. `expires_at` is an ISO date or date-time (a date
8375
+ * ends at 23:59 UTC; no offset means UTC), Unix seconds, or `null` for none.
8651
8376
  * @param options - `idempotencyKey`: new for each envelope you mean to create.
8652
8377
  * @param accountId - Override the client's default account ID.
8653
8378
  * @returns The created envelope (see {@link EnvelopeResource.list}). An
8654
8379
  * embedded or WhatsApp-only signer has `url: null` in `signing_urls`.
8655
8380
  * @throws {ValidationError} If the payload is malformed, a signer's channels
8656
8381
  * do not pair, or a `collect` document has no `entries`.
8657
- * @throws {ApiError} `400` with `fieldErrors` naming each field at fault, `403`
8658
- * (`PlanRestricted` or `InsufficientScope`), `409` (`CreditCeilingExceeded`,
8659
- * or `IdempotencyKeyInUse` while the first request with that key runs).
8382
+ * @throws {ApiError} `400` with `fieldErrors` naming each field at fault;
8383
+ * `403` (`PlanRestricted`, `FreePlanSignerLimit` for a free workspace above
8384
+ * three signers, or `InsufficientScope`); `404` for an unknown workspace;
8385
+ * `409` (`CreditCeilingExceeded`, or `IdempotencyKeyInUse` while the first
8386
+ * request with that key runs); `429` (`FreePlanEmailLimit`) when the free
8387
+ * plan's daily signer e-mail limit has no room for the invitations:
8388
+ * `Retry-After` gives the seconds until it has (often hours), and nothing
8389
+ * is created or charged.
8660
8390
  *
8661
8391
  * @example
8662
8392
  * ```ts
@@ -8688,13 +8418,13 @@ declare class EnvelopeResource extends BaseResource {
8688
8418
  * ```jsonc
8689
8419
  * {
8690
8420
  * "documents": 1,
8691
- * "credits": 1.45,
8421
+ * "credits": 1.35, // sum of the breakdown costs
8692
8422
  * "needs_extra_document": false,
8693
- * "extra_document_cost": 1,
8694
- * "total_credits": 1.45,
8423
+ * "extra_document_cost": 1, // added to total_credits only when needs_extra_document
8424
+ * "total_credits": 1.35,
8695
8425
  * "breakdown": [
8696
8426
  * { "code": "NotificationWhatsapp", "name": "WhatsApp notification", "cost": 0.45, "quantity": 1, "unit_cost": 0.45 },
8697
- * { "code": "SignatureDigitalCertificate", "name": "Digital certificate signature", "cost": 1, "quantity": 2, "unit_cost": 0.5 }
8427
+ * { "code": "SignatureDigitalCertificate", "name": "Digital certificate signature", "cost": 0.9, "quantity": 2, "unit_cost": 0.45 }
8698
8428
  * ],
8699
8429
  * "document_balance": 97, // null when documents are not limited
8700
8430
  * "credit_balance": 10, // null when credits are not limited
@@ -8704,8 +8434,9 @@ declare class EnvelopeResource extends BaseResource {
8704
8434
  * }
8705
8435
  * ```
8706
8436
  * @throws {ValidationError} If the payload is malformed or a signer's channels do not pair.
8707
- * @throws {ApiError} `400` for fields at fault, `403` (`PlanRestricted` or
8708
- * `InsufficientScope`).
8437
+ * @throws {ApiError} `400` for fields at fault; `403` (`PlanRestricted`,
8438
+ * `FreePlanSignerLimit` for a free workspace above three signers, or
8439
+ * `InsufficientScope`); `404` for an unknown workspace.
8709
8440
  *
8710
8441
  * @example
8711
8442
  * ```ts
@@ -8772,8 +8503,8 @@ declare class EnvelopeResource extends BaseResource {
8772
8503
  * @returns What happened to each document:
8773
8504
  * ```jsonc
8774
8505
  * [
8775
- * { "id": "1052a1e9b8c7d6e5f4a3b2c1d0e9", "status": "cancelled", "cancelled": true },
8776
- * { "id": "1052a1eaf9e8d7c6b5a4f3e2d1c0", "status": "certificated", "cancelled": false }
8506
+ * { "id": "1000000000000000000000000010", "status": "cancelled", "cancelled": true },
8507
+ * { "id": "1000000000000000000000000012", "status": "certificated", "cancelled": false }
8777
8508
  * ]
8778
8509
  * ```
8779
8510
  * @throws {ValidationError} If an ID is missing or invalid.
@@ -8804,9 +8535,9 @@ declare class EnvelopeResource extends BaseResource {
8804
8535
  * "id": 7731204,
8805
8536
  * "event": "signer_signed_document",
8806
8537
  * "message": "Ana Souza signed the document",
8807
- * "payload": { "signer": { "id": "1052a1d4c3b2a1f0e9d8c7b6a5f4" } }, // same keys as that event's webhook
8538
+ * "payload": { "signer": { "id": "1000000000000000000000000011" } }, // same keys as that event's webhook
8808
8539
  * "origin": { "ip": "203.0.113.10", "user-agent": "Mozilla/5.0" },
8809
- * "document_id": "1052a1e9b8c7d6e5f4a3b2c1d0e9",
8540
+ * "document_id": "1000000000000000000000000010",
8810
8541
  * "document_name": "contract.pdf",
8811
8542
  * "created_at": "2026-11-11T14:05:00Z"
8812
8543
  * }],
@@ -8852,16 +8583,24 @@ declare class EnvelopeResource extends BaseResource {
8852
8583
  *
8853
8584
  * The document is checked as on creation and goes last. Only its
8854
8585
  * certificate signatures are charged; the chosen signers receive the
8855
- * envelope invitation again, now listing it. No new signer can join, and an
8856
- * envelope holds at most 20 documents.
8586
+ * envelope invitation again, now listing it. No new signer can join. An
8587
+ * envelope holds 20 documents at a time and 60 over the envelope's life,
8588
+ * counting documents taken out; past either, or past 2,000 fields or 100
8589
+ * copy receivers, it answers `400` (an `errors` entry with a `null` field)
8590
+ * and sends nothing.
8857
8591
  *
8858
8592
  * @param envelopeId - Envelope ID.
8859
8593
  * @param payload - `{ id, signer_ids, method?, entries?, expires_at?, copy_receiver_ids?, max_total_credits? }`.
8860
8594
  * @param accountId - Override the client's default account ID.
8861
8595
  * @returns The updated envelope (see {@link EnvelopeResource.list}).
8862
8596
  * @throws {ValidationError} If the document definition is malformed.
8863
- * @throws {ApiError} `400` for fields at fault, `403` (`PlanRestricted` or
8864
- * `InsufficientScope`), `409` (`EnvelopeClosed`, `CreditCeilingExceeded`).
8597
+ * @throws {ApiError} `400` for fields at fault or a limit above; `403`
8598
+ * (`PlanRestricted`, `FreePlanSignerLimit` for a free workspace above three
8599
+ * signers, or `InsufficientScope`); `404` for an unknown envelope; `409`
8600
+ * (`EnvelopeClosed`, `CreditCeilingExceeded`); `429` (`FreePlanEmailLimit`)
8601
+ * when the free plan's daily signer e-mail limit has no room for the
8602
+ * invitations: `Retry-After` gives the seconds until it has (often hours),
8603
+ * and nothing is added or charged.
8865
8604
  *
8866
8605
  * @example
8867
8606
  * ```ts
@@ -8904,7 +8643,7 @@ declare class EnvelopeResource extends BaseResource {
8904
8643
  * @param accountId - Override the client's default account ID.
8905
8644
  * @returns Delivery acknowledgement:
8906
8645
  * ```jsonc
8907
- * { "is_sent": true, "envelope_id": "1052a1f0c3d4e5f6a7b8c9d0e1f2", "signer_id": "1052a1d4c3b2a1f0e9d8c7b6a5f4" }
8646
+ * { "is_sent": true, "envelope_id": "100000000000000000000000000f", "signer_id": "1000000000000000000000000011" }
8908
8647
  * ```
8909
8648
  * @throws {ValidationError} If an ID is missing or invalid.
8910
8649
  * @throws {ApiError} `400` when the signer has nothing left to sign or credits
@@ -8921,7 +8660,7 @@ declare class EnvelopeResource extends BaseResource {
8921
8660
  * Price a whole-envelope reminder
8922
8661
  * (`POST /accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/estimate-resend-cost`).
8923
8662
  *
8924
- * Staging extension. Sends and charges nothing. Prices one reminder per
8663
+ * Sends and charges nothing. Prices one reminder per
8925
8664
  * channel regardless of document count, without checking reminder cooldown
8926
8665
  * or whether the envelope is closed. OAuth requires `documents:write`.
8927
8666
  * @param envelopeId - Envelope ID.
@@ -8932,7 +8671,7 @@ declare class EnvelopeResource extends BaseResource {
8932
8671
  * { "total": 0, "breakdown": [], "credit_balance": null, "has_sufficient_credits": true }
8933
8672
  * ```
8934
8673
  * @throws {ValidationError} If an ID is missing or invalid.
8935
- * @throws {ApiError} `401`, `403`, or `404` for an unknown envelope/signer or older deployment.
8674
+ * @throws {ApiError} `401`, `403`, or `404` for an unknown envelope or signer.
8936
8675
  * @example
8937
8676
  * ```ts
8938
8677
  * const estimate = await client.envelopes.estimateResendCost(envelope.id, signer.id);
@@ -8960,7 +8699,7 @@ declare class EmbedResource extends BaseResource {
8960
8699
  * @param accountId - Override the client's default account ID.
8961
8700
  * @returns Registered origins:
8962
8701
  * ```jsonc
8963
- * [{ "id": "1052c7d8e9f0a1b2c3d4e5f6a7b8", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }]
8702
+ * [{ "id": "100000000000000000000000000e", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }]
8964
8703
  * ```
8965
8704
  * @throws {ValidationError} If no account ID is available.
8966
8705
  * @throws {ApiError} `403` (`PlanRestricted`, or an OAuth application token).
@@ -8982,7 +8721,7 @@ declare class EmbedResource extends BaseResource {
8982
8721
  * @param origin - Origin of the page that will host the iframe.
8983
8722
  * @param accountId - Override the client's default account ID.
8984
8723
  * @returns The stored origin, e.g.
8985
- * `{ "id": "1052c7d8e9f0a1b2c3d4e5f6a7b8", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }`.
8724
+ * `{ "id": "100000000000000000000000000e", "origin": "https://app.example.com", "created_at": "2026-11-04T12:05:00Z" }`.
8986
8725
  * @throws {ValidationError} If `origin` is blank.
8987
8726
  * @throws {ApiError} `400` when it is invalid, already registered, or the
8988
8727
  * account has 10; `403` (`PlanRestricted`, or an OAuth application token).
@@ -9047,7 +8786,7 @@ declare class EmbedResource extends BaseResource {
9047
8786
  * @returns The session:
9048
8787
  * ```jsonc
9049
8788
  * {
9050
- * "url": "https://app.assinafy.com.br/embed/3b1f0c7e9a2d4c58b6e1f4a07d93c2e85a1b0f6d4c7e2a9183b5d6f0e4c8a712",
8789
+ * "url": "https://app.assinafy.com.br/embed/1000000000000000000000000000000000000000000000000000000000000001",
9051
8790
  * "expires_at": "2026-11-04T12:05:00Z"
9052
8791
  * }
9053
8792
  * ```
@@ -9069,7 +8808,7 @@ declare class EmbedResource extends BaseResource {
9069
8808
  }
9070
8809
 
9071
8810
  /**
9072
- * Deferred assignment/envelope requests, available on staging. All routes,
8811
+ * Deferred assignment/envelope requests. All routes,
9073
8812
  * including listing, need `documents:write` for OAuth applications. Requests
9074
8813
  * are checked when scheduled, and checked and charged again when sent. The
9075
8814
  * server checks due sends every five minutes. No mutation is automatically
@@ -9091,19 +8830,24 @@ declare class ScheduledSendResource extends BaseResource {
9091
8830
  * @param payload.signerIds - Compatibility alias for signer IDs.
9092
8831
  * @param payload.entries - Required field placements for `collect`.
9093
8832
  * @param payload.message - Invitation text.
9094
- * @param payload.copy_receivers - Contacts receiving copies.
8833
+ * @param payload.copy_receivers - Signer IDs receiving copies, sent as `copy_receiver_ids`.
9095
8834
  * @param payload.expires_at - Absolute deadline at least two hours after send_at, or null for none.
9096
8835
  * @param payload.max_total_credits - Credit ceiling enforced when sending.
9097
- * @returns The saved request's state:
8836
+ * @returns The saved request's state. `next_attempt_at` is set while a
8837
+ * pending send is postponed by the free plan's daily signer e-mail limit
8838
+ * (`send_at` keeps the original time); held 7 days past `send_at`, the send
8839
+ * fails with a `failure_reason`:
9098
8840
  * ```jsonc
9099
8841
  * { "resource": "scheduled_send", "id": "send-1", "type": "assignment",
9100
8842
  * "document_ids": ["doc-1"], "status": "pending", "send_at": "2026-12-01T12:00:00Z",
9101
- * "assignment_id": null, "envelope_id": null, "failure_reason": null,
9102
- * "created_at": "2026-11-24T12:00:00Z", "processed_at": null }
8843
+ * "next_attempt_at": null, "assignment_id": null, "envelope_id": null,
8844
+ * "failure_reason": null, "created_at": "2026-11-24T12:00:00Z", "processed_at": null }
9103
8845
  * ```
9104
8846
  * @throws {ValidationError} If the ID, time or signing request is malformed.
9105
8847
  * @throws {ApiError} `400` for timing, assignment or pending-send conflicts;
9106
- * `401`, `403` for plan/scope restrictions, `404` for document/contact/deployment availability.
8848
+ * `401`; `403` (`PlanRestricted`, `FreePlanSignerLimit` for a free workspace
8849
+ * above three signers, `InsufficientScope`); `404` for an unknown document
8850
+ * or contact.
9107
8851
  * @example
9108
8852
  * ```ts
9109
8853
  * const scheduled = await client.scheduledSends.createAssignment(document.id, {
@@ -9132,12 +8876,13 @@ declare class ScheduledSendResource extends BaseResource {
9132
8876
  * ```jsonc
9133
8877
  * { "resource": "scheduled_send", "id": "send-2", "type": "envelope",
9134
8878
  * "document_ids": ["doc-1", "doc-2"], "status": "pending", "send_at": "2026-12-01T12:00:00Z",
9135
- * "assignment_id": null, "envelope_id": null, "failure_reason": null,
9136
- * "created_at": "2026-11-24T12:00:00Z", "processed_at": null }
8879
+ * "next_attempt_at": null, "assignment_id": null, "envelope_id": null,
8880
+ * "failure_reason": null, "created_at": "2026-11-24T12:00:00Z", "processed_at": null }
9137
8881
  * ```
9138
8882
  * @throws {ValidationError} If the time or envelope request is malformed.
9139
8883
  * @throws {ApiError} `400` for timing or envelope/pending-send conflicts;
9140
- * `401`, `403` (`PlanRestricted`, `InsufficientScope`), `404`.
8884
+ * `401`; `403` (`PlanRestricted`, `FreePlanSignerLimit` for a free workspace
8885
+ * above three signers, `InsufficientScope`); `404`.
9141
8886
  * @example
9142
8887
  * ```ts
9143
8888
  * const scheduled = await client.scheduledSends.createEnvelope({
@@ -9162,9 +8907,9 @@ declare class ScheduledSendResource extends BaseResource {
9162
8907
  * @returns Requests and header-derived pagination:
9163
8908
  * ```jsonc
9164
8909
  * { "data": [{ "id": "send-1", "type": "assignment", "document_ids": ["doc-1"],
9165
- * "status": "sent", "send_at": "2026-12-01T12:00:00Z", "assignment_id": "assignment-1",
9166
- * "envelope_id": null, "failure_reason": null, "created_at": "2026-11-24T12:00:00Z",
9167
- * "processed_at": "2026-12-01T12:00:03Z" }],
8910
+ * "status": "sent", "send_at": "2026-12-01T12:00:00Z", "next_attempt_at": null,
8911
+ * "assignment_id": "assignment-1", "envelope_id": null, "failure_reason": null,
8912
+ * "created_at": "2026-11-24T12:00:00Z", "processed_at": "2026-12-01T12:00:03Z" }],
9168
8913
  * "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 } }
9169
8914
  * ```
9170
8915
  * @throws {ValidationError} If the workspace/filter is invalid.
@@ -9184,9 +8929,9 @@ declare class ScheduledSendResource extends BaseResource {
9184
8929
  * @returns The cancelled state:
9185
8930
  * ```jsonc
9186
8931
  * { "id": "send-1", "type": "assignment", "document_ids": ["doc-1"],
9187
- * "status": "cancelled", "send_at": "2026-12-01T12:00:00Z", "assignment_id": null,
9188
- * "envelope_id": null, "failure_reason": null, "created_at": "2026-11-24T12:00:00Z",
9189
- * "processed_at": "2026-11-24T12:05:00Z" }
8932
+ * "status": "cancelled", "send_at": "2026-12-01T12:00:00Z", "next_attempt_at": null,
8933
+ * "assignment_id": null, "envelope_id": null, "failure_reason": null,
8934
+ * "created_at": "2026-11-24T12:00:00Z", "processed_at": "2026-11-24T12:05:00Z" }
9190
8935
  * ```
9191
8936
  * @throws {ValidationError} If an ID is invalid.
9192
8937
  * @throws {ApiError} `401`, `403`, `404`, `409` if no longer pending.
@@ -9206,13 +8951,20 @@ declare class ScheduledSendResource extends BaseResource {
9206
8951
  * @returns The sent state and created assignment or envelope ID:
9207
8952
  * ```jsonc
9208
8953
  * { "id": "send-1", "type": "assignment", "document_ids": ["doc-1"],
9209
- * "status": "sent", "send_at": "2026-12-01T12:00:00Z", "assignment_id": "assignment-1",
9210
- * "envelope_id": null, "failure_reason": null, "created_at": "2026-11-24T12:00:00Z",
9211
- * "processed_at": "2026-11-24T13:00:00Z" }
8954
+ * "status": "sent", "send_at": "2026-12-01T12:00:00Z", "next_attempt_at": null,
8955
+ * "assignment_id": "assignment-1", "envelope_id": null, "failure_reason": null,
8956
+ * "created_at": "2026-11-24T12:00:00Z", "processed_at": "2026-11-24T13:00:00Z" }
9212
8957
  * ```
9213
8958
  * @throws {ValidationError} If an ID is invalid.
9214
- * @throws {ApiError} `400` for invalid requests/balances or departed members;
9215
- * `401`, `403`, `404`, `409` if no longer pending or `CreditCeilingExceeded`.
8959
+ * @throws {ApiError} `400` for invalid requests/balances or a departed
8960
+ * scheduling member; `401`; `403` (`PlanRestricted`, `FreePlanSignerLimit`
8961
+ * for a free workspace above three signers, `InsufficientScope`, or the
8962
+ * workspace's deletion pending); `404` for an unknown send, or when the
8963
+ * document an assignment sends no longer exists (the send stays pending);
8964
+ * `409` if no longer pending or `CreditCeilingExceeded`; `429`
8965
+ * (`FreePlanEmailLimit`) when the free plan's daily signer e-mail limit has
8966
+ * no room for the invitations now: `Retry-After` gives the seconds until it
8967
+ * has (often hours), and nothing is charged.
9216
8968
  * @example
9217
8969
  * ```ts
9218
8970
  * const sent = await client.scheduledSends.sendNow(scheduled.id);
@@ -9299,8 +9051,11 @@ declare class WebhookVerifier {
9299
9051
  */
9300
9052
  verify(payload: string | Buffer, signature: string): boolean;
9301
9053
  /**
9302
- * Parse the raw webhook body into a JSON object. Both the rich envelope and
9303
- * compatibility `{ type, data }` form are accepted.
9054
+ * Parse the raw webhook body into a JSON object. Assinafy sends the
9055
+ * `{ id, event, object, subject, payload, … }` envelope. Any other JSON
9056
+ * object, such as the deprecated `{ type, data }` form, is also returned
9057
+ * as is: Assinafy never sends that form, and it is accepted only so older
9058
+ * receivers and their test fixtures keep working.
9304
9059
  *
9305
9060
  * @param payload - Raw UTF-8 JSON request body.
9306
9061
  * @returns The object envelope, or `null` for malformed JSON, primitives,
@@ -9314,7 +9069,11 @@ declare class WebhookVerifier {
9314
9069
  */
9315
9070
  extractEvent(payload: string | Buffer): IWebhookPayload | null;
9316
9071
  /**
9317
- * Extract an event name from the current `event` or legacy `type` field.
9072
+ * Extract an event name from the `event` field.
9073
+ *
9074
+ * Deprecated fallback: when `event` is absent the legacy `type` field is
9075
+ * read. Assinafy never sends `type`; the fallback stays for backwards
9076
+ * compatibility.
9318
9077
  *
9319
9078
  * @param event - Parsed webhook envelope, or a nullable parse result.
9320
9079
  * @returns The event name, or `null` when neither field is a string.
@@ -9327,16 +9086,20 @@ declare class WebhookVerifier {
9327
9086
  */
9328
9087
  getEventType(event: IWebhookPayload | null | undefined): string | null;
9329
9088
  /**
9330
- * Extract the event-specific object, falling back to legacy `data`.
9089
+ * Extract the event-specific object from `event.object`.
9090
+ *
9091
+ * Deprecated fallback: when `object` is absent the legacy `data` field is
9092
+ * read. Assinafy never sends `data`; the fallback stays for backwards
9093
+ * compatibility.
9331
9094
  *
9332
9095
  * @param event - Parsed webhook envelope, or a nullable parse result.
9333
- * @returns `event.object`, then `event.data`, or an empty object when no
9334
- * object payload exists.
9096
+ * @returns `event.object`, then the deprecated `event.data`, or an empty
9097
+ * object when no object payload exists.
9335
9098
  *
9336
9099
  * @example
9337
9100
  * ```ts
9338
9101
  * const data = verifier.getEventData(event);
9339
- * console.log(data.document_id);
9102
+ * console.log(data.id); // the document, for document events
9340
9103
  * ```
9341
9104
  */
9342
9105
  getEventData(event: IWebhookPayload | null | undefined): Record<string, unknown>;
@@ -9387,7 +9150,6 @@ declare class AssinafyClient {
9387
9150
  readonly webhooks: WebhookResource;
9388
9151
  readonly templates: TemplateResource;
9389
9152
  readonly tags: TagResource;
9390
- readonly auth: AuthenticationResource;
9391
9153
  readonly oauth: OAuthResource;
9392
9154
  readonly fields: FieldsResource;
9393
9155
  readonly signerDocuments: SignerDocumentsResource;
@@ -9398,11 +9160,12 @@ declare class AssinafyClient {
9398
9160
  readonly scheduledSends: ScheduledSendResource;
9399
9161
  readonly webhookVerifier: WebhookVerifier;
9400
9162
  /**
9401
- * Create a client. Supply `apiKey` (preferred, sent as `X-Api-Key`) or a
9402
- * Bearer `token` for protected operations. Credentials are optional so the
9403
- * same client can drive public login, verification, OAuth-URL and
9404
- * signer-access-code flows; a protected request without credentials receives
9405
- * the API's normal `401` {@link ApiError}.
9163
+ * Create a client. Supply `apiKey` (sent as `X-Api-Key`) for your own
9164
+ * workspace, or an OAuth access `token` (sent as `Authorization: Bearer`)
9165
+ * for a workspace connected to your application. Credentials are optional
9166
+ * so the same client can drive public verification, OAuth and
9167
+ * signer-access-code flows; a protected request without credentials
9168
+ * receives the API's normal `401` {@link ApiError}.
9406
9169
  *
9407
9170
  * @param options - Credentials and configuration. `apiKey` or `token`
9408
9171
  * authenticates protected operations; `accountId` sets the default
@@ -9413,8 +9176,9 @@ declare class AssinafyClient {
9413
9176
  * {@link AssinafyClient.webhookVerifier}) and `logger` are optional.
9414
9177
  * Automatic retries cover `GET`, `HEAD`, `OPTIONS`, and `DELETE`, except
9415
9178
  * `GET /sign` because that read records a signer view. An
9416
- * `Idempotency-Key` opts advanced/custom requests into SDK replay only;
9417
- * confirm that the target route actually deduplicates that key first.
9179
+ * `Idempotency-Key` opts a `POST` into SDK replay (never a `PUT` or `PATCH`); confirm
9180
+ * that the target route deduplicates that key first. A `429` whose
9181
+ * `Retry-After` exceeds 30 s is thrown at once.
9418
9182
  *
9419
9183
  * @throws {ValidationError} If `timeout` / `maxRetries` is invalid or
9420
9184
  * `baseUrl` is not an absolute HTTP(S) URL.
@@ -9469,12 +9233,13 @@ declare class AssinafyClient {
9469
9233
  */
9470
9234
  static fromConfig(config: ClientConfigInput): AssinafyClient;
9471
9235
  /**
9472
- * Flagship helper: upload a PDF, ensure each signer exists, and open a
9236
+ * Flagship helper: upload a document (PDF, DOC, DOCX or ODT), ensure each
9237
+ * signer exists, and open a
9473
9238
  * **virtual** signature assignment — the whole "send this
9474
9239
  * document for signature" flow in a single call.
9475
9240
  *
9476
9241
  * Sequence of API calls:
9477
- * 1. `POST /accounts/{accountId}/documents` — upload the PDF
9242
+ * 1. `POST /accounts/{accountId}/documents` — upload the file
9478
9243
  * ({@link DocumentResource.upload}).
9479
9244
  * 2. For each signer, reuse an existing signer by email or
9480
9245
  * `POST /accounts/{accountId}/signers` to create one
@@ -9485,18 +9250,16 @@ declare class AssinafyClient {
9485
9250
  * processing finishes; otherwise return the upload response immediately.
9486
9251
  *
9487
9252
  * @param options - Workflow options.
9488
- * @param options.source - The PDF to upload, as a file path or in-memory
9253
+ * @param options.source - The PDF, DOC, DOCX or ODT file to upload, as a file path or in-memory
9489
9254
  * buffer (see {@link DocumentUploadSource}).
9490
9255
  * @param options.signers - Signers to request signatures from — at least one
9491
9256
  * is required. Each is `{ name, email?, whatsapp_phone_number? | phone?,
9492
- * cpf?, metadata? }`; a signer needs an email or a WhatsApp number to be
9257
+ * cpf? }`; a signer needs an email or a WhatsApp number to be
9493
9258
  * notified. Phone-only signers automatically use WhatsApp for verification
9494
9259
  * and notification, which requires a paid plan and incurs the channel cost;
9495
9260
  * signers with e-mail default to the e-mail channel.
9496
9261
  * @param options.message - Optional invitation message attached to the
9497
9262
  * assignment.
9498
- * @param options.metadata - Optional metadata attached to the uploaded
9499
- * document.
9500
9263
  * @param options.waitForReady - Wait for document processing before
9501
9264
  * returning. Defaults to `true`. Virtual assignments are created directly
9502
9265
  * from `uploaded`, `metadata_processing`, or `metadata_ready`, as allowed by
@@ -9507,9 +9270,7 @@ declare class AssinafyClient {
9507
9270
  * ends at 23:59 UTC; a date-time without an offset is interpreted as UTC;
9508
9271
  * an explicit offset is honored.
9509
9272
  * @param options.copyReceivers - Optional existing signer IDs (not email
9510
- * addresses) that receive a copy. See the caveat on
9511
- * {@link ICreateAssignmentPayload.copy_receivers}; some plans silently drop
9512
- * the field.
9273
+ * addresses) that receive a copy of the signed document.
9513
9274
  * @param options.accountId - Override the client's default account ID.
9514
9275
  * @returns `{ document, assignment, signer_ids }`. `document` is the
9515
9276
  * re-fetched {@link IDocumentDetailsResponse} when `waitForReady` (the
@@ -9519,29 +9280,29 @@ declare class AssinafyClient {
9519
9280
  * {
9520
9281
  * "document": {
9521
9282
  * "resource": "document",
9522
- * "id": "103ad216846e6b90710cb9acef59",
9283
+ * "id": "1000000000000000000000000001",
9523
9284
  * "name": "contract.pdf",
9524
9285
  * "status": "pending_signature", // re-fetched after assignment when waitForReady is true
9525
9286
  * "artifacts": { "original": "https://…", "thumbnail": "https://…" },
9526
- * "assignment": { "id": "1032c55c58bb00a8dc35db916751" }, // the just-created assignment (same as the top-level `assignment` below)
9287
+ * "assignment": { "id": "1000000000000000000000000002" }, // the just-created assignment (same as the top-level `assignment` below)
9527
9288
  * "pages": [
9528
- * { "id": "103ad216be62159d3087452d7cf8", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…" }
9289
+ * { "id": "1000000000000000000000000003", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…" }
9529
9290
  * ]
9530
9291
  * },
9531
9292
  * "assignment": {
9532
- * "id": "1032c55c58bb00a8dc35db916751",
9293
+ * "id": "1000000000000000000000000002",
9533
9294
  * "method": "virtual",
9534
9295
  * "sender_email": "sender@example.com",
9535
9296
  * "message": "Please sign the attached agreement.",
9536
9297
  * "expires_at": null,
9537
9298
  * "signers": [
9538
- * { "id": "1032becb82a279550bc3e5df9bbb", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
9299
+ * { "id": "1000000000000000000000000004", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
9539
9300
  * ],
9540
9301
  * "signing_urls": [
9541
- * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
9302
+ * { "signer_id": "1000000000000000000000000004", "url": "https://app.assinafy.com.br/sign/1000000000000000000000000001?email=ana%40example.com" }
9542
9303
  * ]
9543
9304
  * },
9544
- * "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
9305
+ * "signer_ids": ["1000000000000000000000000004"]
9545
9306
  * }
9546
9307
  * ```
9547
9308
  * This workflow is not transactional. If any post-upload step fails, its
@@ -9551,7 +9312,8 @@ declare class AssinafyClient {
9551
9312
  * before retrying. The SDK does not auto-delete successfully created data.
9552
9313
  *
9553
9314
  * @throws {ValidationError} If the workflow/options or a signer is invalid,
9554
- * the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
9315
+ * the upload is empty, an unsupported or mismatched file type, larger than
9316
+ * 25 MB, or `waitForReady` is
9555
9317
  * enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
9556
9318
  * timeout.
9557
9319
  * @throws {ApiError} If any underlying API call is rejected — see the
@@ -9578,7 +9340,6 @@ declare class AssinafyClient {
9578
9340
  source: DocumentUploadSource;
9579
9341
  signers: IUploadAndRequestSignaturesSigner[];
9580
9342
  message?: string;
9581
- metadata?: Record<string, unknown>;
9582
9343
  waitForReady?: boolean;
9583
9344
  waitOptions?: {
9584
9345
  maxWaitMs?: number;
@@ -9597,11 +9358,16 @@ declare class AssinafyClient {
9597
9358
  * and the HTTP 429 retry interceptor are already applied. Automatic retries
9598
9359
  * are limited to read-safe `GET`, `HEAD`, `OPTIONS`, and `DELETE` requests;
9599
9360
  * `GET /sign` is excluded because it records that the assignment was viewed.
9600
- * An `Idempotency-Key` opts a custom request into SDK replay only after the
9601
- * caller confirms that the target route deduplicates it server-side.
9361
+ * An `Idempotency-Key` opts a custom `POST` (never a `PUT` or `PATCH`) into SDK replay
9362
+ * only after the caller confirms that the target route deduplicates it.
9602
9363
  * Same-origin absolute URLs are supported; cross-origin requests are
9603
9364
  * rejected before dispatch, and credentials are removed from cross-origin
9604
- * redirects. Use a separate axios client for unrelated hosts.
9365
+ * redirects. These checks run after your interceptors under axios's default
9366
+ * interceptor ordering (the other ordering is refused). Only axios's `http`
9367
+ * adapter follows redirects automatically; any other adapter gets
9368
+ * `maxRedirects: 0`. An adapter function, a `transformRequest` function or an
9369
+ * interceptor that undoes an SDK refusal is your own transport code. Use a
9370
+ * separate axios client for unrelated hosts.
9605
9371
  *
9606
9372
  * @example
9607
9373
  * ```ts
@@ -9660,7 +9426,8 @@ declare function parseWwwAuthenticate(value: string | undefined): IAuthenticateC
9660
9426
  * Rate-limit state reported by the API's response headers.
9661
9427
  *
9662
9428
  * Every rate-limited response carries the `X-Rate-Limit-*` trio; a `429 Too
9663
- * Many Requests` adds `Retry-After`. Absent or non-numeric headers are left
9429
+ * Many Requests` adds `Retry-After`, as does a `503` while a signed document is
9430
+ * still being rendered. Absent or non-numeric headers are left
9664
9431
  * out rather than guessed.
9665
9432
  */
9666
9433
  interface IRateLimitInfo {
@@ -9670,7 +9437,7 @@ interface IRateLimitInfo {
9670
9437
  remaining?: number;
9671
9438
  /** `X-Rate-Limit-Reset` — seconds until the window resets. */
9672
9439
  reset?: number;
9673
- /** `Retry-After` — seconds to wait before retrying (sent on `429`). */
9440
+ /** `Retry-After` — seconds to wait before retrying (sent on `429` and some `503`). */
9674
9441
  retryAfter?: number;
9675
9442
  }
9676
9443
 
@@ -9705,11 +9472,23 @@ declare class ApiError extends AssinafyError {
9705
9472
  readonly responseData: unknown;
9706
9473
  /**
9707
9474
  * Machine-readable refusal code from the error body, on the refusals a
9708
- * client can act on: `PlanRestricted` (offer the upgrade, don't retry),
9709
- * `InsufficientScope`, `DocumentNotReady`, `CreditCeilingExceeded`,
9710
- * `IdempotencyKeyInUse`, `EnvelopeOpen`, `EnvelopeClosed`, `DocumentClosed`,
9711
- * `ContractChanged`, `NoContractTerms`, `TagInUse`, `embed_origins_missing`, ….
9712
- * `undefined` when the body has none.
9475
+ * client can act on. `undefined` when the body has none. Among them:
9476
+ *
9477
+ * - `400`: `SignerDataUnconfirmed`, `TermsNotAccepted`,
9478
+ * `EmailVerificationRequired`, `WhatsappVerificationRequired`,
9479
+ * `IdentityVerificationRequired`, `DigitalCertificateRequired` (the signer
9480
+ * still has a step to complete), `SignatureImageInvalid`,
9481
+ * `SignatureImageBlank`, `InvalidEmail`.
9482
+ * - `403`: `PlanRestricted` (offer the upgrade, don't retry),
9483
+ * `FreePlanSignerLimit` (a free workspace above three signers),
9484
+ * `FreeWorkspaceLimit`, `InsufficientScope`.
9485
+ * - `409`: `DocumentNotReady` (retry with backoff), `DocumentClosed` (it
9486
+ * won't reopen: don't retry), `CreditCeilingExceeded`,
9487
+ * `IdempotencyKeyInUse`, `EnvelopeOpen`, `EnvelopeClosed`,
9488
+ * `ContractChanged`, `NoContractTerms`, `SubscriptionChanged`, `TagInUse`.
9489
+ * - `429`: `FreePlanEmailLimit` (the free plan's daily signer e-mail limit;
9490
+ * `rateLimit.retryAfter` can be hours).
9491
+ * - `embed_origins_missing` and other lowercase codes on embed refusals.
9713
9492
  *
9714
9493
  * @example
9715
9494
  * ```ts
@@ -9748,14 +9527,19 @@ declare class ApiError extends AssinafyError {
9748
9527
  * Rate-limit headers carried by the failed response: `X-Rate-Limit-Limit`,
9749
9528
  * `X-Rate-Limit-Remaining`, `X-Rate-Limit-Reset` and, on `429`,
9750
9529
  * `Retry-After` (all in requests or seconds). `undefined` when the response
9751
- * carried none of them. The client already retries a `429` up to
9752
- * `maxRetries` times; this is what remains once those retries are spent.
9530
+ * carried none of them. The client retries a `429` up to `maxRetries`
9531
+ * times only on `GET`, `HEAD`, `OPTIONS`, `DELETE` and a `POST` with an
9532
+ * `Idempotency-Key`, and only when the server's wait fits the retry cap;
9533
+ * this is what remains otherwise.
9753
9534
  *
9754
9535
  * @example
9755
9536
  * ```ts
9756
9537
  * try {
9757
9538
  * await client.documents.list();
9758
9539
  * } catch (error) {
9540
+ * if (error instanceof ApiError && error.code === 'FreePlanEmailLimit') {
9541
+ * return scheduleLater(error.rateLimit?.retryAfter); // can be hours away
9542
+ * }
9759
9543
  * if (error instanceof ApiError && error.statusCode === 429) {
9760
9544
  * await sleep((error.rateLimit?.retryAfter ?? 60) * 1000);
9761
9545
  * }
@@ -9891,16 +9675,15 @@ declare class NetworkError extends AssinafyError {
9891
9675
  }
9892
9676
 
9893
9677
  /**
9894
- * Observed page-size cap for document and signer lists on older deployments.
9678
+ * Observed page-size cap for document and signer lists on older API versions.
9895
9679
  *
9896
9680
  * The API silently clamps `per-page` to this value rather than rejecting a
9897
9681
  * larger one, so a caller asking for 100 receives 50 and no error. Methods that
9898
9682
  * need "as many rows as one request can give" pin this instead of guessing.
9899
- * Production document activities have a documented maximum of 100 instead.
9900
9683
  */
9901
9684
  declare const MAX_LIST_PAGE_SIZE = 50;
9902
9685
 
9903
9686
  declare const SDK_USER_AGENT: string;
9904
9687
 
9905
- export { ApiError, AssignmentResource, AssinafyClient, AssinafyError, AuthenticationResource, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, DocumentResource, EmbedResource, EnvelopeResource, FieldsResource, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, OAuthError, OAuthResource, SDK_USER_AGENT, ScheduledSendResource, SignerDocumentsResource, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9906
- export type { AccountLogoUploadSource, AnyString, AssignmentDisplaySettings, AssignmentMethod, AssignmentNotificationMethod, AssignmentVerificationMethod, AssinafyClientOptions, ClientConfigInput, DocumentArtifactName, DocumentContractRelationType, DocumentContractStatus, DocumentStatsGranularity, DocumentStatus, DocumentUploadSource, IAcceptTermsResult, IAccountLimits, IAccountSigningFeatures, IAccountTheme, IAccountUsage, IAccountUsageBalance, IAddEnvelopeDocumentPayload, IApiFieldError, IApiKeyResponse, IAssignment, IAssignmentCostSigner, IAssignmentEntry, IAssignmentItem, IAssignmentListParams, IAssignmentListResponse, IAssignmentSigner, IAuthenticateChallenge, IAuthenticatedUser, ICertifiedCopyResendResult, IConfirmSignerDataPayload, IConfirmTotpPayload, ICostEstimate, ICreateAssignmentPayload, ICreateAssignmentResponse, ICreateDocumentFromTemplateOptions, ICreateEnvelopePayload, ICreateFieldPayload, ICreateSignerPayload, ICreateSignerResponse, ICreateTagPayload, ICreateWorkspacePayload, IDeleteTagResponse, IDetachDocumentTagResponse, IDisplaySettings, IDocumentActivity, IDocumentContract, IDocumentContractAmendment, IDocumentContractExternalReference, IDocumentContractInput, IDocumentContractListParams, IDocumentContractListResponse, IDocumentDetailsOptions, IDocumentDetailsResponse, IDocumentEnvelopeRef, IDocumentListItem, IDocumentListParams, IDocumentListResponse, IDocumentRenderOptions, IDocumentSearchParams, IDocumentStatsParams, IDocumentStatsRow, IDocumentStatusInfo, IDocumentUploadOptions, IDocumentUploadResponse, IDocumentVerification, IEmbedOrigin, IEmbedSession, IEnvelope, IEnvelopeActivity, IEnvelopeCancelResult, IEnvelopeDocument, IEnvelopeDocumentInput, IEnvelopeDocumentSigner, IEnvelopeListParams, IEnvelopeListResponse, IEnvelopeResendResponse, IEnvelopeSignerInput, IEstimateAssignmentCostPayload, IFieldDefinition, IFieldType, IFieldValidateMultipleEntry, IFieldValidationMultipleResult, IFieldValidationResponse, IFieldValidationResult, IInlineTag, ILegacyConfirmSignerDataPayload, ILegacyResendCostEstimate, ILegacyUploadSignatureOptions, IListParams, ILoginResponse, IMaskedApiKeyResponse, IMfaMethod, IMfaReauth, IMfaRecoveryCodes, IMfaStatus, INotificationHistoryEntry, INotificationPolicy, INotificationPreferences, IOAuthAuthorizationCallback, IOAuthAuthorizationRequest, IOAuthAuthorizationServerMetadata, IOAuthProtectedResourceMetadata, IOAuthTokenResponse, IOAuthUserInfo, IPage, IPaginatedResponse, IPublicDocumentInfo, IPushPreferences, IRateLimitInfo, IRenameDocumentResponse, IRenewDocumentContractPayload, IResendCostEstimate, IResendEmailResponse, IReviewIdentityVerificationPayload, IScheduleAssignmentPayload, IScheduleEnvelopePayload, IScheduledSend, IScheduledSendListParams, ISendTokenResult, ISignFieldEntry, ISigner, ISignerCapacity, ISignerCertifiedCopyStatus, ISignerDocumentListParams, ISignerIdentityReview, ISignerIdentityVerification, ISignerIdentityVerificationSession, ISignerListParams, ISignerListResponse, ISignerNotificationHistory, ISignerSelf, ISigningCurrentSigner, ISigningDocument, ISigningProgress, ISigningReadOptions, ISigningUrl, IStartIdentityVerificationPayload, ITag, ITemplateCostSigner, ITemplateDetailsResponse, ITemplateFieldPlacement, ITemplateListItem, ITemplateListParams, ITemplateListResponse, ITemplateRole, ITemplateSigner, ITerminateDocumentContractPayload, ITotpEnrollment, IUpdateEnvelopePayload, IUpdateFieldPayload, IUpdateNotificationPolicyPayload, IUpdateNotificationPreferences, IUpdatePushPreferences, IUpdateSignerPayload, IUpdateTagPayload, IUpdateTemplatePayload, IUpdateWorkspacePayload, IUploadAndRequestSignaturesResult, IUploadAndRequestSignaturesSigner, IUploadSignatureOptions, IWebhookDispatch, IWebhookDispatchListParams, IWebhookEndpoint, IWebhookEndpointCreatePayload, IWebhookEndpointCreateResponse, IWebhookEndpointSecret, IWebhookEndpointSecretRotation, IWebhookEndpointUpdatePayload, IWebhookEventTypeInfo, IWebhookPayload, IWebhookRegisterPayload, IWebhookSubscription, IWhatsAppNotification, IWorkspaceListItem, IWorkspaceListResponse, IWorkspaceResponse, IdentityVerificationImageName, IdentityVerificationStatus, Logger, NotificationPolicyEvent, NotificationSenderType, OAuthScope, PaginatedResult, PaginationMeta, PushPreferenceEvent, SendTokenChannel, SignatureImageType, SignerCapacity, SignerReference, WebhookDeliveryEventType, WebhookEventType, WebhookHeaders };
9688
+ export { ApiError, AssignmentResource, AssinafyClient, AssinafyError, ContractResource, DEFAULT_WEBHOOK_EVENTS, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, DocumentResource, EmbedResource, EnvelopeResource, FieldsResource, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, OAuthError, OAuthResource, SDK_USER_AGENT, ScheduledSendResource, SignerDocumentsResource, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
9689
+ export type { AccountLogoUploadSource, AnyString, AssignmentDisplaySettings, AssignmentMethod, AssignmentNotificationMethod, AssignmentVerificationMethod, AssinafyClientOptions, ClientConfigInput, DocumentArtifactName, DocumentContractRelationType, DocumentContractStatus, DocumentStatsGranularity, DocumentStatus, DocumentUploadSource, IAcceptTermsResult, IAccountLimits, IAccountSigningFeatures, IAccountTheme, IAccountUsage, IAccountUsageBalance, IAddEnvelopeDocumentPayload, IApiFieldError, IAssignment, IAssignmentCostSigner, IAssignmentEntry, IAssignmentItem, IAssignmentListParams, IAssignmentListResponse, IAssignmentSigner, IAuthenticateChallenge, IAuthenticatedUser, ICertifiedCopyResendResult, IConfirmSignerDataPayload, ICostEstimate, ICreateAssignmentPayload, ICreateAssignmentResponse, ICreateDocumentFromTemplateOptions, ICreateEnvelopePayload, ICreateFieldPayload, ICreateSignerPayload, ICreateSignerResponse, ICreateTagPayload, ICreateWorkspacePayload, IDeleteTagResponse, IDetachDocumentTagResponse, IDisplaySettings, IDocumentActivity, IDocumentContract, IDocumentContractAmendment, IDocumentContractExternalReference, IDocumentContractInput, IDocumentContractListParams, IDocumentContractListResponse, IDocumentDetailsOptions, IDocumentDetailsResponse, IDocumentEnvelopeRef, IDocumentListItem, IDocumentListParams, IDocumentListResponse, IDocumentRenderOptions, IDocumentSearchParams, IDocumentStatsParams, IDocumentStatsRow, IDocumentStatusInfo, IDocumentUploadOptions, IDocumentUploadResponse, IDocumentVerification, IEmbedOrigin, IEmbedSession, IEnvelope, IEnvelopeActivity, IEnvelopeCancelResult, IEnvelopeDocument, IEnvelopeDocumentInput, IEnvelopeDocumentSigner, IEnvelopeListParams, IEnvelopeListResponse, IEnvelopeResendResponse, IEnvelopeSignerInput, IEstimateAssignmentCostPayload, IFieldDefinition, IFieldType, IFieldValidateMultipleEntry, IFieldValidationMultipleResult, IFieldValidationResponse, IInlineTag, IListParams, INotificationHistoryEntry, INotificationPolicy, INotificationPreferences, IOAuthAuthorizationCallback, IOAuthAuthorizationRequest, IOAuthAuthorizationServerMetadata, IOAuthProtectedResourceMetadata, IOAuthTokenResponse, IOAuthUserInfo, IPage, IPublicDocumentInfo, IPushPreferences, IRateLimitInfo, IRenameDocumentResponse, IRenewDocumentContractPayload, IResendCostEstimate, IResendEmailResponse, IReviewIdentityVerificationPayload, IScheduleAssignmentPayload, IScheduleEnvelopePayload, IScheduledSend, IScheduledSendListParams, ISendTokenResult, ISignFieldEntry, ISigner, ISignerCapacity, ISignerCertifiedCopyStatus, ISignerDocumentListParams, ISignerIdentityReview, ISignerIdentityVerification, ISignerIdentityVerificationSession, ISignerListParams, ISignerListResponse, ISignerNotificationHistory, ISignerSelf, ISigningCurrentSigner, ISigningDocument, ISigningProgress, ISigningReadOptions, ISigningUrl, IStartIdentityVerificationPayload, ITag, ITemplateCostSigner, ITemplateDetailsResponse, ITemplateFieldPlacement, ITemplateListItem, ITemplateListParams, ITemplateListResponse, ITemplateRole, ITemplateSigner, ITerminateDocumentContractPayload, IUpdateEnvelopePayload, IUpdateFieldPayload, IUpdateNotificationPolicyPayload, IUpdateNotificationPreferences, IUpdatePushPreferences, IUpdateSignerPayload, IUpdateTagPayload, IUpdateTemplatePayload, IUpdateWorkspacePayload, IUploadAndRequestSignaturesResult, IUploadAndRequestSignaturesSigner, IUploadSignatureOptions, IWebhookDispatch, IWebhookDispatchListParams, IWebhookEndpoint, IWebhookEndpointCreatePayload, IWebhookEndpointCreateResponse, IWebhookEndpointSecret, IWebhookEndpointSecretRotation, IWebhookEndpointUpdatePayload, IWebhookEventTypeInfo, IWebhookPayload, IWebhookRegisterPayload, IWebhookSubscription, IWhatsAppNotification, IWorkspaceListItem, IWorkspaceListResponse, IWorkspaceResponse, IdentityVerificationImageName, IdentityVerificationStatus, Logger, NotificationPolicyEvent, NotificationSenderType, OAuthScope, PaginatedResult, PaginationMeta, PushPreferenceEvent, SignatureImageType, SignerCapacity, SignerReference, WebhookDeliveryEventType, WebhookEventType, WebhookHeaders };