@assinafy/sdk 2.7.1 → 2.8.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/CHANGELOG.md +50 -1
- package/README.en.md +89 -17
- package/README.md +86 -16
- package/dist/index.d.mts +399 -42
- package/dist/index.d.ts +399 -42
- package/dist/index.js +387 -44
- package/dist/index.mjs +386 -44
- package/docs/API_COVERAGE.md +14 -8
- package/docs/COMPATIBILITY.md +67 -8
- package/package.json +1 -1
package/dist/index.d.mts
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
|
|
32
|
+
* | `DigitalCertificate` | The signer signs with their own ICP-Brasil certificate — **A1** (software, a file on the machine) or **A3** (hardware, a token or smartcard) — through the Web PKI browser extension, producing a qualified PAdES signature. | `method: 'virtual'`; Digital Certificate feature (Standard/Pro); `government_id`; the signer must be alone in their signing step. | 0.5 credits + notification |
|
|
33
|
+
* | `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
|
-
*
|
|
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. */
|
|
@@ -231,6 +310,7 @@ type ISignerListResponse = PaginatedResult<ISigner>;
|
|
|
231
310
|
type SignerReference = string | {
|
|
232
311
|
id?: string;
|
|
233
312
|
signer_id?: string;
|
|
313
|
+
/** `DigitalCertificate` is valid only when the assignment method is `virtual`. */
|
|
234
314
|
verification_method?: AssignmentVerificationMethod;
|
|
235
315
|
notification_methods?: AssignmentNotificationMethod[];
|
|
236
316
|
/**
|
|
@@ -302,7 +382,7 @@ interface IAssignmentEntry {
|
|
|
302
382
|
display_settings?: IDisplaySettings;
|
|
303
383
|
}>;
|
|
304
384
|
}
|
|
305
|
-
/** Channel descriptor accepted by assignment cost estimation. */
|
|
385
|
+
/** Channel descriptor accepted by assignment cost estimation. `DigitalCertificate` requires `method: 'virtual'`. */
|
|
306
386
|
interface IAssignmentCostSigner {
|
|
307
387
|
verification_method?: AssignmentVerificationMethod;
|
|
308
388
|
notification_methods?: AssignmentNotificationMethod[];
|
|
@@ -324,6 +404,8 @@ interface IEstimateAssignmentCostPayload {
|
|
|
324
404
|
}
|
|
325
405
|
/** A signer as embedded inside an assignment (richer than the bare {@link ISigner}). */
|
|
326
406
|
interface IAssignmentSigner extends ISigner {
|
|
407
|
+
/** `InReview` requires an account decision before document certification. */
|
|
408
|
+
identity_verification_status?: IdentityVerificationStatus | AnyString | null;
|
|
327
409
|
/** Only present in account-owner contexts; omitted from signer-code responses. */
|
|
328
410
|
completed?: boolean | null;
|
|
329
411
|
/** Optional because some deployments omit notification history. */
|
|
@@ -464,7 +546,7 @@ interface IWebhookPayload {
|
|
|
464
546
|
[key: string]: unknown;
|
|
465
547
|
}
|
|
466
548
|
/** 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';
|
|
549
|
+
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
550
|
/** Document listing item (paginated). */
|
|
469
551
|
interface IDocumentListItem {
|
|
470
552
|
id: string;
|
|
@@ -786,6 +868,11 @@ interface IWebhookEndpoint {
|
|
|
786
868
|
/** ISO-8601 UTC timestamp. */
|
|
787
869
|
updated_at: string;
|
|
788
870
|
}
|
|
871
|
+
/** Endpoint creation also returns the signing secret when signing is enabled. */
|
|
872
|
+
interface IWebhookEndpointCreateResponse extends IWebhookEndpoint {
|
|
873
|
+
/** Store securely at creation: OAuth applications cannot read or rotate this later. */
|
|
874
|
+
secret?: string;
|
|
875
|
+
}
|
|
789
876
|
/** An endpoint's Standard Webhooks signing secret. */
|
|
790
877
|
interface IWebhookEndpointSecret {
|
|
791
878
|
/** `whsec_` followed by the base64-encoded key. */
|
|
@@ -953,7 +1040,13 @@ interface ITemplateDetailsResponse {
|
|
|
953
1040
|
updated_at?: string;
|
|
954
1041
|
[key: string]: unknown;
|
|
955
1042
|
}
|
|
956
|
-
/**
|
|
1043
|
+
/**
|
|
1044
|
+
* Signer assignment for creating a document from a template.
|
|
1045
|
+
*
|
|
1046
|
+
* The SDK temporarily rejects `DigitalCertificate` because the server derives
|
|
1047
|
+
* the method from template fields and can create an unusable `collect`
|
|
1048
|
+
* assignment. Use a direct `virtual` assignment for certificate signers.
|
|
1049
|
+
*/
|
|
957
1050
|
interface ITemplateSigner {
|
|
958
1051
|
role_id: string;
|
|
959
1052
|
id: string;
|
|
@@ -964,7 +1057,9 @@ interface ITemplateSigner {
|
|
|
964
1057
|
}
|
|
965
1058
|
/**
|
|
966
1059
|
* Role/channel descriptor used only for template cost estimation. The official
|
|
967
|
-
* schema intentionally omits signer `id` and sequential-signing `step`.
|
|
1060
|
+
* schema intentionally omits signer `id` and sequential-signing `step`. The SDK
|
|
1061
|
+
* temporarily rejects `DigitalCertificate`; use direct virtual-assignment cost
|
|
1062
|
+
* estimation instead.
|
|
968
1063
|
*/
|
|
969
1064
|
interface ITemplateCostSigner {
|
|
970
1065
|
role_id: string;
|
|
@@ -1512,6 +1607,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1512
1607
|
*
|
|
1513
1608
|
* @param source - The PDF to upload, as a file path or an in-memory buffer.
|
|
1514
1609
|
* @param options - Display name, metadata, and account override.
|
|
1610
|
+
* @param options.name - Multipart filename override; the API derives the display name from it.
|
|
1611
|
+
* @param options.metadata - JSON metadata (compatibility multipart part).
|
|
1612
|
+
* @param options.accountId - Override the client's default workspace.
|
|
1515
1613
|
* @returns The created document, freshly uploaded (`status: 'uploaded'`,
|
|
1516
1614
|
* empty `pages` until `metadata_ready`). Response shape:
|
|
1517
1615
|
* ```jsonc
|
|
@@ -1605,7 +1703,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1605
1703
|
* method: 'virtual',
|
|
1606
1704
|
* 'per-page': 50,
|
|
1607
1705
|
* });
|
|
1608
|
-
* console.log(data[0]?.pages
|
|
1706
|
+
* console.log(data[0]?.pages?.length, meta?.total);
|
|
1609
1707
|
* ```
|
|
1610
1708
|
*/
|
|
1611
1709
|
list(params?: IDocumentListParams, accountId?: string): Promise<IDocumentListResponse>;
|
|
@@ -1776,7 +1874,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1776
1874
|
get(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
1777
1875
|
/**
|
|
1778
1876
|
* Poll {@link DocumentResource.details} until the document reaches a ready
|
|
1779
|
-
* status (`metadata_ready`, `pending_signature`,
|
|
1877
|
+
* status (`metadata_ready`, `pending_signature`, `pending_identity_review`,
|
|
1878
|
+
* or `certificated`),
|
|
1780
1879
|
* throwing on a terminal failure status or timeout.
|
|
1781
1880
|
*
|
|
1782
1881
|
* Transient errors are tolerated — a `5xx` or `429` is retried on the next
|
|
@@ -1786,6 +1885,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1786
1885
|
* @param documentId - The document to wait on.
|
|
1787
1886
|
* @param options - `maxWaitMs` (default `30_000`) and `pollIntervalMs`
|
|
1788
1887
|
* (default `2_000`).
|
|
1888
|
+
* @param options.maxWaitMs - Finite non-negative wait budget in milliseconds; default `30_000`.
|
|
1889
|
+
* @param options.pollIntervalMs - Finite positive polling interval in milliseconds; default `2_000`.
|
|
1789
1890
|
* @returns The document details once it reaches a ready status (see
|
|
1790
1891
|
* {@link DocumentResource.details} for the shape).
|
|
1791
1892
|
* @throws {ValidationError} If `documentId` is missing, the document enters
|
|
@@ -1966,6 +2067,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1966
2067
|
* names are not portable identifiers and should not be used here. This
|
|
1967
2068
|
* overwrites the existing set — use
|
|
1968
2069
|
* {@link DocumentResource.addTags} to append.
|
|
2070
|
+
* Older sandbox deployments interpret these strings as names and create
|
|
2071
|
+
* ID-named tags for ID inputs; pass existing names intentionally there.
|
|
2072
|
+
* Strings are sent unchanged. See `docs/COMPATIBILITY.md` for this variant.
|
|
1969
2073
|
*
|
|
1970
2074
|
* Request body (`application/json`):
|
|
1971
2075
|
* ```jsonc
|
|
@@ -2004,6 +2108,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2004
2108
|
* `tags` is a non-empty array of tag **IDs**. Attaching an ID already
|
|
2005
2109
|
* present is a no-op. To replace the whole set instead, use
|
|
2006
2110
|
* {@link DocumentResource.replaceTags}.
|
|
2111
|
+
* On older name-based sandbox deployments, pass existing tag names
|
|
2112
|
+
* intentionally; ID inputs create ID-named tags. No automatic remapping occurs.
|
|
2007
2113
|
*
|
|
2008
2114
|
* Request body (`application/json`):
|
|
2009
2115
|
* ```jsonc
|
|
@@ -2100,10 +2206,20 @@ declare class DocumentResource extends BaseResource {
|
|
|
2100
2206
|
* plus optional `verification_method`, `notification_methods`, `step`).
|
|
2101
2207
|
* Only one notification method is allowed per signer; when only one of the
|
|
2102
2208
|
* verification/notification fields is supplied, the API infers the other.
|
|
2103
|
-
* `DigitalCertificate` costs
|
|
2104
|
-
* signer `government_id`, and that signer must be alone in its step.
|
|
2209
|
+
* `DigitalCertificate` costs 0.5 credits, requires the feature plus a
|
|
2210
|
+
* signer `government_id`, and that signer must be alone in its step. The
|
|
2211
|
+
* server derives the assignment method from placed template fields but
|
|
2212
|
+
* does not yet reject unusable certificate/`collect` combinations, so the
|
|
2213
|
+
* SDK temporarily refuses certificate signers on this template route.
|
|
2214
|
+
* `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
|
|
2215
|
+
* and a valid CPF in `government_id`; estimate the per-signer fee first.
|
|
2105
2216
|
* @param options - Optional `name`, `message`, `expires_at`,
|
|
2106
2217
|
* `editor_fields`, `tags`.
|
|
2218
|
+
* @param options.name - Generated document display name.
|
|
2219
|
+
* @param options.message - Signing invitation message.
|
|
2220
|
+
* @param options.expires_at - ISO-8601 signature deadline.
|
|
2221
|
+
* @param options.editor_fields - Template editor values as `{ field_id, value }` entries.
|
|
2222
|
+
* @param options.tags - Tag names attached to the generated document.
|
|
2107
2223
|
* @param accountId - Override the client's default account ID.
|
|
2108
2224
|
* @returns The created document (an {@link IDocumentDetailsResponse} with
|
|
2109
2225
|
* `template_id` set and its `assignment` populated):
|
|
@@ -2125,15 +2241,16 @@ declare class DocumentResource extends BaseResource {
|
|
|
2125
2241
|
* "updated_at": "2026-07-15T19:59:33Z"
|
|
2126
2242
|
* }
|
|
2127
2243
|
* ```
|
|
2128
|
-
* @throws {ValidationError} If `templateId` is missing
|
|
2129
|
-
* available
|
|
2244
|
+
* @throws {ValidationError} If `templateId` is missing, no account ID is
|
|
2245
|
+
* available, or a signer uses `DigitalCertificate`. Certificate refusals
|
|
2246
|
+
* have `errors.code === 'digital_certificate_requires_virtual_method'`.
|
|
2130
2247
|
* @throws {ApiError} `400` if the signers/roles are invalid or the template
|
|
2131
2248
|
* is not ready.
|
|
2132
2249
|
*
|
|
2133
2250
|
* @example
|
|
2134
2251
|
* ```ts
|
|
2135
2252
|
* await client.documents.createFromTemplate('tmpl_id', [
|
|
2136
|
-
* { role_id: 'role_id', id: 'signer_id', verification_method: '
|
|
2253
|
+
* { role_id: 'role_id', id: 'signer_id', verification_method: 'Email' },
|
|
2137
2254
|
* ], { name: 'My Contract' });
|
|
2138
2255
|
* ```
|
|
2139
2256
|
*/
|
|
@@ -2144,8 +2261,10 @@ declare class DocumentResource extends BaseResource {
|
|
|
2144
2261
|
*
|
|
2145
2262
|
* A dry run: sends only `{ signers }` and consumes nothing. Use it to check
|
|
2146
2263
|
* balances before calling {@link DocumentResource.createFromTemplate}.
|
|
2147
|
-
* `DigitalCertificate`
|
|
2148
|
-
*
|
|
2264
|
+
* `DigitalCertificate` requires a provably `virtual` assignment. Because
|
|
2265
|
+
* this route leaves method detection to the server, the SDK temporarily
|
|
2266
|
+
* refuses certificate signers instead of returning a price for an
|
|
2267
|
+
* assignment that may charge credits but cannot be completed.
|
|
2149
2268
|
*
|
|
2150
2269
|
* Request body (`application/json`):
|
|
2151
2270
|
* ```jsonc
|
|
@@ -2187,14 +2306,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
2187
2306
|
* "message": null
|
|
2188
2307
|
* }
|
|
2189
2308
|
* ```
|
|
2190
|
-
* @throws {ValidationError} If `templateId` is missing
|
|
2191
|
-
* available
|
|
2309
|
+
* @throws {ValidationError} If `templateId` is missing, no account ID is
|
|
2310
|
+
* available, or a signer uses `DigitalCertificate`. Certificate refusals
|
|
2311
|
+
* have `errors.code === 'digital_certificate_requires_virtual_method'`.
|
|
2192
2312
|
* @throws {ApiError} If the API rejects the request.
|
|
2193
2313
|
*
|
|
2194
2314
|
* @example
|
|
2195
2315
|
* ```ts
|
|
2196
2316
|
* const estimate = await client.documents.estimateCostFromTemplate('tmpl_id', [
|
|
2197
|
-
* { role_id: 'role_id', verification_method: '
|
|
2317
|
+
* { role_id: 'role_id', verification_method: 'Email' },
|
|
2198
2318
|
* ]);
|
|
2199
2319
|
* if (!estimate.has_sufficient_resources) throw new Error(estimate.blocking_reason ?? 'insufficient');
|
|
2200
2320
|
* ```
|
|
@@ -2596,9 +2716,8 @@ declare class SignerResource extends BaseResource {
|
|
|
2596
2716
|
* re-filtered here for an exact, case-insensitive email match.
|
|
2597
2717
|
*
|
|
2598
2718
|
* Page size is pinned to {@link MAX_LIST_PAGE_SIZE}, the largest page the
|
|
2599
|
-
* server actually returns.
|
|
2600
|
-
*
|
|
2601
|
-
* miss one — the API exposes no exact-email filter to rule that out.
|
|
2719
|
+
* server actually returns. Pages are searched until an exact match is found
|
|
2720
|
+
* or the result set ends, so substring matches cannot hide an existing signer.
|
|
2602
2721
|
*
|
|
2603
2722
|
* A `404` from the underlying list is treated as "no match" and mapped to
|
|
2604
2723
|
* `null`; any other {@link ApiError} propagates.
|
|
@@ -2847,6 +2966,8 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2847
2966
|
* @param accountId - Account to aggregate.
|
|
2848
2967
|
* @param params - Omit for 12 monthly rows, or request daily rows with
|
|
2849
2968
|
* `{ granularity: 'daily', month: '2026-06' }`.
|
|
2969
|
+
* @param params.granularity - `monthly` (default) or `daily`.
|
|
2970
|
+
* @param params.month - Month in `YYYY-MM` format; required for daily rows.
|
|
2850
2971
|
* @returns Zero-filled KPI rows:
|
|
2851
2972
|
* ```jsonc
|
|
2852
2973
|
* [{
|
|
@@ -2946,6 +3067,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2946
3067
|
* @param accountId - The workspace to delete.
|
|
2947
3068
|
* @param options - Set `force: true` to cancel an active paid subscription
|
|
2948
3069
|
* and proceed with deletion.
|
|
3070
|
+
* @param options.force - Cancel an active subscription and bypass deletion restrictions.
|
|
2949
3071
|
* @returns Nothing on success (`200` with no meaningful body).
|
|
2950
3072
|
* @throws {ValidationError} If `accountId` is missing.
|
|
2951
3073
|
* @throws {ApiError} `400` (with a `restrictions` list) when the workspace
|
|
@@ -2963,6 +3085,8 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2963
3085
|
}): Promise<void>;
|
|
2964
3086
|
}
|
|
2965
3087
|
|
|
3088
|
+
/** Stable {@link ValidationError.errors} code for an unusable certificate assignment. */
|
|
3089
|
+
declare const DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD = "digital_certificate_requires_virtual_method";
|
|
2966
3090
|
/**
|
|
2967
3091
|
* Normalize a public assignment input into the exact create-request body.
|
|
2968
3092
|
* String IDs and legacy `signer_id` aliases become signer objects, omitted
|
|
@@ -2973,7 +3097,9 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2973
3097
|
* @returns A JSON-ready body shaped as
|
|
2974
3098
|
* `{ method, signers: [{ id, verification_method?, notification_methods?, step? }], message?, expires_at?, copy_receivers?, entries? }`.
|
|
2975
3099
|
* @throws {ValidationError} If no signer is present, a signer reference is
|
|
2976
|
-
* malformed,
|
|
3100
|
+
* malformed, a collect assignment has no field-placement entries, or a
|
|
3101
|
+
* `DigitalCertificate` signer is combined with `method: 'collect'`. The last
|
|
3102
|
+
* case has `errors.code === 'digital_certificate_requires_virtual_method'`.
|
|
2977
3103
|
*
|
|
2978
3104
|
* @example
|
|
2979
3105
|
* ```ts
|
|
@@ -3087,8 +3213,12 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3087
3213
|
* {@link buildAssignmentPayload}. A `virtual` assignment may be created at
|
|
3088
3214
|
* `uploaded`, `metadata_processing`, or `metadata_ready` and is promoted
|
|
3089
3215
|
* automatically; `collect` requires rendered pages at `metadata_ready`.
|
|
3090
|
-
* `DigitalCertificate` costs
|
|
3091
|
-
* signer `government_id`,
|
|
3216
|
+
* `DigitalCertificate` costs 0.5 credits, requires the feature plus a
|
|
3217
|
+
* signer `government_id`, that signer must be alone in its step, and the
|
|
3218
|
+
* assignment must use `method: 'virtual'`. Certificate completion marks a
|
|
3219
|
+
* virtual item complete; it cannot submit placed `collect` fields.
|
|
3220
|
+
* `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
|
|
3221
|
+
* and a valid CPF in the signer's `government_id`; estimate its fee first.
|
|
3092
3222
|
*
|
|
3093
3223
|
* Request body (`application/json`):
|
|
3094
3224
|
* ```jsonc
|
|
@@ -3186,7 +3316,9 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3186
3316
|
* }
|
|
3187
3317
|
* ```
|
|
3188
3318
|
* @throws {ValidationError} If `documentId` is missing, no signer is
|
|
3189
|
-
* supplied,
|
|
3319
|
+
* supplied, a signer reference is invalid, or `DigitalCertificate` is
|
|
3320
|
+
* combined with `collect`. The last case has `errors.code ===
|
|
3321
|
+
* 'digital_certificate_requires_virtual_method'`.
|
|
3190
3322
|
* @throws {ApiError} `400` for an invalid assignment or unmet verification
|
|
3191
3323
|
* precondition; otherwise if the API rejects the request.
|
|
3192
3324
|
*
|
|
@@ -3209,8 +3341,10 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3209
3341
|
* only `verification_method` / `notification_methods` (or `{}` for the
|
|
3210
3342
|
* default Email channel). {@link buildAssignmentEstimatePayload} projects
|
|
3211
3343
|
* exactly the fields permitted by the estimate schema.
|
|
3212
|
-
* `DigitalCertificate` is priced at
|
|
3213
|
-
* subject to the feature
|
|
3344
|
+
* `DigitalCertificate` is priced at 0.5 credits per signer and remains
|
|
3345
|
+
* subject to the feature and identity requirements. It is valid only with
|
|
3346
|
+
* `method: 'virtual'`; the SDK refuses to quote a certificate/`collect`
|
|
3347
|
+
* request because that assignment cannot be completed.
|
|
3214
3348
|
* Current documented unit prices are 1 credit for an extra document, 0 for
|
|
3215
3349
|
* email notification, and 0.45 for WhatsApp notification; a digital
|
|
3216
3350
|
* certificate charge is added on top of its notification cost.
|
|
@@ -3255,7 +3389,9 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3255
3389
|
* ```
|
|
3256
3390
|
* @throws {ValidationError} If `documentId` is missing, a `virtual` request
|
|
3257
3391
|
* has no signer entry, or a `collect` request has no signer entry or no
|
|
3258
|
-
* field-placement entry
|
|
3392
|
+
* field-placement entry, or combines `DigitalCertificate` with `collect`.
|
|
3393
|
+
* The last case has `errors.code ===
|
|
3394
|
+
* 'digital_certificate_requires_virtual_method'`.
|
|
3259
3395
|
* @throws {ApiError} If the API rejects the request.
|
|
3260
3396
|
*
|
|
3261
3397
|
* @example
|
|
@@ -3436,6 +3572,116 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3436
3572
|
* ```
|
|
3437
3573
|
*/
|
|
3438
3574
|
listWhatsAppNotifications(documentId: string, assignmentId: string): Promise<IWhatsAppNotification[]>;
|
|
3575
|
+
/**
|
|
3576
|
+
* Read the account's signer identity review
|
|
3577
|
+
* (`GET /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification`).
|
|
3578
|
+
*
|
|
3579
|
+
* No request body. `InReview` lets the signer continue signing but holds
|
|
3580
|
+
* certification. Evidence is a summary without images or biometrics; a
|
|
3581
|
+
* directly approved verification exposes evidence on its activity instead.
|
|
3582
|
+
*
|
|
3583
|
+
* @param documentId - Document owning the assignment.
|
|
3584
|
+
* @param assignmentId - Assignment containing the signer.
|
|
3585
|
+
* @param signerId - Signer whose identity is under review.
|
|
3586
|
+
* @returns The complete review summary:
|
|
3587
|
+
* ```jsonc
|
|
3588
|
+
* {
|
|
3589
|
+
* "id": "verification_example", "status": "InReview",
|
|
3590
|
+
* "provider": "AssinafyVerify", "verification_method": "IdDocumentFaceMatchBasic",
|
|
3591
|
+
* "reason_codes": [{ "code": "NAME_MISMATCH", "description": "Name differs" }],
|
|
3592
|
+
* "evidence_available": true,
|
|
3593
|
+
* "expected": { "name": "Example Signer", "cpf": null },
|
|
3594
|
+
* "document": { "type": "CNH", "name": "EXAMPLE SIGNER", "cpf": null },
|
|
3595
|
+
* "matches": { "cpf": null, "name": 0.52, "birth_date": null },
|
|
3596
|
+
* "checks": [{ "name": "name", "result": "review", "score": 0.52, "reasons": ["NAME_MISMATCH"] }],
|
|
3597
|
+
* "images": ["document_front", "face"], // available only while InReview
|
|
3598
|
+
* "ruleset_version": "2026-10-12.2", "evidence_sha256": null,
|
|
3599
|
+
* "reviewed_by": null, "reviewed_at": null, "review_note": null, "completed_at": null
|
|
3600
|
+
* }
|
|
3601
|
+
* ```
|
|
3602
|
+
* @throws {ValidationError} If any ID is blank or invalid for a URL.
|
|
3603
|
+
* @throws {ApiError} `401` for invalid credentials; `404` for an unknown
|
|
3604
|
+
* assignment, signer or verification; `500` for a server failure.
|
|
3605
|
+
* @example
|
|
3606
|
+
* ```ts
|
|
3607
|
+
* const review = await client.assignments.getIdentityVerification('doc-1', 'asg-1', 'signer-1');
|
|
3608
|
+
* console.log(review.status, review.images.length);
|
|
3609
|
+
* ```
|
|
3610
|
+
*/
|
|
3611
|
+
getIdentityVerification(documentId: string, assignmentId: string, signerId: string): Promise<ISignerIdentityReview>;
|
|
3612
|
+
/**
|
|
3613
|
+
* Download identity review evidence
|
|
3614
|
+
* (`GET /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}`).
|
|
3615
|
+
*
|
|
3616
|
+
* No request body. The provider supplies the bytes on each request; Assinafy
|
|
3617
|
+
* never stores them. Available only while the review is open. Keep these
|
|
3618
|
+
* sensitive bytes out of caches and logs (`Cache-Control: no-store`).
|
|
3619
|
+
*
|
|
3620
|
+
* @param documentId - Document owning the assignment.
|
|
3621
|
+
* @param assignmentId - Assignment containing the signer.
|
|
3622
|
+
* @param signerId - Signer whose evidence to view.
|
|
3623
|
+
* @param name - One of the review's `images`: `document_front`,
|
|
3624
|
+
* `document_back`, `document_pdf`, or `face`.
|
|
3625
|
+
* @returns Raw JPEG, PNG or PDF bytes as a `Buffer`.
|
|
3626
|
+
* @throws {ValidationError} If an ID or image name is invalid.
|
|
3627
|
+
* @throws {ApiError} `401` for invalid credentials; `404` for absent evidence
|
|
3628
|
+
* or a decided review; `500` for a provider/server failure.
|
|
3629
|
+
* @example
|
|
3630
|
+
* ```ts
|
|
3631
|
+
* const bytes = await client.assignments.downloadIdentityVerificationImage('doc-1', 'asg-1', 'signer-1', 'face');
|
|
3632
|
+
* ```
|
|
3633
|
+
*/
|
|
3634
|
+
downloadIdentityVerificationImage(documentId: string, assignmentId: string, signerId: string, name: IdentityVerificationImageName): Promise<Buffer>;
|
|
3635
|
+
/**
|
|
3636
|
+
* Decide a signer identity review
|
|
3637
|
+
* (`POST /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review`).
|
|
3638
|
+
*
|
|
3639
|
+
* Requires `InReview` and a document at `pending_signature` or
|
|
3640
|
+
* `pending_identity_review`. Approval allows certification once all signers
|
|
3641
|
+
* sign and every review is approved. Rejection cancels the document as
|
|
3642
|
+
* `rejected_by_user` and sends cancellation notices to signers and copy
|
|
3643
|
+
* receivers. The note is hidden from them; the provider receives the decision.
|
|
3644
|
+
*
|
|
3645
|
+
* Request body (`application/json`):
|
|
3646
|
+
* ```jsonc
|
|
3647
|
+
* { "decision": "Approved", "note": "Verified independently." }
|
|
3648
|
+
* ```
|
|
3649
|
+
* @param documentId - Document owning the assignment.
|
|
3650
|
+
* @param assignmentId - Assignment containing the signer.
|
|
3651
|
+
* @param signerId - Signer whose review to decide.
|
|
3652
|
+
* @param payload - Explicit account review decision.
|
|
3653
|
+
* @param payload.decision - `Approved` or `Rejected`.
|
|
3654
|
+
* @param payload.note - Optional nullable note, at most 2000 characters.
|
|
3655
|
+
* @returns The updated review, in the full
|
|
3656
|
+
* {@link AssignmentResource.getIdentityVerification} shape:
|
|
3657
|
+
* ```jsonc
|
|
3658
|
+
* {
|
|
3659
|
+
* "id": "verification_example", "status": "Approved",
|
|
3660
|
+
* "provider": "AssinafyVerify", "verification_method": "IdDocumentFaceMatchBasic",
|
|
3661
|
+
* "reason_codes": [{ "code": "NAME_MISMATCH", "description": "Name differs" }],
|
|
3662
|
+
* "evidence_available": true,
|
|
3663
|
+
* "expected": { "name": "Example Signer", "cpf": null },
|
|
3664
|
+
* "document": { "type": "CNH", "name": "EXAMPLE SIGNER", "cpf": null },
|
|
3665
|
+
* "matches": { "cpf": null, "name": 0.52, "birth_date": null },
|
|
3666
|
+
* "checks": [{ "name": "name", "result": "review", "score": 0.52, "reasons": ["NAME_MISMATCH"] }],
|
|
3667
|
+
* "images": [], "ruleset_version": "2026-10-12.2", "evidence_sha256": null,
|
|
3668
|
+
* "reviewed_by": { "id": "user_example", "name": "Example Reviewer" },
|
|
3669
|
+
* "reviewed_at": "2026-10-16T12:00:00Z", "review_note": "Verified independently.",
|
|
3670
|
+
* "completed_at": "2026-10-16T12:00:00Z"
|
|
3671
|
+
* }
|
|
3672
|
+
* ```
|
|
3673
|
+
* @throws {ValidationError} If IDs, decision or note are invalid.
|
|
3674
|
+
* @throws {ApiError} `400` for a closed review or invalid document state;
|
|
3675
|
+
* `401` for invalid credentials; `404` if absent; `500` for a server failure.
|
|
3676
|
+
* @example
|
|
3677
|
+
* ```ts
|
|
3678
|
+
* await client.assignments.reviewIdentityVerification('doc-1', 'asg-1', 'signer-1', {
|
|
3679
|
+
* decision: 'Approved', note: 'Verified independently.',
|
|
3680
|
+
* });
|
|
3681
|
+
* ```
|
|
3682
|
+
*/
|
|
3683
|
+
reviewIdentityVerification(documentId: string, assignmentId: string, signerId: string, payload: IReviewIdentityVerificationPayload): Promise<ISignerIdentityReview>;
|
|
3684
|
+
private identityVerificationPath;
|
|
3439
3685
|
}
|
|
3440
3686
|
|
|
3441
3687
|
/**
|
|
@@ -3716,6 +3962,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3716
3962
|
* `account:read` scope.
|
|
3717
3963
|
*
|
|
3718
3964
|
* @param accountId - Override the client's default account ID.
|
|
3965
|
+
* @param params - Optional endpoint filters.
|
|
3966
|
+
* @param params.url - Match the exact registered endpoint URL.
|
|
3719
3967
|
* @returns Every endpoint (1 on free plans, up to 3 on paid plans):
|
|
3720
3968
|
* ```jsonc
|
|
3721
3969
|
* [
|
|
@@ -3741,15 +3989,18 @@ declare class WebhookResource extends BaseResource {
|
|
|
3741
3989
|
* const signed = endpoints.filter((endpoint) => endpoint.signing_enabled);
|
|
3742
3990
|
* ```
|
|
3743
3991
|
*/
|
|
3744
|
-
listEndpoints(accountId?: string
|
|
3992
|
+
listEndpoints(accountId?: string, params?: {
|
|
3993
|
+
url?: string;
|
|
3994
|
+
}): Promise<IWebhookEndpoint[]>;
|
|
3745
3995
|
/**
|
|
3746
3996
|
* Register a URL to receive the account's webhook events
|
|
3747
3997
|
* (`POST /accounts/{accountId}/webhooks/endpoints`).
|
|
3748
3998
|
*
|
|
3749
3999
|
* An account can have 1 endpoint, or up to 3 on paid plans. Each endpoint
|
|
3750
4000
|
* of a workspace needs a different `url`. With `signing_enabled: true` the
|
|
3751
|
-
* API
|
|
3752
|
-
* {@link WebhookResource.getEndpointSecret}
|
|
4001
|
+
* API returns a signing `secret` in this creation response. Store it now:
|
|
4002
|
+
* OAuth applications cannot call {@link WebhookResource.getEndpointSecret}
|
|
4003
|
+
* or rotate it later. When `events` is omitted or
|
|
3753
4004
|
* empty, {@link DEFAULT_WEBHOOK_EVENTS} is sent. OAuth tokens need the
|
|
3754
4005
|
* `webhooks:write` scope.
|
|
3755
4006
|
*
|
|
@@ -3779,6 +4030,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
3779
4030
|
* "events": ["document_ready", "signer_signed_document"],
|
|
3780
4031
|
* "is_active": true,
|
|
3781
4032
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4033
|
+
* "secret": "whsec_c2VjcmV0", // only in this response when signing is enabled
|
|
3782
4034
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
3783
4035
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
3784
4036
|
* }
|
|
@@ -3798,10 +4050,10 @@ declare class WebhookResource extends BaseResource {
|
|
|
3798
4050
|
* events: ['document_ready', 'signer_signed_document'],
|
|
3799
4051
|
* signing_enabled: true,
|
|
3800
4052
|
* });
|
|
3801
|
-
*
|
|
4053
|
+
* if (endpoint.secret) await secretStore.save(endpoint.id, endpoint.secret);
|
|
3802
4054
|
* ```
|
|
3803
4055
|
*/
|
|
3804
|
-
createEndpoint(payload: IWebhookEndpointCreatePayload, accountId?: string): Promise<
|
|
4056
|
+
createEndpoint(payload: IWebhookEndpointCreatePayload, accountId?: string): Promise<IWebhookEndpointCreateResponse>;
|
|
3805
4057
|
/**
|
|
3806
4058
|
* Retrieve one webhook endpoint
|
|
3807
4059
|
* (`GET /accounts/{accountId}/webhooks/endpoints/{endpointId}`). OAuth
|
|
@@ -3903,6 +4155,25 @@ declare class WebhookResource extends BaseResource {
|
|
|
3903
4155
|
* ```
|
|
3904
4156
|
*/
|
|
3905
4157
|
deleteEndpoint(endpointId: string, accountId?: string): Promise<void>;
|
|
4158
|
+
/**
|
|
4159
|
+
* Delete a webhook endpoint using its registered URL
|
|
4160
|
+
* (`DELETE /accounts/{accountId}/webhooks/endpoints?url=…`).
|
|
4161
|
+
*
|
|
4162
|
+
* No request body. The query URL must match the registered value exactly.
|
|
4163
|
+
* Frees its plan slot; OAuth applications need `webhooks:write`.
|
|
4164
|
+
*
|
|
4165
|
+
* @param url - Exact registered HTTP(S) endpoint URL, including its query.
|
|
4166
|
+
* @param accountId - Override the client's default workspace.
|
|
4167
|
+
* @returns Resolves on acknowledgement (`{ "status": 200, "data": [] }`).
|
|
4168
|
+
* @throws {ValidationError} If the URL is invalid or the account is missing.
|
|
4169
|
+
* @throws {ApiError} `400` for a missing URL; `401` for invalid credentials;
|
|
4170
|
+
* `403` for missing scope; `404` if no endpoint uses the URL; `500` on failure.
|
|
4171
|
+
* @example
|
|
4172
|
+
* ```ts
|
|
4173
|
+
* await client.webhooks.deleteEndpointByUrl('https://example.com/webhooks/assinafy');
|
|
4174
|
+
* ```
|
|
4175
|
+
*/
|
|
4176
|
+
deleteEndpointByUrl(url: string, accountId?: string): Promise<void>;
|
|
3906
4177
|
/**
|
|
3907
4178
|
* Return the secret that signs deliveries to an endpoint
|
|
3908
4179
|
* (`GET /accounts/{accountId}/webhooks/endpoints/{endpointId}/secret`).
|
|
@@ -3979,6 +4250,8 @@ declare class TemplateResource extends BaseResource {
|
|
|
3979
4250
|
*
|
|
3980
4251
|
* @param source - The PDF to upload, as a file path or an in-memory buffer.
|
|
3981
4252
|
* @param options - `name` (display name) and an optional `accountId` override.
|
|
4253
|
+
* @param options.name - Multipart filename override, with a `.pdf` extension.
|
|
4254
|
+
* @param options.accountId - Override the client's default workspace.
|
|
3982
4255
|
* @returns The created template (envelope unwrapped). Response shape:
|
|
3983
4256
|
* ```jsonc
|
|
3984
4257
|
* {
|
|
@@ -4122,7 +4395,7 @@ declare class TemplateResource extends BaseResource {
|
|
|
4122
4395
|
* @example
|
|
4123
4396
|
* ```ts
|
|
4124
4397
|
* const tmpl = await client.templates.get('103ad2171db7979468c3e97eb067');
|
|
4125
|
-
* if (tmpl.status === 'Ready') console.log(tmpl.pages
|
|
4398
|
+
* if (tmpl.status === 'Ready') console.log(tmpl.pages?.length ?? 0);
|
|
4126
4399
|
* ```
|
|
4127
4400
|
*/
|
|
4128
4401
|
get(templateId: string, accountId?: string): Promise<ITemplateDetailsResponse>;
|
|
@@ -4247,6 +4520,7 @@ declare class TagResource extends BaseResource {
|
|
|
4247
4520
|
*
|
|
4248
4521
|
* @param params - Optional filters. `search` matches tag names
|
|
4249
4522
|
* case-insensitively (substring).
|
|
4523
|
+
* @param params.search - Optional case-insensitive tag-name substring.
|
|
4250
4524
|
* @param accountId - Override the client's default account ID.
|
|
4251
4525
|
* @returns The matching tags (list items carry no `resource` field):
|
|
4252
4526
|
* ```jsonc
|
|
@@ -4380,6 +4654,8 @@ declare class TagResource extends BaseResource {
|
|
|
4380
4654
|
* @param tagId - The tag to delete.
|
|
4381
4655
|
* @param options - `force` to detach-and-delete when the tag is still in
|
|
4382
4656
|
* use, and `accountId` to override the client's default account ID.
|
|
4657
|
+
* @param options.force - Detach the tag from documents before deletion.
|
|
4658
|
+
* @param options.accountId - Override the client's default workspace.
|
|
4383
4659
|
* @returns `{ deleted: true }` when the tag was deleted.
|
|
4384
4660
|
* @throws {ValidationError} If `tagId` is missing, or no account ID is available.
|
|
4385
4661
|
* @throws {ApiError} `404` if the tag does not exist; `409` if the tag is
|
|
@@ -5595,6 +5871,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
5595
5871
|
* @param value - The value to check (validated against the field's
|
|
5596
5872
|
* type/regex). Sent as `{ value }` in the request body.
|
|
5597
5873
|
* @param options - Account override and optional legacy `signerAccessCode`.
|
|
5874
|
+
* @param options.accountId - Override the client's default workspace.
|
|
5875
|
+
* @param options.signerAccessCode - Legacy signer code sent as a query parameter.
|
|
5598
5876
|
* @returns The validation result. Response shape:
|
|
5599
5877
|
* ```jsonc
|
|
5600
5878
|
* {
|
|
@@ -5641,6 +5919,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
5641
5919
|
*
|
|
5642
5920
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
5643
5921
|
* @param options - Account override and optional legacy `signerAccessCode`.
|
|
5922
|
+
* @param options.accountId - Override the client's default workspace.
|
|
5923
|
+
* @param options.signerAccessCode - Legacy signer code sent as a query parameter.
|
|
5644
5924
|
* @returns One validation result per entry. Response shape:
|
|
5645
5925
|
* ```jsonc
|
|
5646
5926
|
* [
|
|
@@ -6032,7 +6312,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6032
6312
|
* "has_accepted_terms": false,
|
|
6033
6313
|
* "has_signature": false,
|
|
6034
6314
|
* "has_initial": false,
|
|
6035
|
-
* "is_signature_reusable": false
|
|
6315
|
+
* "is_signature_reusable": false,
|
|
6316
|
+
* "verification_method": "IdDocumentFaceMatchBasic"
|
|
6036
6317
|
* }
|
|
6037
6318
|
* ```
|
|
6038
6319
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
@@ -6047,6 +6328,74 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6047
6328
|
* ```
|
|
6048
6329
|
*/
|
|
6049
6330
|
self(signerAccessCode: string): Promise<ISignerSelf>;
|
|
6331
|
+
/**
|
|
6332
|
+
* Read the signer's identity verification state
|
|
6333
|
+
* (`GET /signers/identity-verification?signer-access-code=…`).
|
|
6334
|
+
*
|
|
6335
|
+
* No request body or workspace credentials. Reads a pending provider
|
|
6336
|
+
* decision when available. A new session can start before the first capture
|
|
6337
|
+
* or after `Expired`; `Declined` and `Abandoned` require a new document and
|
|
6338
|
+
* assignment. `InReview` lets the signer continue; account approval gates
|
|
6339
|
+
* certification, with `pending_identity_review` after everyone signs.
|
|
6340
|
+
*
|
|
6341
|
+
* @param signerAccessCode - Access code from the signer's signing link.
|
|
6342
|
+
* @returns Provider state, with nullable fields before a session exists:
|
|
6343
|
+
* ```jsonc
|
|
6344
|
+
* {
|
|
6345
|
+
* "can_start": false, "status": "Pending",
|
|
6346
|
+
* "url": "https://verify.example.com/c/session#t=opaque",
|
|
6347
|
+
* "expires_at": "2026-10-16T12:30:00Z", "completed_at": null
|
|
6348
|
+
* }
|
|
6349
|
+
* ```
|
|
6350
|
+
* `url` exists only while Pending. It is a bearer link: open it intact,
|
|
6351
|
+
* including its fragment, and keep it out of logs and browser storage.
|
|
6352
|
+
* @throws {ValidationError} If the access code is blank.
|
|
6353
|
+
* @throws {ApiError} `401` for an invalid/expired code; `500` for a server failure.
|
|
6354
|
+
* @example
|
|
6355
|
+
* ```ts
|
|
6356
|
+
* const state = await client.signerDocuments.getIdentityVerification(accessCode);
|
|
6357
|
+
* console.log(state.status, state.can_start);
|
|
6358
|
+
* ```
|
|
6359
|
+
*/
|
|
6360
|
+
getIdentityVerification(signerAccessCode: string): Promise<ISignerIdentityVerification>;
|
|
6361
|
+
/**
|
|
6362
|
+
* Record biometric consent and open an identity verification session
|
|
6363
|
+
* (`POST /signers/identity-verification?signer-access-code=…`).
|
|
6364
|
+
*
|
|
6365
|
+
* Send only after the signer explicitly consents. Starts a session when
|
|
6366
|
+
* none exists or replaces an Expired session. Other states return `400`;
|
|
6367
|
+
* resending a notification never replaces a live session. The account is
|
|
6368
|
+
* billed at assignment creation, with no new charge for a restart.
|
|
6369
|
+
*
|
|
6370
|
+
* Request body (`application/json`):
|
|
6371
|
+
* ```jsonc
|
|
6372
|
+
* { "consent": true }
|
|
6373
|
+
* ```
|
|
6374
|
+
* @param signerAccessCode - Access code from the signer's signing link.
|
|
6375
|
+
* @param payload - Explicit consent from the signer.
|
|
6376
|
+
* @param payload.consent - Must be `true`; never default or infer consent.
|
|
6377
|
+
* @returns The newly opened provider session:
|
|
6378
|
+
* ```jsonc
|
|
6379
|
+
* {
|
|
6380
|
+
* "id": "verification_example",
|
|
6381
|
+
* "url": "https://verify.example.com/c/session#t=opaque",
|
|
6382
|
+
* "expires_at": "2026-10-16T12:30:00Z"
|
|
6383
|
+
* }
|
|
6384
|
+
* ```
|
|
6385
|
+
* `expires_at` can be null. Open the URL as-is; it is a bearer credential
|
|
6386
|
+
* and its fragment must survive navigation. Do not log or persist it in
|
|
6387
|
+
* browser storage. No workspace credential is attached to this call.
|
|
6388
|
+
* @throws {ValidationError} If the code is blank or consent is not `true`.
|
|
6389
|
+
* @throws {ApiError} `400` when a non-expired session already exists;
|
|
6390
|
+
* `401` for an invalid/expired code; `500` for a provider/server failure.
|
|
6391
|
+
* @example
|
|
6392
|
+
* ```ts
|
|
6393
|
+
* // Inside the handler for the signer's explicit consent action:
|
|
6394
|
+
* const session = await client.signerDocuments.startIdentityVerification(accessCode, { consent: true });
|
|
6395
|
+
* response.redirect(session.url);
|
|
6396
|
+
* ```
|
|
6397
|
+
*/
|
|
6398
|
+
startIdentityVerification(signerAccessCode: string, payload: IStartIdentityVerificationPayload): Promise<ISignerIdentityVerificationSession>;
|
|
6050
6399
|
/**
|
|
6051
6400
|
* Accept the platform terms of use as the signer
|
|
6052
6401
|
* (`PUT /signers/accept-terms?signer-access-code=…`).
|
|
@@ -6072,10 +6421,10 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6072
6421
|
*/
|
|
6073
6422
|
acceptTerms(signerAccessCode: string): Promise<void>;
|
|
6074
6423
|
/**
|
|
6075
|
-
* Verify the signer's email one-time password
|
|
6424
|
+
* Verify the signer's email or WhatsApp one-time password
|
|
6076
6425
|
* (`POST /verify?signer-access-code=…`).
|
|
6077
6426
|
*
|
|
6078
|
-
* Confirms the 6-digit OTP
|
|
6427
|
+
* Confirms the 6-digit OTP sent through the selected channel. The access code
|
|
6079
6428
|
* authenticates via the `signer-access-code` **query param**; the request
|
|
6080
6429
|
* **body carries only `verification-code`** (putting the access code in the
|
|
6081
6430
|
* body leaves the request unauthenticated → `401`).
|
|
@@ -6089,6 +6438,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6089
6438
|
*
|
|
6090
6439
|
* @param payload - `signerAccessCode` (the signing-link code) and
|
|
6091
6440
|
* `verificationCode` (the OTP the signer received).
|
|
6441
|
+
* @param payload.signerAccessCode - Signing-link code sent only in the query.
|
|
6442
|
+
* @param payload.verificationCode - Email or WhatsApp OTP sent as `verification-code`.
|
|
6092
6443
|
* @returns Resolves when the API acknowledges the operation. The response
|
|
6093
6444
|
* envelope has no `data` field and is intentionally discarded.
|
|
6094
6445
|
* @throws {ValidationError} If `signerAccessCode` or `verificationCode` is
|
|
@@ -6197,6 +6548,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6197
6548
|
* @param image - The image bytes as a non-empty `Buffer`.
|
|
6198
6549
|
* @param options - `imageType` (`'signature'` default, or `'initial'`) and
|
|
6199
6550
|
* `reuse` (persist for reuse). The official request content type is PNG.
|
|
6551
|
+
* @param options.imageType - Signature image category; defaults to `signature`.
|
|
6552
|
+
* @param options.reuse - Persist the image for future signing requests.
|
|
6200
6553
|
* @returns Resolves when the API acknowledges the upload. The response
|
|
6201
6554
|
* envelope has no `data` field and is intentionally discarded.
|
|
6202
6555
|
* @throws {ValidationError} If `signerAccessCode` is missing or `image` is not
|
|
@@ -6222,6 +6575,9 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6222
6575
|
* @param signerAccessCode - Access code sent in the query string.
|
|
6223
6576
|
* @param image - Non-empty raw image bytes, without a JSON envelope.
|
|
6224
6577
|
* @param options - Image type, reuse preference and compatibility content type.
|
|
6578
|
+
* @param options.imageType - Signature image category; defaults to `signature`.
|
|
6579
|
+
* @param options.reuse - Persist the image for future signing requests.
|
|
6580
|
+
* @param options.contentType - Compatibility media type; the official type is `image/png`.
|
|
6225
6581
|
* @returns Nothing; the acknowledgement body is discarded.
|
|
6226
6582
|
* @throws {ValidationError} If the code, image or options are invalid.
|
|
6227
6583
|
* @throws {ApiError} If the API rejects the upload.
|
|
@@ -6305,7 +6661,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
6305
6661
|
* "expires_at": null,
|
|
6306
6662
|
* "signers": [
|
|
6307
6663
|
* { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
|
|
6308
|
-
* "full_name": "Example Signer", "notified": true
|
|
6664
|
+
* "full_name": "Example Signer", "notified": true }
|
|
6309
6665
|
* ],
|
|
6310
6666
|
* "items": [
|
|
6311
6667
|
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
@@ -6756,7 +7112,8 @@ declare class WebhookVerifier {
|
|
|
6756
7112
|
* @param toleranceSeconds - Accepted clock distance. Defaults to `300`.
|
|
6757
7113
|
* @returns `true` only when a signature entry matches (constant-time) and
|
|
6758
7114
|
* the timestamp is fresh; `false` when verification is disabled, a header
|
|
6759
|
-
* is missing,
|
|
7115
|
+
* is missing, the tolerance is not finite and non-negative, or anything
|
|
7116
|
+
* does not match.
|
|
6760
7117
|
*
|
|
6761
7118
|
* @example
|
|
6762
7119
|
* ```ts
|
|
@@ -7363,4 +7720,4 @@ declare const MAX_LIST_PAGE_SIZE = 50;
|
|
|
7363
7720
|
|
|
7364
7721
|
declare const SDK_USER_AGENT: string;
|
|
7365
7722
|
|
|
7366
|
-
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 ISendTokenResult, 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 };
|
|
7723
|
+
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, DIGITAL_CERTIFICATE_REQUIRES_VIRTUAL_METHOD, 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 };
|