@assinafy/sdk 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -1
- package/README.md +601 -117
- package/SECURITY.md +4 -2
- package/dist/index.d.mts +697 -316
- package/dist/index.d.ts +697 -316
- package/dist/index.js +3102 -1938
- package/dist/index.mjs +3100 -1938
- package/docs/API_COVERAGE.md +28 -30
- package/docs/COMPATIBILITY.md +279 -179
- package/docs/RELEASING.md +42 -11
- package/package.json +10 -9
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,9 @@ import { AxiosInstance, AxiosResponse } from 'axios';
|
|
|
3
3
|
/** Document lifecycle states emitted by the API. */
|
|
4
4
|
type DocumentStatus = 'uploading' | 'uploaded' | 'metadata_processing' | 'metadata_ready' | 'pending_signature' | 'expired' | 'certificating' | 'certificated' | 'rejected_by_signer' | 'rejected_by_user' | 'failed';
|
|
5
5
|
/** Artifact names available for document download. */
|
|
6
|
-
type DocumentArtifactName = 'original' | 'certificated' | 'certificate-page' | 'bundle';
|
|
6
|
+
type DocumentArtifactName = 'original' | 'certificated' | 'certificate-page' | 'pades' | 'bundle';
|
|
7
|
+
/** Server-defined signature image category, with known values suggested. */
|
|
8
|
+
type SignatureImageType = 'signature' | 'initial' | AnyString;
|
|
7
9
|
/**
|
|
8
10
|
* Any string, while keeping editor autocomplete for the literals it is unioned
|
|
9
11
|
* with.
|
|
@@ -21,9 +23,9 @@ type AnyString = string & {};
|
|
|
21
23
|
/** Assignment methods supported by the API. */
|
|
22
24
|
type AssignmentMethod = 'virtual' | 'collect';
|
|
23
25
|
/** Verification methods accepted by assignment signer entries. */
|
|
24
|
-
type AssignmentVerificationMethod = 'Email' | 'Whatsapp' |
|
|
26
|
+
type AssignmentVerificationMethod = 'Email' | 'Whatsapp' | 'DigitalCertificate';
|
|
25
27
|
/** Notification methods accepted by assignment signer entries. */
|
|
26
|
-
type AssignmentNotificationMethod = 'Email' | 'Whatsapp'
|
|
28
|
+
type AssignmentNotificationMethod = 'Email' | 'Whatsapp';
|
|
27
29
|
/** Minimal logger contract (compatible with console, pino, winston, etc.). */
|
|
28
30
|
interface Logger {
|
|
29
31
|
debug: (message: string, context?: Record<string, unknown>) => void;
|
|
@@ -42,7 +44,10 @@ interface AssinafyClientOptions {
|
|
|
42
44
|
token?: string;
|
|
43
45
|
/** Default account (workspace) ID applied to account-scoped endpoints. */
|
|
44
46
|
accountId?: string;
|
|
45
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Override the API base URL. Defaults to https://api.assinafy.com.br/v1.
|
|
49
|
+
* Must be absolute HTTP(S) without credentials, a query, or a fragment.
|
|
50
|
+
*/
|
|
46
51
|
baseUrl?: string;
|
|
47
52
|
/**
|
|
48
53
|
* Secret for an opt-in HMAC-SHA256 convention implemented by your own
|
|
@@ -54,8 +59,10 @@ interface AssinafyClientOptions {
|
|
|
54
59
|
timeout?: number;
|
|
55
60
|
/**
|
|
56
61
|
* Max automatic retries on HTTP 429 (rate limit), honoring `Retry-After`.
|
|
57
|
-
* Automatic retries are limited to
|
|
58
|
-
* DELETE requests
|
|
62
|
+
* Automatic retries are limited to replay-safe GET, HEAD, OPTIONS, and
|
|
63
|
+
* DELETE requests. `GET /sign` is excluded because it records a signer
|
|
64
|
+
* view. An explicit `Idempotency-Key` opts other requests into SDK replay;
|
|
65
|
+
* callers must confirm server-side deduplication for the target route.
|
|
59
66
|
* Defaults to `2`. Set to `0` to disable retrying.
|
|
60
67
|
*/
|
|
61
68
|
maxRetries?: number;
|
|
@@ -74,9 +81,9 @@ interface ICreateSignerPayload {
|
|
|
74
81
|
whatsapp_phone_number?: string;
|
|
75
82
|
/** Compatibility alias normalized to `whatsapp_phone_number` before sending. */
|
|
76
83
|
phone?: string;
|
|
77
|
-
/**
|
|
84
|
+
/** Compatibility extension. Brazilian CPF; non-digits are stripped. */
|
|
78
85
|
cpf?: string;
|
|
79
|
-
/**
|
|
86
|
+
/** Compatibility extension retained for existing integrations. */
|
|
80
87
|
metadata?: Record<string, unknown>;
|
|
81
88
|
}
|
|
82
89
|
/** Payload for updating a signer. */
|
|
@@ -86,8 +93,10 @@ interface IUpdateSignerPayload {
|
|
|
86
93
|
whatsapp_phone_number?: string;
|
|
87
94
|
/** Compatibility alias normalized to `whatsapp_phone_number` before sending. */
|
|
88
95
|
phone?: string;
|
|
89
|
-
/**
|
|
96
|
+
/** Compatibility extension. Brazilian CPF; non-digits are stripped. */
|
|
90
97
|
cpf?: string;
|
|
98
|
+
/** Official CPF/CNPJ field; non-digits are stripped before sending. */
|
|
99
|
+
government_id?: string;
|
|
91
100
|
}
|
|
92
101
|
/** Signer object as returned by the API. */
|
|
93
102
|
interface ISigner {
|
|
@@ -112,9 +121,12 @@ interface ISigner {
|
|
|
112
121
|
}
|
|
113
122
|
/** Signer profile returned by the signer-code-authenticated `GET /signers/self`. */
|
|
114
123
|
interface ISignerSelf extends ISigner {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
/** Optional for compatibility with deployments that omit this field. */
|
|
125
|
+
has_signature?: boolean;
|
|
126
|
+
/** Optional for compatibility with deployments that omit this field. */
|
|
127
|
+
has_initial?: boolean;
|
|
128
|
+
/** Optional for compatibility with deployments that omit this field. */
|
|
129
|
+
is_signature_reusable?: boolean;
|
|
118
130
|
}
|
|
119
131
|
/** Official identity fields accepted by the signer `confirm-data` operation. */
|
|
120
132
|
interface IConfirmSignerDataPayload {
|
|
@@ -123,28 +135,27 @@ interface IConfirmSignerDataPayload {
|
|
|
123
135
|
email?: string;
|
|
124
136
|
/** Government-issued identifier recorded with the signature. */
|
|
125
137
|
government_id?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Accept terms atomically with identity confirmation. Required before
|
|
140
|
+
* opening a DigitalCertificate assignment unless `acceptTerms()` was called.
|
|
141
|
+
*/
|
|
142
|
+
has_accepted_terms?: boolean;
|
|
126
143
|
}
|
|
127
144
|
/**
|
|
128
145
|
* Compatibility input retained for integrations written against older
|
|
129
|
-
* Assinafy deployments.
|
|
146
|
+
* Assinafy deployments. The extra phone property does not belong to the current
|
|
130
147
|
* `confirm-data` request schema.
|
|
131
148
|
*/
|
|
132
149
|
interface ILegacyConfirmSignerDataPayload extends IConfirmSignerDataPayload {
|
|
133
150
|
/**
|
|
134
|
-
* @deprecated
|
|
151
|
+
* @deprecated Compatibility field. Prefer updating the account signer
|
|
135
152
|
* record before starting the signing flow.
|
|
136
153
|
*/
|
|
137
154
|
whatsapp_phone_number?: string;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Unverified legacy pass-through. It does not replace the
|
|
140
|
-
* official `acceptTerms()` operation and must not be treated as proof of
|
|
141
|
-
* legal consent.
|
|
142
|
-
*/
|
|
143
|
-
has_accepted_terms?: boolean;
|
|
144
155
|
}
|
|
145
156
|
/** Official options for uploading the PNG signature image described by OpenAPI. */
|
|
146
157
|
interface IUploadSignatureOptions {
|
|
147
|
-
imageType?:
|
|
158
|
+
imageType?: SignatureImageType;
|
|
148
159
|
/** Persist this image so it is reused on future documents. */
|
|
149
160
|
reuse?: boolean;
|
|
150
161
|
}
|
|
@@ -152,10 +163,11 @@ interface IUploadSignatureOptions {
|
|
|
152
163
|
interface ILegacyUploadSignatureOptions extends IUploadSignatureOptions {
|
|
153
164
|
/**
|
|
154
165
|
* @deprecated The current API contract accepts only `image/png`. Non-PNG
|
|
155
|
-
* values are retained as
|
|
166
|
+
* values are retained as a compatibility escape hatch.
|
|
156
167
|
*/
|
|
157
168
|
contentType?: string;
|
|
158
169
|
}
|
|
170
|
+
/** Signer returned after create or update. */
|
|
159
171
|
type ICreateSignerResponse = ISigner;
|
|
160
172
|
/** Pagination metadata extracted from `X-Pagination-*` response headers. */
|
|
161
173
|
interface PaginationMeta {
|
|
@@ -171,6 +183,7 @@ interface PaginatedResult<T> {
|
|
|
171
183
|
}
|
|
172
184
|
/** @deprecated use {@link PaginatedResult} — retained for existing type imports. */
|
|
173
185
|
type IPaginatedResponse<T> = PaginatedResult<T>;
|
|
186
|
+
/** Paginated signer-list response. */
|
|
174
187
|
type ISignerListResponse = PaginatedResult<ISigner>;
|
|
175
188
|
/** Signer reference accepted by the assignment endpoints. */
|
|
176
189
|
type SignerReference = string | {
|
|
@@ -198,30 +211,42 @@ interface ICreateAssignmentPayload {
|
|
|
198
211
|
* shape before sending.
|
|
199
212
|
*/
|
|
200
213
|
signers?: SignerReference[];
|
|
201
|
-
/**
|
|
214
|
+
/** Compatibility alias rewritten by the SDK to the official `signers` field. */
|
|
202
215
|
signer_ids?: string[];
|
|
203
216
|
/** Camel-case legacy alias used by the quick-start docs. */
|
|
204
217
|
signerIds?: string[];
|
|
205
218
|
message?: string;
|
|
206
219
|
expires_at?: string;
|
|
207
220
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* ⚠️ Observed to be **silently dropped** on the sandbox plan: values sent
|
|
211
|
-
* here came back as `[]` from `assignments.create`, `assignments.list` and
|
|
212
|
-
* `documents.details().assignment` alike, for both email addresses and
|
|
213
|
-
* signer IDs. The field is accepted (no error) but nothing is persisted.
|
|
221
|
+
* Existing signer IDs to CC on the signature request (not email addresses).
|
|
214
222
|
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* are plausible. **Do not rely on it without verifying against your own
|
|
219
|
-
* account**, and do not treat a CC as delivered.
|
|
223
|
+
* This can be plan-dependent. Confirm that returned assignment data retains
|
|
224
|
+
* the IDs before treating a copy as delivered; unsupported plans may accept
|
|
225
|
+
* the field but return an empty array.
|
|
220
226
|
*/
|
|
221
227
|
copy_receivers?: string[];
|
|
222
228
|
/** Field placement entries used when `method` is `collect`. */
|
|
223
229
|
entries?: IAssignmentEntry[];
|
|
224
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Field rectangle used by collect assignments. Coordinates are pixels in the
|
|
233
|
+
* API's 150-DPI page image, measured from the upper-left corner.
|
|
234
|
+
*/
|
|
235
|
+
interface IDisplaySettings {
|
|
236
|
+
left: number;
|
|
237
|
+
top: number;
|
|
238
|
+
width: number;
|
|
239
|
+
height: number;
|
|
240
|
+
fontSize: number;
|
|
241
|
+
fontFamily?: string;
|
|
242
|
+
backgroundColor?: string;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Assignment-item rendering metadata. Collect items use
|
|
246
|
+
* {@link IDisplaySettings}; older virtual responses can contain an empty array
|
|
247
|
+
* or another JSON primitive instead.
|
|
248
|
+
*/
|
|
249
|
+
type AssignmentDisplaySettings = IDisplaySettings | unknown[] | string | number | boolean | null;
|
|
225
250
|
/**
|
|
226
251
|
* A field-placement entry for a `collect`-method assignment: one page and the
|
|
227
252
|
* per-signer fields positioned on it.
|
|
@@ -231,12 +256,8 @@ interface IAssignmentEntry {
|
|
|
231
256
|
fields: Array<{
|
|
232
257
|
signer_id: string;
|
|
233
258
|
field_id: string;
|
|
234
|
-
/**
|
|
235
|
-
|
|
236
|
-
* loosely typed: the spec models it as a bare object and the live API
|
|
237
|
-
* returns an unstable shape (an empty array on assignment items).
|
|
238
|
-
*/
|
|
239
|
-
display_settings?: Record<string, unknown>;
|
|
259
|
+
/** Rectangle and presentation metadata for this field. */
|
|
260
|
+
display_settings?: IDisplaySettings;
|
|
240
261
|
}>;
|
|
241
262
|
}
|
|
242
263
|
/** Channel descriptor accepted by assignment cost estimation. */
|
|
@@ -259,9 +280,12 @@ interface IEstimateAssignmentCostPayload {
|
|
|
259
280
|
interface IAssignmentSigner extends ISigner {
|
|
260
281
|
/** Only present in account-owner contexts; omitted from signer-code responses. */
|
|
261
282
|
completed?: boolean | null;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
283
|
+
/** Optional because some deployments omit notification history. */
|
|
284
|
+
notification_history?: INotificationHistoryEntry[] | null;
|
|
285
|
+
/** Server-controlled response value; request payloads use the strict request enum. */
|
|
286
|
+
verification_method: AssignmentVerificationMethod | AnyString | null;
|
|
287
|
+
/** Server-controlled response values; request payloads use the strict request enum. */
|
|
288
|
+
notification_methods: Array<AssignmentNotificationMethod | AnyString> | null;
|
|
265
289
|
/** 1-based signing order. See {@link SignerReference.step}. */
|
|
266
290
|
step: number | null;
|
|
267
291
|
notified: boolean | null;
|
|
@@ -287,6 +311,8 @@ interface IAssignmentItem {
|
|
|
287
311
|
} | null;
|
|
288
312
|
signer: ISigner;
|
|
289
313
|
field: IFieldDefinition | null;
|
|
314
|
+
/** Collect settings or a documented legacy/non-object wire value. */
|
|
315
|
+
display_settings?: AssignmentDisplaySettings;
|
|
290
316
|
/** Captured field value; its wire type depends on the field definition. */
|
|
291
317
|
value: unknown | null;
|
|
292
318
|
completed?: boolean;
|
|
@@ -318,7 +344,9 @@ interface IAssignment {
|
|
|
318
344
|
url: string;
|
|
319
345
|
}>;
|
|
320
346
|
}
|
|
347
|
+
/** Assignment returned after requesting signatures. */
|
|
321
348
|
type ICreateAssignmentResponse = IAssignment;
|
|
349
|
+
/** Acknowledgement returned after resending a signature notification. */
|
|
322
350
|
interface IResendEmailResponse {
|
|
323
351
|
is_sent: boolean;
|
|
324
352
|
document_id: string;
|
|
@@ -344,17 +372,15 @@ interface ICostEstimate {
|
|
|
344
372
|
document_balance: number;
|
|
345
373
|
credit_balance: number;
|
|
346
374
|
has_sufficient_resources: boolean;
|
|
347
|
-
/** `null` when the operation can proceed; otherwise
|
|
348
|
-
blocking_reason:
|
|
375
|
+
/** `null` when the operation can proceed; otherwise the documented reason code. */
|
|
376
|
+
blocking_reason: 'PendingPayment' | 'InsufficientDocuments' | 'InsufficientCredits' | null;
|
|
349
377
|
message: string | null;
|
|
350
378
|
}
|
|
351
379
|
/**
|
|
352
380
|
* Legacy resend-cost payload still returned by some Assinafy environments.
|
|
353
381
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* The SDK models both wire formats instead of promising fields that may be
|
|
357
|
-
* absent at runtime.
|
|
382
|
+
* This smaller, resend-specific compatibility shape can be returned instead of
|
|
383
|
+
* {@link ICostEstimate}; the SDK models both wire formats.
|
|
358
384
|
*/
|
|
359
385
|
interface ILegacyResendCostEstimate {
|
|
360
386
|
total: number;
|
|
@@ -396,7 +422,7 @@ type WebhookEventType = 'document_uploaded' | 'document_metadata_ready' | 'docum
|
|
|
396
422
|
interface IDocumentListItem {
|
|
397
423
|
id: string;
|
|
398
424
|
name: string;
|
|
399
|
-
status: DocumentStatus;
|
|
425
|
+
status: DocumentStatus | AnyString;
|
|
400
426
|
account_id?: string;
|
|
401
427
|
template_id?: string | null;
|
|
402
428
|
/** Artifact download URLs keyed by name (`original`, `thumbnail`, …). */
|
|
@@ -413,9 +439,14 @@ interface IDocumentListItem {
|
|
|
413
439
|
updated_at?: string;
|
|
414
440
|
is_closed?: boolean;
|
|
415
441
|
}
|
|
442
|
+
/** Paginated document-list/search response. */
|
|
416
443
|
type IDocumentListResponse = PaginatedResult<IDocumentListItem>;
|
|
417
444
|
/** Query parameters accepted by `documents.list`. */
|
|
418
445
|
interface IDocumentListParams extends IListParams {
|
|
446
|
+
/** Free-text term matched against document fields. */
|
|
447
|
+
search?: string;
|
|
448
|
+
/** Sort expression accepted by the document list endpoint. */
|
|
449
|
+
sort?: string;
|
|
419
450
|
/** Filter by document status, e.g. `pending_signature`. */
|
|
420
451
|
status?: DocumentStatus | AnyString;
|
|
421
452
|
/** Filter by signature method (`virtual` or `collect`). */
|
|
@@ -426,15 +457,14 @@ interface IDocumentListParams extends IListParams {
|
|
|
426
457
|
/**
|
|
427
458
|
* Response of `documents.rename` (`PATCH /documents/{documentId}`).
|
|
428
459
|
*
|
|
429
|
-
* The
|
|
430
|
-
* `assignment` — verified against the live API, which echoes only
|
|
460
|
+
* The response can omit `pages` and `assignment` and return only
|
|
431
461
|
* `resource`, `id`, `account_id`, `template_id`, `name`, `status`,
|
|
432
462
|
* `artifacts`, `signing_url`, `is_closed`, `decline_reason`, `declined_by`,
|
|
433
|
-
* `tags`, `created_at` and `updated_at`.
|
|
434
|
-
*
|
|
435
|
-
*
|
|
463
|
+
* `tags`, `created_at` and `updated_at`. The two fields are therefore optional:
|
|
464
|
+
* callers get the complete document fields without being promised values that
|
|
465
|
+
* can be absent at runtime.
|
|
436
466
|
*/
|
|
437
|
-
type IRenameDocumentResponse = Omit<IDocumentDetailsResponse, 'pages' | 'assignment'
|
|
467
|
+
type IRenameDocumentResponse = Omit<IDocumentDetailsResponse, 'pages' | 'assignment'> & Partial<Pick<IDocumentDetailsResponse, 'pages' | 'assignment'>>;
|
|
438
468
|
/** Query parameters accepted by `documents.search`. */
|
|
439
469
|
interface IDocumentSearchParams extends IListParams {
|
|
440
470
|
/** Free-text term matched against the document name. */
|
|
@@ -462,13 +492,14 @@ interface IDocumentUploadResponse {
|
|
|
462
492
|
account_id: string;
|
|
463
493
|
template_id: string | null;
|
|
464
494
|
name: string;
|
|
465
|
-
status: DocumentStatus;
|
|
495
|
+
status: DocumentStatus | AnyString;
|
|
466
496
|
/** Absent on a fresh upload; an {@link IAssignment} (or `null`) once one exists. */
|
|
467
497
|
assignment?: IAssignment | null;
|
|
468
498
|
artifacts: {
|
|
469
499
|
original: string;
|
|
470
500
|
certificated?: string;
|
|
471
501
|
'certificate-page'?: string;
|
|
502
|
+
pades?: string;
|
|
472
503
|
bundle?: string;
|
|
473
504
|
thumbnail?: string;
|
|
474
505
|
};
|
|
@@ -498,7 +529,7 @@ interface IDocumentDetailsResponse {
|
|
|
498
529
|
account_id: string;
|
|
499
530
|
template_id?: string | null;
|
|
500
531
|
name: string;
|
|
501
|
-
status: DocumentStatus;
|
|
532
|
+
status: DocumentStatus | AnyString;
|
|
502
533
|
assignment: IAssignment | null;
|
|
503
534
|
download_url?: string;
|
|
504
535
|
download_final_url?: string;
|
|
@@ -507,6 +538,7 @@ interface IDocumentDetailsResponse {
|
|
|
507
538
|
original: string;
|
|
508
539
|
certificated?: string;
|
|
509
540
|
'certificate-page'?: string;
|
|
541
|
+
pades?: string;
|
|
510
542
|
bundle?: string;
|
|
511
543
|
thumbnail?: string;
|
|
512
544
|
};
|
|
@@ -521,11 +553,12 @@ interface IDocumentDetailsResponse {
|
|
|
521
553
|
declined_by?: ISigner | null;
|
|
522
554
|
activities?: Array<IDocumentActivity>;
|
|
523
555
|
}
|
|
556
|
+
/** One immutable activity event returned by `documents.activities()`. */
|
|
524
557
|
interface IDocumentActivity {
|
|
525
558
|
id: number;
|
|
526
559
|
event: string;
|
|
527
560
|
message: string;
|
|
528
|
-
/** Event-specific payload
|
|
561
|
+
/** Event-specific payload. Object for most events, occasionally `[]` or `null`. */
|
|
529
562
|
payload?: Record<string, unknown> | unknown[] | null;
|
|
530
563
|
/** Request origin (`ip` / `user-agent`) when available; `null` for system events. */
|
|
531
564
|
origin: {
|
|
@@ -546,10 +579,21 @@ interface IListParams {
|
|
|
546
579
|
page?: number;
|
|
547
580
|
per_page?: number;
|
|
548
581
|
'per-page'?: number;
|
|
582
|
+
/** Compatibility filter used by several list endpoints. */
|
|
549
583
|
search?: string;
|
|
584
|
+
/** Compatibility sort expression retained for existing integrations. */
|
|
550
585
|
sort?: string;
|
|
586
|
+
/** Deployment-specific list filters retained for backwards compatibility. */
|
|
551
587
|
[key: string]: string | number | boolean | undefined;
|
|
552
588
|
}
|
|
589
|
+
/** Query parameters accepted by `signers.list`. */
|
|
590
|
+
interface ISignerListParams extends IListParams {
|
|
591
|
+
search?: string;
|
|
592
|
+
}
|
|
593
|
+
/** Query parameters accepted by `templates.list`. */
|
|
594
|
+
interface ITemplateListParams extends IListParams {
|
|
595
|
+
search?: string;
|
|
596
|
+
}
|
|
553
597
|
/**
|
|
554
598
|
* Workspace creation payload.
|
|
555
599
|
*
|
|
@@ -557,7 +601,7 @@ interface IListParams {
|
|
|
557
601
|
* which accept a leading `#` and strip it — the account endpoints require an
|
|
558
602
|
* **exactly 6-character hex string with NO leading `#`** (`'ff0066'`, not
|
|
559
603
|
* `'#ff0066'`); a 7-character `#`-prefixed value is rejected with `400`
|
|
560
|
-
* ("Primary Color" deve conter 6 caracteres).
|
|
604
|
+
* ("Primary Color" deve conter 6 caracteres).
|
|
561
605
|
*/
|
|
562
606
|
interface ICreateWorkspacePayload {
|
|
563
607
|
name: string;
|
|
@@ -578,6 +622,7 @@ interface IUpdateWorkspacePayload {
|
|
|
578
622
|
/** 6-char hex, no leading `#`. */
|
|
579
623
|
secondary_color?: string | null;
|
|
580
624
|
}
|
|
625
|
+
/** Workspace returned by account create/get/update operations. */
|
|
581
626
|
interface IWorkspaceResponse {
|
|
582
627
|
resource?: string;
|
|
583
628
|
id: string;
|
|
@@ -591,10 +636,12 @@ interface IWorkspaceResponse {
|
|
|
591
636
|
}
|
|
592
637
|
/** Notification sender identity accepted by account create/update operations. */
|
|
593
638
|
type NotificationSenderType = 'User' | 'Account';
|
|
639
|
+
/** Workspace list item with the caller's roles and deletion permission. */
|
|
594
640
|
interface IWorkspaceListItem extends IWorkspaceResponse {
|
|
595
641
|
is_delete_allowed: boolean;
|
|
596
642
|
roles: string[];
|
|
597
643
|
}
|
|
644
|
+
/** Paginated workspace-list response. */
|
|
598
645
|
type IWorkspaceListResponse = PaginatedResult<IWorkspaceListItem>;
|
|
599
646
|
/** Branding returned by `GET /accounts/{accountId}/theme`. */
|
|
600
647
|
interface IAccountTheme {
|
|
@@ -614,18 +661,31 @@ interface IDocumentStatsParams {
|
|
|
614
661
|
/** Target `YYYY-MM`; required when `granularity` is `daily`. */
|
|
615
662
|
month?: string;
|
|
616
663
|
}
|
|
617
|
-
/**
|
|
664
|
+
/**
|
|
665
|
+
* One zero-filled document-funnel KPI period. Notification counters are not
|
|
666
|
+
* mutually exclusive; verification counters are and sum to
|
|
667
|
+
* `signature_requests`.
|
|
668
|
+
*/
|
|
618
669
|
interface IDocumentStatsRow {
|
|
619
670
|
/** `YYYY-MM` for monthly results or `YYYY-MM-DD` for daily results. */
|
|
620
671
|
period: string;
|
|
621
672
|
documents_uploaded: number;
|
|
622
673
|
documents_sent: number;
|
|
623
674
|
signature_requests: number;
|
|
624
|
-
|
|
625
|
-
|
|
675
|
+
signature_requests_notification_email: number;
|
|
676
|
+
signature_requests_notification_whatsapp: number;
|
|
677
|
+
signature_requests_notification_bypass: number;
|
|
678
|
+
signature_requests_verification_email: number;
|
|
679
|
+
signature_requests_verification_whatsapp: number;
|
|
680
|
+
signature_requests_verification_bypass: number;
|
|
681
|
+
signature_requests_verification_digital_certificate: number;
|
|
626
682
|
signature_requests_viewed: number;
|
|
627
683
|
signature_requests_completed: number;
|
|
628
684
|
documents_certified: number;
|
|
685
|
+
/** @deprecated Older deployment field; use `signature_requests_notification_email`. */
|
|
686
|
+
signature_requests_email?: number;
|
|
687
|
+
/** @deprecated Older deployment field; use `signature_requests_notification_whatsapp`. */
|
|
688
|
+
signature_requests_whatsapp?: number;
|
|
629
689
|
}
|
|
630
690
|
/** Webhook subscription payload. */
|
|
631
691
|
interface IWebhookRegisterPayload {
|
|
@@ -651,10 +711,12 @@ interface IWebhookSubscription {
|
|
|
651
711
|
is_active: boolean;
|
|
652
712
|
updated_at?: string | null;
|
|
653
713
|
}
|
|
714
|
+
/** Event code and human-readable description from the webhook event catalog. */
|
|
654
715
|
interface IWebhookEventTypeInfo {
|
|
655
716
|
id: WebhookEventType | AnyString;
|
|
656
717
|
description: string;
|
|
657
718
|
}
|
|
719
|
+
/** One webhook delivery attempt returned by the delivery-history endpoints. */
|
|
658
720
|
interface IWebhookDispatch {
|
|
659
721
|
resource?: string;
|
|
660
722
|
id: string;
|
|
@@ -664,6 +726,7 @@ interface IWebhookDispatch {
|
|
|
664
726
|
payload: IWebhookPayload | Record<string, unknown> | null;
|
|
665
727
|
delivered: boolean;
|
|
666
728
|
http_status: number | null;
|
|
729
|
+
/** Receiving endpoint body, truncated by Assinafy to 2,000 characters. */
|
|
667
730
|
response_body: string | null;
|
|
668
731
|
error: string | null;
|
|
669
732
|
/** ISO-8601 UTC timestamp, e.g. `'2026-07-15T20:04:36Z'`. */
|
|
@@ -671,6 +734,7 @@ interface IWebhookDispatch {
|
|
|
671
734
|
/** ISO-8601 UTC timestamp, e.g. `'2026-07-15T20:04:36Z'`. */
|
|
672
735
|
updated_at?: string;
|
|
673
736
|
}
|
|
737
|
+
/** Filters accepted by `webhooks.listDispatches()`. */
|
|
674
738
|
interface IWebhookDispatchListParams extends IListParams {
|
|
675
739
|
event?: WebhookEventType | AnyString;
|
|
676
740
|
delivered?: boolean | 'true' | 'false';
|
|
@@ -684,7 +748,7 @@ interface IUploadAndRequestSignaturesResult {
|
|
|
684
748
|
* fully-processed {@link IDocumentDetailsResponse} re-fetched after the
|
|
685
749
|
* assignment is created — so `status`, `pages` and the embedded `assignment`
|
|
686
750
|
* are current. When `waitForReady` is `false` it is the raw
|
|
687
|
-
* {@link IDocumentUploadResponse} upload
|
|
751
|
+
* {@link IDocumentUploadResponse} upload response (`status: 'uploaded'`).
|
|
688
752
|
*/
|
|
689
753
|
document: IDocumentUploadResponse | IDocumentDetailsResponse;
|
|
690
754
|
assignment: IAssignment;
|
|
@@ -728,7 +792,8 @@ interface ITemplateListItem {
|
|
|
728
792
|
* Rendered pages, each with a `download_url`. Empty until the template
|
|
729
793
|
* finishes processing (`status: 'Ready'`). Both the list and get endpoints
|
|
730
794
|
* return `pages`, so there is no need to fetch a template again just to read
|
|
731
|
-
* them.
|
|
795
|
+
* them. The URL requires API-key authentication; prefer
|
|
796
|
+
* `templates.downloadPage()` to fetch its bytes.
|
|
732
797
|
*/
|
|
733
798
|
pages?: IPage[];
|
|
734
799
|
roles?: ITemplateRole[];
|
|
@@ -737,8 +802,8 @@ interface ITemplateListItem {
|
|
|
737
802
|
created_at: string;
|
|
738
803
|
updated_at?: string;
|
|
739
804
|
}
|
|
805
|
+
/** Paginated template-list response. */
|
|
740
806
|
type ITemplateListResponse = PaginatedResult<ITemplateListItem>;
|
|
741
|
-
/** Full template details. */
|
|
742
807
|
/**
|
|
743
808
|
* A rendered page of a document or template.
|
|
744
809
|
*
|
|
@@ -766,7 +831,7 @@ interface IPage {
|
|
|
766
831
|
height: number;
|
|
767
832
|
/** Rendered width in pixels (150 DPI). */
|
|
768
833
|
width: number;
|
|
769
|
-
/** Absolute URL of the page's JPEG rendering. */
|
|
834
|
+
/** Absolute API-key-authenticated URL of the page's JPEG rendering. */
|
|
770
835
|
download_url?: string;
|
|
771
836
|
/** Fields positioned on this page. Present on templates; absent on documents. */
|
|
772
837
|
fields?: ITemplateFieldPlacement[];
|
|
@@ -782,6 +847,7 @@ interface ITemplateFieldPlacement {
|
|
|
782
847
|
created_at?: string;
|
|
783
848
|
updated_at?: string;
|
|
784
849
|
}
|
|
850
|
+
/** Full template details returned by `templates.get()`. */
|
|
785
851
|
interface ITemplateDetailsResponse {
|
|
786
852
|
resource?: string;
|
|
787
853
|
id: string;
|
|
@@ -804,8 +870,8 @@ interface ITemplateDetailsResponse {
|
|
|
804
870
|
interface ITemplateSigner {
|
|
805
871
|
role_id: string;
|
|
806
872
|
id: string;
|
|
807
|
-
verification_method?:
|
|
808
|
-
notification_methods?:
|
|
873
|
+
verification_method?: AssignmentVerificationMethod;
|
|
874
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
809
875
|
/** Positive integer controlling signing order (see {@link SignerReference}). */
|
|
810
876
|
step?: number;
|
|
811
877
|
}
|
|
@@ -815,8 +881,8 @@ interface ITemplateSigner {
|
|
|
815
881
|
*/
|
|
816
882
|
interface ITemplateCostSigner {
|
|
817
883
|
role_id: string;
|
|
818
|
-
verification_method?:
|
|
819
|
-
notification_methods?:
|
|
884
|
+
verification_method?: AssignmentVerificationMethod;
|
|
885
|
+
notification_methods?: AssignmentNotificationMethod[];
|
|
820
886
|
}
|
|
821
887
|
/** Options for creating a document from a template. */
|
|
822
888
|
interface ICreateDocumentFromTemplateOptions {
|
|
@@ -837,7 +903,7 @@ interface ICreateDocumentFromTemplateOptions {
|
|
|
837
903
|
* Item returned by `GET /documents/statuses`.
|
|
838
904
|
*
|
|
839
905
|
* The API uses `code` (the status name); we mirror that field. `description`
|
|
840
|
-
* is
|
|
906
|
+
* is optional because responses can omit it.
|
|
841
907
|
*/
|
|
842
908
|
interface IDocumentStatusInfo {
|
|
843
909
|
code: DocumentStatus | AnyString;
|
|
@@ -849,9 +915,9 @@ interface IPublicDocumentInfo extends Partial<Omit<IDocumentDetailsResponse, 'id
|
|
|
849
915
|
resource?: string;
|
|
850
916
|
id: string;
|
|
851
917
|
name: string;
|
|
852
|
-
/**
|
|
918
|
+
/** Optional compatibility response field. */
|
|
853
919
|
page_count?: string | number;
|
|
854
|
-
/**
|
|
920
|
+
/** Optional compatibility response field. */
|
|
855
921
|
created_by?: string;
|
|
856
922
|
[key: string]: unknown;
|
|
857
923
|
}
|
|
@@ -870,7 +936,6 @@ interface IDocumentVerification {
|
|
|
870
936
|
}
|
|
871
937
|
/** Channel accepted by the `send-token` endpoint. */
|
|
872
938
|
type SendTokenChannel = 'email' | 'whatsapp' | AnyString;
|
|
873
|
-
/** Authentication: login response (also returned by social login). */
|
|
874
939
|
/** Authenticated user profile returned by login and `users.getCurrent()`. */
|
|
875
940
|
interface IAuthenticatedUser {
|
|
876
941
|
id: string;
|
|
@@ -880,11 +945,30 @@ interface IAuthenticatedUser {
|
|
|
880
945
|
government_id: string | null;
|
|
881
946
|
is_email_verified: boolean;
|
|
882
947
|
has_accepted_terms: boolean;
|
|
883
|
-
/**
|
|
948
|
+
/** Compatibility field. */
|
|
884
949
|
is_password_set?: boolean;
|
|
885
950
|
created_at: string;
|
|
886
951
|
to_be_deleted_at: string | null;
|
|
887
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Owner-facing document e-mail preferences returned by
|
|
955
|
+
* `GET /users/self/notification-preferences`. The API always returns all nine
|
|
956
|
+
* keys; `true` means that notification is enabled.
|
|
957
|
+
*/
|
|
958
|
+
interface INotificationPreferences {
|
|
959
|
+
DocumentCompleted: boolean;
|
|
960
|
+
SignerDeclined: boolean;
|
|
961
|
+
DocumentCancelled: boolean;
|
|
962
|
+
DocumentAboutToExpire: boolean;
|
|
963
|
+
DocumentExpired: boolean;
|
|
964
|
+
DocumentExpirationReset: boolean;
|
|
965
|
+
DocumentProcessingFailed: boolean;
|
|
966
|
+
TemplateProcessingFailed: boolean;
|
|
967
|
+
SignerWhatsappFailed: boolean;
|
|
968
|
+
}
|
|
969
|
+
/** Partial preference map accepted by `PUT /users/self/notification-preferences`. */
|
|
970
|
+
type IUpdateNotificationPreferences = Partial<INotificationPreferences>;
|
|
971
|
+
/** Login/social-login response containing the bearer token, user, and accounts. */
|
|
888
972
|
interface ILoginResponse {
|
|
889
973
|
access_token: string;
|
|
890
974
|
user: IAuthenticatedUser;
|
|
@@ -924,16 +1008,16 @@ interface ICreateFieldPayload {
|
|
|
924
1008
|
name: string;
|
|
925
1009
|
regex?: string | null;
|
|
926
1010
|
is_required?: boolean;
|
|
927
|
-
/**
|
|
1011
|
+
/** Compatibility extension. */
|
|
928
1012
|
is_active?: boolean;
|
|
929
1013
|
}
|
|
930
1014
|
/** Payload for updating a field definition. */
|
|
931
1015
|
interface IUpdateFieldPayload {
|
|
932
|
-
/**
|
|
1016
|
+
/** Compatibility extension. */
|
|
933
1017
|
type?: string;
|
|
934
1018
|
name?: string;
|
|
935
1019
|
regex?: string | null;
|
|
936
|
-
/**
|
|
1020
|
+
/** Compatibility extension. */
|
|
937
1021
|
is_required?: boolean;
|
|
938
1022
|
is_active?: boolean;
|
|
939
1023
|
}
|
|
@@ -942,13 +1026,28 @@ interface IFieldType {
|
|
|
942
1026
|
type: string;
|
|
943
1027
|
name: string;
|
|
944
1028
|
}
|
|
945
|
-
/**
|
|
1029
|
+
/**
|
|
1030
|
+
* @deprecated Compatibility shape previously shared by both field-validation
|
|
1031
|
+
* endpoints. Prefer {@link IFieldValidationResponse} for a single value or
|
|
1032
|
+
* {@link IFieldValidationMultipleResult} for one item in a batch response.
|
|
1033
|
+
*/
|
|
946
1034
|
interface IFieldValidationResult {
|
|
947
1035
|
type?: string;
|
|
948
1036
|
field_id?: string;
|
|
949
1037
|
success: boolean;
|
|
950
1038
|
error_message: string;
|
|
951
1039
|
}
|
|
1040
|
+
/** Result returned by `POST /accounts/{id}/fields/{id}/validate`. */
|
|
1041
|
+
interface IFieldValidationResponse extends IFieldValidationResult {
|
|
1042
|
+
type: string;
|
|
1043
|
+
/** The single-value endpoint does not return a field ID. */
|
|
1044
|
+
field_id?: never;
|
|
1045
|
+
}
|
|
1046
|
+
/** One item returned by `POST /accounts/{id}/fields/validate-multiple`. */
|
|
1047
|
+
interface IFieldValidationMultipleResult extends IFieldValidationResult {
|
|
1048
|
+
type: string;
|
|
1049
|
+
field_id: string;
|
|
1050
|
+
}
|
|
952
1051
|
/** Payload entry for `POST /accounts/{id}/fields/validate-multiple`. */
|
|
953
1052
|
interface IFieldValidateMultipleEntry {
|
|
954
1053
|
field_id: string;
|
|
@@ -985,6 +1084,14 @@ interface ITag {
|
|
|
985
1084
|
created_at: string;
|
|
986
1085
|
updated_at: string;
|
|
987
1086
|
}
|
|
1087
|
+
/** Acknowledgement returned after detaching a tag from a document. */
|
|
1088
|
+
interface IDetachDocumentTagResponse {
|
|
1089
|
+
detached: boolean;
|
|
1090
|
+
}
|
|
1091
|
+
/** Acknowledgement returned after deleting a workspace tag. */
|
|
1092
|
+
interface IDeleteTagResponse {
|
|
1093
|
+
deleted: boolean;
|
|
1094
|
+
}
|
|
988
1095
|
/** Inline tag shape embedded inside documents/templates (`{ id, name, color? }`). */
|
|
989
1096
|
interface IInlineTag {
|
|
990
1097
|
id: string;
|
|
@@ -1127,7 +1234,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1127
1234
|
* }
|
|
1128
1235
|
* ```
|
|
1129
1236
|
* @throws {ValidationError} If the file is empty, not a `.pdf`, exceeds
|
|
1130
|
-
* 25 MB, or the API returns no document ID.
|
|
1237
|
+
* 25 MB, or the API returns no document ID. The API rejects PDFs over
|
|
1238
|
+
* 2,000 pages.
|
|
1131
1239
|
* @throws {ApiError} If the API rejects the upload.
|
|
1132
1240
|
*
|
|
1133
1241
|
* @example
|
|
@@ -1150,8 +1258,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
1150
1258
|
* so prefer it when you need signing state or page geometry. Pagination
|
|
1151
1259
|
* info (if any) is attached in `meta`.
|
|
1152
1260
|
*
|
|
1153
|
-
* @param params - Filters and pagination: `status
|
|
1154
|
-
* (comma-separated
|
|
1261
|
+
* @param params - Filters and pagination: `status`; `method` (`virtual` or
|
|
1262
|
+
* `collect`); `tags` (comma-separated IDs, all of which must match);
|
|
1263
|
+
* `search` (document name, signer name, or signer email); `sort` (`name` or
|
|
1264
|
+
* `updated_at`); `page`; and `per-page` (the server clamps this to 50
|
|
1265
|
+
* rather than rejecting a larger value).
|
|
1155
1266
|
* @param accountId - Override the client's default account ID.
|
|
1156
1267
|
* @returns Matching documents, with pagination in `meta`. Each item:
|
|
1157
1268
|
* ```jsonc
|
|
@@ -1254,10 +1365,29 @@ declare class DocumentResource extends BaseResource {
|
|
|
1254
1365
|
*
|
|
1255
1366
|
* @param documentId - The document to rename.
|
|
1256
1367
|
* @param name - The new display name (max 255 chars), e.g.
|
|
1257
|
-
* `'Service agreement.pdf'`.
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
* {@link DocumentResource.details}
|
|
1368
|
+
* `'Service agreement.pdf'`. The API removes diacritics and replaces
|
|
1369
|
+
* unsupported characters with dashes.
|
|
1370
|
+
* @returns The updated document. `pages` and `assignment` are optional on
|
|
1371
|
+
* this response; call {@link DocumentResource.details} when they are
|
|
1372
|
+
* required:
|
|
1373
|
+
* ```jsonc
|
|
1374
|
+
* {
|
|
1375
|
+
* "resource": "document",
|
|
1376
|
+
* "id": "103ad216846e6b90710cb9acef59",
|
|
1377
|
+
* "account_id": "acc_example",
|
|
1378
|
+
* "template_id": null,
|
|
1379
|
+
* "name": "Service agreement.pdf",
|
|
1380
|
+
* "status": "metadata_ready",
|
|
1381
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
1382
|
+
* "signing_url": "https://…/sign/103ad216…",
|
|
1383
|
+
* "is_closed": false,
|
|
1384
|
+
* "decline_reason": null,
|
|
1385
|
+
* "declined_by": null,
|
|
1386
|
+
* "tags": [],
|
|
1387
|
+
* "created_at": "2026-07-19T17:24:43Z",
|
|
1388
|
+
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1389
|
+
* }
|
|
1390
|
+
* ```
|
|
1261
1391
|
* @throws {ValidationError} If `documentId` or `name` is missing.
|
|
1262
1392
|
* @throws {ApiError} `400` if the document is processing or already in
|
|
1263
1393
|
* signing; `404` if it does not exist.
|
|
@@ -1274,7 +1404,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1274
1404
|
* Get document details (`GET /documents/{documentId}`).
|
|
1275
1405
|
*
|
|
1276
1406
|
* The full single-document view, including the embedded `assignment` (or
|
|
1277
|
-
* `null`), rendered `pages`, and `artifacts`.
|
|
1407
|
+
* `null`), rendered `pages`, and `artifacts`. `decline_reason` is returned
|
|
1408
|
+
* only when the access token belongs to the document creator.
|
|
1278
1409
|
*
|
|
1279
1410
|
* @param documentId - The document to fetch.
|
|
1280
1411
|
* @returns The document. Response shape (once `metadata_ready`):
|
|
@@ -1284,7 +1415,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1284
1415
|
* "id": "103ad216846e6b90710cb9acef59",
|
|
1285
1416
|
* "account_id": "acc_example",
|
|
1286
1417
|
* "template_id": null,
|
|
1287
|
-
* "name": "
|
|
1418
|
+
* "name": "service-agreement.pdf",
|
|
1288
1419
|
* "status": "metadata_ready",
|
|
1289
1420
|
* "artifacts": {
|
|
1290
1421
|
* "original": "https://…/documents/103ad216…/download/original",
|
|
@@ -1309,7 +1440,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1309
1440
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1310
1441
|
* }
|
|
1311
1442
|
* ```
|
|
1312
|
-
* @throws {ValidationError} If `documentId` is missing
|
|
1443
|
+
* @throws {ValidationError} If `documentId` is missing or `artifactName` is
|
|
1444
|
+
* not one of the five documented artifact names.
|
|
1313
1445
|
* @throws {ApiError} `404` if the document does not exist.
|
|
1314
1446
|
*
|
|
1315
1447
|
* @example
|
|
@@ -1319,6 +1451,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1319
1451
|
* ```
|
|
1320
1452
|
*/
|
|
1321
1453
|
details(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
1454
|
+
private fetchDetails;
|
|
1322
1455
|
/**
|
|
1323
1456
|
* Alias for {@link DocumentResource.details}
|
|
1324
1457
|
* (`GET /documents/{documentId}`).
|
|
@@ -1376,9 +1509,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
1376
1509
|
*
|
|
1377
1510
|
* @param documentId - The document to download from.
|
|
1378
1511
|
* @param artifactName - Which artifact to fetch: `original`,
|
|
1379
|
-
* `certificated` (the default — the signed PDF), `certificate-page`,
|
|
1380
|
-
* `bundle
|
|
1381
|
-
*
|
|
1512
|
+
* `certificated` (the default — the signed PDF), `certificate-page`,
|
|
1513
|
+
* `pades`, or `bundle` (ZIP). `pades` exists only when the document had a
|
|
1514
|
+
* Digital Certificate signer. `bundle` contains the original, certificated,
|
|
1515
|
+
* and certificate-page artifacts, plus PAdES when present.
|
|
1516
|
+
* @returns A {@link Buffer} containing the raw PDF or ZIP bytes.
|
|
1382
1517
|
* @throws {ValidationError} If `documentId` is missing.
|
|
1383
1518
|
* @throws {ApiError} `404` if the document or artifact does not exist (e.g.
|
|
1384
1519
|
* requesting `certificated` before signing completes).
|
|
@@ -1387,6 +1522,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1387
1522
|
* ```ts
|
|
1388
1523
|
* const pdf = await client.documents.download('doc-1'); // signed PDF
|
|
1389
1524
|
* const original = await client.documents.download('doc-1', 'original');
|
|
1525
|
+
* const pades = await client.documents.download('doc-1', 'pades');
|
|
1390
1526
|
* await fs.promises.writeFile('signed.pdf', pdf);
|
|
1391
1527
|
* ```
|
|
1392
1528
|
*/
|
|
@@ -1432,7 +1568,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1432
1568
|
* Fetch the document activity log
|
|
1433
1569
|
* (`GET /documents/{documentId}/activities`).
|
|
1434
1570
|
*
|
|
1435
|
-
* Returns a chronological
|
|
1571
|
+
* Returns a chronological history of lifecycle events. Normalises an
|
|
1436
1572
|
* absent body to `[]`.
|
|
1437
1573
|
*
|
|
1438
1574
|
* @param documentId - The document whose activity log to fetch.
|
|
@@ -1452,7 +1588,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1452
1588
|
* "event": "document_uploaded",
|
|
1453
1589
|
* "message": "Documento criado.",
|
|
1454
1590
|
* "payload": [],
|
|
1455
|
-
* "origin": { "ip": "
|
|
1591
|
+
* "origin": { "ip": "192.0.2.10", "user-agent": "assinafy-webforms-java-client-sdk" },
|
|
1456
1592
|
* "created_at": "2026-07-19T14:56:55Z"
|
|
1457
1593
|
* }
|
|
1458
1594
|
* ]
|
|
@@ -1476,7 +1612,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1476
1612
|
* certificated.
|
|
1477
1613
|
*
|
|
1478
1614
|
* @param documentId - The document to delete.
|
|
1479
|
-
* @returns Nothing
|
|
1615
|
+
* @returns Nothing; resolves when the document is deleted.
|
|
1480
1616
|
* @throws {ValidationError} If `documentId` is missing.
|
|
1481
1617
|
* @throws {ApiError} `400` if the document is not in a deletable status;
|
|
1482
1618
|
* `404` if it does not exist.
|
|
@@ -1520,10 +1656,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1520
1656
|
* Replace the document's tag set
|
|
1521
1657
|
* (`PUT /accounts/{accountId}/documents/{documentId}/tags`).
|
|
1522
1658
|
*
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
* should not be relied on. This overwrites the existing set — use
|
|
1659
|
+
* `tags` is an array of tag **IDs**. An empty array detaches all tags. Tag
|
|
1660
|
+
* names are not portable identifiers and should not be used here. This
|
|
1661
|
+
* overwrites the existing set — use
|
|
1527
1662
|
* {@link DocumentResource.addTags} to append.
|
|
1528
1663
|
*
|
|
1529
1664
|
* @param documentId - The document to retag.
|
|
@@ -1586,29 +1721,34 @@ declare class DocumentResource extends BaseResource {
|
|
|
1586
1721
|
* @param documentId - The document to detach from.
|
|
1587
1722
|
* @param tagId - The ID of the tag to detach.
|
|
1588
1723
|
* @param accountId - Override the client's default account ID.
|
|
1589
|
-
* @returns
|
|
1724
|
+
* @returns `{ detached: true }` when the association was removed.
|
|
1590
1725
|
* @throws {ValidationError} If `documentId` or `tagId` is missing, or no
|
|
1591
1726
|
* account ID is available.
|
|
1592
1727
|
* @throws {ApiError} If the API rejects the request.
|
|
1593
1728
|
*
|
|
1594
1729
|
* @example
|
|
1595
1730
|
* ```ts
|
|
1596
|
-
* await client.documents.detachTag('doc-1', 'tag-1');
|
|
1731
|
+
* const { detached } = await client.documents.detachTag('doc-1', 'tag-1');
|
|
1597
1732
|
* ```
|
|
1598
1733
|
*/
|
|
1599
|
-
detachTag(documentId: string, tagId: string, accountId?: string): Promise<
|
|
1734
|
+
detachTag(documentId: string, tagId: string, accountId?: string): Promise<IDetachDocumentTagResponse>;
|
|
1600
1735
|
/**
|
|
1601
1736
|
* Create a document from a template
|
|
1602
1737
|
* (`POST /accounts/{accountId}/templates/{templateId}/documents`).
|
|
1603
1738
|
*
|
|
1604
1739
|
* Instantiates the template, binding each role to a signer, and returns the
|
|
1605
1740
|
* new document. The request body is `{ signers, ...options }` — `signers`
|
|
1606
|
-
* maps template `role_id`
|
|
1607
|
-
* `message`, `expires_at`, `editor_fields`, and
|
|
1741
|
+
* maps every template `role_id` to an existing account signer `id`, and
|
|
1742
|
+
* `options` may add `name`, `message`, `expires_at`, `editor_fields`, and
|
|
1743
|
+
* tag names in `tags` (unknown names are created automatically).
|
|
1608
1744
|
*
|
|
1609
1745
|
* @param templateId - The template to instantiate.
|
|
1610
1746
|
* @param signers - Role-to-signer bindings (each with `role_id` and `id`,
|
|
1611
1747
|
* plus optional `verification_method`, `notification_methods`, `step`).
|
|
1748
|
+
* Only one notification method is allowed per signer; when only one of the
|
|
1749
|
+
* verification/notification fields is supplied, the API infers the other.
|
|
1750
|
+
* `DigitalCertificate` costs two credits, requires the feature plus a
|
|
1751
|
+
* signer `government_id`, and that signer must be alone in its step.
|
|
1612
1752
|
* @param options - Optional `name`, `message`, `expires_at`,
|
|
1613
1753
|
* `editor_fields`, `tags`.
|
|
1614
1754
|
* @param accountId - Override the client's default account ID.
|
|
@@ -1620,12 +1760,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1620
1760
|
* "id": "19f675b761b392a48b8642503bb",
|
|
1621
1761
|
* "account_id": "acc_example",
|
|
1622
1762
|
* "template_id": "103a0991a5cde83518e5672aa9aa",
|
|
1623
|
-
* "name": "
|
|
1763
|
+
* "name": "Service agreement from template",
|
|
1624
1764
|
* "status": "pending_signature",
|
|
1625
1765
|
* "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
|
|
1626
1766
|
* "is_closed": false,
|
|
1627
1767
|
* "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
|
|
1628
|
-
* "tags": [{ "id": "103a0992…", "name": "
|
|
1768
|
+
* "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
|
|
1629
1769
|
* "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
|
|
1630
1770
|
* "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
|
|
1631
1771
|
* "created_at": "2026-07-15T19:57:55Z",
|
|
@@ -1640,7 +1780,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1640
1780
|
* @example
|
|
1641
1781
|
* ```ts
|
|
1642
1782
|
* await client.documents.createFromTemplate('tmpl_id', [
|
|
1643
|
-
* { role_id: 'role_id', id: 'signer_id', verification_method: '
|
|
1783
|
+
* { role_id: 'role_id', id: 'signer_id', verification_method: 'DigitalCertificate' },
|
|
1644
1784
|
* ], { name: 'My Contract' });
|
|
1645
1785
|
* ```
|
|
1646
1786
|
*/
|
|
@@ -1651,11 +1791,14 @@ declare class DocumentResource extends BaseResource {
|
|
|
1651
1791
|
*
|
|
1652
1792
|
* A dry run: sends only `{ signers }` and consumes nothing. Use it to check
|
|
1653
1793
|
* balances before calling {@link DocumentResource.createFromTemplate}.
|
|
1794
|
+
* `DigitalCertificate` adds two credits per signer and has the same feature,
|
|
1795
|
+
* `government_id`, and signing-step prerequisites as document creation.
|
|
1654
1796
|
*
|
|
1655
1797
|
* @param templateId - The template that would be instantiated.
|
|
1656
1798
|
* @param signers - One channel descriptor per template role. Cost requests
|
|
1657
1799
|
* use only `role_id`, `verification_method`, and `notification_methods`;
|
|
1658
|
-
* they do not send a signer ID or signing-order step
|
|
1800
|
+
* they do not send a signer ID or signing-order step, and editor roles are
|
|
1801
|
+
* ignored by the cost calculation.
|
|
1659
1802
|
* @param accountId - Override the client's default account ID.
|
|
1660
1803
|
* @returns An {@link ICostEstimate}: `total_credits`, balances, and a
|
|
1661
1804
|
* per-line `breakdown` of what the operation would consume:
|
|
@@ -1683,7 +1826,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1683
1826
|
* @example
|
|
1684
1827
|
* ```ts
|
|
1685
1828
|
* const estimate = await client.documents.estimateCostFromTemplate('tmpl_id', [
|
|
1686
|
-
* { role_id: 'role_id', verification_method: '
|
|
1829
|
+
* { role_id: 'role_id', verification_method: 'DigitalCertificate' },
|
|
1687
1830
|
* ]);
|
|
1688
1831
|
* if (!estimate.has_sufficient_resources) throw new Error(estimate.blocking_reason ?? 'insufficient');
|
|
1689
1832
|
* ```
|
|
@@ -1699,8 +1842,21 @@ declare class DocumentResource extends BaseResource {
|
|
|
1699
1842
|
*
|
|
1700
1843
|
* @param hash - The document's signature hash (the
|
|
1701
1844
|
* `documentSignatureHash` path segment).
|
|
1702
|
-
* @returns
|
|
1703
|
-
*
|
|
1845
|
+
* @returns The verification record:
|
|
1846
|
+
* ```jsonc
|
|
1847
|
+
* {
|
|
1848
|
+
* "hash": "FE32EDDADE7CBDDCBB934E7402047450B0E59C02",
|
|
1849
|
+
* "id": "63ddb172402799bfc991d10d",
|
|
1850
|
+
* "status": "certificated",
|
|
1851
|
+
* "page_count": "1",
|
|
1852
|
+
* "signer_count": "1",
|
|
1853
|
+
* "completed_count": 1,
|
|
1854
|
+
* "completed_at": "2023-01-27T19:27:44Z",
|
|
1855
|
+
* "verified_at": "2023-01-27T19:27:46Z",
|
|
1856
|
+
* "is_valid": true,
|
|
1857
|
+
* "message": ""
|
|
1858
|
+
* }
|
|
1859
|
+
* ```
|
|
1704
1860
|
* @throws {ValidationError} If `hash` is missing.
|
|
1705
1861
|
* @throws {ApiError} If the API rejects the request.
|
|
1706
1862
|
*
|
|
@@ -1711,11 +1867,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1711
1867
|
*/
|
|
1712
1868
|
verify(hash: string): Promise<IDocumentVerification>;
|
|
1713
1869
|
/**
|
|
1714
|
-
* List
|
|
1870
|
+
* List the server's document-status catalog (`GET /documents/statuses`).
|
|
1715
1871
|
*
|
|
1716
|
-
* A
|
|
1717
|
-
* in that status can be deleted (`deletable`).
|
|
1718
|
-
*
|
|
1872
|
+
* A server-controlled catalog of each status `code` and whether documents
|
|
1873
|
+
* in that status can be deleted (`deletable`). New statuses may be added,
|
|
1874
|
+
* so callers should not depend on a fixed count or order. This catalog
|
|
1875
|
+
* requires the same API-key or Bearer authentication as workspace calls.
|
|
1719
1876
|
*
|
|
1720
1877
|
* @returns The status catalog:
|
|
1721
1878
|
* ```jsonc
|
|
@@ -1725,9 +1882,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1725
1882
|
* { "code": "metadata_processing", "deletable": false },
|
|
1726
1883
|
* { "code": "metadata_ready", "deletable": true },
|
|
1727
1884
|
* { "code": "pending_signature", "deletable": true },
|
|
1728
|
-
* { "code": "
|
|
1729
|
-
*
|
|
1730
|
-
*
|
|
1885
|
+
* { "code": "expired", "deletable": false },
|
|
1886
|
+
* { "code": "certificating", "deletable": false },
|
|
1887
|
+
* { "code": "certificated", "deletable": false },
|
|
1888
|
+
* { "code": "rejected_by_signer", "deletable": false },
|
|
1889
|
+
* { "code": "rejected_by_user", "deletable": false },
|
|
1890
|
+
* { "code": "failed", "deletable": false }
|
|
1731
1891
|
* ]
|
|
1732
1892
|
* ```
|
|
1733
1893
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -1740,21 +1900,32 @@ declare class DocumentResource extends BaseResource {
|
|
|
1740
1900
|
*/
|
|
1741
1901
|
statuses(): Promise<IDocumentStatusInfo[]>;
|
|
1742
1902
|
/**
|
|
1743
|
-
* Public, unauthenticated lookup of
|
|
1903
|
+
* Public, unauthenticated lookup of a document
|
|
1744
1904
|
* (`GET /public/documents/{documentId}`).
|
|
1745
1905
|
*
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1906
|
+
* Returns either the full document response or a compact `page_count` /
|
|
1907
|
+
* `created_by` compatibility variant.
|
|
1748
1908
|
*
|
|
1749
1909
|
* @param documentId - The document to look up.
|
|
1750
|
-
* @returns
|
|
1910
|
+
* @returns The current document representation:
|
|
1751
1911
|
* ```jsonc
|
|
1752
1912
|
* {
|
|
1753
1913
|
* "resource": "document",
|
|
1754
1914
|
* "id": "103ad216846e6b90710cb9acef59",
|
|
1915
|
+
* "account_id": "acc_example",
|
|
1916
|
+
* "template_id": null,
|
|
1755
1917
|
* "name": "Service agreement.pdf",
|
|
1756
|
-
* "
|
|
1757
|
-
* "
|
|
1918
|
+
* "status": "pending_signature",
|
|
1919
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
1920
|
+
* "is_closed": false,
|
|
1921
|
+
* "signing_url": "https://…/sign/103ad216…",
|
|
1922
|
+
* "decline_reason": null,
|
|
1923
|
+
* "declined_by": null,
|
|
1924
|
+
* "tags": [],
|
|
1925
|
+
* "assignment": null,
|
|
1926
|
+
* "pages": [],
|
|
1927
|
+
* "created_at": "2026-07-19T17:24:43Z",
|
|
1928
|
+
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1758
1929
|
* }
|
|
1759
1930
|
* ```
|
|
1760
1931
|
* @throws {ValidationError} If `documentId` is missing.
|
|
@@ -1783,7 +1954,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1783
1954
|
* explicit channel is supplied).
|
|
1784
1955
|
* @param channel - Optional legacy delivery channel.
|
|
1785
1956
|
* @returns Nothing after the API's empty acknowledgement.
|
|
1786
|
-
* @throws {ValidationError} If `documentId` or `recipient` is missing
|
|
1957
|
+
* @throws {ValidationError} If `documentId` or `recipient` is missing, the
|
|
1958
|
+
* official two-argument form does not receive a valid email address, or a
|
|
1959
|
+
* supplied `channel` is not a non-empty string.
|
|
1787
1960
|
* @throws {ApiError} If the API rejects the request.
|
|
1788
1961
|
*
|
|
1789
1962
|
* @example
|
|
@@ -1853,10 +2026,13 @@ declare class SignerResource extends BaseResource {
|
|
|
1853
2026
|
* an existing signer with that address is reused instead of duplicated (a
|
|
1854
2027
|
* duplicate POST is answered by the API with `400 "Um signatário com este
|
|
1855
2028
|
* e-mail já existe."`, which this method recovers from transparently).
|
|
2029
|
+
* A reused signer is returned unchanged; this method does not overwrite its
|
|
2030
|
+
* existing name, phone, CPF, or metadata with the create payload.
|
|
1856
2031
|
*
|
|
1857
|
-
* @param payload - The signer to create.
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
2032
|
+
* @param payload - The signer to create. The official fields are required
|
|
2033
|
+
* `full_name` plus optional `email` and E.164 `whatsapp_phone_number`.
|
|
2034
|
+
* `phone`, `cpf`, and `metadata` are compatibility extensions; the SDK
|
|
2035
|
+
* normalizes the phone alias and strips non-digits from CPF before sending.
|
|
1860
2036
|
* @param accountId - Override the client's default account ID.
|
|
1861
2037
|
* @returns The created (or reused) signer. Note the response **never echoes
|
|
1862
2038
|
* `cpf` back**, even when one was sent:
|
|
@@ -1923,8 +2099,9 @@ declare class SignerResource extends BaseResource {
|
|
|
1923
2099
|
* List signers for the workspace (`GET /accounts/{accountId}/signers`).
|
|
1924
2100
|
* Pagination info (if any) is attached in `meta`.
|
|
1925
2101
|
*
|
|
1926
|
-
* @param params - `page`, `per-page`, `search
|
|
1927
|
-
*
|
|
2102
|
+
* @param params - `page`, `per-page`, and `search` (matches `full_name` or
|
|
2103
|
+
* `email`). The server clamps `per-page` to {@link MAX_LIST_PAGE_SIZE}
|
|
2104
|
+
* (50); a larger value is not rejected, it is silently reduced.
|
|
1928
2105
|
* @param accountId - Override the client's default account ID.
|
|
1929
2106
|
* @returns The matching signers, with pagination in `meta`. Each item:
|
|
1930
2107
|
* ```jsonc
|
|
@@ -1947,14 +2124,16 @@ declare class SignerResource extends BaseResource {
|
|
|
1947
2124
|
* });
|
|
1948
2125
|
* ```
|
|
1949
2126
|
*/
|
|
1950
|
-
list(params?:
|
|
2127
|
+
list(params?: ISignerListParams, accountId?: string): Promise<ISignerListResponse>;
|
|
1951
2128
|
/**
|
|
1952
|
-
* Update a signer (`PUT /accounts/{accountId}/signers/{signerId}`).
|
|
1953
|
-
*
|
|
2129
|
+
* Update a signer (`PUT /accounts/{accountId}/signers/{signerId}`). A name
|
|
2130
|
+
* can always be updated. A verified email or WhatsApp channel cannot change
|
|
2131
|
+
* while it belongs to an in-flight document; changing an unverified channel
|
|
2132
|
+
* rotates its access/verification codes, so resend the notification.
|
|
1954
2133
|
*
|
|
1955
2134
|
* @param signerId - The signer to update.
|
|
1956
|
-
* @param payload - Fields to change.
|
|
1957
|
-
* sending.
|
|
2135
|
+
* @param payload - Fields to change. The official `government_id` field and
|
|
2136
|
+
* legacy `cpf` extension are stripped to digits before sending.
|
|
1958
2137
|
* @param accountId - Override the client's default account ID.
|
|
1959
2138
|
* @returns The updated signer (as with create, `cpf` is never echoed back):
|
|
1960
2139
|
* ```jsonc
|
|
@@ -1968,13 +2147,14 @@ declare class SignerResource extends BaseResource {
|
|
|
1968
2147
|
* }
|
|
1969
2148
|
* ```
|
|
1970
2149
|
* @throws {ValidationError} If `signerId` is missing or no account ID is available.
|
|
1971
|
-
* @throws {ApiError} `400` if
|
|
1972
|
-
* does not exist.
|
|
2150
|
+
* @throws {ApiError} `400` if a verified contact channel is in use by an
|
|
2151
|
+
* in-flight document; `404` if the signer does not exist.
|
|
1973
2152
|
*
|
|
1974
2153
|
* @example
|
|
1975
2154
|
* ```ts
|
|
1976
2155
|
* await client.signers.update('19e6b92e7895332ed9708535d8c', {
|
|
1977
2156
|
* full_name: 'Ana Souza Lima',
|
|
2157
|
+
* government_id: '390.533.447-05',
|
|
1978
2158
|
* });
|
|
1979
2159
|
* ```
|
|
1980
2160
|
*/
|
|
@@ -2003,11 +2183,10 @@ declare class SignerResource extends BaseResource {
|
|
|
2003
2183
|
* `search` is a substring match across signer fields, so the result is
|
|
2004
2184
|
* re-filtered here for an exact, case-insensitive email match.
|
|
2005
2185
|
*
|
|
2006
|
-
* Page size is pinned to
|
|
2007
|
-
*
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2010
|
-
* exact-email filter to rule that out.
|
|
2186
|
+
* Page size is pinned to {@link MAX_LIST_PAGE_SIZE}, the largest page the
|
|
2187
|
+
* server actually returns. An exact address realistically matches one
|
|
2188
|
+
* signer, but a search term that matched more than that could in principle
|
|
2189
|
+
* miss one — the API exposes no exact-email filter to rule that out.
|
|
2011
2190
|
*
|
|
2012
2191
|
* A `404` from the underlying list is treated as "no match" and mapped to
|
|
2013
2192
|
* `null`; any other {@link ApiError} propagates.
|
|
@@ -2053,10 +2232,9 @@ type AccountLogoUploadSource = {
|
|
|
2053
2232
|
* signer, template, tag, field, and webhook. Each endpoint lives under
|
|
2054
2233
|
* `/accounts`, and the `accountId` used elsewhere in the SDK is a workspace id.
|
|
2055
2234
|
*
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
* rejected with `400`. Verified live against the API.
|
|
2235
|
+
* Requests accept `name`, `notification_sender_type`, `primary_color`, and
|
|
2236
|
+
* `secondary_color`. Colours are always modeled on responses. When
|
|
2237
|
+
* sent, they must be exactly six hex characters with no leading `#`.
|
|
2060
2238
|
*
|
|
2061
2239
|
* @example
|
|
2062
2240
|
* ```ts
|
|
@@ -2068,18 +2246,25 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2068
2246
|
/**
|
|
2069
2247
|
* Create a new workspace (`POST /accounts`).
|
|
2070
2248
|
*
|
|
2071
|
-
* @param payload -
|
|
2072
|
-
*
|
|
2249
|
+
* @param payload - Official fields are workspace `name` (required) and
|
|
2250
|
+
* optional `notification_sender_type` (`User` or `Account`). Optional brand
|
|
2251
|
+
* colours use six hex characters without
|
|
2252
|
+
* a leading `#`.
|
|
2073
2253
|
* @returns The created workspace. Response shape:
|
|
2074
2254
|
* ```jsonc
|
|
2075
2255
|
* {
|
|
2256
|
+
* "resource": "account",
|
|
2076
2257
|
* "id": "acc_example",
|
|
2077
2258
|
* "name": "Acme Legal",
|
|
2259
|
+
* "notification_sender_type": "Account",
|
|
2078
2260
|
* "primary_color": "ff0066",
|
|
2079
2261
|
* "secondary_color": "0066ff",
|
|
2262
|
+
* "roles": ["owner"],
|
|
2263
|
+
* "is_delete_allowed": true,
|
|
2080
2264
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2081
2265
|
* }
|
|
2082
2266
|
* ```
|
|
2267
|
+
* @throws {ValidationError} If `payload` is not an object.
|
|
2083
2268
|
* @throws {ApiError} If the API rejects the request — e.g. `400` when a
|
|
2084
2269
|
* colour is not exactly 6 hex characters (or carries a leading `#`).
|
|
2085
2270
|
*
|
|
@@ -2087,6 +2272,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2087
2272
|
* ```ts
|
|
2088
2273
|
* const ws = await client.workspaces.create({
|
|
2089
2274
|
* name: 'Acme Legal',
|
|
2275
|
+
* notification_sender_type: 'Account',
|
|
2090
2276
|
* primary_color: 'ff0066',
|
|
2091
2277
|
* secondary_color: '0066ff',
|
|
2092
2278
|
* });
|
|
@@ -2102,8 +2288,12 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2102
2288
|
* {
|
|
2103
2289
|
* "data": [
|
|
2104
2290
|
* {
|
|
2291
|
+
* "resource": "account",
|
|
2105
2292
|
* "id": "acc_example",
|
|
2106
2293
|
* "name": "MT",
|
|
2294
|
+
* "primary_color": null,
|
|
2295
|
+
* "secondary_color": null,
|
|
2296
|
+
* "notification_sender_type": "User",
|
|
2107
2297
|
* "roles": ["owner"],
|
|
2108
2298
|
* "is_delete_allowed": true,
|
|
2109
2299
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
@@ -2128,10 +2318,14 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2128
2318
|
* until brand colours are set (6-char hex, no `#`, when present):
|
|
2129
2319
|
* ```jsonc
|
|
2130
2320
|
* {
|
|
2321
|
+
* "resource": "account",
|
|
2131
2322
|
* "id": "acc_example",
|
|
2132
2323
|
* "name": "MT",
|
|
2133
2324
|
* "primary_color": null,
|
|
2134
2325
|
* "secondary_color": null,
|
|
2326
|
+
* "notification_sender_type": "User",
|
|
2327
|
+
* "roles": ["owner"],
|
|
2328
|
+
* "is_delete_allowed": true,
|
|
2135
2329
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2136
2330
|
* }
|
|
2137
2331
|
* ```
|
|
@@ -2216,6 +2410,8 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2216
2410
|
*
|
|
2217
2411
|
* @param accountId - Account whose logo should be removed.
|
|
2218
2412
|
* @returns Resolves when the API acknowledges deletion.
|
|
2413
|
+
* @throws {ValidationError} If `accountId` is empty.
|
|
2414
|
+
* @throws {ApiError} If the API rejects the request.
|
|
2219
2415
|
* @example
|
|
2220
2416
|
* ```ts
|
|
2221
2417
|
* await client.workspaces.deleteLogo('acc_example');
|
|
@@ -2236,8 +2432,13 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2236
2432
|
* "documents_uploaded": 42,
|
|
2237
2433
|
* "documents_sent": 37,
|
|
2238
2434
|
* "signature_requests": 61,
|
|
2239
|
-
* "
|
|
2240
|
-
* "
|
|
2435
|
+
* "signature_requests_notification_email": 55,
|
|
2436
|
+
* "signature_requests_notification_whatsapp": 18,
|
|
2437
|
+
* "signature_requests_notification_bypass": 3,
|
|
2438
|
+
* "signature_requests_verification_email": 48,
|
|
2439
|
+
* "signature_requests_verification_whatsapp": 6,
|
|
2440
|
+
* "signature_requests_verification_bypass": 3,
|
|
2441
|
+
* "signature_requests_verification_digital_certificate": 4,
|
|
2241
2442
|
* "signature_requests_viewed": 44,
|
|
2242
2443
|
* "signature_requests_completed": 52,
|
|
2243
2444
|
* "documents_certified": 30
|
|
@@ -2262,19 +2463,26 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2262
2463
|
* Update a workspace (`PUT /accounts/{accountId}`).
|
|
2263
2464
|
*
|
|
2264
2465
|
* @param accountId - The workspace to update.
|
|
2265
|
-
* @param payload -
|
|
2266
|
-
*
|
|
2466
|
+
* @param payload - Official fields are `name` and
|
|
2467
|
+
* `notification_sender_type` (`User` or `Account`). Brand colours use six
|
|
2468
|
+
* hex characters without a leading `#`;
|
|
2469
|
+
* pass `null` to clear one.
|
|
2267
2470
|
* @returns The updated workspace. Response shape:
|
|
2268
2471
|
* ```jsonc
|
|
2269
2472
|
* {
|
|
2473
|
+
* "resource": "account",
|
|
2270
2474
|
* "id": "acc_example",
|
|
2271
2475
|
* "name": "Acme Legal (Renamed)",
|
|
2476
|
+
* "notification_sender_type": "Account",
|
|
2272
2477
|
* "primary_color": "ff0066",
|
|
2273
2478
|
* "secondary_color": "0066ff",
|
|
2479
|
+
* "roles": ["owner"],
|
|
2480
|
+
* "is_delete_allowed": true,
|
|
2274
2481
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2275
2482
|
* }
|
|
2276
2483
|
* ```
|
|
2277
|
-
* @throws {ValidationError} If `accountId` is missing
|
|
2484
|
+
* @throws {ValidationError} If `accountId` is missing or `payload` is not
|
|
2485
|
+
* an object.
|
|
2278
2486
|
* @throws {ApiError} `400` for an invalid colour; `404` if the workspace
|
|
2279
2487
|
* does not exist.
|
|
2280
2488
|
*
|
|
@@ -2282,6 +2490,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2282
2490
|
* ```ts
|
|
2283
2491
|
* await client.workspaces.update('acc_example', {
|
|
2284
2492
|
* name: 'Acme Legal (Renamed)',
|
|
2493
|
+
* notification_sender_type: 'Account',
|
|
2285
2494
|
* primary_color: 'ff0066',
|
|
2286
2495
|
* });
|
|
2287
2496
|
* ```
|
|
@@ -2290,12 +2499,14 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2290
2499
|
/**
|
|
2291
2500
|
* Delete a workspace (`DELETE /accounts/{accountId}`).
|
|
2292
2501
|
*
|
|
2293
|
-
* A workspace with
|
|
2294
|
-
*
|
|
2295
|
-
*
|
|
2502
|
+
* A workspace with an active paid subscription is rejected with `400` and
|
|
2503
|
+
* a `restrictions` list. `{ force: true }` cancels that subscription and
|
|
2504
|
+
* proceeds with deletion; it is not documented as a blanket override for
|
|
2505
|
+
* unrelated restrictions. The flag is sent in the request body.
|
|
2296
2506
|
*
|
|
2297
2507
|
* @param accountId - The workspace to delete.
|
|
2298
|
-
* @param options - Set `force: true` to
|
|
2508
|
+
* @param options - Set `force: true` to cancel an active paid subscription
|
|
2509
|
+
* and proceed with deletion.
|
|
2299
2510
|
* @returns Nothing on success (`200` with no meaningful body).
|
|
2300
2511
|
* @throws {ValidationError} If `accountId` is missing.
|
|
2301
2512
|
* @throws {ApiError} `400` (with a `restrictions` list) when the workspace
|
|
@@ -2304,7 +2515,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2304
2515
|
* @example
|
|
2305
2516
|
* ```ts
|
|
2306
2517
|
* await client.workspaces.delete('acc_example');
|
|
2307
|
-
* //
|
|
2518
|
+
* // cancel an active paid subscription, then delete:
|
|
2308
2519
|
* await client.workspaces.delete('acc_example', { force: true });
|
|
2309
2520
|
* ```
|
|
2310
2521
|
*/
|
|
@@ -2319,7 +2530,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2319
2530
|
* values are removed, and collect assignments must include placement entries.
|
|
2320
2531
|
*
|
|
2321
2532
|
* @param payload - Assignment method, signer references, and optional message,
|
|
2322
|
-
* expiration, copy
|
|
2533
|
+
* expiration, copy-receiver signer IDs, or collect-field placements.
|
|
2323
2534
|
* @returns A JSON-ready body shaped as
|
|
2324
2535
|
* `{ method, signers: [{ id, verification_method?, notification_methods?, step? }], message?, expires_at?, copy_receivers?, entries? }`.
|
|
2325
2536
|
* @throws {ValidationError} If no signer is present, a signer reference is
|
|
@@ -2352,6 +2563,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2352
2563
|
* returns):
|
|
2353
2564
|
* ```jsonc
|
|
2354
2565
|
* {
|
|
2566
|
+
* "resource": "assignment",
|
|
2355
2567
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2356
2568
|
* "sender_email": "sender@example.com",
|
|
2357
2569
|
* "method": "virtual",
|
|
@@ -2390,6 +2602,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2390
2602
|
* "type": "virtual",
|
|
2391
2603
|
* "is_active": true
|
|
2392
2604
|
* },
|
|
2605
|
+
* "display_settings": [],
|
|
2393
2606
|
* "value": null,
|
|
2394
2607
|
* "completed": false
|
|
2395
2608
|
* }
|
|
@@ -2432,17 +2645,22 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2432
2645
|
* Signers may be passed as bare id strings or as objects
|
|
2433
2646
|
* (`{ id, verification_method, notification_methods, step }`); the SDK
|
|
2434
2647
|
* normalises them to the docs-sanctioned `signers: [{ ... }]` shape via
|
|
2435
|
-
* {@link buildAssignmentPayload}.
|
|
2436
|
-
* `
|
|
2648
|
+
* {@link buildAssignmentPayload}. A `virtual` assignment may be created at
|
|
2649
|
+
* `uploaded`, `metadata_processing`, or `metadata_ready` and is promoted
|
|
2650
|
+
* automatically; `collect` requires rendered pages at `metadata_ready`.
|
|
2651
|
+
* `DigitalCertificate` costs two credits, requires the feature plus a
|
|
2652
|
+
* signer `government_id`, and that signer must be alone in its step.
|
|
2437
2653
|
*
|
|
2438
2654
|
* @param documentId - The document to request signatures on.
|
|
2439
2655
|
* @param payload - Signers plus optional `method` (defaults to `virtual`),
|
|
2440
|
-
* `message`, `expires_at`, `copy_receivers
|
|
2656
|
+
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
2657
|
+
* addresses), and `collect`-mode `entries` with page-image geometry.
|
|
2441
2658
|
* @returns The created {@link IAssignment}: `signers` (rich, with `step` /
|
|
2442
2659
|
* `notified` / `verification_method`), `items` (one row per signer × field),
|
|
2443
2660
|
* a `summary` count block, and per-signer `signing_urls`. Response shape:
|
|
2444
2661
|
* ```jsonc
|
|
2445
2662
|
* {
|
|
2663
|
+
* "resource": "assignment",
|
|
2446
2664
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2447
2665
|
* "sender_email": "sender@example.com",
|
|
2448
2666
|
* "method": "virtual",
|
|
@@ -2479,6 +2697,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2479
2697
|
* "type": "virtual",
|
|
2480
2698
|
* "is_active": true
|
|
2481
2699
|
* },
|
|
2700
|
+
* "display_settings": [],
|
|
2482
2701
|
* "value": null,
|
|
2483
2702
|
* "completed": false
|
|
2484
2703
|
* }
|
|
@@ -2507,9 +2726,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2507
2726
|
* ```
|
|
2508
2727
|
* @throws {ValidationError} If `documentId` is missing, no signer is
|
|
2509
2728
|
* supplied, or a signer reference is invalid.
|
|
2510
|
-
* @throws {ApiError}
|
|
2511
|
-
*
|
|
2512
|
-
* exists on the account.
|
|
2729
|
+
* @throws {ApiError} `400` for an invalid assignment or unmet verification
|
|
2730
|
+
* precondition; otherwise if the API rejects the request.
|
|
2513
2731
|
*
|
|
2514
2732
|
* @example
|
|
2515
2733
|
* ```ts
|
|
@@ -2518,7 +2736,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2518
2736
|
* message: 'Please sign this contract',
|
|
2519
2737
|
* });
|
|
2520
2738
|
* // → wire body: { method: 'virtual', signers: [{ id: '19e6…' }], message: 'Please sign this contract' }
|
|
2521
|
-
* assignment.signing_urls?.
|
|
2739
|
+
* console.log(assignment.signing_urls?.length); // one protected link per signer
|
|
2522
2740
|
* ```
|
|
2523
2741
|
*/
|
|
2524
2742
|
create(documentId: string, payload: ICreateAssignmentPayload): Promise<ICreateAssignmentResponse>;
|
|
@@ -2530,11 +2748,17 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2530
2748
|
* only `verification_method` / `notification_methods` (or `{}` for the
|
|
2531
2749
|
* default Email channel). {@link buildAssignmentEstimatePayload} projects
|
|
2532
2750
|
* exactly the fields permitted by the estimate schema.
|
|
2751
|
+
* `DigitalCertificate` is priced at two credits per signer and remains
|
|
2752
|
+
* subject to the feature, identity, and one-signer-per-step requirements.
|
|
2753
|
+
* Current documented unit prices are 1 credit for an extra document, 0 for
|
|
2754
|
+
* email notification, and 0.45 for WhatsApp notification; a digital
|
|
2755
|
+
* certificate charge is added on top of its notification cost.
|
|
2533
2756
|
*
|
|
2534
2757
|
* @param documentId - The document the assignment would be created on.
|
|
2535
2758
|
* @param payload - `method` plus channel-only signer descriptors and/or
|
|
2536
2759
|
* `collect`-mode `entries`. Create-only fields and signer IDs are not part
|
|
2537
|
-
* of this request schema.
|
|
2760
|
+
* of this request schema. `blocking_reason` may be `PendingPayment`,
|
|
2761
|
+
* `InsufficientDocuments`, or `InsufficientCredits`.
|
|
2538
2762
|
* @returns an {@link ICostEstimate} with `total_credits`, balances, a
|
|
2539
2763
|
* line-item `breakdown`, and a `has_sufficient_resources` gate. Response
|
|
2540
2764
|
* shape:
|
|
@@ -2571,15 +2795,14 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2571
2795
|
* Update the expiration date of an existing assignment
|
|
2572
2796
|
* (`PUT /documents/{documentId}/assignments/{assignmentId}/reset-expiration`).
|
|
2573
2797
|
*
|
|
2574
|
-
* Sends `{ expires_at }` verbatim.
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
* intentionally not stripped from the body.
|
|
2798
|
+
* Sends `{ expires_at }` verbatim. Use an ISO-8601 date/time string; `null`
|
|
2799
|
+
* is retained as a compatibility value and, unlike ordinary nullable
|
|
2800
|
+
* inputs, is intentionally not stripped from the body.
|
|
2578
2801
|
*
|
|
2579
2802
|
* @param documentId - The document the assignment belongs to.
|
|
2580
2803
|
* @param assignmentId - The assignment to update.
|
|
2581
2804
|
* @param expiresAt - New expiry as an ISO-8601 date/time string. `null` is
|
|
2582
|
-
*
|
|
2805
|
+
* a compatibility value intended to clear it.
|
|
2583
2806
|
* @returns The updated {@link IAssignment} — the same full shape
|
|
2584
2807
|
* {@link AssignmentResource.create} returns (`signers`, `items`, `summary`,
|
|
2585
2808
|
* `signing_urls`), with `expires_at` reflecting the new value:
|
|
@@ -2588,7 +2811,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2588
2811
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2589
2812
|
* "sender_email": "sender@example.com",
|
|
2590
2813
|
* "method": "virtual",
|
|
2591
|
-
* "expires_at": "
|
|
2814
|
+
* "expires_at": "2027-12-31T23:59:59Z",
|
|
2592
2815
|
* "message": "Please sign this contract",
|
|
2593
2816
|
* "copy_receivers": [],
|
|
2594
2817
|
* "signers": [
|
|
@@ -2615,7 +2838,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2615
2838
|
* @example
|
|
2616
2839
|
* ```ts
|
|
2617
2840
|
* // Extend the deadline …
|
|
2618
|
-
* await client.assignments.resetExpiration('doc-1', 'asg-1', '
|
|
2841
|
+
* await client.assignments.resetExpiration('doc-1', 'asg-1', '2027-12-31T23:59:59Z');
|
|
2619
2842
|
* // … or remove it entirely (sends { expires_at: null }).
|
|
2620
2843
|
* await client.assignments.resetExpiration('doc-1', 'asg-1', null);
|
|
2621
2844
|
* ```
|
|
@@ -2660,17 +2883,22 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2660
2883
|
* @param documentId - The document the assignment belongs to.
|
|
2661
2884
|
* @param assignmentId - The assignment containing the signer.
|
|
2662
2885
|
* @param signerId - The signer whose notification would be resent.
|
|
2663
|
-
* @returns An {@link IResendCostEstimate}
|
|
2664
|
-
*
|
|
2665
|
-
* `
|
|
2886
|
+
* @returns An {@link IResendCostEstimate}: either the full
|
|
2887
|
+
* {@link ICostEstimate} or the compact `total` /
|
|
2888
|
+
* `has_sufficient_credits` compatibility shape:
|
|
2666
2889
|
* ```jsonc
|
|
2667
2890
|
* {
|
|
2668
|
-
* "
|
|
2669
|
-
* "
|
|
2670
|
-
*
|
|
2671
|
-
*
|
|
2891
|
+
* "documents": 1,
|
|
2892
|
+
* "credits": 0,
|
|
2893
|
+
* "needs_extra_document": false,
|
|
2894
|
+
* "extra_document_cost": 0,
|
|
2895
|
+
* "total_credits": 0,
|
|
2896
|
+
* "breakdown": [],
|
|
2897
|
+
* "document_balance": 67,
|
|
2672
2898
|
* "credit_balance": 0,
|
|
2673
|
-
* "
|
|
2899
|
+
* "has_sufficient_resources": true,
|
|
2900
|
+
* "blocking_reason": null,
|
|
2901
|
+
* "message": null
|
|
2674
2902
|
* }
|
|
2675
2903
|
* ```
|
|
2676
2904
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
@@ -2719,7 +2947,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2719
2947
|
* @example
|
|
2720
2948
|
* ```ts
|
|
2721
2949
|
* const notifications = await client.assignments.listWhatsAppNotifications('doc-1', 'asg-1');
|
|
2722
|
-
*
|
|
2950
|
+
* console.log(notifications.length);
|
|
2723
2951
|
* ```
|
|
2724
2952
|
*/
|
|
2725
2953
|
listWhatsAppNotifications(documentId: string, assignmentId: string): Promise<IWhatsAppNotification[]>;
|
|
@@ -2760,7 +2988,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
2760
2988
|
* "updated_at": "2026-07-18T02:36:02Z" // no `id` / `created_at` are returned
|
|
2761
2989
|
* }
|
|
2762
2990
|
* ```
|
|
2763
|
-
* @throws {ValidationError} If `url`
|
|
2991
|
+
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
2992
|
+
* `is_active` has the wrong type, or no account ID is available.
|
|
2764
2993
|
* @throws {ApiError} If the API rejects the subscription.
|
|
2765
2994
|
*
|
|
2766
2995
|
* @example
|
|
@@ -2787,7 +3016,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2787
3016
|
* present:
|
|
2788
3017
|
* ```jsonc
|
|
2789
3018
|
* {
|
|
2790
|
-
* "url": "https://
|
|
3019
|
+
* "url": "https://webhooks.example.com/assinafy",
|
|
2791
3020
|
* "email": "ops@example.com",
|
|
2792
3021
|
* "events": [
|
|
2793
3022
|
* "document_ready",
|
|
@@ -2798,6 +3027,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2798
3027
|
* "updated_at": "2026-07-18T02:36:02Z"
|
|
2799
3028
|
* }
|
|
2800
3029
|
* ```
|
|
3030
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2801
3031
|
* @throws {ApiError} If the API fails for a reason other than `404`.
|
|
2802
3032
|
*
|
|
2803
3033
|
* @example
|
|
@@ -2838,6 +3068,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2838
3068
|
* "updated_at": "2026-07-18T02:36:02Z"
|
|
2839
3069
|
* }
|
|
2840
3070
|
* ```
|
|
3071
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2841
3072
|
* @throws {ApiError} If the API rejects the request.
|
|
2842
3073
|
*
|
|
2843
3074
|
* @example
|
|
@@ -2852,14 +3083,9 @@ declare class WebhookResource extends BaseResource {
|
|
|
2852
3083
|
* (`GET /webhooks/event-types`). This is a global, account-independent
|
|
2853
3084
|
* catalog.
|
|
2854
3085
|
*
|
|
2855
|
-
* @returns The
|
|
2856
|
-
*
|
|
2857
|
-
*
|
|
2858
|
-
* `assignment_created`, `signature_requested`, `document_ready`,
|
|
2859
|
-
* `signer_created`, `signer_email_verified`, `signer_whatsapp_verified`,
|
|
2860
|
-
* `signer_data_confirmed`, `signer_signed_document`, `signer_viewed_document`,
|
|
2861
|
-
* `signer_rejected_document`, `user_rejected_document`,
|
|
2862
|
-
* `document_processing_failed`. Response shape:
|
|
3086
|
+
* @returns The server-controlled event catalog with human-readable
|
|
3087
|
+
* descriptions. Event types can be added over time, so callers should not
|
|
3088
|
+
* depend on a fixed count or order. Response shape:
|
|
2863
3089
|
* ```jsonc
|
|
2864
3090
|
* [
|
|
2865
3091
|
* {
|
|
@@ -2870,7 +3096,6 @@ declare class WebhookResource extends BaseResource {
|
|
|
2870
3096
|
* "id": "document_metadata_ready",
|
|
2871
3097
|
* "description": "Triggered when the document is ready to be prepared. The document has been normalized to PDF and its pages are available."
|
|
2872
3098
|
* }
|
|
2873
|
-
* // …13 more (15 total)
|
|
2874
3099
|
* ]
|
|
2875
3100
|
* ```
|
|
2876
3101
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -2887,6 +3112,12 @@ declare class WebhookResource extends BaseResource {
|
|
|
2887
3112
|
* (`GET /accounts/{accountId}/webhooks`). Pagination info (if any) is
|
|
2888
3113
|
* attached in `meta`.
|
|
2889
3114
|
*
|
|
3115
|
+
* Assinafy treats any `2xx` response as success. It makes at most two
|
|
3116
|
+
* attempts per event with a three-second wait. After ten consecutive failed
|
|
3117
|
+
* events, the circuit breaker pauses normal delivery and sends roughly 5%
|
|
3118
|
+
* as recovery checks until one succeeds. The stored `response_body` is
|
|
3119
|
+
* truncated to 2,000 characters.
|
|
3120
|
+
*
|
|
2890
3121
|
* @param params - Optional filters and pagination:
|
|
2891
3122
|
* - `event` — restrict to a single {@link WebhookEventType}
|
|
2892
3123
|
* (e.g. `'signer_signed_document'`).
|
|
@@ -2898,6 +3129,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2898
3129
|
* @returns Delivery records, with pagination in `meta`. Each item:
|
|
2899
3130
|
* ```jsonc
|
|
2900
3131
|
* {
|
|
3132
|
+
* "resource": "activity_dispatching_history",
|
|
2901
3133
|
* "id": "103a09cfce51319dd3b3f72ffcdf",
|
|
2902
3134
|
* "event": "signature_requested",
|
|
2903
3135
|
* "activity_id": 8629,
|
|
@@ -2910,12 +3142,13 @@ declare class WebhookResource extends BaseResource {
|
|
|
2910
3142
|
* },
|
|
2911
3143
|
* "delivered": true,
|
|
2912
3144
|
* "http_status": 200,
|
|
2913
|
-
* "response_body": "{ ... }", //
|
|
3145
|
+
* "response_body": "{ ... }", // receiving endpoint body, max 2,000 chars
|
|
2914
3146
|
* "error": null,
|
|
2915
3147
|
* "created_at": "2026-07-15T20:04:36Z",
|
|
2916
3148
|
* "updated_at": "2026-07-15T20:04:36Z"
|
|
2917
3149
|
* }
|
|
2918
3150
|
* ```
|
|
3151
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2919
3152
|
* @throws {ApiError} If the API rejects the request.
|
|
2920
3153
|
*
|
|
2921
3154
|
* @example
|
|
@@ -2944,6 +3177,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2944
3177
|
* shape:
|
|
2945
3178
|
* ```jsonc
|
|
2946
3179
|
* {
|
|
3180
|
+
* "resource": "activity_dispatching_history",
|
|
2947
3181
|
* "id": "103a09cfce51319dd3b3f72ffcdf",
|
|
2948
3182
|
* "event": "signature_requested",
|
|
2949
3183
|
* "activity_id": 8629,
|
|
@@ -2951,13 +3185,14 @@ declare class WebhookResource extends BaseResource {
|
|
|
2951
3185
|
* "payload": { }, // the original event body that was re-POSTed
|
|
2952
3186
|
* "delivered": true,
|
|
2953
3187
|
* "http_status": 200,
|
|
2954
|
-
* "response_body": "{ ... }",
|
|
3188
|
+
* "response_body": "{ ... }", // max 2,000 characters
|
|
2955
3189
|
* "error": null,
|
|
2956
3190
|
* "created_at": "2026-07-15T20:04:36Z",
|
|
2957
3191
|
* "updated_at": "2026-07-15T20:05:10Z"
|
|
2958
3192
|
* }
|
|
2959
3193
|
* ```
|
|
2960
|
-
* @throws {ValidationError} If `dispatchId` is empty
|
|
3194
|
+
* @throws {ValidationError} If `dispatchId` is empty or no account ID is
|
|
3195
|
+
* available.
|
|
2961
3196
|
* @throws {ApiError} If the dispatch is not found (`404`) or the retry fails.
|
|
2962
3197
|
*
|
|
2963
3198
|
* @example
|
|
@@ -2970,17 +3205,18 @@ declare class WebhookResource extends BaseResource {
|
|
|
2970
3205
|
}
|
|
2971
3206
|
|
|
2972
3207
|
/**
|
|
2973
|
-
*
|
|
3208
|
+
* Manage reusable templates.
|
|
2974
3209
|
*
|
|
2975
|
-
*
|
|
2976
|
-
*
|
|
2977
|
-
*
|
|
2978
|
-
* environment before a production rollout.
|
|
3210
|
+
* Provides template listing plus compatibility methods for upload,
|
|
3211
|
+
* single-template get/update/delete, and page download. Confirm compatibility
|
|
3212
|
+
* method availability on the configured host.
|
|
2979
3213
|
*/
|
|
2980
3214
|
declare class TemplateResource extends BaseResource {
|
|
2981
3215
|
/**
|
|
2982
3216
|
* Create a template by uploading a PDF (`POST /accounts/{id}/templates`).
|
|
2983
3217
|
*
|
|
3218
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3219
|
+
*
|
|
2984
3220
|
* The template is created in `Uploaded` status and transitions to `Ready`
|
|
2985
3221
|
* once the platform finishes processing its pages (`pages` stays empty until
|
|
2986
3222
|
* then). Configure roles/fields afterwards in the Assinafy editor. As with
|
|
@@ -3035,9 +3271,11 @@ declare class TemplateResource extends BaseResource {
|
|
|
3035
3271
|
* List templates for the workspace (`GET /accounts/{id}/templates`).
|
|
3036
3272
|
*
|
|
3037
3273
|
* Pagination lives in the response **headers** and is surfaced on `meta`.
|
|
3038
|
-
* Each item is an {@link ITemplateListItem} carrying `pages[]` (each with
|
|
3039
|
-
* `download_url`), so there is no need to `get()` a
|
|
3040
|
-
* read its rendered pages.
|
|
3274
|
+
* Each item is an {@link ITemplateListItem} carrying `pages[]` (each with an
|
|
3275
|
+
* API-key-authenticated `download_url`), so there is no need to `get()` a
|
|
3276
|
+
* template again just to read its rendered pages. Prefer
|
|
3277
|
+
* {@link TemplateResource.downloadPage} to download the image bytes.
|
|
3278
|
+
* Lifecycle values may be lowercase or title case (`ready` / `Ready`).
|
|
3041
3279
|
*
|
|
3042
3280
|
* @param params - `search`, `page`, and `per-page` (the SDK normalizes
|
|
3043
3281
|
* `per_page` → `per-page`, the only spelling the API honors).
|
|
@@ -3049,7 +3287,7 @@ declare class TemplateResource extends BaseResource {
|
|
|
3049
3287
|
* "name": "NDA template.pdf",
|
|
3050
3288
|
* "document_name": "nda.pdf",
|
|
3051
3289
|
* "message": null,
|
|
3052
|
-
* "status": "
|
|
3290
|
+
* "status": "ready",
|
|
3053
3291
|
* "pages": [
|
|
3054
3292
|
* {
|
|
3055
3293
|
* "id": "103ad217673e1f978cb86179e8f8",
|
|
@@ -3076,15 +3314,18 @@ declare class TemplateResource extends BaseResource {
|
|
|
3076
3314
|
* const { data, meta } = await client.templates.list({ search: 'nda', 'per-page': 20 });
|
|
3077
3315
|
* ```
|
|
3078
3316
|
*/
|
|
3079
|
-
list(params?:
|
|
3317
|
+
list(params?: ITemplateListParams, accountId?: string): Promise<ITemplateListResponse>;
|
|
3080
3318
|
/**
|
|
3081
3319
|
* Get a template by ID (`GET /accounts/{id}/templates/{template_id}`).
|
|
3082
3320
|
*
|
|
3321
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3322
|
+
*
|
|
3083
3323
|
* Returns the same shape as {@link TemplateResource.list} plus
|
|
3084
3324
|
* `default_document_tags` (the tags auto-applied to every document created
|
|
3085
3325
|
* from this template) and `resource`. Both endpoints return `pages` with
|
|
3086
|
-
* per-page `download_url`, so fetching a template
|
|
3087
|
-
* pages is unnecessary.
|
|
3326
|
+
* per-page API-key-authenticated `download_url`, so fetching a template
|
|
3327
|
+
* again purely to read its pages is unnecessary. Prefer
|
|
3328
|
+
* {@link TemplateResource.downloadPage} to download the image bytes.
|
|
3088
3329
|
*
|
|
3089
3330
|
* @param templateId - The template to fetch.
|
|
3090
3331
|
* @param accountId - Override the client's default account ID.
|
|
@@ -3136,6 +3377,8 @@ declare class TemplateResource extends BaseResource {
|
|
|
3136
3377
|
* Update a template's `name` and/or default `message`
|
|
3137
3378
|
* (`PUT /accounts/{id}/templates/{template_id}`).
|
|
3138
3379
|
*
|
|
3380
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3381
|
+
*
|
|
3139
3382
|
* `message` is the default invitation message applied to documents created
|
|
3140
3383
|
* from this template. Omit a field to leave it unchanged — the SDK strips
|
|
3141
3384
|
* `undefined` keys before sending. Unlike uploads, `name` here is a plain
|
|
@@ -3177,6 +3420,8 @@ declare class TemplateResource extends BaseResource {
|
|
|
3177
3420
|
/**
|
|
3178
3421
|
* Delete a template (`DELETE /accounts/{id}/templates/{template_id}`).
|
|
3179
3422
|
*
|
|
3423
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3424
|
+
*
|
|
3180
3425
|
* The API responds with an empty `data` payload; this method resolves to
|
|
3181
3426
|
* `void`.
|
|
3182
3427
|
*
|
|
@@ -3196,9 +3441,11 @@ declare class TemplateResource extends BaseResource {
|
|
|
3196
3441
|
* Download a template page as a JPEG
|
|
3197
3442
|
* (`GET /accounts/{id}/templates/{template_id}/pages/{page_id}/download`).
|
|
3198
3443
|
*
|
|
3444
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3445
|
+
*
|
|
3199
3446
|
* Used by template editors to render page thumbnails on the client. The
|
|
3200
|
-
* matching `download_url` is also returned on each
|
|
3201
|
-
*
|
|
3447
|
+
* matching API-key-authenticated `download_url` is also returned on each
|
|
3448
|
+
* `template.pages[]` entry; this wrapper supplies the required credentials.
|
|
3202
3449
|
*
|
|
3203
3450
|
* @param templateId - The template that owns the page.
|
|
3204
3451
|
* @param pageId - The page to download (`pages[].id` from `get()`/`list()`).
|
|
@@ -3276,10 +3523,11 @@ declare class TagResource extends BaseResource {
|
|
|
3276
3523
|
*
|
|
3277
3524
|
* `color` is an optional 6-char hex string; the API accepts it **with or
|
|
3278
3525
|
* without** a leading `#` and always stores it **without** — `'#ff8800'`
|
|
3279
|
-
* and `'ff8800'` both persist as `'ff8800'
|
|
3526
|
+
* and `'ff8800'` both persist as `'ff8800'`. Omit `color`
|
|
3280
3527
|
* (or pass `null`) for no color.
|
|
3281
3528
|
*
|
|
3282
|
-
* @param payload - `name` (required
|
|
3529
|
+
* @param payload - `name` (required, max 64 characters; trimmed with
|
|
3530
|
+
* internal whitespace collapsed) and optional `color`.
|
|
3283
3531
|
* @param accountId - Override the client's default account ID.
|
|
3284
3532
|
* @returns The created tag:
|
|
3285
3533
|
* ```jsonc
|
|
@@ -3292,7 +3540,8 @@ declare class TagResource extends BaseResource {
|
|
|
3292
3540
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
3293
3541
|
* }
|
|
3294
3542
|
* ```
|
|
3295
|
-
* @throws {ValidationError} If `
|
|
3543
|
+
* @throws {ValidationError} If `payload` is not an object, `name` is empty,
|
|
3544
|
+
* or no account ID is available.
|
|
3296
3545
|
* @throws {ApiError} `409` if a tag with the same name already exists
|
|
3297
3546
|
* (case-insensitive).
|
|
3298
3547
|
*
|
|
@@ -3327,7 +3576,8 @@ declare class TagResource extends BaseResource {
|
|
|
3327
3576
|
* "updated_at": "2026-07-19T17:24:47Z"
|
|
3328
3577
|
* }
|
|
3329
3578
|
* ```
|
|
3330
|
-
* @throws {ValidationError} If `
|
|
3579
|
+
* @throws {ValidationError} If `payload` is not an object, `tagId` is
|
|
3580
|
+
* missing, or no account ID is available.
|
|
3331
3581
|
* @throws {ApiError} `404` if the tag does not exist; `409` if another tag
|
|
3332
3582
|
* already uses the new name.
|
|
3333
3583
|
*
|
|
@@ -3348,20 +3598,19 @@ declare class TagResource extends BaseResource {
|
|
|
3348
3598
|
*
|
|
3349
3599
|
* By default the API returns `409` if the tag is still attached to any
|
|
3350
3600
|
* document or template. Pass `{ force: true }` to detach it everywhere
|
|
3351
|
-
* first — that adds a `?force=true` query param.
|
|
3352
|
-
* success (the endpoint's `{ "deleted": true }` body is discarded).
|
|
3601
|
+
* first — that adds a `?force=true` query param.
|
|
3353
3602
|
*
|
|
3354
3603
|
* @param tagId - The tag to delete.
|
|
3355
3604
|
* @param options - `force` to detach-and-delete when the tag is still in
|
|
3356
3605
|
* use, and `accountId` to override the client's default account ID.
|
|
3357
|
-
* @returns
|
|
3606
|
+
* @returns `{ deleted: true }` when the tag was deleted.
|
|
3358
3607
|
* @throws {ValidationError} If `tagId` is missing, or no account ID is available.
|
|
3359
3608
|
* @throws {ApiError} `404` if the tag does not exist; `409` if the tag is
|
|
3360
3609
|
* still in use and `force` was not set.
|
|
3361
3610
|
*
|
|
3362
3611
|
* @example
|
|
3363
3612
|
* ```ts
|
|
3364
|
-
* await client.tags.delete('103ad216fdc641c8f0465678c813');
|
|
3613
|
+
* const { deleted } = await client.tags.delete('103ad216fdc641c8f0465678c813');
|
|
3365
3614
|
* // detach from every document/template, then delete
|
|
3366
3615
|
* await client.tags.delete('103ad216fdc641c8f0465678c813', { force: true });
|
|
3367
3616
|
* ```
|
|
@@ -3369,7 +3618,7 @@ declare class TagResource extends BaseResource {
|
|
|
3369
3618
|
delete(tagId: string, options?: {
|
|
3370
3619
|
force?: boolean;
|
|
3371
3620
|
accountId?: string;
|
|
3372
|
-
}): Promise<
|
|
3621
|
+
}): Promise<IDeleteTagResponse>;
|
|
3373
3622
|
}
|
|
3374
3623
|
|
|
3375
3624
|
/**
|
|
@@ -3387,6 +3636,9 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3387
3636
|
* Build the browser-facing OAuth start URL
|
|
3388
3637
|
* (`GET /auth/authenticate?authclient=…`).
|
|
3389
3638
|
*
|
|
3639
|
+
* This is a compatibility browser route. Confirm availability on the
|
|
3640
|
+
* configured host before exposing it in a login flow.
|
|
3641
|
+
*
|
|
3390
3642
|
* This endpoint responds with `302` to the provider consent screen, so the
|
|
3391
3643
|
* SDK returns the URL for your web framework to redirect to instead of
|
|
3392
3644
|
* following the redirect inside the Node process.
|
|
@@ -3394,17 +3646,20 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3394
3646
|
* @param authClient - Provider key; currently `google`.
|
|
3395
3647
|
* @returns An absolute URL, for example
|
|
3396
3648
|
* `https://api.assinafy.com.br/v1/auth/authenticate?authclient=google`.
|
|
3397
|
-
* @throws {ValidationError} If `authClient` is
|
|
3649
|
+
* @throws {ValidationError} If `authClient` is not `google`.
|
|
3398
3650
|
*
|
|
3399
3651
|
* @example
|
|
3400
3652
|
* ```ts
|
|
3401
3653
|
* response.redirect(client.auth.getSocialLoginUrl('google'));
|
|
3402
3654
|
* ```
|
|
3403
3655
|
*/
|
|
3404
|
-
getSocialLoginUrl(authClient?: 'google'
|
|
3656
|
+
getSocialLoginUrl(authClient?: 'google'): string;
|
|
3405
3657
|
/**
|
|
3406
3658
|
* Return the Assinafy browser callback URL (`GET /login-callback`).
|
|
3407
3659
|
*
|
|
3660
|
+
* This is a compatibility browser route. Confirm availability on the
|
|
3661
|
+
* configured host before use.
|
|
3662
|
+
*
|
|
3408
3663
|
* The callback response payload is intentionally unspecified by the API;
|
|
3409
3664
|
* OAuth providers call it in a browser. Use this URL when a provider setup
|
|
3410
3665
|
* asks for Assinafy's callback/redirect URI.
|
|
@@ -3475,8 +3730,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3475
3730
|
* {@link AuthenticationResource.login}.
|
|
3476
3731
|
*
|
|
3477
3732
|
* @param payload - The social-login body.
|
|
3478
|
-
* @param payload.provider - OAuth provider
|
|
3479
|
-
* `'google'`; the type is left open for forward-compatibility.
|
|
3733
|
+
* @param payload.provider - OAuth provider; currently exactly `'google'`.
|
|
3480
3734
|
* @param payload.token - The provider-issued OAuth/ID token.
|
|
3481
3735
|
* @param payload.has_accepted_terms - Whether the user has accepted the
|
|
3482
3736
|
* terms of service.
|
|
@@ -3489,8 +3743,12 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3489
3743
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3490
3744
|
* "name": "Multica Test",
|
|
3491
3745
|
* "email": "user@example.com",
|
|
3746
|
+
* "telephone": null,
|
|
3747
|
+
* "government_id": "",
|
|
3492
3748
|
* "is_email_verified": true,
|
|
3493
|
-
* "has_accepted_terms": true
|
|
3749
|
+
* "has_accepted_terms": true,
|
|
3750
|
+
* "created_at": "2026-05-12T13:45:11Z",
|
|
3751
|
+
* "to_be_deleted_at": null
|
|
3494
3752
|
* },
|
|
3495
3753
|
* "accounts": [
|
|
3496
3754
|
* {
|
|
@@ -3503,7 +3761,8 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3503
3761
|
* ]
|
|
3504
3762
|
* }
|
|
3505
3763
|
* ```
|
|
3506
|
-
* @throws {ValidationError} If `provider`
|
|
3764
|
+
* @throws {ValidationError} If `provider` is not `google`, `token` is
|
|
3765
|
+
* missing, or `has_accepted_terms` is not a boolean.
|
|
3507
3766
|
* @throws {ApiError} `400` if the provider token is rejected.
|
|
3508
3767
|
*
|
|
3509
3768
|
* @example
|
|
@@ -3516,8 +3775,8 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3516
3775
|
* ```
|
|
3517
3776
|
*/
|
|
3518
3777
|
socialLogin(payload: {
|
|
3519
|
-
/** OAuth provider. The API
|
|
3520
|
-
provider: 'google'
|
|
3778
|
+
/** OAuth provider. The current API accepts only `google`. */
|
|
3779
|
+
provider: 'google';
|
|
3521
3780
|
token: string;
|
|
3522
3781
|
has_accepted_terms: boolean;
|
|
3523
3782
|
}): Promise<ILoginResponse>;
|
|
@@ -3534,7 +3793,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3534
3793
|
*
|
|
3535
3794
|
* @param payload - Social provider and provider-issued access/ID token.
|
|
3536
3795
|
* @returns Resolves when the API acknowledges that the identity was linked.
|
|
3537
|
-
* @throws {ValidationError} If
|
|
3796
|
+
* @throws {ValidationError} If `provider` is not `google` or `token` is empty.
|
|
3538
3797
|
* @throws {ApiError} `400` for an invalid provider token or `401` for
|
|
3539
3798
|
* missing/invalid Assinafy credentials.
|
|
3540
3799
|
*
|
|
@@ -3547,7 +3806,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3547
3806
|
* ```
|
|
3548
3807
|
*/
|
|
3549
3808
|
linkSocialLogin(payload: {
|
|
3550
|
-
provider: 'google'
|
|
3809
|
+
provider: 'google';
|
|
3551
3810
|
token: string;
|
|
3552
3811
|
}): Promise<void>;
|
|
3553
3812
|
/**
|
|
@@ -3696,7 +3955,9 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3696
3955
|
*
|
|
3697
3956
|
* @param payload - The reset-password body.
|
|
3698
3957
|
* @param payload.email - The user's email address.
|
|
3699
|
-
* @param payload.token - The reset token from the emailed link.
|
|
3958
|
+
* @param payload.token - The reset token from the emailed link. The current
|
|
3959
|
+
* schema leaves it optional even though the operation description says the
|
|
3960
|
+
* reset uses that token.
|
|
3700
3961
|
* @param payload.new_password - The new password to set.
|
|
3701
3962
|
* @returns `{ email }` — the address whose password was reset. Response
|
|
3702
3963
|
* shape:
|
|
@@ -3747,7 +4008,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
3747
4008
|
* @param payload - The field to create. `type` and `name` are required;
|
|
3748
4009
|
* `type` must be one of the platform field types (see
|
|
3749
4010
|
* {@link FieldsResource.listTypes}); `regex` may be a string or `null`,
|
|
3750
|
-
* and `is_required` is optional. `is_active` is a
|
|
4011
|
+
* and `is_required` is optional. `is_active` is a compatibility extension.
|
|
3751
4012
|
* @param accountId - Override the client's default account ID.
|
|
3752
4013
|
* @returns The created field definition. Response shape:
|
|
3753
4014
|
* ```jsonc
|
|
@@ -3852,9 +4113,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3852
4113
|
* (`PUT /accounts/{accountId}/fields/{fieldId}`).
|
|
3853
4114
|
*
|
|
3854
4115
|
* @param fieldId - The field definition to update.
|
|
3855
|
-
* @param payload -
|
|
3856
|
-
* `
|
|
3857
|
-
* compatibility extensions.
|
|
4116
|
+
* @param payload - Fields are `name`, nullable `regex`, and `is_active`;
|
|
4117
|
+
* `type` and `is_required` are compatibility extensions.
|
|
3858
4118
|
* @param accountId - Override the client's default account ID.
|
|
3859
4119
|
* @returns The updated field definition. Response shape:
|
|
3860
4120
|
* ```jsonc
|
|
@@ -3907,9 +4167,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
3907
4167
|
* Validate a single value against a field definition
|
|
3908
4168
|
* (`POST /accounts/{accountId}/fields/{fieldId}/validate`).
|
|
3909
4169
|
*
|
|
3910
|
-
* The
|
|
3911
|
-
* `signerAccessCode` is
|
|
3912
|
-
*
|
|
4170
|
+
* The operation uses the client's API-key/Bearer authentication.
|
|
4171
|
+
* `signerAccessCode` is a compatibility query and is sent as
|
|
4172
|
+
* `signer-access-code` when supplied.
|
|
3913
4173
|
*
|
|
3914
4174
|
* @param fieldId - The field definition to validate against.
|
|
3915
4175
|
* @param value - The value to check (validated against the field's
|
|
@@ -3923,7 +4183,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3923
4183
|
* "error_message": ""
|
|
3924
4184
|
* }
|
|
3925
4185
|
* ```
|
|
3926
|
-
* @throws {ValidationError} If `fieldId` or the account ID is missing
|
|
4186
|
+
* @throws {ValidationError} If `fieldId` or the account ID is missing, or
|
|
4187
|
+
* `value` is `undefined`.
|
|
3927
4188
|
* @throws {ApiError} If the API rejects the request.
|
|
3928
4189
|
*
|
|
3929
4190
|
* @example
|
|
@@ -3938,14 +4199,14 @@ declare class FieldsResource extends BaseResource {
|
|
|
3938
4199
|
validate(fieldId: string, value: unknown, options?: {
|
|
3939
4200
|
signerAccessCode?: string;
|
|
3940
4201
|
accountId?: string;
|
|
3941
|
-
}): Promise<
|
|
4202
|
+
}): Promise<IFieldValidationResponse>;
|
|
3942
4203
|
/**
|
|
3943
4204
|
* Validate multiple values at once
|
|
3944
4205
|
* (`POST /accounts/{accountId}/fields/validate-multiple`).
|
|
3945
4206
|
*
|
|
3946
4207
|
* The request body is the array of `{ field_id, value }` entries itself
|
|
3947
4208
|
* (not wrapped in an object). The optional `signerAccessCode` query is the
|
|
3948
|
-
* same
|
|
4209
|
+
* same compatibility extension described on
|
|
3949
4210
|
* {@link FieldsResource.validate}.
|
|
3950
4211
|
*
|
|
3951
4212
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
@@ -3953,8 +4214,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3953
4214
|
* @returns One validation result per entry. Response shape:
|
|
3954
4215
|
* ```jsonc
|
|
3955
4216
|
* [
|
|
3956
|
-
* { "type": "cpf", "success": true, "error_message": "" },
|
|
3957
|
-
* { "type": "text", "success": true, "error_message": "" }
|
|
4217
|
+
* { "field_id": "field-cpf", "type": "cpf", "success": true, "error_message": "" },
|
|
4218
|
+
* { "field_id": "field-name", "type": "text", "success": true, "error_message": "" }
|
|
3958
4219
|
* ]
|
|
3959
4220
|
* ```
|
|
3960
4221
|
* @throws {ValidationError} If `entries` is empty or the account ID is missing.
|
|
@@ -3973,11 +4234,15 @@ declare class FieldsResource extends BaseResource {
|
|
|
3973
4234
|
validateMultiple(entries: IFieldValidateMultipleEntry[], options?: {
|
|
3974
4235
|
signerAccessCode?: string;
|
|
3975
4236
|
accountId?: string;
|
|
3976
|
-
}): Promise<
|
|
4237
|
+
}): Promise<IFieldValidationMultipleResult[]>;
|
|
3977
4238
|
/**
|
|
3978
4239
|
* List the platform's supported field types (`GET /field-types`).
|
|
3979
4240
|
*
|
|
3980
|
-
*
|
|
4241
|
+
* The catalog is server-controlled. CPF validation expects 11 digits;
|
|
4242
|
+
* CNPJ accepts 14 characters, including letters A–Z in positions 1–12,
|
|
4243
|
+
* with numeric check digits in positions 13–14. Punctuation is ignored.
|
|
4244
|
+
*
|
|
4245
|
+
* @returns The current catalogue of field types. Response shape:
|
|
3981
4246
|
* ```jsonc
|
|
3982
4247
|
* [
|
|
3983
4248
|
* { "type": "personName", "name": "Nome" },
|
|
@@ -4004,6 +4269,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
4004
4269
|
* public exception and can be called without an access code.
|
|
4005
4270
|
*/
|
|
4006
4271
|
declare class SignerDocumentsResource extends BaseResource {
|
|
4272
|
+
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
4007
4273
|
/**
|
|
4008
4274
|
* Fetch the document currently awaiting a given signer
|
|
4009
4275
|
* (`GET /signers/{signer_id}/document?signer-access-code=…`).
|
|
@@ -4040,7 +4306,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4040
4306
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
4041
4307
|
* }
|
|
4042
4308
|
* ```
|
|
4043
|
-
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing
|
|
4309
|
+
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing,
|
|
4310
|
+
* or a supplied `search` value is not a string.
|
|
4044
4311
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
4045
4312
|
*
|
|
4046
4313
|
* @example
|
|
@@ -4103,9 +4370,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4103
4370
|
*
|
|
4104
4371
|
* The signer-side counterpart of {@link DocumentResource.search}, scoped to
|
|
4105
4372
|
* one signer and authorised by their access code rather than the API key.
|
|
4106
|
-
* Like {@link SignerDocumentsResource.list}, it requires
|
|
4107
|
-
* `signer-access-code
|
|
4108
|
-
* endpoint is not usable without it.
|
|
4373
|
+
* Like {@link SignerDocumentsResource.list}, it requires the
|
|
4374
|
+
* `signer-access-code` query parameter.
|
|
4109
4375
|
*
|
|
4110
4376
|
* @param signerId - The signer whose documents are searched.
|
|
4111
4377
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
@@ -4133,19 +4399,22 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4133
4399
|
* artifact names, exposed by the API as a public signer-link endpoint. The
|
|
4134
4400
|
* optional access-code argument is retained for compatibility with deployed
|
|
4135
4401
|
* environments that still accept or require the legacy query parameter. The
|
|
4136
|
-
* `certificated` and `bundle`
|
|
4137
|
-
*
|
|
4402
|
+
* `certificated` and `bundle` exist only once the document is fully signed.
|
|
4403
|
+
* `pades` exists only when the document had a Digital Certificate signer.
|
|
4404
|
+
* A bundle contains original, certificated, and certificate-page artifacts,
|
|
4405
|
+
* plus PAdES when present.
|
|
4138
4406
|
*
|
|
4139
4407
|
* @param signerId - The signer requesting the download.
|
|
4140
4408
|
* @param documentId - The document to download.
|
|
4141
4409
|
* @param artifactName - Which artifact to fetch (`original`, `certificated`,
|
|
4142
|
-
* `certificate-page`, or `bundle`).
|
|
4410
|
+
* `certificate-page`, `pades`, or `bundle`).
|
|
4143
4411
|
* @param signerAccessCode - Optional legacy signer access code. Omit it for
|
|
4144
4412
|
* the official public request shape.
|
|
4145
|
-
* @returns The artifact bytes as a Node `Buffer` (PDF for
|
|
4146
|
-
*
|
|
4147
|
-
* @throws {ValidationError} If `signerId` or `documentId` is missing,
|
|
4148
|
-
*
|
|
4413
|
+
* @returns The raw artifact bytes as a Node `Buffer` (PDF except for the
|
|
4414
|
+
* ZIP `bundle`).
|
|
4415
|
+
* @throws {ValidationError} If `signerId` or `documentId` is missing,
|
|
4416
|
+
* `artifactName` is not one of the five documented names, or an explicitly
|
|
4417
|
+
* supplied legacy `signerAccessCode` is blank.
|
|
4149
4418
|
* @throws {ApiError} `404` if the artifact does not exist yet.
|
|
4150
4419
|
*
|
|
4151
4420
|
* @example
|
|
@@ -4166,6 +4435,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4166
4435
|
* Batch shortcut for a signer who has multiple pending documents under the
|
|
4167
4436
|
* same access code — it signs each with their stored signature/initials
|
|
4168
4437
|
* rather than field-by-field (contrast {@link SignerDocumentsResource.sign}).
|
|
4438
|
+
* Every document must use the `virtual` assignment method.
|
|
4169
4439
|
* The `document_ids` array goes in the request body; the access code
|
|
4170
4440
|
* authenticates via the `signer-access-code` query param.
|
|
4171
4441
|
*
|
|
@@ -4226,8 +4496,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4226
4496
|
* prompt for {@link SignerDocumentsResource.uploadSignature} before signing.
|
|
4227
4497
|
*
|
|
4228
4498
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4229
|
-
* @returns The signer profile.
|
|
4230
|
-
*
|
|
4499
|
+
* @returns The signer profile. `has_signature`, `has_initial`, and
|
|
4500
|
+
* `is_signature_reusable` are optional compatibility flags:
|
|
4231
4501
|
* ```jsonc
|
|
4232
4502
|
* {
|
|
4233
4503
|
* "resource": "signer",
|
|
@@ -4316,34 +4586,35 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4316
4586
|
* the signed document. Only the provided fields are sent — `undefined`/`null`
|
|
4317
4587
|
* entries are stripped by {@link cleanParams} before the request — so you can
|
|
4318
4588
|
* pass just the fields the signer changed. The access code authenticates via
|
|
4319
|
-
* the `signer-access-code` query param.
|
|
4320
|
-
*
|
|
4321
|
-
*
|
|
4589
|
+
* the `signer-access-code` query param. For `DigitalCertificate`, pass
|
|
4590
|
+
* `has_accepted_terms: true` here or call
|
|
4591
|
+
* {@link SignerDocumentsResource.acceptTerms} before fetching the assignment.
|
|
4322
4592
|
*
|
|
4323
4593
|
* @param documentId - The document the signer is confirming data for.
|
|
4324
4594
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4325
4595
|
* @param payload - Any of the official `full_name`, `email`, or
|
|
4326
|
-
* `government_id` fields. Fields left out are not
|
|
4596
|
+
* `government_id`, or `has_accepted_terms` fields. Fields left out are not
|
|
4597
|
+
* sent.
|
|
4327
4598
|
* @returns The confirmed signer in the full {@link ISigner} response shape.
|
|
4328
|
-
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing
|
|
4599
|
+
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
4600
|
+
* or a supplied identity value is malformed.
|
|
4329
4601
|
* @throws {ApiError} If the access code is invalid/expired or a value fails
|
|
4330
4602
|
* validation.
|
|
4331
4603
|
*
|
|
4332
4604
|
* @example
|
|
4333
4605
|
* ```ts
|
|
4334
|
-
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00' }
|
|
4606
|
+
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00', has_accepted_terms: true }
|
|
4335
4607
|
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
4336
4608
|
* full_name: 'Example Signer',
|
|
4337
4609
|
* government_id: '123.456.789-00',
|
|
4610
|
+
* has_accepted_terms: true,
|
|
4338
4611
|
* });
|
|
4339
|
-
* await client.signerDocuments.acceptTerms(accessCode);
|
|
4340
4612
|
* ```
|
|
4341
4613
|
*/
|
|
4342
4614
|
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner>;
|
|
4343
4615
|
/**
|
|
4344
4616
|
* @deprecated Compatibility overload preserving the previous wire shape.
|
|
4345
|
-
* `whatsapp_phone_number`
|
|
4346
|
-
* pass-through fields. Call `acceptTerms()` explicitly for legal consent.
|
|
4617
|
+
* `whatsapp_phone_number` is a compatibility pass-through field.
|
|
4347
4618
|
*/
|
|
4348
4619
|
confirmData(documentId: string, signerAccessCode: string, payload: ILegacyConfirmSignerDataPayload): Promise<ISigner>;
|
|
4349
4620
|
/**
|
|
@@ -4391,8 +4662,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4391
4662
|
* custom signing UI). Returns bytes, not JSON.
|
|
4392
4663
|
*
|
|
4393
4664
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4394
|
-
* @param imageType -
|
|
4395
|
-
* `'initial'`.
|
|
4665
|
+
* @param imageType - Server-defined image category; known values are
|
|
4666
|
+
* `'signature'` (default) and `'initial'`.
|
|
4396
4667
|
* @returns The image bytes as a Node `Buffer` (PNG by default).
|
|
4397
4668
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
4398
4669
|
* @throws {ApiError} `404` if the signer has no such image stored; `401`/`403`
|
|
@@ -4404,16 +4675,22 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4404
4675
|
* await fs.writeFile('signature.png', png);
|
|
4405
4676
|
* ```
|
|
4406
4677
|
*/
|
|
4407
|
-
downloadSignature(signerAccessCode: string, imageType?:
|
|
4678
|
+
downloadSignature(signerAccessCode: string, imageType?: SignatureImageType): Promise<Buffer>;
|
|
4408
4679
|
/**
|
|
4409
4680
|
* Fetch the assignment (document + fields) as the signer sees it
|
|
4410
4681
|
* (`GET /sign?signer-access-code=…`).
|
|
4411
4682
|
*
|
|
4412
4683
|
* The entry point for a custom signing UI: resolves the access code to the
|
|
4413
4684
|
* document, its pages, and the {@link ISignFieldEntry}-addressable items the
|
|
4414
|
-
* signer must fill.
|
|
4415
|
-
*
|
|
4416
|
-
* `hasAcceptedTerms: true`
|
|
4685
|
+
* signer must fill. The server answers `409` while the document is still
|
|
4686
|
+
* being prepared; retry that response with backoff. For ordinary signers,
|
|
4687
|
+
* `hasAcceptedTerms: true` records terms acceptance on this request.
|
|
4688
|
+
* Digital-certificate signers must confirm their data and accept terms
|
|
4689
|
+
* before this request; otherwise it returns `400`. The query flag is too
|
|
4690
|
+
* late to open that gate, so use `confirmData(..., { has_accepted_terms:
|
|
4691
|
+
* true })` or `acceptTerms()` first.
|
|
4692
|
+
* The API records this read as the signer having viewed the assignment, so
|
|
4693
|
+
* the SDK never automatically replays this particular `GET` after a `429`.
|
|
4417
4694
|
*
|
|
4418
4695
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4419
4696
|
* @param hasAcceptedTerms - Maps to the `has_accepted_terms` query param
|
|
@@ -4425,8 +4702,9 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4425
4702
|
* from which the `itemId` / `fieldId` / `pageId` values for
|
|
4426
4703
|
* {@link SignerDocumentsResource.sign} are read.
|
|
4427
4704
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
4428
|
-
* @throws {ApiError} `
|
|
4429
|
-
* `
|
|
4705
|
+
* @throws {ApiError} `400` when DigitalCertificate identity/terms are not
|
|
4706
|
+
* confirmed; `401`/`403` if the access code is invalid or expired; `409`
|
|
4707
|
+
* while the document is still being prepared.
|
|
4430
4708
|
*
|
|
4431
4709
|
* @example
|
|
4432
4710
|
* ```ts
|
|
@@ -4444,6 +4722,9 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4444
4722
|
* the request body, each entry addressing one item resolved from
|
|
4445
4723
|
* {@link SignerDocumentsResource.getAssignment}. The access code
|
|
4446
4724
|
* authenticates via the `signer-access-code` query param.
|
|
4725
|
+
* Virtual signers must call {@link SignerDocumentsResource.confirmData}
|
|
4726
|
+
* first. Digital Certificate signers cannot use this endpoint; use the
|
|
4727
|
+
* certificate start/complete API flow instead.
|
|
4447
4728
|
*
|
|
4448
4729
|
* @param documentId - The document being signed.
|
|
4449
4730
|
* @param assignmentId - The assignment within that document.
|
|
@@ -4545,8 +4826,13 @@ declare class UserResource extends BaseResource {
|
|
|
4545
4826
|
* "documents_uploaded": 42,
|
|
4546
4827
|
* "documents_sent": 37,
|
|
4547
4828
|
* "signature_requests": 61,
|
|
4548
|
-
* "
|
|
4549
|
-
* "
|
|
4829
|
+
* "signature_requests_notification_email": 55,
|
|
4830
|
+
* "signature_requests_notification_whatsapp": 18,
|
|
4831
|
+
* "signature_requests_notification_bypass": 3,
|
|
4832
|
+
* "signature_requests_verification_email": 48,
|
|
4833
|
+
* "signature_requests_verification_whatsapp": 6,
|
|
4834
|
+
* "signature_requests_verification_bypass": 3,
|
|
4835
|
+
* "signature_requests_verification_digital_certificate": 4,
|
|
4550
4836
|
* "signature_requests_viewed": 44,
|
|
4551
4837
|
* "signature_requests_completed": 52,
|
|
4552
4838
|
* "documents_certified": 30
|
|
@@ -4566,6 +4852,61 @@ declare class UserResource extends BaseResource {
|
|
|
4566
4852
|
* ```
|
|
4567
4853
|
*/
|
|
4568
4854
|
getStats(params?: IDocumentStatsParams): Promise<IDocumentStatsRow[]>;
|
|
4855
|
+
/**
|
|
4856
|
+
* Return the authenticated user's owner-facing document e-mail settings
|
|
4857
|
+
* (`GET /users/self/notification-preferences`).
|
|
4858
|
+
*
|
|
4859
|
+
* Request body: none. Authentication: `X-Api-Key` or Bearer token.
|
|
4860
|
+
*
|
|
4861
|
+
* @returns The complete nine-key preference map:
|
|
4862
|
+
* ```json
|
|
4863
|
+
* {
|
|
4864
|
+
* "DocumentCompleted": true,
|
|
4865
|
+
* "SignerDeclined": true,
|
|
4866
|
+
* "DocumentCancelled": true,
|
|
4867
|
+
* "DocumentAboutToExpire": true,
|
|
4868
|
+
* "DocumentExpired": true,
|
|
4869
|
+
* "DocumentExpirationReset": true,
|
|
4870
|
+
* "DocumentProcessingFailed": true,
|
|
4871
|
+
* "TemplateProcessingFailed": true,
|
|
4872
|
+
* "SignerWhatsappFailed": true
|
|
4873
|
+
* }
|
|
4874
|
+
* ```
|
|
4875
|
+
* @throws {ApiError} `401` when credentials are missing/invalid, or `500`
|
|
4876
|
+
* when the API cannot load the preferences.
|
|
4877
|
+
*
|
|
4878
|
+
* @example
|
|
4879
|
+
* ```ts
|
|
4880
|
+
* const preferences = await client.users.getNotificationPreferences();
|
|
4881
|
+
* ```
|
|
4882
|
+
*/
|
|
4883
|
+
getNotificationPreferences(): Promise<INotificationPreferences>;
|
|
4884
|
+
/**
|
|
4885
|
+
* Merge owner-facing document e-mail settings for the authenticated user
|
|
4886
|
+
* (`PUT /users/self/notification-preferences`). Omitted keys retain their
|
|
4887
|
+
* current values; account/security e-mails are not configurable here.
|
|
4888
|
+
*
|
|
4889
|
+
* @param preferences - One or more of the nine documented keys, each with
|
|
4890
|
+
* a boolean value. Request example:
|
|
4891
|
+
* ```json
|
|
4892
|
+
* { "DocumentCompleted": true, "SignerDeclined": false }
|
|
4893
|
+
* ```
|
|
4894
|
+
* @returns The complete updated map; its shape is identical to
|
|
4895
|
+
* {@link UserResource.getNotificationPreferences}.
|
|
4896
|
+
* @throws {ValidationError} Before requesting when the map is empty, has an
|
|
4897
|
+
* unknown key, or contains a non-boolean value.
|
|
4898
|
+
* @throws {ApiError} `400` if the API rejects the map, `401` for invalid
|
|
4899
|
+
* credentials, or `500` on a server error.
|
|
4900
|
+
*
|
|
4901
|
+
* @example
|
|
4902
|
+
* ```ts
|
|
4903
|
+
* await client.users.updateNotificationPreferences({
|
|
4904
|
+
* SignerDeclined: false,
|
|
4905
|
+
* DocumentExpired: false,
|
|
4906
|
+
* });
|
|
4907
|
+
* ```
|
|
4908
|
+
*/
|
|
4909
|
+
updateNotificationPreferences(preferences: IUpdateNotificationPreferences): Promise<INotificationPreferences>;
|
|
4569
4910
|
}
|
|
4570
4911
|
|
|
4571
4912
|
/**
|
|
@@ -4608,9 +4949,8 @@ declare class WebhookVerifier {
|
|
|
4608
4949
|
*/
|
|
4609
4950
|
verify(payload: string | Buffer, signature: string): boolean;
|
|
4610
4951
|
/**
|
|
4611
|
-
* Parse the raw webhook body into a JSON object.
|
|
4612
|
-
*
|
|
4613
|
-
* tolerant of both the observed rich envelope and legacy `{ type, data }`.
|
|
4952
|
+
* Parse the raw webhook body into a JSON object. Both the rich envelope and
|
|
4953
|
+
* compatibility `{ type, data }` form are accepted.
|
|
4614
4954
|
*
|
|
4615
4955
|
* @param payload - Raw UTF-8 JSON request body.
|
|
4616
4956
|
* @returns The object envelope, or `null` for malformed JSON, primitives,
|
|
@@ -4713,11 +5053,16 @@ declare class AssinafyClient {
|
|
|
4713
5053
|
* authenticates protected operations; `accountId` sets the default
|
|
4714
5054
|
* workspace used by every account-scoped resource; `baseUrl` (default the
|
|
4715
5055
|
* production API), `timeout`
|
|
4716
|
-
* (default 30 s), `maxRetries` (default 2, for HTTP 429 on
|
|
5056
|
+
* (default 30 s), `maxRetries` (default 2, for HTTP 429 on replay-safe
|
|
4717
5057
|
* requests), `webhookSecret` (enables
|
|
4718
5058
|
* {@link AssinafyClient.webhookVerifier}) and `logger` are optional.
|
|
4719
|
-
*
|
|
4720
|
-
* `
|
|
5059
|
+
* Automatic retries cover `GET`, `HEAD`, `OPTIONS`, and `DELETE`, except
|
|
5060
|
+
* `GET /sign` because that read records a signer view. An
|
|
5061
|
+
* `Idempotency-Key` opts advanced/custom requests into SDK replay only;
|
|
5062
|
+
* confirm that the target route actually deduplicates that key first.
|
|
5063
|
+
*
|
|
5064
|
+
* @throws {ValidationError} If `timeout` / `maxRetries` is invalid or
|
|
5065
|
+
* `baseUrl` is not an absolute HTTP(S) URL.
|
|
4721
5066
|
*
|
|
4722
5067
|
* @example
|
|
4723
5068
|
* ```ts
|
|
@@ -4736,6 +5081,7 @@ declare class AssinafyClient {
|
|
|
4736
5081
|
* @param options - Extra client options (`baseUrl`, `timeout`, `maxRetries`,
|
|
4737
5082
|
* `webhookSecret`, `logger`), minus `apiKey`/`accountId`.
|
|
4738
5083
|
* @returns A configured {@link AssinafyClient}.
|
|
5084
|
+
* @throws {ValidationError} If an extra client option is invalid.
|
|
4739
5085
|
*
|
|
4740
5086
|
* @example
|
|
4741
5087
|
* ```ts
|
|
@@ -4755,6 +5101,8 @@ declare class AssinafyClient {
|
|
|
4755
5101
|
*
|
|
4756
5102
|
* @param config - Loosely-typed configuration ({@link ClientConfigInput}).
|
|
4757
5103
|
* @returns A configured {@link AssinafyClient}.
|
|
5104
|
+
* @throws {ValidationError} If `config` is not an object or contains an
|
|
5105
|
+
* invalid timeout, retry count, or base URL.
|
|
4758
5106
|
*
|
|
4759
5107
|
* @example
|
|
4760
5108
|
* ```ts
|
|
@@ -4766,23 +5114,20 @@ declare class AssinafyClient {
|
|
|
4766
5114
|
*/
|
|
4767
5115
|
static fromConfig(config: ClientConfigInput): AssinafyClient;
|
|
4768
5116
|
/**
|
|
4769
|
-
* Flagship helper: upload a PDF,
|
|
4770
|
-
*
|
|
5117
|
+
* Flagship helper: upload a PDF, ensure each signer exists, and open a
|
|
5118
|
+
* **virtual** signature assignment — the whole "send this
|
|
4771
5119
|
* document for signature" flow in a single call.
|
|
4772
5120
|
*
|
|
4773
5121
|
* Sequence of API calls:
|
|
4774
5122
|
* 1. `POST /accounts/{accountId}/documents` — upload the PDF
|
|
4775
5123
|
* ({@link DocumentResource.upload}).
|
|
4776
|
-
* 2.
|
|
4777
|
-
* ({@link DocumentResource.waitUntilReady}).
|
|
4778
|
-
* 3. For each signer, reuse an existing signer by email or
|
|
5124
|
+
* 2. For each signer, reuse an existing signer by email or
|
|
4779
5125
|
* `POST /accounts/{accountId}/signers` to create one
|
|
4780
5126
|
* ({@link SignerResource.create} — idempotent by email).
|
|
4781
|
-
*
|
|
5127
|
+
* 3. `POST /documents/{id}/assignments` with `method: 'virtual'` and the
|
|
4782
5128
|
* collected signer IDs ({@link AssignmentResource.create}).
|
|
4783
|
-
*
|
|
4784
|
-
*
|
|
4785
|
-
* the upload snapshot is returned, avoiding only this final round-trip.
|
|
5129
|
+
* 4. When `waitForReady` is not `false`, poll `GET /documents/{id}` until
|
|
5130
|
+
* processing finishes; otherwise return the upload response immediately.
|
|
4786
5131
|
*
|
|
4787
5132
|
* @param options - Workflow options.
|
|
4788
5133
|
* @param options.source - The PDF to upload, as a file path or in-memory
|
|
@@ -4790,24 +5135,29 @@ declare class AssinafyClient {
|
|
|
4790
5135
|
* @param options.signers - Signers to request signatures from — at least one
|
|
4791
5136
|
* is required. Each is `{ name, email?, whatsapp_phone_number? | phone?,
|
|
4792
5137
|
* cpf?, metadata? }`; a signer needs an email or a WhatsApp number to be
|
|
4793
|
-
* notified.
|
|
5138
|
+
* notified. Phone-only signers automatically use WhatsApp for verification
|
|
5139
|
+
* and notification, which requires a paid plan and incurs the channel cost;
|
|
5140
|
+
* signers with e-mail default to the e-mail channel.
|
|
4794
5141
|
* @param options.message - Optional invitation message attached to the
|
|
4795
5142
|
* assignment.
|
|
4796
5143
|
* @param options.metadata - Optional metadata attached to the uploaded
|
|
4797
5144
|
* document.
|
|
4798
|
-
* @param options.waitForReady -
|
|
4799
|
-
*
|
|
4800
|
-
* `
|
|
4801
|
-
*
|
|
5145
|
+
* @param options.waitForReady - Wait for document processing before
|
|
5146
|
+
* returning. Defaults to `true`. Virtual assignments are created directly
|
|
5147
|
+
* from `uploaded`, `metadata_processing`, or `metadata_ready`, as allowed by
|
|
5148
|
+
* the API; only `collect` assignments require pre-rendered pages.
|
|
5149
|
+
* @param options.waitOptions - Optional `maxWaitMs` / `pollIntervalMs`
|
|
5150
|
+
* forwarded to {@link DocumentResource.waitUntilReady}.
|
|
4802
5151
|
* @param options.expiresAt - Optional ISO-8601 assignment expiry, e.g.
|
|
4803
5152
|
* `'2026-08-01T00:00:00Z'`.
|
|
4804
|
-
* @param options.copyReceivers - Optional
|
|
4805
|
-
*
|
|
4806
|
-
* plans
|
|
5153
|
+
* @param options.copyReceivers - Optional existing signer IDs (not email
|
|
5154
|
+
* addresses) that receive a copy. See the caveat on
|
|
5155
|
+
* {@link ICreateAssignmentPayload.copy_receivers}; some plans silently drop
|
|
5156
|
+
* the field.
|
|
4807
5157
|
* @param options.accountId - Override the client's default account ID.
|
|
4808
5158
|
* @returns `{ document, assignment, signer_ids }`. `document` is the
|
|
4809
5159
|
* re-fetched {@link IDocumentDetailsResponse} when `waitForReady` (the
|
|
4810
|
-
* default), otherwise the {@link IDocumentUploadResponse} upload
|
|
5160
|
+
* default), otherwise the {@link IDocumentUploadResponse} upload response;
|
|
4811
5161
|
* `signer_ids` are the created/reused signer IDs in signer order:
|
|
4812
5162
|
* ```jsonc
|
|
4813
5163
|
* {
|
|
@@ -4838,10 +5188,16 @@ declare class AssinafyClient {
|
|
|
4838
5188
|
* "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
|
|
4839
5189
|
* }
|
|
4840
5190
|
* ```
|
|
4841
|
-
*
|
|
4842
|
-
*
|
|
4843
|
-
*
|
|
4844
|
-
* {@link
|
|
5191
|
+
* This workflow is not transactional. If any post-upload step fails, its
|
|
5192
|
+
* {@link AssinafyError} includes the uploaded `documentId`, accumulated
|
|
5193
|
+
* `signerIds`, and `assignmentId` (once created) in `context`; a
|
|
5194
|
+
* {@link ValidationError} also exposes them in `errors`. Inspect those IDs
|
|
5195
|
+
* before retrying. The SDK does not auto-delete successfully created data.
|
|
5196
|
+
*
|
|
5197
|
+
* @throws {ValidationError} If the workflow/options or a signer is invalid,
|
|
5198
|
+
* the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
|
|
5199
|
+
* enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
|
|
5200
|
+
* timeout.
|
|
4845
5201
|
* @throws {ApiError} If any underlying API call is rejected.
|
|
4846
5202
|
*
|
|
4847
5203
|
* @example
|
|
@@ -4854,9 +5210,9 @@ declare class AssinafyClient {
|
|
|
4854
5210
|
* ],
|
|
4855
5211
|
* message: 'Please sign the attached agreement.',
|
|
4856
5212
|
* });
|
|
4857
|
-
* console.log(document.status); // '
|
|
5213
|
+
* console.log(document.status); // usually 'pending_signature'
|
|
4858
5214
|
* console.log(signer_ids.length); // 2
|
|
4859
|
-
* console.log(assignment.signing_urls);
|
|
5215
|
+
* console.log(assignment.signing_urls?.length); // one protected link per signer
|
|
4860
5216
|
* ```
|
|
4861
5217
|
*/
|
|
4862
5218
|
uploadAndRequestSignatures(options: {
|
|
@@ -4865,6 +5221,10 @@ declare class AssinafyClient {
|
|
|
4865
5221
|
message?: string;
|
|
4866
5222
|
metadata?: Record<string, unknown>;
|
|
4867
5223
|
waitForReady?: boolean;
|
|
5224
|
+
waitOptions?: {
|
|
5225
|
+
maxWaitMs?: number;
|
|
5226
|
+
pollIntervalMs?: number;
|
|
5227
|
+
};
|
|
4868
5228
|
expiresAt?: string;
|
|
4869
5229
|
copyReceivers?: string[];
|
|
4870
5230
|
accountId?: string;
|
|
@@ -4876,8 +5236,13 @@ declare class AssinafyClient {
|
|
|
4876
5236
|
*
|
|
4877
5237
|
* @returns The configured `AxiosInstance` — auth headers, base URL, timeout,
|
|
4878
5238
|
* and the HTTP 429 retry interceptor are already applied. Automatic retries
|
|
4879
|
-
* are limited to `GET`, `HEAD`, `OPTIONS`,
|
|
4880
|
-
* `
|
|
5239
|
+
* are limited to read-safe `GET`, `HEAD`, `OPTIONS`, and `DELETE` requests;
|
|
5240
|
+
* `GET /sign` is excluded because it records that the assignment was viewed.
|
|
5241
|
+
* An `Idempotency-Key` opts a custom request into SDK replay only after the
|
|
5242
|
+
* caller confirms that the target route deduplicates it server-side.
|
|
5243
|
+
* Same-origin absolute URLs are supported; cross-origin requests are
|
|
5244
|
+
* rejected before dispatch, and credentials are removed from cross-origin
|
|
5245
|
+
* redirects. Use a separate axios client for unrelated hosts.
|
|
4881
5246
|
*
|
|
4882
5247
|
* @example
|
|
4883
5248
|
* ```ts
|
|
@@ -4924,9 +5289,14 @@ declare class ApiError extends AssinafyError {
|
|
|
4924
5289
|
* Convert a status/body pair into an {@link ApiError}.
|
|
4925
5290
|
*
|
|
4926
5291
|
* @param statusCode - Non-success HTTP response status.
|
|
4927
|
-
* @param responseData -
|
|
4928
|
-
* followed by string `error
|
|
4929
|
-
*
|
|
5292
|
+
* @param responseData - API body. For a JSON object, string `message` takes
|
|
5293
|
+
* priority, followed by string `error`. A non-JSON body (a proxy's
|
|
5294
|
+
* `text/plain` or HTML error page) is used verbatim rather than discarded —
|
|
5295
|
+
* otherwise the only failures reported as the generic fallback would be the
|
|
5296
|
+
* ones with no structured body to explain them. Anything else falls back to
|
|
5297
|
+
* the stable message.
|
|
5298
|
+
* @returns An `ApiError` retaining the original response body in
|
|
5299
|
+
* {@link ApiError.responseData}; `message` is truncated for legibility.
|
|
4930
5300
|
*
|
|
4931
5301
|
* @example
|
|
4932
5302
|
* ```ts
|
|
@@ -4936,11 +5306,11 @@ declare class ApiError extends AssinafyError {
|
|
|
4936
5306
|
*/
|
|
4937
5307
|
static fromResponse(statusCode: number, responseData: unknown): ApiError;
|
|
4938
5308
|
}
|
|
4939
|
-
/** Thrown when
|
|
5309
|
+
/** Thrown when SDK validation fails, including invalid input or workflow state. */
|
|
4940
5310
|
declare class ValidationError extends AssinafyError {
|
|
4941
5311
|
readonly errors: Record<string, unknown>;
|
|
4942
5312
|
/**
|
|
4943
|
-
* Create
|
|
5313
|
+
* Create an SDK validation failure.
|
|
4944
5314
|
*
|
|
4945
5315
|
* @param message - Human-readable validation summary.
|
|
4946
5316
|
* @param errors - Field/value diagnostics for programmatic handling.
|
|
@@ -4968,4 +5338,15 @@ declare class NetworkError extends AssinafyError {
|
|
|
4968
5338
|
constructor(message: string, options?: ErrorOptions);
|
|
4969
5339
|
}
|
|
4970
5340
|
|
|
4971
|
-
|
|
5341
|
+
/**
|
|
5342
|
+
* Largest page the list endpoints actually return.
|
|
5343
|
+
*
|
|
5344
|
+
* The API silently clamps `per-page` to this value rather than rejecting a
|
|
5345
|
+
* larger one, so a caller asking for 100 receives 50 and no error. Methods that
|
|
5346
|
+
* need "as many rows as one request can give" pin this instead of guessing.
|
|
5347
|
+
*/
|
|
5348
|
+
declare const MAX_LIST_PAGE_SIZE = 50;
|
|
5349
|
+
|
|
5350
|
+
declare const SDK_USER_AGENT: string;
|
|
5351
|
+
|
|
5352
|
+
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 IAuthenticatedUser, type IConfirmSignerDataPayload, 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 INotificationHistoryEntry, type INotificationPreferences, 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 IUpdateFieldPayload, type IUpdateNotificationPreferences, type IUpdateSignerPayload, type IUpdateTagPayload, type IUpdateTemplatePayload, type IUpdateWorkspacePayload, type IUploadAndRequestSignaturesResult, type IUploadAndRequestSignaturesSigner, type IUploadSignatureOptions, type IWebhookDispatch, type IWebhookDispatchListParams, 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, type PaginatedResult, type PaginationMeta, SDK_USER_AGENT, type SendTokenChannel, type SignatureImageType, SignerDocumentsResource, type SignerReference, SignerResource, TagResource, TemplateResource, UserResource, ValidationError, type WebhookEventType, WebhookResource, WebhookVerifier, WorkspaceResource, buildAssignmentPayload };
|