@assinafy/sdk 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance, AxiosResponse } from 'axios';
2
2
 
3
3
  /** Document lifecycle states emitted by the API. */
4
- type DocumentStatus = 'uploading' | 'uploaded' | 'metadata_processing' | 'metadata_ready' | 'pending_signature' | 'expired' | 'certificating' | 'certificated' | 'rejected_by_signer' | 'rejected_by_user' | 'failed';
4
+ type DocumentStatus = 'uploading' | 'uploaded' | 'metadata_processing' | 'metadata_ready' | 'pending_signature' | 'pending_identity_review' | 'expired' | 'certificating' | 'certificated' | 'rejected_by_signer' | 'rejected_by_user' | 'failed';
5
5
  /** Artifact names available for document download. */
6
6
  type DocumentArtifactName = 'original' | 'certificated' | 'certificate-page' | 'pades' | 'bundle';
7
7
  /** Server-defined signature image category, with known values suggested. */
@@ -29,7 +29,8 @@ type AssignmentMethod = 'virtual' | 'collect';
29
29
  * | --- | --- | --- | --- |
30
30
  * | `Email` | One-time code sent by e-mail (the default). | An `email`. | 0 credits |
31
31
  * | `Whatsapp` | One-time code sent over WhatsApp. | A `whatsapp_phone_number`; paid plan. | 0.45 credits |
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. | Digital Certificate feature (Standard/Pro); `government_id` (CPF, or CNPJ naming the signer as legal representative); the signer must be alone in their signing step. | 2 credits + notification |
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. | Digital Certificate feature (Standard/Pro); `government_id`; the signer must be alone in their signing step. | 0.5 credits + notification |
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. |
33
34
  *
34
35
  * A1 and A3 are certificate *media*, chosen by the signer in their browser at
35
36
  * signing time. The API models both as the single `DigitalCertificate` value —
@@ -39,13 +40,89 @@ type AssignmentMethod = 'virtual' | 'collect';
39
40
  * Verification is coupled to {@link AssignmentNotificationMethod}: the
40
41
  * verification code travels on the notification channel, so `Email` pairs only
41
42
  * with `Email` and `Whatsapp` only with `Whatsapp`. `DigitalCertificate`
42
- * carries no code and may be announced over either channel. The SDK rejects an
43
+ * and `IdDocumentFaceMatchBasic` carry no OTP and may be announced over either
44
+ * channel. The SDK rejects an
43
45
  * invalid pairing before the request; the API answers `400`.
44
46
  *
45
47
  * Send neither field to get `Email`/`Email`; send one and the other is
46
48
  * inferred from it.
47
49
  */
48
- type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate';
50
+ type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate' | 'IdDocumentFaceMatchBasic';
51
+ /** Provider session state; `InReview` permits signing but holds certification. */
52
+ type IdentityVerificationStatus = 'Pending' | 'InReview' | 'Approved' | 'Declined' | 'Expired' | 'Abandoned';
53
+ /** Evidence names accepted by the account review image endpoint. */
54
+ type IdentityVerificationImageName = 'document_front' | 'document_back' | 'document_pdf' | 'face';
55
+ /** Signer-facing identity verification state, including an optional live capture link. */
56
+ interface ISignerIdentityVerification {
57
+ /** True before a session exists or when the last session is Expired. */
58
+ can_start: boolean;
59
+ status: IdentityVerificationStatus | AnyString | null;
60
+ /** Bearer link: preserve its fragment, never log it or persist it in browser storage. */
61
+ url: string | null;
62
+ /** Capture-link expiry, not a deadline for processing or account review. */
63
+ expires_at: string | null;
64
+ completed_at: string | null;
65
+ }
66
+ /** Explicit biometric-processing consent; never infer it from another action. */
67
+ interface IStartIdentityVerificationPayload {
68
+ consent: true;
69
+ }
70
+ /** A newly opened identity verification provider session. */
71
+ interface ISignerIdentityVerificationSession {
72
+ id: string;
73
+ /** Open as-is, including any fragment; treat it as a credential. */
74
+ url: string;
75
+ expires_at: string | null;
76
+ }
77
+ /** Account review decision. Rejection cancels the document and notifies its recipients. */
78
+ interface IReviewIdentityVerificationPayload {
79
+ decision: 'Approved' | 'Rejected';
80
+ /** Up to 2000 characters; recorded in activity and sent to the provider, hidden from signers. */
81
+ note?: string | null;
82
+ }
83
+ /** Account-visible identity review summary; contains no image bytes or biometrics. */
84
+ interface ISignerIdentityReview {
85
+ id: string;
86
+ status: IdentityVerificationStatus | AnyString;
87
+ provider: 'AssinafyVerify' | AnyString;
88
+ verification_method: 'IdDocumentFaceMatchBasic' | AnyString;
89
+ reason_codes: Array<{
90
+ code: string;
91
+ description: string;
92
+ }>;
93
+ evidence_available: boolean;
94
+ expected: {
95
+ name: string | null;
96
+ cpf: string | null;
97
+ } | null;
98
+ document: {
99
+ type: string | null;
100
+ name: string | null;
101
+ cpf: string | null;
102
+ } | null;
103
+ matches: {
104
+ cpf: boolean | null;
105
+ name: number | null;
106
+ birth_date: boolean | null;
107
+ } | null;
108
+ checks: Array<{
109
+ name: string;
110
+ result: string;
111
+ score: number | null;
112
+ reasons: string[];
113
+ }>;
114
+ /** Evidence available only while `InReview`; empty after the decision. */
115
+ images: IdentityVerificationImageName[];
116
+ ruleset_version: string | null;
117
+ evidence_sha256: string | null;
118
+ reviewed_by: {
119
+ id: string;
120
+ name: string;
121
+ } | null;
122
+ reviewed_at: string | null;
123
+ review_note: string | null;
124
+ completed_at: string | null;
125
+ }
49
126
  /**
50
127
  * How the signing invitation reaches the signer. Exactly one per signer.
51
128
  *
@@ -163,6 +240,8 @@ interface ISigner {
163
240
  }
164
241
  /** Signer profile returned by the signer-code-authenticated `GET /signers/self`. */
165
242
  interface ISignerSelf extends ISigner {
243
+ /** Available before verification so the signing UI can select OTP, certificate or identity capture. */
244
+ verification_method?: AssignmentVerificationMethod | AnyString;
166
245
  /** Optional for compatibility with deployments that omit this field. */
167
246
  has_signature?: boolean;
168
247
  /** Optional for compatibility with deployments that omit this field. */
@@ -324,6 +403,8 @@ interface IEstimateAssignmentCostPayload {
324
403
  }
325
404
  /** A signer as embedded inside an assignment (richer than the bare {@link ISigner}). */
326
405
  interface IAssignmentSigner extends ISigner {
406
+ /** `InReview` requires an account decision before document certification. */
407
+ identity_verification_status?: IdentityVerificationStatus | AnyString | null;
327
408
  /** Only present in account-owner contexts; omitted from signer-code responses. */
328
409
  completed?: boolean | null;
329
410
  /** Optional because some deployments omit notification history. */
@@ -464,7 +545,7 @@ interface IWebhookPayload {
464
545
  [key: string]: unknown;
465
546
  }
466
547
  /** Known webhook event names. */
467
- 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_signed_document' | 'signer_rejected_document' | 'user_rejected_document' | 'document_processing_failed' | 'template_created' | 'template_processed' | 'template_processing_failed';
548
+ 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';
468
549
  /** Document listing item (paginated). */
469
550
  interface IDocumentListItem {
470
551
  id: string;
@@ -786,6 +867,11 @@ interface IWebhookEndpoint {
786
867
  /** ISO-8601 UTC timestamp. */
787
868
  updated_at: string;
788
869
  }
870
+ /** Endpoint creation also returns the signing secret when signing is enabled. */
871
+ interface IWebhookEndpointCreateResponse extends IWebhookEndpoint {
872
+ /** Store securely at creation: OAuth applications cannot read or rotate this later. */
873
+ secret?: string;
874
+ }
789
875
  /** An endpoint's Standard Webhooks signing secret. */
790
876
  interface IWebhookEndpointSecret {
791
877
  /** `whsec_` followed by the base64-encoded key. */
@@ -868,6 +954,8 @@ interface IUpdateTemplatePayload {
868
954
  }
869
955
  /** Template list item (paginated). */
870
956
  interface ITemplateListItem {
957
+ /** Always `template`. */
958
+ resource?: string;
871
959
  id: string;
872
960
  name: string;
873
961
  document_name?: string | null;
@@ -1024,8 +1112,33 @@ interface IDocumentVerification {
1024
1112
  is_valid: boolean;
1025
1113
  message: string;
1026
1114
  }
1027
- /** Channel accepted by the `send-token` endpoint. */
1028
- type SendTokenChannel = 'email' | 'whatsapp' | AnyString;
1115
+ /** Channel accepted by the `send-token` endpoint; the contract allows only `email`. */
1116
+ type SendTokenChannel = 'email';
1117
+ /**
1118
+ * `data` returned by `PUT /public/documents/{documentId}/send-token`.
1119
+ *
1120
+ * ```jsonc
1121
+ * {
1122
+ * "document": { "resource": "document", "id": "a1b2…", "name": "Contract.pdf", "page_count": 3, "created_by": "Jane Doe" },
1123
+ * "channel": "email",
1124
+ * "recipient": "signer@example.com"
1125
+ * }
1126
+ * ```
1127
+ */
1128
+ interface ISendTokenResult {
1129
+ /** Summary of the document the token unlocks. */
1130
+ document: {
1131
+ resource: string;
1132
+ id: string;
1133
+ name: string;
1134
+ page_count: number;
1135
+ created_by: string;
1136
+ };
1137
+ /** Channel the token was sent through. */
1138
+ channel: string;
1139
+ /** Address the token was sent to. */
1140
+ recipient: string;
1141
+ }
1029
1142
  /** Authenticated user profile returned by login and `users.getCurrent()`. */
1030
1143
  interface IAuthenticatedUser {
1031
1144
  id: string;
@@ -1365,6 +1478,12 @@ interface IOAuthTokenResponse {
1365
1478
  scope?: string;
1366
1479
  /** Signed OIDC identity token (RS256). Present only when `openid` was granted. */
1367
1480
  id_token?: string | null;
1481
+ /**
1482
+ * RFC 8693 token type. Returned only by the token-exchange grant, which is
1483
+ * reserved for Assinafy's own services; absent from the two grants the SDK
1484
+ * sends.
1485
+ */
1486
+ issued_token_type?: string;
1368
1487
  }
1369
1488
  /** OpenID Connect claims returned by `GET /oauth/userinfo`. */
1370
1489
  interface IOAuthUserInfo {
@@ -1479,6 +1598,9 @@ declare class DocumentResource extends BaseResource {
1479
1598
  *
1480
1599
  * @param source - The PDF to upload, as a file path or an in-memory buffer.
1481
1600
  * @param options - Display name, metadata, and account override.
1601
+ * @param options.name - Multipart filename override; the API derives the display name from it.
1602
+ * @param options.metadata - JSON metadata (compatibility multipart part).
1603
+ * @param options.accountId - Override the client's default workspace.
1482
1604
  * @returns The created document, freshly uploaded (`status: 'uploaded'`,
1483
1605
  * empty `pages` until `metadata_ready`). Response shape:
1484
1606
  * ```jsonc
@@ -1572,7 +1694,7 @@ declare class DocumentResource extends BaseResource {
1572
1694
  * method: 'virtual',
1573
1695
  * 'per-page': 50,
1574
1696
  * });
1575
- * console.log(data[0]?.pages.length, meta?.total);
1697
+ * console.log(data[0]?.pages?.length, meta?.total);
1576
1698
  * ```
1577
1699
  */
1578
1700
  list(params?: IDocumentListParams, accountId?: string): Promise<IDocumentListResponse>;
@@ -1743,7 +1865,8 @@ declare class DocumentResource extends BaseResource {
1743
1865
  get(documentId: string): Promise<IDocumentDetailsResponse>;
1744
1866
  /**
1745
1867
  * Poll {@link DocumentResource.details} until the document reaches a ready
1746
- * status (`metadata_ready`, `pending_signature`, or `certificated`),
1868
+ * status (`metadata_ready`, `pending_signature`, `pending_identity_review`,
1869
+ * or `certificated`),
1747
1870
  * throwing on a terminal failure status or timeout.
1748
1871
  *
1749
1872
  * Transient errors are tolerated — a `5xx` or `429` is retried on the next
@@ -1753,6 +1876,8 @@ declare class DocumentResource extends BaseResource {
1753
1876
  * @param documentId - The document to wait on.
1754
1877
  * @param options - `maxWaitMs` (default `30_000`) and `pollIntervalMs`
1755
1878
  * (default `2_000`).
1879
+ * @param options.maxWaitMs - Finite non-negative wait budget in milliseconds; default `30_000`.
1880
+ * @param options.pollIntervalMs - Finite positive polling interval in milliseconds; default `2_000`.
1756
1881
  * @returns The document details once it reaches a ready status (see
1757
1882
  * {@link DocumentResource.details} for the shape).
1758
1883
  * @throws {ValidationError} If `documentId` is missing, the document enters
@@ -1933,6 +2058,9 @@ declare class DocumentResource extends BaseResource {
1933
2058
  * names are not portable identifiers and should not be used here. This
1934
2059
  * overwrites the existing set — use
1935
2060
  * {@link DocumentResource.addTags} to append.
2061
+ * Older sandbox deployments interpret these strings as names and create
2062
+ * ID-named tags for ID inputs; pass existing names intentionally there.
2063
+ * Strings are sent unchanged. See `docs/COMPATIBILITY.md` for this variant.
1936
2064
  *
1937
2065
  * Request body (`application/json`):
1938
2066
  * ```jsonc
@@ -1971,6 +2099,8 @@ declare class DocumentResource extends BaseResource {
1971
2099
  * `tags` is a non-empty array of tag **IDs**. Attaching an ID already
1972
2100
  * present is a no-op. To replace the whole set instead, use
1973
2101
  * {@link DocumentResource.replaceTags}.
2102
+ * On older name-based sandbox deployments, pass existing tag names
2103
+ * intentionally; ID inputs create ID-named tags. No automatic remapping occurs.
1974
2104
  *
1975
2105
  * Request body (`application/json`):
1976
2106
  * ```jsonc
@@ -2067,10 +2197,17 @@ declare class DocumentResource extends BaseResource {
2067
2197
  * plus optional `verification_method`, `notification_methods`, `step`).
2068
2198
  * Only one notification method is allowed per signer; when only one of the
2069
2199
  * verification/notification fields is supplied, the API infers the other.
2070
- * `DigitalCertificate` costs two credits, requires the feature plus a
2200
+ * `DigitalCertificate` costs 0.5 credits, requires the feature plus a
2071
2201
  * signer `government_id`, and that signer must be alone in its step.
2202
+ * `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
2203
+ * and a valid CPF in `government_id`; estimate the per-signer fee first.
2072
2204
  * @param options - Optional `name`, `message`, `expires_at`,
2073
2205
  * `editor_fields`, `tags`.
2206
+ * @param options.name - Generated document display name.
2207
+ * @param options.message - Signing invitation message.
2208
+ * @param options.expires_at - ISO-8601 signature deadline.
2209
+ * @param options.editor_fields - Template editor values as `{ field_id, value }` entries.
2210
+ * @param options.tags - Tag names attached to the generated document.
2074
2211
  * @param accountId - Override the client's default account ID.
2075
2212
  * @returns The created document (an {@link IDocumentDetailsResponse} with
2076
2213
  * `template_id` set and its `assignment` populated):
@@ -2111,7 +2248,7 @@ declare class DocumentResource extends BaseResource {
2111
2248
  *
2112
2249
  * A dry run: sends only `{ signers }` and consumes nothing. Use it to check
2113
2250
  * balances before calling {@link DocumentResource.createFromTemplate}.
2114
- * `DigitalCertificate` adds two credits per signer and has the same feature,
2251
+ * `DigitalCertificate` adds 0.5 credits per signer and has the same feature,
2115
2252
  * `government_id`, and signing-step prerequisites as document creation.
2116
2253
  *
2117
2254
  * Request body (`application/json`):
@@ -2274,55 +2411,48 @@ declare class DocumentResource extends BaseResource {
2274
2411
  */
2275
2412
  getPublic(documentId: string): Promise<IPublicDocumentInfo>;
2276
2413
  /**
2277
- * Send the signer's access token to their email
2414
+ * Email the signer the verification token that unlocks a document
2278
2415
  * (`PUT /public/documents/{documentId}/send-token`).
2279
2416
  *
2280
2417
  * Part of the public signing flow: dispatches the 6-digit verification
2281
- * token the signer enters to view the document. The documented request body
2282
- * is `{ recipient, channel }` with `channel` set to `email`. This
2283
- * two-argument form sends the legacy `{ email }` shape, which current
2284
- * deployments still accept, and retries the documented shape only when the
2285
- * server explicitly reports that `channel`/`recipient` is required. Use the
2286
- * three-argument overload to send the documented shape directly.
2418
+ * token the signer enters to view the document. Runs on the
2419
+ * credential-free transport. The contract accepts only the `email`
2420
+ * channel, and both body fields are required.
2287
2421
  *
2288
2422
  * Request body (`application/json`):
2289
2423
  * ```jsonc
2290
- * { "email": "signer@example.com" }
2291
- * ```
2292
- * Documented body, sent on the explicit-channel overload or on retry:
2293
- * ```jsonc
2294
- * { "recipient": "signer@example.com", "channel": "email" }
2424
+ * { "channel": "email", "recipient": "signer@example.com" }
2295
2425
  * ```
2296
2426
  *
2297
2427
  * @param documentId - The document to send the token for.
2298
- * @param email - The signer's email address.
2299
- * @returns Nothing after the API's empty acknowledgement.
2300
- * @throws {ValidationError} If `documentId` is missing or `email` is not a
2301
- * valid email address.
2302
- * @throws {ApiError} If the API rejects the request.
2303
- *
2304
- * @example
2305
- * ```ts
2306
- * await client.documents.sendToken('doc-1', 'signer@example.com');
2428
+ * @param recipient - The signer's email address.
2429
+ * @param channel - Delivery channel; only `email` is accepted (default).
2430
+ * @returns The delivery confirmation (`data` of the envelope):
2431
+ * ```jsonc
2432
+ * {
2433
+ * "document": {
2434
+ * "resource": "document",
2435
+ * "id": "a1b2c3d4e5f6a7b8c9d0",
2436
+ * "name": "Contract.pdf",
2437
+ * "page_count": 3,
2438
+ * "created_by": "Jane Doe"
2439
+ * },
2440
+ * "channel": "email",
2441
+ * "recipient": "signer@example.com"
2442
+ * }
2307
2443
  * ```
2308
- */
2309
- sendToken(documentId: string, email: string): Promise<void>;
2310
- /**
2311
- * Send a signing token through an explicit channel
2312
- * (`PUT /public/documents/{documentId}/send-token`).
2313
- * Sends JSON `{ "recipient": "+5511999998888", "channel": "whatsapp" }`.
2314
- * @param documentId - Document identifier.
2315
- * @param recipient - Controlled email address or WhatsApp number.
2316
- * @param channel - Delivery channel, `email` or `whatsapp`.
2317
- * @returns Nothing; the acknowledgement body is discarded.
2318
- * @throws {ValidationError} If an argument is empty.
2319
- * @throws {ApiError} If delivery is rejected.
2444
+ * @throws {ValidationError} If `documentId` is missing, `recipient` is not
2445
+ * a valid email address, or `channel` is not `email`.
2446
+ * @throws {ApiError} `400` if validation fails; `404` if the document does
2447
+ * not exist.
2448
+ *
2320
2449
  * @example
2321
2450
  * ```ts
2322
- * await client.documents.sendToken('doc-1', 'signer@example.com', 'email');
2451
+ * const sent = await client.documents.sendToken('doc-1', 'signer@example.com');
2452
+ * console.log(sent.recipient);
2323
2453
  * ```
2324
2454
  */
2325
- sendToken(documentId: string, recipient: string, channel: SendTokenChannel): Promise<void>;
2455
+ sendToken(documentId: string, recipient: string, channel?: SendTokenChannel): Promise<ISendTokenResult>;
2326
2456
  /**
2327
2457
  * Quick boolean check (`GET /documents/{documentId}`): has every signer
2328
2458
  * completed their assignment?
@@ -2570,9 +2700,8 @@ declare class SignerResource extends BaseResource {
2570
2700
  * re-filtered here for an exact, case-insensitive email match.
2571
2701
  *
2572
2702
  * Page size is pinned to {@link MAX_LIST_PAGE_SIZE}, the largest page the
2573
- * server actually returns. An exact address realistically matches one
2574
- * signer, but a search term that matched more than that could in principle
2575
- * miss one — the API exposes no exact-email filter to rule that out.
2703
+ * server actually returns. Pages are searched until an exact match is found
2704
+ * or the result set ends, so substring matches cannot hide an existing signer.
2576
2705
  *
2577
2706
  * A `404` from the underlying list is treated as "no match" and mapped to
2578
2707
  * `null`; any other {@link ApiError} propagates.
@@ -2821,6 +2950,8 @@ declare class WorkspaceResource extends BaseResource {
2821
2950
  * @param accountId - Account to aggregate.
2822
2951
  * @param params - Omit for 12 monthly rows, or request daily rows with
2823
2952
  * `{ granularity: 'daily', month: '2026-06' }`.
2953
+ * @param params.granularity - `monthly` (default) or `daily`.
2954
+ * @param params.month - Month in `YYYY-MM` format; required for daily rows.
2824
2955
  * @returns Zero-filled KPI rows:
2825
2956
  * ```jsonc
2826
2957
  * [{
@@ -2920,6 +3051,7 @@ declare class WorkspaceResource extends BaseResource {
2920
3051
  * @param accountId - The workspace to delete.
2921
3052
  * @param options - Set `force: true` to cancel an active paid subscription
2922
3053
  * and proceed with deletion.
3054
+ * @param options.force - Cancel an active subscription and bypass deletion restrictions.
2923
3055
  * @returns Nothing on success (`200` with no meaningful body).
2924
3056
  * @throws {ValidationError} If `accountId` is missing.
2925
3057
  * @throws {ApiError} `400` (with a `restrictions` list) when the workspace
@@ -3061,8 +3193,10 @@ declare class AssignmentResource extends BaseResource {
3061
3193
  * {@link buildAssignmentPayload}. A `virtual` assignment may be created at
3062
3194
  * `uploaded`, `metadata_processing`, or `metadata_ready` and is promoted
3063
3195
  * automatically; `collect` requires rendered pages at `metadata_ready`.
3064
- * `DigitalCertificate` costs two credits, requires the feature plus a
3196
+ * `DigitalCertificate` costs 0.5 credits, requires the feature plus a
3065
3197
  * signer `government_id`, and that signer must be alone in its step.
3198
+ * `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
3199
+ * and a valid CPF in the signer's `government_id`; estimate its fee first.
3066
3200
  *
3067
3201
  * Request body (`application/json`):
3068
3202
  * ```jsonc
@@ -3183,7 +3317,7 @@ declare class AssignmentResource extends BaseResource {
3183
3317
  * only `verification_method` / `notification_methods` (or `{}` for the
3184
3318
  * default Email channel). {@link buildAssignmentEstimatePayload} projects
3185
3319
  * exactly the fields permitted by the estimate schema.
3186
- * `DigitalCertificate` is priced at two credits per signer and remains
3320
+ * `DigitalCertificate` is priced at 0.5 credits per signer and remains
3187
3321
  * subject to the feature, identity, and one-signer-per-step requirements.
3188
3322
  * Current documented unit prices are 1 credit for an extra document, 0 for
3189
3323
  * email notification, and 0.45 for WhatsApp notification; a digital
@@ -3410,6 +3544,116 @@ declare class AssignmentResource extends BaseResource {
3410
3544
  * ```
3411
3545
  */
3412
3546
  listWhatsAppNotifications(documentId: string, assignmentId: string): Promise<IWhatsAppNotification[]>;
3547
+ /**
3548
+ * Read the account's signer identity review
3549
+ * (`GET /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification`).
3550
+ *
3551
+ * No request body. `InReview` lets the signer continue signing but holds
3552
+ * certification. Evidence is a summary without images or biometrics; a
3553
+ * directly approved verification exposes evidence on its activity instead.
3554
+ *
3555
+ * @param documentId - Document owning the assignment.
3556
+ * @param assignmentId - Assignment containing the signer.
3557
+ * @param signerId - Signer whose identity is under review.
3558
+ * @returns The complete review summary:
3559
+ * ```jsonc
3560
+ * {
3561
+ * "id": "verification_example", "status": "InReview",
3562
+ * "provider": "AssinafyVerify", "verification_method": "IdDocumentFaceMatchBasic",
3563
+ * "reason_codes": [{ "code": "NAME_MISMATCH", "description": "Name differs" }],
3564
+ * "evidence_available": true,
3565
+ * "expected": { "name": "Example Signer", "cpf": null },
3566
+ * "document": { "type": "CNH", "name": "EXAMPLE SIGNER", "cpf": null },
3567
+ * "matches": { "cpf": null, "name": 0.52, "birth_date": null },
3568
+ * "checks": [{ "name": "name", "result": "review", "score": 0.52, "reasons": ["NAME_MISMATCH"] }],
3569
+ * "images": ["document_front", "face"], // available only while InReview
3570
+ * "ruleset_version": "2026-10-12.2", "evidence_sha256": null,
3571
+ * "reviewed_by": null, "reviewed_at": null, "review_note": null, "completed_at": null
3572
+ * }
3573
+ * ```
3574
+ * @throws {ValidationError} If any ID is blank or invalid for a URL.
3575
+ * @throws {ApiError} `401` for invalid credentials; `404` for an unknown
3576
+ * assignment, signer or verification; `500` for a server failure.
3577
+ * @example
3578
+ * ```ts
3579
+ * const review = await client.assignments.getIdentityVerification('doc-1', 'asg-1', 'signer-1');
3580
+ * console.log(review.status, review.images.length);
3581
+ * ```
3582
+ */
3583
+ getIdentityVerification(documentId: string, assignmentId: string, signerId: string): Promise<ISignerIdentityReview>;
3584
+ /**
3585
+ * Download identity review evidence
3586
+ * (`GET /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}`).
3587
+ *
3588
+ * No request body. The provider supplies the bytes on each request; Assinafy
3589
+ * never stores them. Available only while the review is open. Keep these
3590
+ * sensitive bytes out of caches and logs (`Cache-Control: no-store`).
3591
+ *
3592
+ * @param documentId - Document owning the assignment.
3593
+ * @param assignmentId - Assignment containing the signer.
3594
+ * @param signerId - Signer whose evidence to view.
3595
+ * @param name - One of the review's `images`: `document_front`,
3596
+ * `document_back`, `document_pdf`, or `face`.
3597
+ * @returns Raw JPEG, PNG or PDF bytes as a `Buffer`.
3598
+ * @throws {ValidationError} If an ID or image name is invalid.
3599
+ * @throws {ApiError} `401` for invalid credentials; `404` for absent evidence
3600
+ * or a decided review; `500` for a provider/server failure.
3601
+ * @example
3602
+ * ```ts
3603
+ * const bytes = await client.assignments.downloadIdentityVerificationImage('doc-1', 'asg-1', 'signer-1', 'face');
3604
+ * ```
3605
+ */
3606
+ downloadIdentityVerificationImage(documentId: string, assignmentId: string, signerId: string, name: IdentityVerificationImageName): Promise<Buffer>;
3607
+ /**
3608
+ * Decide a signer identity review
3609
+ * (`POST /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review`).
3610
+ *
3611
+ * Requires `InReview` and a document at `pending_signature` or
3612
+ * `pending_identity_review`. Approval allows certification once all signers
3613
+ * sign and every review is approved. Rejection cancels the document as
3614
+ * `rejected_by_user` and sends cancellation notices to signers and copy
3615
+ * receivers. The note is hidden from them; the provider receives the decision.
3616
+ *
3617
+ * Request body (`application/json`):
3618
+ * ```jsonc
3619
+ * { "decision": "Approved", "note": "Verified independently." }
3620
+ * ```
3621
+ * @param documentId - Document owning the assignment.
3622
+ * @param assignmentId - Assignment containing the signer.
3623
+ * @param signerId - Signer whose review to decide.
3624
+ * @param payload - Explicit account review decision.
3625
+ * @param payload.decision - `Approved` or `Rejected`.
3626
+ * @param payload.note - Optional nullable note, at most 2000 characters.
3627
+ * @returns The updated review, in the full
3628
+ * {@link AssignmentResource.getIdentityVerification} shape:
3629
+ * ```jsonc
3630
+ * {
3631
+ * "id": "verification_example", "status": "Approved",
3632
+ * "provider": "AssinafyVerify", "verification_method": "IdDocumentFaceMatchBasic",
3633
+ * "reason_codes": [{ "code": "NAME_MISMATCH", "description": "Name differs" }],
3634
+ * "evidence_available": true,
3635
+ * "expected": { "name": "Example Signer", "cpf": null },
3636
+ * "document": { "type": "CNH", "name": "EXAMPLE SIGNER", "cpf": null },
3637
+ * "matches": { "cpf": null, "name": 0.52, "birth_date": null },
3638
+ * "checks": [{ "name": "name", "result": "review", "score": 0.52, "reasons": ["NAME_MISMATCH"] }],
3639
+ * "images": [], "ruleset_version": "2026-10-12.2", "evidence_sha256": null,
3640
+ * "reviewed_by": { "id": "user_example", "name": "Example Reviewer" },
3641
+ * "reviewed_at": "2026-10-16T12:00:00Z", "review_note": "Verified independently.",
3642
+ * "completed_at": "2026-10-16T12:00:00Z"
3643
+ * }
3644
+ * ```
3645
+ * @throws {ValidationError} If IDs, decision or note are invalid.
3646
+ * @throws {ApiError} `400` for a closed review or invalid document state;
3647
+ * `401` for invalid credentials; `404` if absent; `500` for a server failure.
3648
+ * @example
3649
+ * ```ts
3650
+ * await client.assignments.reviewIdentityVerification('doc-1', 'asg-1', 'signer-1', {
3651
+ * decision: 'Approved', note: 'Verified independently.',
3652
+ * });
3653
+ * ```
3654
+ */
3655
+ reviewIdentityVerification(documentId: string, assignmentId: string, signerId: string, payload: IReviewIdentityVerificationPayload): Promise<ISignerIdentityReview>;
3656
+ private identityVerificationPath;
3413
3657
  }
3414
3658
 
3415
3659
  /**
@@ -3690,6 +3934,8 @@ declare class WebhookResource extends BaseResource {
3690
3934
  * `account:read` scope.
3691
3935
  *
3692
3936
  * @param accountId - Override the client's default account ID.
3937
+ * @param params - Optional endpoint filters.
3938
+ * @param params.url - Match the exact registered endpoint URL.
3693
3939
  * @returns Every endpoint (1 on free plans, up to 3 on paid plans):
3694
3940
  * ```jsonc
3695
3941
  * [
@@ -3715,15 +3961,18 @@ declare class WebhookResource extends BaseResource {
3715
3961
  * const signed = endpoints.filter((endpoint) => endpoint.signing_enabled);
3716
3962
  * ```
3717
3963
  */
3718
- listEndpoints(accountId?: string): Promise<IWebhookEndpoint[]>;
3964
+ listEndpoints(accountId?: string, params?: {
3965
+ url?: string;
3966
+ }): Promise<IWebhookEndpoint[]>;
3719
3967
  /**
3720
3968
  * Register a URL to receive the account's webhook events
3721
3969
  * (`POST /accounts/{accountId}/webhooks/endpoints`).
3722
3970
  *
3723
3971
  * An account can have 1 endpoint, or up to 3 on paid plans. Each endpoint
3724
3972
  * of a workspace needs a different `url`. With `signing_enabled: true` the
3725
- * API generates a signing secret; read it with
3726
- * {@link WebhookResource.getEndpointSecret}. When `events` is omitted or
3973
+ * API returns a signing `secret` in this creation response. Store it now:
3974
+ * OAuth applications cannot call {@link WebhookResource.getEndpointSecret}
3975
+ * or rotate it later. When `events` is omitted or
3727
3976
  * empty, {@link DEFAULT_WEBHOOK_EVENTS} is sent. OAuth tokens need the
3728
3977
  * `webhooks:write` scope.
3729
3978
  *
@@ -3753,6 +4002,7 @@ declare class WebhookResource extends BaseResource {
3753
4002
  * "events": ["document_ready", "signer_signed_document"],
3754
4003
  * "is_active": true,
3755
4004
  * "signing_enabled": true, // deliveries carry a `webhook-signature` header
4005
+ * "secret": "whsec_c2VjcmV0", // only in this response when signing is enabled
3756
4006
  * "created_at": "2026-10-01T12:00:00Z",
3757
4007
  * "updated_at": "2026-10-01T12:00:00Z"
3758
4008
  * }
@@ -3772,10 +4022,10 @@ declare class WebhookResource extends BaseResource {
3772
4022
  * events: ['document_ready', 'signer_signed_document'],
3773
4023
  * signing_enabled: true,
3774
4024
  * });
3775
- * const { secret } = await client.webhooks.getEndpointSecret(endpoint.id);
4025
+ * if (endpoint.secret) await secretStore.save(endpoint.id, endpoint.secret);
3776
4026
  * ```
3777
4027
  */
3778
- createEndpoint(payload: IWebhookEndpointCreatePayload, accountId?: string): Promise<IWebhookEndpoint>;
4028
+ createEndpoint(payload: IWebhookEndpointCreatePayload, accountId?: string): Promise<IWebhookEndpointCreateResponse>;
3779
4029
  /**
3780
4030
  * Retrieve one webhook endpoint
3781
4031
  * (`GET /accounts/{accountId}/webhooks/endpoints/{endpointId}`). OAuth
@@ -3877,6 +4127,25 @@ declare class WebhookResource extends BaseResource {
3877
4127
  * ```
3878
4128
  */
3879
4129
  deleteEndpoint(endpointId: string, accountId?: string): Promise<void>;
4130
+ /**
4131
+ * Delete a webhook endpoint using its registered URL
4132
+ * (`DELETE /accounts/{accountId}/webhooks/endpoints?url=…`).
4133
+ *
4134
+ * No request body. The query URL must match the registered value exactly.
4135
+ * Frees its plan slot; OAuth applications need `webhooks:write`.
4136
+ *
4137
+ * @param url - Exact registered HTTP(S) endpoint URL, including its query.
4138
+ * @param accountId - Override the client's default workspace.
4139
+ * @returns Resolves on acknowledgement (`{ "status": 200, "data": [] }`).
4140
+ * @throws {ValidationError} If the URL is invalid or the account is missing.
4141
+ * @throws {ApiError} `400` for a missing URL; `401` for invalid credentials;
4142
+ * `403` for missing scope; `404` if no endpoint uses the URL; `500` on failure.
4143
+ * @example
4144
+ * ```ts
4145
+ * await client.webhooks.deleteEndpointByUrl('https://example.com/webhooks/assinafy');
4146
+ * ```
4147
+ */
4148
+ deleteEndpointByUrl(url: string, accountId?: string): Promise<void>;
3880
4149
  /**
3881
4150
  * Return the secret that signs deliveries to an endpoint
3882
4151
  * (`GET /accounts/{accountId}/webhooks/endpoints/{endpointId}/secret`).
@@ -3953,6 +4222,8 @@ declare class TemplateResource extends BaseResource {
3953
4222
  *
3954
4223
  * @param source - The PDF to upload, as a file path or an in-memory buffer.
3955
4224
  * @param options - `name` (display name) and an optional `accountId` override.
4225
+ * @param options.name - Multipart filename override, with a `.pdf` extension.
4226
+ * @param options.accountId - Override the client's default workspace.
3956
4227
  * @returns The created template (envelope unwrapped). Response shape:
3957
4228
  * ```jsonc
3958
4229
  * {
@@ -4096,7 +4367,7 @@ declare class TemplateResource extends BaseResource {
4096
4367
  * @example
4097
4368
  * ```ts
4098
4369
  * const tmpl = await client.templates.get('103ad2171db7979468c3e97eb067');
4099
- * if (tmpl.status === 'Ready') console.log(tmpl.pages.length);
4370
+ * if (tmpl.status === 'Ready') console.log(tmpl.pages?.length ?? 0);
4100
4371
  * ```
4101
4372
  */
4102
4373
  get(templateId: string, accountId?: string): Promise<ITemplateDetailsResponse>;
@@ -4221,6 +4492,7 @@ declare class TagResource extends BaseResource {
4221
4492
  *
4222
4493
  * @param params - Optional filters. `search` matches tag names
4223
4494
  * case-insensitively (substring).
4495
+ * @param params.search - Optional case-insensitive tag-name substring.
4224
4496
  * @param accountId - Override the client's default account ID.
4225
4497
  * @returns The matching tags (list items carry no `resource` field):
4226
4498
  * ```jsonc
@@ -4354,6 +4626,8 @@ declare class TagResource extends BaseResource {
4354
4626
  * @param tagId - The tag to delete.
4355
4627
  * @param options - `force` to detach-and-delete when the tag is still in
4356
4628
  * use, and `accountId` to override the client's default account ID.
4629
+ * @param options.force - Detach the tag from documents before deletion.
4630
+ * @param options.accountId - Override the client's default workspace.
4357
4631
  * @returns `{ deleted: true }` when the tag was deleted.
4358
4632
  * @throws {ValidationError} If `tagId` is missing, or no account ID is available.
4359
4633
  * @throws {ApiError} `404` if the tag does not exist; `409` if the tag is
@@ -5569,6 +5843,8 @@ declare class FieldsResource extends BaseResource {
5569
5843
  * @param value - The value to check (validated against the field's
5570
5844
  * type/regex). Sent as `{ value }` in the request body.
5571
5845
  * @param options - Account override and optional legacy `signerAccessCode`.
5846
+ * @param options.accountId - Override the client's default workspace.
5847
+ * @param options.signerAccessCode - Legacy signer code sent as a query parameter.
5572
5848
  * @returns The validation result. Response shape:
5573
5849
  * ```jsonc
5574
5850
  * {
@@ -5615,6 +5891,8 @@ declare class FieldsResource extends BaseResource {
5615
5891
  *
5616
5892
  * @param entries - Non-empty array of `{ field_id, value }` pairs.
5617
5893
  * @param options - Account override and optional legacy `signerAccessCode`.
5894
+ * @param options.accountId - Override the client's default workspace.
5895
+ * @param options.signerAccessCode - Legacy signer code sent as a query parameter.
5618
5896
  * @returns One validation result per entry. Response shape:
5619
5897
  * ```jsonc
5620
5898
  * [
@@ -5674,6 +5952,12 @@ declare class FieldsResource extends BaseResource {
5674
5952
  */
5675
5953
  declare class SignerDocumentsResource extends BaseResource {
5676
5954
  constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
5955
+ /**
5956
+ * Credentialed transport used only by the explicit `*AsWorkspace` methods.
5957
+ * Every access-code method stays on the credential-free `http`, so a
5958
+ * signer code and the API key or bearer token never share a request.
5959
+ */
5960
+ private readonly workspaceHttp;
5677
5961
  /**
5678
5962
  * Fetch the document currently awaiting a given signer
5679
5963
  * (`GET /signers/{signer_id}/document?signer-access-code=…`).
@@ -5816,6 +6100,54 @@ declare class SignerDocumentsResource extends BaseResource {
5816
6100
  * ```
5817
6101
  */
5818
6102
  search(signerId: string, signerAccessCode: string, search?: string): Promise<IDocumentListResponse>;
6103
+ /**
6104
+ * List a signer's documents with the workspace credentials
6105
+ * (`GET /signers/{signer_id}/documents`).
6106
+ *
6107
+ * The same operation as {@link SignerDocumentsResource.list}, authorised by
6108
+ * the client's API key or OAuth bearer token instead of a signer access
6109
+ * code. No `signer-access-code` is sent.
6110
+ *
6111
+ * @param signerId - The signer whose documents are listed.
6112
+ * @param params - Pagination: `page`, `per-page` (also accepts `per_page`).
6113
+ * @returns Documents in the compact {@link IDocumentListItem} shape, with
6114
+ * pagination in `meta` (same shape as {@link SignerDocumentsResource.list}):
6115
+ * ```jsonc
6116
+ * {
6117
+ * "data": [{ "id": "103acccd24234c07858ffddf6d84", "name": "Service agreement.pdf", "status": "pending_signature" }],
6118
+ * "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
6119
+ * }
6120
+ * ```
6121
+ * @throws {ValidationError} If `signerId` is missing.
6122
+ * @throws {ApiError} `401` if the workspace credentials are rejected.
6123
+ *
6124
+ * @example
6125
+ * ```ts
6126
+ * const { data } = await client.signerDocuments.listAsWorkspace(signerId, { page: 1 });
6127
+ * ```
6128
+ */
6129
+ listAsWorkspace(signerId: string, params?: IListParams): Promise<IDocumentListResponse>;
6130
+ /**
6131
+ * Search a signer's documents with the workspace credentials
6132
+ * (`GET /signers/{signer_id}/documents/search`).
6133
+ *
6134
+ * The same operation as {@link SignerDocumentsResource.search}, authorised
6135
+ * by the client's API key or OAuth bearer token instead of a signer access
6136
+ * code. No `signer-access-code` is sent.
6137
+ *
6138
+ * @param signerId - The signer whose documents are searched.
6139
+ * @param search - Free-text term matched against the document name.
6140
+ * @returns Matching documents with pagination in `meta`, as
6141
+ * {@link SignerDocumentsResource.listAsWorkspace} returns.
6142
+ * @throws {ValidationError} If `signerId` is missing or `search` is not a string.
6143
+ * @throws {ApiError} `401` if the workspace credentials are rejected.
6144
+ *
6145
+ * @example
6146
+ * ```ts
6147
+ * const { data } = await client.signerDocuments.searchAsWorkspace(signerId, 'agreement');
6148
+ * ```
6149
+ */
6150
+ searchAsWorkspace(signerId: string, search?: string): Promise<IDocumentListResponse>;
5819
6151
  /**
5820
6152
  * Download one of a signer's document artifacts as raw bytes
5821
6153
  * (`GET /signers/{signer_id}/documents/{document_id}/download/{artifact}`).
@@ -5952,7 +6284,8 @@ declare class SignerDocumentsResource extends BaseResource {
5952
6284
  * "has_accepted_terms": false,
5953
6285
  * "has_signature": false,
5954
6286
  * "has_initial": false,
5955
- * "is_signature_reusable": false
6287
+ * "is_signature_reusable": false,
6288
+ * "verification_method": "IdDocumentFaceMatchBasic"
5956
6289
  * }
5957
6290
  * ```
5958
6291
  * @throws {ValidationError} If `signerAccessCode` is missing.
@@ -5967,6 +6300,74 @@ declare class SignerDocumentsResource extends BaseResource {
5967
6300
  * ```
5968
6301
  */
5969
6302
  self(signerAccessCode: string): Promise<ISignerSelf>;
6303
+ /**
6304
+ * Read the signer's identity verification state
6305
+ * (`GET /signers/identity-verification?signer-access-code=…`).
6306
+ *
6307
+ * No request body or workspace credentials. Reads a pending provider
6308
+ * decision when available. A new session can start before the first capture
6309
+ * or after `Expired`; `Declined` and `Abandoned` require a new document and
6310
+ * assignment. `InReview` lets the signer continue; account approval gates
6311
+ * certification, with `pending_identity_review` after everyone signs.
6312
+ *
6313
+ * @param signerAccessCode - Access code from the signer's signing link.
6314
+ * @returns Provider state, with nullable fields before a session exists:
6315
+ * ```jsonc
6316
+ * {
6317
+ * "can_start": false, "status": "Pending",
6318
+ * "url": "https://verify.example.com/c/session#t=opaque",
6319
+ * "expires_at": "2026-10-16T12:30:00Z", "completed_at": null
6320
+ * }
6321
+ * ```
6322
+ * `url` exists only while Pending. It is a bearer link: open it intact,
6323
+ * including its fragment, and keep it out of logs and browser storage.
6324
+ * @throws {ValidationError} If the access code is blank.
6325
+ * @throws {ApiError} `401` for an invalid/expired code; `500` for a server failure.
6326
+ * @example
6327
+ * ```ts
6328
+ * const state = await client.signerDocuments.getIdentityVerification(accessCode);
6329
+ * console.log(state.status, state.can_start);
6330
+ * ```
6331
+ */
6332
+ getIdentityVerification(signerAccessCode: string): Promise<ISignerIdentityVerification>;
6333
+ /**
6334
+ * Record biometric consent and open an identity verification session
6335
+ * (`POST /signers/identity-verification?signer-access-code=…`).
6336
+ *
6337
+ * Send only after the signer explicitly consents. Starts a session when
6338
+ * none exists or replaces an Expired session. Other states return `400`;
6339
+ * resending a notification never replaces a live session. The account is
6340
+ * billed at assignment creation, with no new charge for a restart.
6341
+ *
6342
+ * Request body (`application/json`):
6343
+ * ```jsonc
6344
+ * { "consent": true }
6345
+ * ```
6346
+ * @param signerAccessCode - Access code from the signer's signing link.
6347
+ * @param payload - Explicit consent from the signer.
6348
+ * @param payload.consent - Must be `true`; never default or infer consent.
6349
+ * @returns The newly opened provider session:
6350
+ * ```jsonc
6351
+ * {
6352
+ * "id": "verification_example",
6353
+ * "url": "https://verify.example.com/c/session#t=opaque",
6354
+ * "expires_at": "2026-10-16T12:30:00Z"
6355
+ * }
6356
+ * ```
6357
+ * `expires_at` can be null. Open the URL as-is; it is a bearer credential
6358
+ * and its fragment must survive navigation. Do not log or persist it in
6359
+ * browser storage. No workspace credential is attached to this call.
6360
+ * @throws {ValidationError} If the code is blank or consent is not `true`.
6361
+ * @throws {ApiError} `400` when a non-expired session already exists;
6362
+ * `401` for an invalid/expired code; `500` for a provider/server failure.
6363
+ * @example
6364
+ * ```ts
6365
+ * // Inside the handler for the signer's explicit consent action:
6366
+ * const session = await client.signerDocuments.startIdentityVerification(accessCode, { consent: true });
6367
+ * response.redirect(session.url);
6368
+ * ```
6369
+ */
6370
+ startIdentityVerification(signerAccessCode: string, payload: IStartIdentityVerificationPayload): Promise<ISignerIdentityVerificationSession>;
5970
6371
  /**
5971
6372
  * Accept the platform terms of use as the signer
5972
6373
  * (`PUT /signers/accept-terms?signer-access-code=…`).
@@ -5992,10 +6393,10 @@ declare class SignerDocumentsResource extends BaseResource {
5992
6393
  */
5993
6394
  acceptTerms(signerAccessCode: string): Promise<void>;
5994
6395
  /**
5995
- * Verify the signer's email one-time password
6396
+ * Verify the signer's email or WhatsApp one-time password
5996
6397
  * (`POST /verify?signer-access-code=…`).
5997
6398
  *
5998
- * Confirms the 6-digit OTP the platform emailed the signer. The access code
6399
+ * Confirms the 6-digit OTP sent through the selected channel. The access code
5999
6400
  * authenticates via the `signer-access-code` **query param**; the request
6000
6401
  * **body carries only `verification-code`** (putting the access code in the
6001
6402
  * body leaves the request unauthenticated → `401`).
@@ -6009,6 +6410,8 @@ declare class SignerDocumentsResource extends BaseResource {
6009
6410
  *
6010
6411
  * @param payload - `signerAccessCode` (the signing-link code) and
6011
6412
  * `verificationCode` (the OTP the signer received).
6413
+ * @param payload.signerAccessCode - Signing-link code sent only in the query.
6414
+ * @param payload.verificationCode - Email or WhatsApp OTP sent as `verification-code`.
6012
6415
  * @returns Resolves when the API acknowledges the operation. The response
6013
6416
  * envelope has no `data` field and is intentionally discarded.
6014
6417
  * @throws {ValidationError} If `signerAccessCode` or `verificationCode` is
@@ -6117,6 +6520,8 @@ declare class SignerDocumentsResource extends BaseResource {
6117
6520
  * @param image - The image bytes as a non-empty `Buffer`.
6118
6521
  * @param options - `imageType` (`'signature'` default, or `'initial'`) and
6119
6522
  * `reuse` (persist for reuse). The official request content type is PNG.
6523
+ * @param options.imageType - Signature image category; defaults to `signature`.
6524
+ * @param options.reuse - Persist the image for future signing requests.
6120
6525
  * @returns Resolves when the API acknowledges the upload. The response
6121
6526
  * envelope has no `data` field and is intentionally discarded.
6122
6527
  * @throws {ValidationError} If `signerAccessCode` is missing or `image` is not
@@ -6142,6 +6547,9 @@ declare class SignerDocumentsResource extends BaseResource {
6142
6547
  * @param signerAccessCode - Access code sent in the query string.
6143
6548
  * @param image - Non-empty raw image bytes, without a JSON envelope.
6144
6549
  * @param options - Image type, reuse preference and compatibility content type.
6550
+ * @param options.imageType - Signature image category; defaults to `signature`.
6551
+ * @param options.reuse - Persist the image for future signing requests.
6552
+ * @param options.contentType - Compatibility media type; the official type is `image/png`.
6145
6553
  * @returns Nothing; the acknowledgement body is discarded.
6146
6554
  * @throws {ValidationError} If the code, image or options are invalid.
6147
6555
  * @throws {ApiError} If the API rejects the upload.
@@ -6225,7 +6633,7 @@ declare class SignerDocumentsResource extends BaseResource {
6225
6633
  * "expires_at": null,
6226
6634
  * "signers": [
6227
6635
  * { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
6228
- * "full_name": "Example Signer", "notified": true, "completed": false }
6636
+ * "full_name": "Example Signer", "notified": true }
6229
6637
  * ],
6230
6638
  * "items": [
6231
6639
  * { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
@@ -6676,7 +7084,8 @@ declare class WebhookVerifier {
6676
7084
  * @param toleranceSeconds - Accepted clock distance. Defaults to `300`.
6677
7085
  * @returns `true` only when a signature entry matches (constant-time) and
6678
7086
  * the timestamp is fresh; `false` when verification is disabled, a header
6679
- * is missing, or anything does not match.
7087
+ * is missing, the tolerance is not finite and non-negative, or anything
7088
+ * does not match.
6680
7089
  *
6681
7090
  * @example
6682
7091
  * ```ts
@@ -7064,6 +7473,23 @@ interface IAuthenticateChallenge {
7064
7473
  * ```
7065
7474
  */
7066
7475
  declare function parseWwwAuthenticate(value: string | undefined): IAuthenticateChallenge | undefined;
7476
+ /**
7477
+ * Rate-limit state reported by the API's response headers.
7478
+ *
7479
+ * Every rate-limited response carries the `X-Rate-Limit-*` trio; a `429 Too
7480
+ * Many Requests` adds `Retry-After`. Absent or non-numeric headers are left
7481
+ * out rather than guessed.
7482
+ */
7483
+ interface IRateLimitInfo {
7484
+ /** `X-Rate-Limit-Limit` — requests allowed in the current window. */
7485
+ limit?: number;
7486
+ /** `X-Rate-Limit-Remaining` — requests left in the current window. */
7487
+ remaining?: number;
7488
+ /** `X-Rate-Limit-Reset` — seconds until the window resets. */
7489
+ reset?: number;
7490
+ /** `Retry-After` — seconds to wait before retrying (sent on `429`). */
7491
+ retryAfter?: number;
7492
+ }
7067
7493
 
7068
7494
  /** Base class for all Assinafy SDK errors. */
7069
7495
  declare class AssinafyError extends Error {
@@ -7109,6 +7535,25 @@ declare class ApiError extends AssinafyError {
7109
7535
  * ```
7110
7536
  */
7111
7537
  challenge?: IAuthenticateChallenge;
7538
+ /**
7539
+ * Rate-limit headers carried by the failed response: `X-Rate-Limit-Limit`,
7540
+ * `X-Rate-Limit-Remaining`, `X-Rate-Limit-Reset` and, on `429`,
7541
+ * `Retry-After` (all in requests or seconds). `undefined` when the response
7542
+ * carried none of them. The client already retries a `429` up to
7543
+ * `maxRetries` times; this is what remains once those retries are spent.
7544
+ *
7545
+ * @example
7546
+ * ```ts
7547
+ * try {
7548
+ * await client.documents.list();
7549
+ * } catch (error) {
7550
+ * if (error instanceof ApiError && error.statusCode === 429) {
7551
+ * await sleep((error.rateLimit?.retryAfter ?? 60) * 1000);
7552
+ * }
7553
+ * }
7554
+ * ```
7555
+ */
7556
+ rateLimit?: IRateLimitInfo;
7112
7557
  /**
7113
7558
  * Create an error representing a non-success API response.
7114
7559
  *
@@ -7247,4 +7692,4 @@ declare const MAX_LIST_PAGE_SIZE = 50;
7247
7692
 
7248
7693
  declare const SDK_USER_AGENT: string;
7249
7694
 
7250
- export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, DEFAULT_WEBHOOK_EVENTS, type DocumentArtifactName, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, FieldsResource, type IAccountTheme, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentDetailsResponse, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IRenameDocumentResponse, type IResendCostEstimate, type IResendEmailResponse, type ISignFieldEntry, type ISigner, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningProgress, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITotpEnrollment, type IUpdateFieldPayload, type IUpdateNotificationPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointSecret, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };
7695
+ export { type AccountLogoUploadSource, type AnyString, ApiError, type AssignmentDisplaySettings, type AssignmentMethod, type AssignmentNotificationMethod, AssignmentResource, type AssignmentVerificationMethod, AssinafyClient, type AssinafyClientOptions, AssinafyError, AuthenticationResource, type ClientConfigInput, DEFAULT_WEBHOOK_EVENTS, type DocumentArtifactName, DocumentResource, type DocumentStatsGranularity, type DocumentStatus, type DocumentUploadSource, FieldsResource, type IAccountTheme, type IApiKeyResponse, type IAssignment, type IAssignmentCostSigner, type IAssignmentEntry, type IAssignmentItem, type IAssignmentListParams, type IAssignmentListResponse, type IAssignmentSigner, type IAuthenticateChallenge, type IAuthenticatedUser, type IConfirmSignerDataPayload, type IConfirmTotpPayload, type ICostEstimate, type ICreateAssignmentPayload, type ICreateAssignmentResponse, type ICreateDocumentFromTemplateOptions, type ICreateFieldPayload, type ICreateSignerPayload, type ICreateSignerResponse, type ICreateTagPayload, type ICreateWorkspacePayload, type IDeleteTagResponse, type IDetachDocumentTagResponse, type IDisplaySettings, type IDocumentActivity, type IDocumentDetailsResponse, type IDocumentListItem, type IDocumentListParams, type IDocumentListResponse, type IDocumentSearchParams, type IDocumentStatsParams, type IDocumentStatsRow, type IDocumentStatusInfo, type IDocumentUploadOptions, type IDocumentUploadResponse, type IDocumentVerification, type IEstimateAssignmentCostPayload, type IFieldDefinition, type IFieldType, type IFieldValidateMultipleEntry, type IFieldValidationMultipleResult, type IFieldValidationResponse, type IFieldValidationResult, type IInlineTag, type ILegacyConfirmSignerDataPayload, type ILegacyResendCostEstimate, type ILegacyUploadSignatureOptions, type IListParams, type ILoginResponse, type IMaskedApiKeyResponse, type IMfaMethod, type IMfaReauth, type IMfaRecoveryCodes, type IMfaStatus, type INotificationHistoryEntry, type INotificationPreferences, type IOAuthAuthorizationCallback, type IOAuthAuthorizationRequest, type IOAuthAuthorizationServerMetadata, type IOAuthProtectedResourceMetadata, type IOAuthTokenResponse, type IOAuthUserInfo, type IPage, type IPaginatedResponse, type IPublicDocumentInfo, type IRateLimitInfo, type IRenameDocumentResponse, type IResendCostEstimate, type IResendEmailResponse, type IReviewIdentityVerificationPayload, type ISendTokenResult, type ISignFieldEntry, type ISigner, type ISignerIdentityReview, type ISignerIdentityVerification, type ISignerIdentityVerificationSession, type ISignerListParams, type ISignerListResponse, type ISignerSelf, type ISigningProgress, type IStartIdentityVerificationPayload, type ITag, type ITemplateCostSigner, type ITemplateDetailsResponse, type ITemplateFieldPlacement, type ITemplateListItem, type ITemplateListParams, type ITemplateListResponse, type ITemplateRole, type ITemplateSigner, type ITotpEnrollment, type IUpdateFieldPayload, type IUpdateNotificationPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, type IWebhookEndpoint, type IWebhookEndpointCreatePayload, type IWebhookEndpointCreateResponse, type IWebhookEndpointSecret, type IWebhookEndpointUpdatePayload, type IWebhookEventTypeInfo, type IWebhookPayload, type IWebhookRegisterPayload, type IWebhookSubscription, type IWhatsAppNotification, type IWorkspaceListItem, type IWorkspaceListResponse, type IWorkspaceResponse, type IdentityVerificationImageName, type IdentityVerificationStatus, type Logger, MAX_LIST_PAGE_SIZE, MAX_UPLOAD_BYTES, NetworkError, type NotificationSenderType, OAuthError, OAuthResource, type OAuthScope, type PaginatedResult, type PaginationMeta, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookEventType, type WebhookHeaders, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload, parseWwwAuthenticate };