@assinafy/sdk 2.1.1 → 2.1.2
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/README.md +554 -111
- package/dist/index.d.mts +676 -311
- package/dist/index.d.ts +676 -311
- package/dist/index.js +3064 -1932
- package/dist/index.mjs +3063 -1932
- package/docs/API_COVERAGE.md +28 -30
- package/docs/COMPATIBILITY.md +256 -179
- package/docs/RELEASING.md +42 -11
- package/package.json +10 -9
package/dist/index.d.ts
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,10 @@ 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` (maximum 100).
|
|
1155
1265
|
* @param accountId - Override the client's default account ID.
|
|
1156
1266
|
* @returns Matching documents, with pagination in `meta`. Each item:
|
|
1157
1267
|
* ```jsonc
|
|
@@ -1254,10 +1364,29 @@ declare class DocumentResource extends BaseResource {
|
|
|
1254
1364
|
*
|
|
1255
1365
|
* @param documentId - The document to rename.
|
|
1256
1366
|
* @param name - The new display name (max 255 chars), e.g.
|
|
1257
|
-
* `'Service agreement.pdf'`.
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
* {@link DocumentResource.details}
|
|
1367
|
+
* `'Service agreement.pdf'`. The API removes diacritics and replaces
|
|
1368
|
+
* unsupported characters with dashes.
|
|
1369
|
+
* @returns The updated document. `pages` and `assignment` are optional on
|
|
1370
|
+
* this response; call {@link DocumentResource.details} when they are
|
|
1371
|
+
* required:
|
|
1372
|
+
* ```jsonc
|
|
1373
|
+
* {
|
|
1374
|
+
* "resource": "document",
|
|
1375
|
+
* "id": "103ad216846e6b90710cb9acef59",
|
|
1376
|
+
* "account_id": "acc_example",
|
|
1377
|
+
* "template_id": null,
|
|
1378
|
+
* "name": "Service agreement.pdf",
|
|
1379
|
+
* "status": "metadata_ready",
|
|
1380
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
1381
|
+
* "signing_url": "https://…/sign/103ad216…",
|
|
1382
|
+
* "is_closed": false,
|
|
1383
|
+
* "decline_reason": null,
|
|
1384
|
+
* "declined_by": null,
|
|
1385
|
+
* "tags": [],
|
|
1386
|
+
* "created_at": "2026-07-19T17:24:43Z",
|
|
1387
|
+
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1388
|
+
* }
|
|
1389
|
+
* ```
|
|
1261
1390
|
* @throws {ValidationError} If `documentId` or `name` is missing.
|
|
1262
1391
|
* @throws {ApiError} `400` if the document is processing or already in
|
|
1263
1392
|
* signing; `404` if it does not exist.
|
|
@@ -1274,7 +1403,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1274
1403
|
* Get document details (`GET /documents/{documentId}`).
|
|
1275
1404
|
*
|
|
1276
1405
|
* The full single-document view, including the embedded `assignment` (or
|
|
1277
|
-
* `null`), rendered `pages`, and `artifacts`.
|
|
1406
|
+
* `null`), rendered `pages`, and `artifacts`. `decline_reason` is returned
|
|
1407
|
+
* only when the access token belongs to the document creator.
|
|
1278
1408
|
*
|
|
1279
1409
|
* @param documentId - The document to fetch.
|
|
1280
1410
|
* @returns The document. Response shape (once `metadata_ready`):
|
|
@@ -1284,7 +1414,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1284
1414
|
* "id": "103ad216846e6b90710cb9acef59",
|
|
1285
1415
|
* "account_id": "acc_example",
|
|
1286
1416
|
* "template_id": null,
|
|
1287
|
-
* "name": "
|
|
1417
|
+
* "name": "service-agreement.pdf",
|
|
1288
1418
|
* "status": "metadata_ready",
|
|
1289
1419
|
* "artifacts": {
|
|
1290
1420
|
* "original": "https://…/documents/103ad216…/download/original",
|
|
@@ -1309,7 +1439,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
1309
1439
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1310
1440
|
* }
|
|
1311
1441
|
* ```
|
|
1312
|
-
* @throws {ValidationError} If `documentId` is missing
|
|
1442
|
+
* @throws {ValidationError} If `documentId` is missing or `artifactName` is
|
|
1443
|
+
* not one of the five documented artifact names.
|
|
1313
1444
|
* @throws {ApiError} `404` if the document does not exist.
|
|
1314
1445
|
*
|
|
1315
1446
|
* @example
|
|
@@ -1319,6 +1450,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1319
1450
|
* ```
|
|
1320
1451
|
*/
|
|
1321
1452
|
details(documentId: string): Promise<IDocumentDetailsResponse>;
|
|
1453
|
+
private fetchDetails;
|
|
1322
1454
|
/**
|
|
1323
1455
|
* Alias for {@link DocumentResource.details}
|
|
1324
1456
|
* (`GET /documents/{documentId}`).
|
|
@@ -1376,9 +1508,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
1376
1508
|
*
|
|
1377
1509
|
* @param documentId - The document to download from.
|
|
1378
1510
|
* @param artifactName - Which artifact to fetch: `original`,
|
|
1379
|
-
* `certificated` (the default — the signed PDF), `certificate-page`,
|
|
1380
|
-
* `bundle
|
|
1381
|
-
*
|
|
1511
|
+
* `certificated` (the default — the signed PDF), `certificate-page`,
|
|
1512
|
+
* `pades`, or `bundle` (ZIP). `pades` exists only when the document had a
|
|
1513
|
+
* Digital Certificate signer. `bundle` contains the original, certificated,
|
|
1514
|
+
* and certificate-page artifacts, plus PAdES when present.
|
|
1515
|
+
* @returns A {@link Buffer} containing the raw PDF or ZIP bytes.
|
|
1382
1516
|
* @throws {ValidationError} If `documentId` is missing.
|
|
1383
1517
|
* @throws {ApiError} `404` if the document or artifact does not exist (e.g.
|
|
1384
1518
|
* requesting `certificated` before signing completes).
|
|
@@ -1387,6 +1521,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1387
1521
|
* ```ts
|
|
1388
1522
|
* const pdf = await client.documents.download('doc-1'); // signed PDF
|
|
1389
1523
|
* const original = await client.documents.download('doc-1', 'original');
|
|
1524
|
+
* const pades = await client.documents.download('doc-1', 'pades');
|
|
1390
1525
|
* await fs.promises.writeFile('signed.pdf', pdf);
|
|
1391
1526
|
* ```
|
|
1392
1527
|
*/
|
|
@@ -1432,7 +1567,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1432
1567
|
* Fetch the document activity log
|
|
1433
1568
|
* (`GET /documents/{documentId}/activities`).
|
|
1434
1569
|
*
|
|
1435
|
-
* Returns a chronological
|
|
1570
|
+
* Returns a chronological history of lifecycle events. Normalises an
|
|
1436
1571
|
* absent body to `[]`.
|
|
1437
1572
|
*
|
|
1438
1573
|
* @param documentId - The document whose activity log to fetch.
|
|
@@ -1452,7 +1587,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1452
1587
|
* "event": "document_uploaded",
|
|
1453
1588
|
* "message": "Documento criado.",
|
|
1454
1589
|
* "payload": [],
|
|
1455
|
-
* "origin": { "ip": "
|
|
1590
|
+
* "origin": { "ip": "192.0.2.10", "user-agent": "assinafy-webforms-java-client-sdk" },
|
|
1456
1591
|
* "created_at": "2026-07-19T14:56:55Z"
|
|
1457
1592
|
* }
|
|
1458
1593
|
* ]
|
|
@@ -1476,7 +1611,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1476
1611
|
* certificated.
|
|
1477
1612
|
*
|
|
1478
1613
|
* @param documentId - The document to delete.
|
|
1479
|
-
* @returns Nothing
|
|
1614
|
+
* @returns Nothing; resolves when the document is deleted.
|
|
1480
1615
|
* @throws {ValidationError} If `documentId` is missing.
|
|
1481
1616
|
* @throws {ApiError} `400` if the document is not in a deletable status;
|
|
1482
1617
|
* `404` if it does not exist.
|
|
@@ -1520,10 +1655,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1520
1655
|
* Replace the document's tag set
|
|
1521
1656
|
* (`PUT /accounts/{accountId}/documents/{documentId}/tags`).
|
|
1522
1657
|
*
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
* should not be relied on. This overwrites the existing set — use
|
|
1658
|
+
* `tags` is an array of tag **IDs**. An empty array detaches all tags. Tag
|
|
1659
|
+
* names are not portable identifiers and should not be used here. This
|
|
1660
|
+
* overwrites the existing set — use
|
|
1527
1661
|
* {@link DocumentResource.addTags} to append.
|
|
1528
1662
|
*
|
|
1529
1663
|
* @param documentId - The document to retag.
|
|
@@ -1586,29 +1720,34 @@ declare class DocumentResource extends BaseResource {
|
|
|
1586
1720
|
* @param documentId - The document to detach from.
|
|
1587
1721
|
* @param tagId - The ID of the tag to detach.
|
|
1588
1722
|
* @param accountId - Override the client's default account ID.
|
|
1589
|
-
* @returns
|
|
1723
|
+
* @returns `{ detached: true }` when the association was removed.
|
|
1590
1724
|
* @throws {ValidationError} If `documentId` or `tagId` is missing, or no
|
|
1591
1725
|
* account ID is available.
|
|
1592
1726
|
* @throws {ApiError} If the API rejects the request.
|
|
1593
1727
|
*
|
|
1594
1728
|
* @example
|
|
1595
1729
|
* ```ts
|
|
1596
|
-
* await client.documents.detachTag('doc-1', 'tag-1');
|
|
1730
|
+
* const { detached } = await client.documents.detachTag('doc-1', 'tag-1');
|
|
1597
1731
|
* ```
|
|
1598
1732
|
*/
|
|
1599
|
-
detachTag(documentId: string, tagId: string, accountId?: string): Promise<
|
|
1733
|
+
detachTag(documentId: string, tagId: string, accountId?: string): Promise<IDetachDocumentTagResponse>;
|
|
1600
1734
|
/**
|
|
1601
1735
|
* Create a document from a template
|
|
1602
1736
|
* (`POST /accounts/{accountId}/templates/{templateId}/documents`).
|
|
1603
1737
|
*
|
|
1604
1738
|
* Instantiates the template, binding each role to a signer, and returns the
|
|
1605
1739
|
* new document. The request body is `{ signers, ...options }` — `signers`
|
|
1606
|
-
* maps template `role_id`
|
|
1607
|
-
* `message`, `expires_at`, `editor_fields`, and
|
|
1740
|
+
* maps every template `role_id` to an existing account signer `id`, and
|
|
1741
|
+
* `options` may add `name`, `message`, `expires_at`, `editor_fields`, and
|
|
1742
|
+
* tag names in `tags` (unknown names are created automatically).
|
|
1608
1743
|
*
|
|
1609
1744
|
* @param templateId - The template to instantiate.
|
|
1610
1745
|
* @param signers - Role-to-signer bindings (each with `role_id` and `id`,
|
|
1611
1746
|
* plus optional `verification_method`, `notification_methods`, `step`).
|
|
1747
|
+
* Only one notification method is allowed per signer; when only one of the
|
|
1748
|
+
* verification/notification fields is supplied, the API infers the other.
|
|
1749
|
+
* `DigitalCertificate` costs two credits, requires the feature plus a
|
|
1750
|
+
* signer `government_id`, and that signer must be alone in its step.
|
|
1612
1751
|
* @param options - Optional `name`, `message`, `expires_at`,
|
|
1613
1752
|
* `editor_fields`, `tags`.
|
|
1614
1753
|
* @param accountId - Override the client's default account ID.
|
|
@@ -1620,12 +1759,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1620
1759
|
* "id": "19f675b761b392a48b8642503bb",
|
|
1621
1760
|
* "account_id": "acc_example",
|
|
1622
1761
|
* "template_id": "103a0991a5cde83518e5672aa9aa",
|
|
1623
|
-
* "name": "
|
|
1762
|
+
* "name": "Service agreement from template",
|
|
1624
1763
|
* "status": "pending_signature",
|
|
1625
1764
|
* "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
|
|
1626
1765
|
* "is_closed": false,
|
|
1627
1766
|
* "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
|
|
1628
|
-
* "tags": [{ "id": "103a0992…", "name": "
|
|
1767
|
+
* "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
|
|
1629
1768
|
* "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
|
|
1630
1769
|
* "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
|
|
1631
1770
|
* "created_at": "2026-07-15T19:57:55Z",
|
|
@@ -1640,7 +1779,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1640
1779
|
* @example
|
|
1641
1780
|
* ```ts
|
|
1642
1781
|
* await client.documents.createFromTemplate('tmpl_id', [
|
|
1643
|
-
* { role_id: 'role_id', id: 'signer_id', verification_method: '
|
|
1782
|
+
* { role_id: 'role_id', id: 'signer_id', verification_method: 'DigitalCertificate' },
|
|
1644
1783
|
* ], { name: 'My Contract' });
|
|
1645
1784
|
* ```
|
|
1646
1785
|
*/
|
|
@@ -1651,11 +1790,14 @@ declare class DocumentResource extends BaseResource {
|
|
|
1651
1790
|
*
|
|
1652
1791
|
* A dry run: sends only `{ signers }` and consumes nothing. Use it to check
|
|
1653
1792
|
* balances before calling {@link DocumentResource.createFromTemplate}.
|
|
1793
|
+
* `DigitalCertificate` adds two credits per signer and has the same feature,
|
|
1794
|
+
* `government_id`, and signing-step prerequisites as document creation.
|
|
1654
1795
|
*
|
|
1655
1796
|
* @param templateId - The template that would be instantiated.
|
|
1656
1797
|
* @param signers - One channel descriptor per template role. Cost requests
|
|
1657
1798
|
* use only `role_id`, `verification_method`, and `notification_methods`;
|
|
1658
|
-
* they do not send a signer ID or signing-order step
|
|
1799
|
+
* they do not send a signer ID or signing-order step, and editor roles are
|
|
1800
|
+
* ignored by the cost calculation.
|
|
1659
1801
|
* @param accountId - Override the client's default account ID.
|
|
1660
1802
|
* @returns An {@link ICostEstimate}: `total_credits`, balances, and a
|
|
1661
1803
|
* per-line `breakdown` of what the operation would consume:
|
|
@@ -1683,7 +1825,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1683
1825
|
* @example
|
|
1684
1826
|
* ```ts
|
|
1685
1827
|
* const estimate = await client.documents.estimateCostFromTemplate('tmpl_id', [
|
|
1686
|
-
* { role_id: 'role_id', verification_method: '
|
|
1828
|
+
* { role_id: 'role_id', verification_method: 'DigitalCertificate' },
|
|
1687
1829
|
* ]);
|
|
1688
1830
|
* if (!estimate.has_sufficient_resources) throw new Error(estimate.blocking_reason ?? 'insufficient');
|
|
1689
1831
|
* ```
|
|
@@ -1699,8 +1841,21 @@ declare class DocumentResource extends BaseResource {
|
|
|
1699
1841
|
*
|
|
1700
1842
|
* @param hash - The document's signature hash (the
|
|
1701
1843
|
* `documentSignatureHash` path segment).
|
|
1702
|
-
* @returns
|
|
1703
|
-
*
|
|
1844
|
+
* @returns The verification record:
|
|
1845
|
+
* ```jsonc
|
|
1846
|
+
* {
|
|
1847
|
+
* "hash": "FE32EDDADE7CBDDCBB934E7402047450B0E59C02",
|
|
1848
|
+
* "id": "63ddb172402799bfc991d10d",
|
|
1849
|
+
* "status": "certificated",
|
|
1850
|
+
* "page_count": "1",
|
|
1851
|
+
* "signer_count": "1",
|
|
1852
|
+
* "completed_count": 1,
|
|
1853
|
+
* "completed_at": "2023-01-27T19:27:44Z",
|
|
1854
|
+
* "verified_at": "2023-01-27T19:27:46Z",
|
|
1855
|
+
* "is_valid": true,
|
|
1856
|
+
* "message": ""
|
|
1857
|
+
* }
|
|
1858
|
+
* ```
|
|
1704
1859
|
* @throws {ValidationError} If `hash` is missing.
|
|
1705
1860
|
* @throws {ApiError} If the API rejects the request.
|
|
1706
1861
|
*
|
|
@@ -1711,11 +1866,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1711
1866
|
*/
|
|
1712
1867
|
verify(hash: string): Promise<IDocumentVerification>;
|
|
1713
1868
|
/**
|
|
1714
|
-
* List
|
|
1869
|
+
* List the server's document-status catalog (`GET /documents/statuses`).
|
|
1715
1870
|
*
|
|
1716
|
-
* A
|
|
1717
|
-
* in that status can be deleted (`deletable`).
|
|
1718
|
-
*
|
|
1871
|
+
* A server-controlled catalog of each status `code` and whether documents
|
|
1872
|
+
* in that status can be deleted (`deletable`). New statuses may be added,
|
|
1873
|
+
* so callers should not depend on a fixed count or order. This catalog
|
|
1874
|
+
* requires the same API-key or Bearer authentication as workspace calls.
|
|
1719
1875
|
*
|
|
1720
1876
|
* @returns The status catalog:
|
|
1721
1877
|
* ```jsonc
|
|
@@ -1725,9 +1881,12 @@ declare class DocumentResource extends BaseResource {
|
|
|
1725
1881
|
* { "code": "metadata_processing", "deletable": false },
|
|
1726
1882
|
* { "code": "metadata_ready", "deletable": true },
|
|
1727
1883
|
* { "code": "pending_signature", "deletable": true },
|
|
1728
|
-
* { "code": "
|
|
1729
|
-
*
|
|
1730
|
-
*
|
|
1884
|
+
* { "code": "expired", "deletable": false },
|
|
1885
|
+
* { "code": "certificating", "deletable": false },
|
|
1886
|
+
* { "code": "certificated", "deletable": false },
|
|
1887
|
+
* { "code": "rejected_by_signer", "deletable": false },
|
|
1888
|
+
* { "code": "rejected_by_user", "deletable": false },
|
|
1889
|
+
* { "code": "failed", "deletable": false }
|
|
1731
1890
|
* ]
|
|
1732
1891
|
* ```
|
|
1733
1892
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -1740,21 +1899,32 @@ declare class DocumentResource extends BaseResource {
|
|
|
1740
1899
|
*/
|
|
1741
1900
|
statuses(): Promise<IDocumentStatusInfo[]>;
|
|
1742
1901
|
/**
|
|
1743
|
-
* Public, unauthenticated lookup of
|
|
1902
|
+
* Public, unauthenticated lookup of a document
|
|
1744
1903
|
* (`GET /public/documents/{documentId}`).
|
|
1745
1904
|
*
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1905
|
+
* Returns either the full document response or a compact `page_count` /
|
|
1906
|
+
* `created_by` compatibility variant.
|
|
1748
1907
|
*
|
|
1749
1908
|
* @param documentId - The document to look up.
|
|
1750
|
-
* @returns
|
|
1909
|
+
* @returns The current document representation:
|
|
1751
1910
|
* ```jsonc
|
|
1752
1911
|
* {
|
|
1753
1912
|
* "resource": "document",
|
|
1754
1913
|
* "id": "103ad216846e6b90710cb9acef59",
|
|
1914
|
+
* "account_id": "acc_example",
|
|
1915
|
+
* "template_id": null,
|
|
1755
1916
|
* "name": "Service agreement.pdf",
|
|
1756
|
-
* "
|
|
1757
|
-
* "
|
|
1917
|
+
* "status": "pending_signature",
|
|
1918
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
1919
|
+
* "is_closed": false,
|
|
1920
|
+
* "signing_url": "https://…/sign/103ad216…",
|
|
1921
|
+
* "decline_reason": null,
|
|
1922
|
+
* "declined_by": null,
|
|
1923
|
+
* "tags": [],
|
|
1924
|
+
* "assignment": null,
|
|
1925
|
+
* "pages": [],
|
|
1926
|
+
* "created_at": "2026-07-19T17:24:43Z",
|
|
1927
|
+
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1758
1928
|
* }
|
|
1759
1929
|
* ```
|
|
1760
1930
|
* @throws {ValidationError} If `documentId` is missing.
|
|
@@ -1783,7 +1953,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
1783
1953
|
* explicit channel is supplied).
|
|
1784
1954
|
* @param channel - Optional legacy delivery channel.
|
|
1785
1955
|
* @returns Nothing after the API's empty acknowledgement.
|
|
1786
|
-
* @throws {ValidationError} If `documentId` or `recipient` is missing
|
|
1956
|
+
* @throws {ValidationError} If `documentId` or `recipient` is missing, the
|
|
1957
|
+
* official two-argument form does not receive a valid email address, or a
|
|
1958
|
+
* supplied `channel` is not a non-empty string.
|
|
1787
1959
|
* @throws {ApiError} If the API rejects the request.
|
|
1788
1960
|
*
|
|
1789
1961
|
* @example
|
|
@@ -1853,10 +2025,13 @@ declare class SignerResource extends BaseResource {
|
|
|
1853
2025
|
* an existing signer with that address is reused instead of duplicated (a
|
|
1854
2026
|
* duplicate POST is answered by the API with `400 "Um signatário com este
|
|
1855
2027
|
* e-mail já existe."`, which this method recovers from transparently).
|
|
2028
|
+
* A reused signer is returned unchanged; this method does not overwrite its
|
|
2029
|
+
* existing name, phone, CPF, or metadata with the create payload.
|
|
1856
2030
|
*
|
|
1857
|
-
* @param payload - The signer to create.
|
|
1858
|
-
*
|
|
1859
|
-
*
|
|
2031
|
+
* @param payload - The signer to create. The official fields are required
|
|
2032
|
+
* `full_name` plus optional `email` and E.164 `whatsapp_phone_number`.
|
|
2033
|
+
* `phone`, `cpf`, and `metadata` are compatibility extensions; the SDK
|
|
2034
|
+
* normalizes the phone alias and strips non-digits from CPF before sending.
|
|
1860
2035
|
* @param accountId - Override the client's default account ID.
|
|
1861
2036
|
* @returns The created (or reused) signer. Note the response **never echoes
|
|
1862
2037
|
* `cpf` back**, even when one was sent:
|
|
@@ -1923,8 +2098,8 @@ declare class SignerResource extends BaseResource {
|
|
|
1923
2098
|
* List signers for the workspace (`GET /accounts/{accountId}/signers`).
|
|
1924
2099
|
* Pagination info (if any) is attached in `meta`.
|
|
1925
2100
|
*
|
|
1926
|
-
* @param params - `page`, `per-page`, `search
|
|
1927
|
-
*
|
|
2101
|
+
* @param params - `page`, `per-page`, and `search` (matches `full_name` or
|
|
2102
|
+
* `email`). The API maximum is 100 items per page.
|
|
1928
2103
|
* @param accountId - Override the client's default account ID.
|
|
1929
2104
|
* @returns The matching signers, with pagination in `meta`. Each item:
|
|
1930
2105
|
* ```jsonc
|
|
@@ -1947,14 +2122,16 @@ declare class SignerResource extends BaseResource {
|
|
|
1947
2122
|
* });
|
|
1948
2123
|
* ```
|
|
1949
2124
|
*/
|
|
1950
|
-
list(params?:
|
|
2125
|
+
list(params?: ISignerListParams, accountId?: string): Promise<ISignerListResponse>;
|
|
1951
2126
|
/**
|
|
1952
|
-
* Update a signer (`PUT /accounts/{accountId}/signers/{signerId}`).
|
|
1953
|
-
*
|
|
2127
|
+
* Update a signer (`PUT /accounts/{accountId}/signers/{signerId}`). A name
|
|
2128
|
+
* can always be updated. A verified email or WhatsApp channel cannot change
|
|
2129
|
+
* while it belongs to an in-flight document; changing an unverified channel
|
|
2130
|
+
* rotates its access/verification codes, so resend the notification.
|
|
1954
2131
|
*
|
|
1955
2132
|
* @param signerId - The signer to update.
|
|
1956
|
-
* @param payload - Fields to change.
|
|
1957
|
-
* sending.
|
|
2133
|
+
* @param payload - Fields to change. The official `government_id` field and
|
|
2134
|
+
* legacy `cpf` extension are stripped to digits before sending.
|
|
1958
2135
|
* @param accountId - Override the client's default account ID.
|
|
1959
2136
|
* @returns The updated signer (as with create, `cpf` is never echoed back):
|
|
1960
2137
|
* ```jsonc
|
|
@@ -1968,13 +2145,14 @@ declare class SignerResource extends BaseResource {
|
|
|
1968
2145
|
* }
|
|
1969
2146
|
* ```
|
|
1970
2147
|
* @throws {ValidationError} If `signerId` is missing or no account ID is available.
|
|
1971
|
-
* @throws {ApiError} `400` if
|
|
1972
|
-
* does not exist.
|
|
2148
|
+
* @throws {ApiError} `400` if a verified contact channel is in use by an
|
|
2149
|
+
* in-flight document; `404` if the signer does not exist.
|
|
1973
2150
|
*
|
|
1974
2151
|
* @example
|
|
1975
2152
|
* ```ts
|
|
1976
2153
|
* await client.signers.update('19e6b92e7895332ed9708535d8c', {
|
|
1977
2154
|
* full_name: 'Ana Souza Lima',
|
|
2155
|
+
* government_id: '390.533.447-05',
|
|
1978
2156
|
* });
|
|
1979
2157
|
* ```
|
|
1980
2158
|
*/
|
|
@@ -2003,10 +2181,9 @@ declare class SignerResource extends BaseResource {
|
|
|
2003
2181
|
* `search` is a substring match across signer fields, so the result is
|
|
2004
2182
|
* re-filtered here for an exact, case-insensitive email match.
|
|
2005
2183
|
*
|
|
2006
|
-
* Page size is pinned to the API's maximum of
|
|
2007
|
-
* silently clamped to 50 by the server, so asking for more is misleading.
|
|
2184
|
+
* Page size is pinned to the API's maximum of 100.
|
|
2008
2185
|
* An exact address realistically matches one signer, but a search term that
|
|
2009
|
-
* matched more than
|
|
2186
|
+
* matched more than 100 could in principle miss one — the API exposes no
|
|
2010
2187
|
* exact-email filter to rule that out.
|
|
2011
2188
|
*
|
|
2012
2189
|
* A `404` from the underlying list is treated as "no match" and mapped to
|
|
@@ -2053,10 +2230,9 @@ type AccountLogoUploadSource = {
|
|
|
2053
2230
|
* signer, template, tag, field, and webhook. Each endpoint lives under
|
|
2054
2231
|
* `/accounts`, and the `accountId` used elsewhere in the SDK is a workspace id.
|
|
2055
2232
|
*
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
* rejected with `400`. Verified live against the API.
|
|
2233
|
+
* Requests accept `name`, `notification_sender_type`, `primary_color`, and
|
|
2234
|
+
* `secondary_color`. Colours are always modeled on responses. When
|
|
2235
|
+
* sent, they must be exactly six hex characters with no leading `#`.
|
|
2060
2236
|
*
|
|
2061
2237
|
* @example
|
|
2062
2238
|
* ```ts
|
|
@@ -2068,18 +2244,25 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2068
2244
|
/**
|
|
2069
2245
|
* Create a new workspace (`POST /accounts`).
|
|
2070
2246
|
*
|
|
2071
|
-
* @param payload -
|
|
2072
|
-
*
|
|
2247
|
+
* @param payload - Official fields are workspace `name` (required) and
|
|
2248
|
+
* optional `notification_sender_type` (`User` or `Account`). Optional brand
|
|
2249
|
+
* colours use six hex characters without
|
|
2250
|
+
* a leading `#`.
|
|
2073
2251
|
* @returns The created workspace. Response shape:
|
|
2074
2252
|
* ```jsonc
|
|
2075
2253
|
* {
|
|
2254
|
+
* "resource": "account",
|
|
2076
2255
|
* "id": "acc_example",
|
|
2077
2256
|
* "name": "Acme Legal",
|
|
2257
|
+
* "notification_sender_type": "Account",
|
|
2078
2258
|
* "primary_color": "ff0066",
|
|
2079
2259
|
* "secondary_color": "0066ff",
|
|
2260
|
+
* "roles": ["owner"],
|
|
2261
|
+
* "is_delete_allowed": true,
|
|
2080
2262
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2081
2263
|
* }
|
|
2082
2264
|
* ```
|
|
2265
|
+
* @throws {ValidationError} If `payload` is not an object.
|
|
2083
2266
|
* @throws {ApiError} If the API rejects the request — e.g. `400` when a
|
|
2084
2267
|
* colour is not exactly 6 hex characters (or carries a leading `#`).
|
|
2085
2268
|
*
|
|
@@ -2087,6 +2270,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2087
2270
|
* ```ts
|
|
2088
2271
|
* const ws = await client.workspaces.create({
|
|
2089
2272
|
* name: 'Acme Legal',
|
|
2273
|
+
* notification_sender_type: 'Account',
|
|
2090
2274
|
* primary_color: 'ff0066',
|
|
2091
2275
|
* secondary_color: '0066ff',
|
|
2092
2276
|
* });
|
|
@@ -2102,8 +2286,12 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2102
2286
|
* {
|
|
2103
2287
|
* "data": [
|
|
2104
2288
|
* {
|
|
2289
|
+
* "resource": "account",
|
|
2105
2290
|
* "id": "acc_example",
|
|
2106
2291
|
* "name": "MT",
|
|
2292
|
+
* "primary_color": null,
|
|
2293
|
+
* "secondary_color": null,
|
|
2294
|
+
* "notification_sender_type": "User",
|
|
2107
2295
|
* "roles": ["owner"],
|
|
2108
2296
|
* "is_delete_allowed": true,
|
|
2109
2297
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
@@ -2128,10 +2316,14 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2128
2316
|
* until brand colours are set (6-char hex, no `#`, when present):
|
|
2129
2317
|
* ```jsonc
|
|
2130
2318
|
* {
|
|
2319
|
+
* "resource": "account",
|
|
2131
2320
|
* "id": "acc_example",
|
|
2132
2321
|
* "name": "MT",
|
|
2133
2322
|
* "primary_color": null,
|
|
2134
2323
|
* "secondary_color": null,
|
|
2324
|
+
* "notification_sender_type": "User",
|
|
2325
|
+
* "roles": ["owner"],
|
|
2326
|
+
* "is_delete_allowed": true,
|
|
2135
2327
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2136
2328
|
* }
|
|
2137
2329
|
* ```
|
|
@@ -2216,6 +2408,8 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2216
2408
|
*
|
|
2217
2409
|
* @param accountId - Account whose logo should be removed.
|
|
2218
2410
|
* @returns Resolves when the API acknowledges deletion.
|
|
2411
|
+
* @throws {ValidationError} If `accountId` is empty.
|
|
2412
|
+
* @throws {ApiError} If the API rejects the request.
|
|
2219
2413
|
* @example
|
|
2220
2414
|
* ```ts
|
|
2221
2415
|
* await client.workspaces.deleteLogo('acc_example');
|
|
@@ -2236,8 +2430,13 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2236
2430
|
* "documents_uploaded": 42,
|
|
2237
2431
|
* "documents_sent": 37,
|
|
2238
2432
|
* "signature_requests": 61,
|
|
2239
|
-
* "
|
|
2240
|
-
* "
|
|
2433
|
+
* "signature_requests_notification_email": 55,
|
|
2434
|
+
* "signature_requests_notification_whatsapp": 18,
|
|
2435
|
+
* "signature_requests_notification_bypass": 3,
|
|
2436
|
+
* "signature_requests_verification_email": 48,
|
|
2437
|
+
* "signature_requests_verification_whatsapp": 6,
|
|
2438
|
+
* "signature_requests_verification_bypass": 3,
|
|
2439
|
+
* "signature_requests_verification_digital_certificate": 4,
|
|
2241
2440
|
* "signature_requests_viewed": 44,
|
|
2242
2441
|
* "signature_requests_completed": 52,
|
|
2243
2442
|
* "documents_certified": 30
|
|
@@ -2262,19 +2461,26 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2262
2461
|
* Update a workspace (`PUT /accounts/{accountId}`).
|
|
2263
2462
|
*
|
|
2264
2463
|
* @param accountId - The workspace to update.
|
|
2265
|
-
* @param payload -
|
|
2266
|
-
*
|
|
2464
|
+
* @param payload - Official fields are `name` and
|
|
2465
|
+
* `notification_sender_type` (`User` or `Account`). Brand colours use six
|
|
2466
|
+
* hex characters without a leading `#`;
|
|
2467
|
+
* pass `null` to clear one.
|
|
2267
2468
|
* @returns The updated workspace. Response shape:
|
|
2268
2469
|
* ```jsonc
|
|
2269
2470
|
* {
|
|
2471
|
+
* "resource": "account",
|
|
2270
2472
|
* "id": "acc_example",
|
|
2271
2473
|
* "name": "Acme Legal (Renamed)",
|
|
2474
|
+
* "notification_sender_type": "Account",
|
|
2272
2475
|
* "primary_color": "ff0066",
|
|
2273
2476
|
* "secondary_color": "0066ff",
|
|
2477
|
+
* "roles": ["owner"],
|
|
2478
|
+
* "is_delete_allowed": true,
|
|
2274
2479
|
* "created_at": "2026-05-12T18:05:11Z"
|
|
2275
2480
|
* }
|
|
2276
2481
|
* ```
|
|
2277
|
-
* @throws {ValidationError} If `accountId` is missing
|
|
2482
|
+
* @throws {ValidationError} If `accountId` is missing or `payload` is not
|
|
2483
|
+
* an object.
|
|
2278
2484
|
* @throws {ApiError} `400` for an invalid colour; `404` if the workspace
|
|
2279
2485
|
* does not exist.
|
|
2280
2486
|
*
|
|
@@ -2282,6 +2488,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2282
2488
|
* ```ts
|
|
2283
2489
|
* await client.workspaces.update('acc_example', {
|
|
2284
2490
|
* name: 'Acme Legal (Renamed)',
|
|
2491
|
+
* notification_sender_type: 'Account',
|
|
2285
2492
|
* primary_color: 'ff0066',
|
|
2286
2493
|
* });
|
|
2287
2494
|
* ```
|
|
@@ -2290,12 +2497,14 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2290
2497
|
/**
|
|
2291
2498
|
* Delete a workspace (`DELETE /accounts/{accountId}`).
|
|
2292
2499
|
*
|
|
2293
|
-
* A workspace with
|
|
2294
|
-
*
|
|
2295
|
-
*
|
|
2500
|
+
* A workspace with an active paid subscription is rejected with `400` and
|
|
2501
|
+
* a `restrictions` list. `{ force: true }` cancels that subscription and
|
|
2502
|
+
* proceeds with deletion; it is not documented as a blanket override for
|
|
2503
|
+
* unrelated restrictions. The flag is sent in the request body.
|
|
2296
2504
|
*
|
|
2297
2505
|
* @param accountId - The workspace to delete.
|
|
2298
|
-
* @param options - Set `force: true` to
|
|
2506
|
+
* @param options - Set `force: true` to cancel an active paid subscription
|
|
2507
|
+
* and proceed with deletion.
|
|
2299
2508
|
* @returns Nothing on success (`200` with no meaningful body).
|
|
2300
2509
|
* @throws {ValidationError} If `accountId` is missing.
|
|
2301
2510
|
* @throws {ApiError} `400` (with a `restrictions` list) when the workspace
|
|
@@ -2304,7 +2513,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2304
2513
|
* @example
|
|
2305
2514
|
* ```ts
|
|
2306
2515
|
* await client.workspaces.delete('acc_example');
|
|
2307
|
-
* //
|
|
2516
|
+
* // cancel an active paid subscription, then delete:
|
|
2308
2517
|
* await client.workspaces.delete('acc_example', { force: true });
|
|
2309
2518
|
* ```
|
|
2310
2519
|
*/
|
|
@@ -2319,7 +2528,7 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2319
2528
|
* values are removed, and collect assignments must include placement entries.
|
|
2320
2529
|
*
|
|
2321
2530
|
* @param payload - Assignment method, signer references, and optional message,
|
|
2322
|
-
* expiration, copy
|
|
2531
|
+
* expiration, copy-receiver signer IDs, or collect-field placements.
|
|
2323
2532
|
* @returns A JSON-ready body shaped as
|
|
2324
2533
|
* `{ method, signers: [{ id, verification_method?, notification_methods?, step? }], message?, expires_at?, copy_receivers?, entries? }`.
|
|
2325
2534
|
* @throws {ValidationError} If no signer is present, a signer reference is
|
|
@@ -2352,6 +2561,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2352
2561
|
* returns):
|
|
2353
2562
|
* ```jsonc
|
|
2354
2563
|
* {
|
|
2564
|
+
* "resource": "assignment",
|
|
2355
2565
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2356
2566
|
* "sender_email": "sender@example.com",
|
|
2357
2567
|
* "method": "virtual",
|
|
@@ -2390,6 +2600,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2390
2600
|
* "type": "virtual",
|
|
2391
2601
|
* "is_active": true
|
|
2392
2602
|
* },
|
|
2603
|
+
* "display_settings": [],
|
|
2393
2604
|
* "value": null,
|
|
2394
2605
|
* "completed": false
|
|
2395
2606
|
* }
|
|
@@ -2432,17 +2643,22 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2432
2643
|
* Signers may be passed as bare id strings or as objects
|
|
2433
2644
|
* (`{ id, verification_method, notification_methods, step }`); the SDK
|
|
2434
2645
|
* normalises them to the docs-sanctioned `signers: [{ ... }]` shape via
|
|
2435
|
-
* {@link buildAssignmentPayload}.
|
|
2436
|
-
* `
|
|
2646
|
+
* {@link buildAssignmentPayload}. A `virtual` assignment may be created at
|
|
2647
|
+
* `uploaded`, `metadata_processing`, or `metadata_ready` and is promoted
|
|
2648
|
+
* automatically; `collect` requires rendered pages at `metadata_ready`.
|
|
2649
|
+
* `DigitalCertificate` costs two credits, requires the feature plus a
|
|
2650
|
+
* signer `government_id`, and that signer must be alone in its step.
|
|
2437
2651
|
*
|
|
2438
2652
|
* @param documentId - The document to request signatures on.
|
|
2439
2653
|
* @param payload - Signers plus optional `method` (defaults to `virtual`),
|
|
2440
|
-
* `message`, `expires_at`, `copy_receivers
|
|
2654
|
+
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
2655
|
+
* addresses), and `collect`-mode `entries` with page-image geometry.
|
|
2441
2656
|
* @returns The created {@link IAssignment}: `signers` (rich, with `step` /
|
|
2442
2657
|
* `notified` / `verification_method`), `items` (one row per signer × field),
|
|
2443
2658
|
* a `summary` count block, and per-signer `signing_urls`. Response shape:
|
|
2444
2659
|
* ```jsonc
|
|
2445
2660
|
* {
|
|
2661
|
+
* "resource": "assignment",
|
|
2446
2662
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2447
2663
|
* "sender_email": "sender@example.com",
|
|
2448
2664
|
* "method": "virtual",
|
|
@@ -2479,6 +2695,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2479
2695
|
* "type": "virtual",
|
|
2480
2696
|
* "is_active": true
|
|
2481
2697
|
* },
|
|
2698
|
+
* "display_settings": [],
|
|
2482
2699
|
* "value": null,
|
|
2483
2700
|
* "completed": false
|
|
2484
2701
|
* }
|
|
@@ -2507,9 +2724,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2507
2724
|
* ```
|
|
2508
2725
|
* @throws {ValidationError} If `documentId` is missing, no signer is
|
|
2509
2726
|
* supplied, or a signer reference is invalid.
|
|
2510
|
-
* @throws {ApiError}
|
|
2511
|
-
*
|
|
2512
|
-
* exists on the account.
|
|
2727
|
+
* @throws {ApiError} `400` for an invalid assignment or unmet verification
|
|
2728
|
+
* precondition; otherwise if the API rejects the request.
|
|
2513
2729
|
*
|
|
2514
2730
|
* @example
|
|
2515
2731
|
* ```ts
|
|
@@ -2518,7 +2734,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2518
2734
|
* message: 'Please sign this contract',
|
|
2519
2735
|
* });
|
|
2520
2736
|
* // → wire body: { method: 'virtual', signers: [{ id: '19e6…' }], message: 'Please sign this contract' }
|
|
2521
|
-
* assignment.signing_urls?.
|
|
2737
|
+
* console.log(assignment.signing_urls?.length); // one protected link per signer
|
|
2522
2738
|
* ```
|
|
2523
2739
|
*/
|
|
2524
2740
|
create(documentId: string, payload: ICreateAssignmentPayload): Promise<ICreateAssignmentResponse>;
|
|
@@ -2530,11 +2746,17 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2530
2746
|
* only `verification_method` / `notification_methods` (or `{}` for the
|
|
2531
2747
|
* default Email channel). {@link buildAssignmentEstimatePayload} projects
|
|
2532
2748
|
* exactly the fields permitted by the estimate schema.
|
|
2749
|
+
* `DigitalCertificate` is priced at two credits per signer and remains
|
|
2750
|
+
* subject to the feature, identity, and one-signer-per-step requirements.
|
|
2751
|
+
* Current documented unit prices are 1 credit for an extra document, 0 for
|
|
2752
|
+
* email notification, and 0.45 for WhatsApp notification; a digital
|
|
2753
|
+
* certificate charge is added on top of its notification cost.
|
|
2533
2754
|
*
|
|
2534
2755
|
* @param documentId - The document the assignment would be created on.
|
|
2535
2756
|
* @param payload - `method` plus channel-only signer descriptors and/or
|
|
2536
2757
|
* `collect`-mode `entries`. Create-only fields and signer IDs are not part
|
|
2537
|
-
* of this request schema.
|
|
2758
|
+
* of this request schema. `blocking_reason` may be `PendingPayment`,
|
|
2759
|
+
* `InsufficientDocuments`, or `InsufficientCredits`.
|
|
2538
2760
|
* @returns an {@link ICostEstimate} with `total_credits`, balances, a
|
|
2539
2761
|
* line-item `breakdown`, and a `has_sufficient_resources` gate. Response
|
|
2540
2762
|
* shape:
|
|
@@ -2571,15 +2793,14 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2571
2793
|
* Update the expiration date of an existing assignment
|
|
2572
2794
|
* (`PUT /documents/{documentId}/assignments/{assignmentId}/reset-expiration`).
|
|
2573
2795
|
*
|
|
2574
|
-
* Sends `{ expires_at }` verbatim.
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
* intentionally not stripped from the body.
|
|
2796
|
+
* Sends `{ expires_at }` verbatim. Use an ISO-8601 date/time string; `null`
|
|
2797
|
+
* is retained as a compatibility value and, unlike ordinary nullable
|
|
2798
|
+
* inputs, is intentionally not stripped from the body.
|
|
2578
2799
|
*
|
|
2579
2800
|
* @param documentId - The document the assignment belongs to.
|
|
2580
2801
|
* @param assignmentId - The assignment to update.
|
|
2581
2802
|
* @param expiresAt - New expiry as an ISO-8601 date/time string. `null` is
|
|
2582
|
-
*
|
|
2803
|
+
* a compatibility value intended to clear it.
|
|
2583
2804
|
* @returns The updated {@link IAssignment} — the same full shape
|
|
2584
2805
|
* {@link AssignmentResource.create} returns (`signers`, `items`, `summary`,
|
|
2585
2806
|
* `signing_urls`), with `expires_at` reflecting the new value:
|
|
@@ -2588,7 +2809,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2588
2809
|
* "id": "103033c9d2cec233bf65eea04999",
|
|
2589
2810
|
* "sender_email": "sender@example.com",
|
|
2590
2811
|
* "method": "virtual",
|
|
2591
|
-
* "expires_at": "
|
|
2812
|
+
* "expires_at": "2027-12-31T23:59:59Z",
|
|
2592
2813
|
* "message": "Please sign this contract",
|
|
2593
2814
|
* "copy_receivers": [],
|
|
2594
2815
|
* "signers": [
|
|
@@ -2615,7 +2836,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2615
2836
|
* @example
|
|
2616
2837
|
* ```ts
|
|
2617
2838
|
* // Extend the deadline …
|
|
2618
|
-
* await client.assignments.resetExpiration('doc-1', 'asg-1', '
|
|
2839
|
+
* await client.assignments.resetExpiration('doc-1', 'asg-1', '2027-12-31T23:59:59Z');
|
|
2619
2840
|
* // … or remove it entirely (sends { expires_at: null }).
|
|
2620
2841
|
* await client.assignments.resetExpiration('doc-1', 'asg-1', null);
|
|
2621
2842
|
* ```
|
|
@@ -2660,17 +2881,22 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2660
2881
|
* @param documentId - The document the assignment belongs to.
|
|
2661
2882
|
* @param assignmentId - The assignment containing the signer.
|
|
2662
2883
|
* @param signerId - The signer whose notification would be resent.
|
|
2663
|
-
* @returns An {@link IResendCostEstimate}
|
|
2664
|
-
*
|
|
2665
|
-
* `
|
|
2884
|
+
* @returns An {@link IResendCostEstimate}: either the full
|
|
2885
|
+
* {@link ICostEstimate} or the compact `total` /
|
|
2886
|
+
* `has_sufficient_credits` compatibility shape:
|
|
2666
2887
|
* ```jsonc
|
|
2667
2888
|
* {
|
|
2668
|
-
* "
|
|
2669
|
-
* "
|
|
2670
|
-
*
|
|
2671
|
-
*
|
|
2889
|
+
* "documents": 1,
|
|
2890
|
+
* "credits": 0,
|
|
2891
|
+
* "needs_extra_document": false,
|
|
2892
|
+
* "extra_document_cost": 0,
|
|
2893
|
+
* "total_credits": 0,
|
|
2894
|
+
* "breakdown": [],
|
|
2895
|
+
* "document_balance": 67,
|
|
2672
2896
|
* "credit_balance": 0,
|
|
2673
|
-
* "
|
|
2897
|
+
* "has_sufficient_resources": true,
|
|
2898
|
+
* "blocking_reason": null,
|
|
2899
|
+
* "message": null
|
|
2674
2900
|
* }
|
|
2675
2901
|
* ```
|
|
2676
2902
|
* @throws {ValidationError} If any of the three IDs is missing.
|
|
@@ -2719,7 +2945,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2719
2945
|
* @example
|
|
2720
2946
|
* ```ts
|
|
2721
2947
|
* const notifications = await client.assignments.listWhatsAppNotifications('doc-1', 'asg-1');
|
|
2722
|
-
*
|
|
2948
|
+
* console.log(notifications.length);
|
|
2723
2949
|
* ```
|
|
2724
2950
|
*/
|
|
2725
2951
|
listWhatsAppNotifications(documentId: string, assignmentId: string): Promise<IWhatsAppNotification[]>;
|
|
@@ -2760,7 +2986,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
2760
2986
|
* "updated_at": "2026-07-18T02:36:02Z" // no `id` / `created_at` are returned
|
|
2761
2987
|
* }
|
|
2762
2988
|
* ```
|
|
2763
|
-
* @throws {ValidationError} If `url`
|
|
2989
|
+
* @throws {ValidationError} If `url` / `email` is invalid, `events` /
|
|
2990
|
+
* `is_active` has the wrong type, or no account ID is available.
|
|
2764
2991
|
* @throws {ApiError} If the API rejects the subscription.
|
|
2765
2992
|
*
|
|
2766
2993
|
* @example
|
|
@@ -2787,7 +3014,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2787
3014
|
* present:
|
|
2788
3015
|
* ```jsonc
|
|
2789
3016
|
* {
|
|
2790
|
-
* "url": "https://
|
|
3017
|
+
* "url": "https://webhooks.example.com/assinafy",
|
|
2791
3018
|
* "email": "ops@example.com",
|
|
2792
3019
|
* "events": [
|
|
2793
3020
|
* "document_ready",
|
|
@@ -2798,6 +3025,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2798
3025
|
* "updated_at": "2026-07-18T02:36:02Z"
|
|
2799
3026
|
* }
|
|
2800
3027
|
* ```
|
|
3028
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2801
3029
|
* @throws {ApiError} If the API fails for a reason other than `404`.
|
|
2802
3030
|
*
|
|
2803
3031
|
* @example
|
|
@@ -2838,6 +3066,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2838
3066
|
* "updated_at": "2026-07-18T02:36:02Z"
|
|
2839
3067
|
* }
|
|
2840
3068
|
* ```
|
|
3069
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2841
3070
|
* @throws {ApiError} If the API rejects the request.
|
|
2842
3071
|
*
|
|
2843
3072
|
* @example
|
|
@@ -2852,14 +3081,9 @@ declare class WebhookResource extends BaseResource {
|
|
|
2852
3081
|
* (`GET /webhooks/event-types`). This is a global, account-independent
|
|
2853
3082
|
* catalog.
|
|
2854
3083
|
*
|
|
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:
|
|
3084
|
+
* @returns The server-controlled event catalog with human-readable
|
|
3085
|
+
* descriptions. Event types can be added over time, so callers should not
|
|
3086
|
+
* depend on a fixed count or order. Response shape:
|
|
2863
3087
|
* ```jsonc
|
|
2864
3088
|
* [
|
|
2865
3089
|
* {
|
|
@@ -2870,7 +3094,6 @@ declare class WebhookResource extends BaseResource {
|
|
|
2870
3094
|
* "id": "document_metadata_ready",
|
|
2871
3095
|
* "description": "Triggered when the document is ready to be prepared. The document has been normalized to PDF and its pages are available."
|
|
2872
3096
|
* }
|
|
2873
|
-
* // …13 more (15 total)
|
|
2874
3097
|
* ]
|
|
2875
3098
|
* ```
|
|
2876
3099
|
* @throws {ApiError} If the API rejects the request.
|
|
@@ -2887,6 +3110,12 @@ declare class WebhookResource extends BaseResource {
|
|
|
2887
3110
|
* (`GET /accounts/{accountId}/webhooks`). Pagination info (if any) is
|
|
2888
3111
|
* attached in `meta`.
|
|
2889
3112
|
*
|
|
3113
|
+
* Assinafy treats any `2xx` response as success. It makes at most two
|
|
3114
|
+
* attempts per event with a three-second wait. After ten consecutive failed
|
|
3115
|
+
* events, the circuit breaker pauses normal delivery and sends roughly 5%
|
|
3116
|
+
* as recovery checks until one succeeds. The stored `response_body` is
|
|
3117
|
+
* truncated to 2,000 characters.
|
|
3118
|
+
*
|
|
2890
3119
|
* @param params - Optional filters and pagination:
|
|
2891
3120
|
* - `event` — restrict to a single {@link WebhookEventType}
|
|
2892
3121
|
* (e.g. `'signer_signed_document'`).
|
|
@@ -2898,6 +3127,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2898
3127
|
* @returns Delivery records, with pagination in `meta`. Each item:
|
|
2899
3128
|
* ```jsonc
|
|
2900
3129
|
* {
|
|
3130
|
+
* "resource": "activity_dispatching_history",
|
|
2901
3131
|
* "id": "103a09cfce51319dd3b3f72ffcdf",
|
|
2902
3132
|
* "event": "signature_requested",
|
|
2903
3133
|
* "activity_id": 8629,
|
|
@@ -2910,12 +3140,13 @@ declare class WebhookResource extends BaseResource {
|
|
|
2910
3140
|
* },
|
|
2911
3141
|
* "delivered": true,
|
|
2912
3142
|
* "http_status": 200,
|
|
2913
|
-
* "response_body": "{ ... }", //
|
|
3143
|
+
* "response_body": "{ ... }", // receiving endpoint body, max 2,000 chars
|
|
2914
3144
|
* "error": null,
|
|
2915
3145
|
* "created_at": "2026-07-15T20:04:36Z",
|
|
2916
3146
|
* "updated_at": "2026-07-15T20:04:36Z"
|
|
2917
3147
|
* }
|
|
2918
3148
|
* ```
|
|
3149
|
+
* @throws {ValidationError} If no account ID is available.
|
|
2919
3150
|
* @throws {ApiError} If the API rejects the request.
|
|
2920
3151
|
*
|
|
2921
3152
|
* @example
|
|
@@ -2944,6 +3175,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
2944
3175
|
* shape:
|
|
2945
3176
|
* ```jsonc
|
|
2946
3177
|
* {
|
|
3178
|
+
* "resource": "activity_dispatching_history",
|
|
2947
3179
|
* "id": "103a09cfce51319dd3b3f72ffcdf",
|
|
2948
3180
|
* "event": "signature_requested",
|
|
2949
3181
|
* "activity_id": 8629,
|
|
@@ -2951,13 +3183,14 @@ declare class WebhookResource extends BaseResource {
|
|
|
2951
3183
|
* "payload": { }, // the original event body that was re-POSTed
|
|
2952
3184
|
* "delivered": true,
|
|
2953
3185
|
* "http_status": 200,
|
|
2954
|
-
* "response_body": "{ ... }",
|
|
3186
|
+
* "response_body": "{ ... }", // max 2,000 characters
|
|
2955
3187
|
* "error": null,
|
|
2956
3188
|
* "created_at": "2026-07-15T20:04:36Z",
|
|
2957
3189
|
* "updated_at": "2026-07-15T20:05:10Z"
|
|
2958
3190
|
* }
|
|
2959
3191
|
* ```
|
|
2960
|
-
* @throws {ValidationError} If `dispatchId` is empty
|
|
3192
|
+
* @throws {ValidationError} If `dispatchId` is empty or no account ID is
|
|
3193
|
+
* available.
|
|
2961
3194
|
* @throws {ApiError} If the dispatch is not found (`404`) or the retry fails.
|
|
2962
3195
|
*
|
|
2963
3196
|
* @example
|
|
@@ -2970,17 +3203,18 @@ declare class WebhookResource extends BaseResource {
|
|
|
2970
3203
|
}
|
|
2971
3204
|
|
|
2972
3205
|
/**
|
|
2973
|
-
*
|
|
3206
|
+
* Manage reusable templates.
|
|
2974
3207
|
*
|
|
2975
|
-
*
|
|
2976
|
-
*
|
|
2977
|
-
*
|
|
2978
|
-
* environment before a production rollout.
|
|
3208
|
+
* Provides template listing plus compatibility methods for upload,
|
|
3209
|
+
* single-template get/update/delete, and page download. Confirm compatibility
|
|
3210
|
+
* method availability on the configured host.
|
|
2979
3211
|
*/
|
|
2980
3212
|
declare class TemplateResource extends BaseResource {
|
|
2981
3213
|
/**
|
|
2982
3214
|
* Create a template by uploading a PDF (`POST /accounts/{id}/templates`).
|
|
2983
3215
|
*
|
|
3216
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3217
|
+
*
|
|
2984
3218
|
* The template is created in `Uploaded` status and transitions to `Ready`
|
|
2985
3219
|
* once the platform finishes processing its pages (`pages` stays empty until
|
|
2986
3220
|
* then). Configure roles/fields afterwards in the Assinafy editor. As with
|
|
@@ -3035,9 +3269,11 @@ declare class TemplateResource extends BaseResource {
|
|
|
3035
3269
|
* List templates for the workspace (`GET /accounts/{id}/templates`).
|
|
3036
3270
|
*
|
|
3037
3271
|
* 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.
|
|
3272
|
+
* Each item is an {@link ITemplateListItem} carrying `pages[]` (each with an
|
|
3273
|
+
* API-key-authenticated `download_url`), so there is no need to `get()` a
|
|
3274
|
+
* template again just to read its rendered pages. Prefer
|
|
3275
|
+
* {@link TemplateResource.downloadPage} to download the image bytes.
|
|
3276
|
+
* Lifecycle values may be lowercase or title case (`ready` / `Ready`).
|
|
3041
3277
|
*
|
|
3042
3278
|
* @param params - `search`, `page`, and `per-page` (the SDK normalizes
|
|
3043
3279
|
* `per_page` → `per-page`, the only spelling the API honors).
|
|
@@ -3049,7 +3285,7 @@ declare class TemplateResource extends BaseResource {
|
|
|
3049
3285
|
* "name": "NDA template.pdf",
|
|
3050
3286
|
* "document_name": "nda.pdf",
|
|
3051
3287
|
* "message": null,
|
|
3052
|
-
* "status": "
|
|
3288
|
+
* "status": "ready",
|
|
3053
3289
|
* "pages": [
|
|
3054
3290
|
* {
|
|
3055
3291
|
* "id": "103ad217673e1f978cb86179e8f8",
|
|
@@ -3076,15 +3312,18 @@ declare class TemplateResource extends BaseResource {
|
|
|
3076
3312
|
* const { data, meta } = await client.templates.list({ search: 'nda', 'per-page': 20 });
|
|
3077
3313
|
* ```
|
|
3078
3314
|
*/
|
|
3079
|
-
list(params?:
|
|
3315
|
+
list(params?: ITemplateListParams, accountId?: string): Promise<ITemplateListResponse>;
|
|
3080
3316
|
/**
|
|
3081
3317
|
* Get a template by ID (`GET /accounts/{id}/templates/{template_id}`).
|
|
3082
3318
|
*
|
|
3319
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3320
|
+
*
|
|
3083
3321
|
* Returns the same shape as {@link TemplateResource.list} plus
|
|
3084
3322
|
* `default_document_tags` (the tags auto-applied to every document created
|
|
3085
3323
|
* from this template) and `resource`. Both endpoints return `pages` with
|
|
3086
|
-
* per-page `download_url`, so fetching a template
|
|
3087
|
-
* pages is unnecessary.
|
|
3324
|
+
* per-page API-key-authenticated `download_url`, so fetching a template
|
|
3325
|
+
* again purely to read its pages is unnecessary. Prefer
|
|
3326
|
+
* {@link TemplateResource.downloadPage} to download the image bytes.
|
|
3088
3327
|
*
|
|
3089
3328
|
* @param templateId - The template to fetch.
|
|
3090
3329
|
* @param accountId - Override the client's default account ID.
|
|
@@ -3136,6 +3375,8 @@ declare class TemplateResource extends BaseResource {
|
|
|
3136
3375
|
* Update a template's `name` and/or default `message`
|
|
3137
3376
|
* (`PUT /accounts/{id}/templates/{template_id}`).
|
|
3138
3377
|
*
|
|
3378
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3379
|
+
*
|
|
3139
3380
|
* `message` is the default invitation message applied to documents created
|
|
3140
3381
|
* from this template. Omit a field to leave it unchanged — the SDK strips
|
|
3141
3382
|
* `undefined` keys before sending. Unlike uploads, `name` here is a plain
|
|
@@ -3177,6 +3418,8 @@ declare class TemplateResource extends BaseResource {
|
|
|
3177
3418
|
/**
|
|
3178
3419
|
* Delete a template (`DELETE /accounts/{id}/templates/{template_id}`).
|
|
3179
3420
|
*
|
|
3421
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3422
|
+
*
|
|
3180
3423
|
* The API responds with an empty `data` payload; this method resolves to
|
|
3181
3424
|
* `void`.
|
|
3182
3425
|
*
|
|
@@ -3196,9 +3439,11 @@ declare class TemplateResource extends BaseResource {
|
|
|
3196
3439
|
* Download a template page as a JPEG
|
|
3197
3440
|
* (`GET /accounts/{id}/templates/{template_id}/pages/{page_id}/download`).
|
|
3198
3441
|
*
|
|
3442
|
+
* Compatibility endpoint; confirm availability on the configured host.
|
|
3443
|
+
*
|
|
3199
3444
|
* Used by template editors to render page thumbnails on the client. The
|
|
3200
|
-
* matching `download_url` is also returned on each
|
|
3201
|
-
*
|
|
3445
|
+
* matching API-key-authenticated `download_url` is also returned on each
|
|
3446
|
+
* `template.pages[]` entry; this wrapper supplies the required credentials.
|
|
3202
3447
|
*
|
|
3203
3448
|
* @param templateId - The template that owns the page.
|
|
3204
3449
|
* @param pageId - The page to download (`pages[].id` from `get()`/`list()`).
|
|
@@ -3276,10 +3521,11 @@ declare class TagResource extends BaseResource {
|
|
|
3276
3521
|
*
|
|
3277
3522
|
* `color` is an optional 6-char hex string; the API accepts it **with or
|
|
3278
3523
|
* without** a leading `#` and always stores it **without** — `'#ff8800'`
|
|
3279
|
-
* and `'ff8800'` both persist as `'ff8800'
|
|
3524
|
+
* and `'ff8800'` both persist as `'ff8800'`. Omit `color`
|
|
3280
3525
|
* (or pass `null`) for no color.
|
|
3281
3526
|
*
|
|
3282
|
-
* @param payload - `name` (required
|
|
3527
|
+
* @param payload - `name` (required, max 64 characters; trimmed with
|
|
3528
|
+
* internal whitespace collapsed) and optional `color`.
|
|
3283
3529
|
* @param accountId - Override the client's default account ID.
|
|
3284
3530
|
* @returns The created tag:
|
|
3285
3531
|
* ```jsonc
|
|
@@ -3292,7 +3538,8 @@ declare class TagResource extends BaseResource {
|
|
|
3292
3538
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
3293
3539
|
* }
|
|
3294
3540
|
* ```
|
|
3295
|
-
* @throws {ValidationError} If `
|
|
3541
|
+
* @throws {ValidationError} If `payload` is not an object, `name` is empty,
|
|
3542
|
+
* or no account ID is available.
|
|
3296
3543
|
* @throws {ApiError} `409` if a tag with the same name already exists
|
|
3297
3544
|
* (case-insensitive).
|
|
3298
3545
|
*
|
|
@@ -3327,7 +3574,8 @@ declare class TagResource extends BaseResource {
|
|
|
3327
3574
|
* "updated_at": "2026-07-19T17:24:47Z"
|
|
3328
3575
|
* }
|
|
3329
3576
|
* ```
|
|
3330
|
-
* @throws {ValidationError} If `
|
|
3577
|
+
* @throws {ValidationError} If `payload` is not an object, `tagId` is
|
|
3578
|
+
* missing, or no account ID is available.
|
|
3331
3579
|
* @throws {ApiError} `404` if the tag does not exist; `409` if another tag
|
|
3332
3580
|
* already uses the new name.
|
|
3333
3581
|
*
|
|
@@ -3348,20 +3596,19 @@ declare class TagResource extends BaseResource {
|
|
|
3348
3596
|
*
|
|
3349
3597
|
* By default the API returns `409` if the tag is still attached to any
|
|
3350
3598
|
* 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).
|
|
3599
|
+
* first — that adds a `?force=true` query param.
|
|
3353
3600
|
*
|
|
3354
3601
|
* @param tagId - The tag to delete.
|
|
3355
3602
|
* @param options - `force` to detach-and-delete when the tag is still in
|
|
3356
3603
|
* use, and `accountId` to override the client's default account ID.
|
|
3357
|
-
* @returns
|
|
3604
|
+
* @returns `{ deleted: true }` when the tag was deleted.
|
|
3358
3605
|
* @throws {ValidationError} If `tagId` is missing, or no account ID is available.
|
|
3359
3606
|
* @throws {ApiError} `404` if the tag does not exist; `409` if the tag is
|
|
3360
3607
|
* still in use and `force` was not set.
|
|
3361
3608
|
*
|
|
3362
3609
|
* @example
|
|
3363
3610
|
* ```ts
|
|
3364
|
-
* await client.tags.delete('103ad216fdc641c8f0465678c813');
|
|
3611
|
+
* const { deleted } = await client.tags.delete('103ad216fdc641c8f0465678c813');
|
|
3365
3612
|
* // detach from every document/template, then delete
|
|
3366
3613
|
* await client.tags.delete('103ad216fdc641c8f0465678c813', { force: true });
|
|
3367
3614
|
* ```
|
|
@@ -3369,7 +3616,7 @@ declare class TagResource extends BaseResource {
|
|
|
3369
3616
|
delete(tagId: string, options?: {
|
|
3370
3617
|
force?: boolean;
|
|
3371
3618
|
accountId?: string;
|
|
3372
|
-
}): Promise<
|
|
3619
|
+
}): Promise<IDeleteTagResponse>;
|
|
3373
3620
|
}
|
|
3374
3621
|
|
|
3375
3622
|
/**
|
|
@@ -3387,6 +3634,9 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3387
3634
|
* Build the browser-facing OAuth start URL
|
|
3388
3635
|
* (`GET /auth/authenticate?authclient=…`).
|
|
3389
3636
|
*
|
|
3637
|
+
* This is a compatibility browser route. Confirm availability on the
|
|
3638
|
+
* configured host before exposing it in a login flow.
|
|
3639
|
+
*
|
|
3390
3640
|
* This endpoint responds with `302` to the provider consent screen, so the
|
|
3391
3641
|
* SDK returns the URL for your web framework to redirect to instead of
|
|
3392
3642
|
* following the redirect inside the Node process.
|
|
@@ -3394,17 +3644,20 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3394
3644
|
* @param authClient - Provider key; currently `google`.
|
|
3395
3645
|
* @returns An absolute URL, for example
|
|
3396
3646
|
* `https://api.assinafy.com.br/v1/auth/authenticate?authclient=google`.
|
|
3397
|
-
* @throws {ValidationError} If `authClient` is
|
|
3647
|
+
* @throws {ValidationError} If `authClient` is not `google`.
|
|
3398
3648
|
*
|
|
3399
3649
|
* @example
|
|
3400
3650
|
* ```ts
|
|
3401
3651
|
* response.redirect(client.auth.getSocialLoginUrl('google'));
|
|
3402
3652
|
* ```
|
|
3403
3653
|
*/
|
|
3404
|
-
getSocialLoginUrl(authClient?: 'google'
|
|
3654
|
+
getSocialLoginUrl(authClient?: 'google'): string;
|
|
3405
3655
|
/**
|
|
3406
3656
|
* Return the Assinafy browser callback URL (`GET /login-callback`).
|
|
3407
3657
|
*
|
|
3658
|
+
* This is a compatibility browser route. Confirm availability on the
|
|
3659
|
+
* configured host before use.
|
|
3660
|
+
*
|
|
3408
3661
|
* The callback response payload is intentionally unspecified by the API;
|
|
3409
3662
|
* OAuth providers call it in a browser. Use this URL when a provider setup
|
|
3410
3663
|
* asks for Assinafy's callback/redirect URI.
|
|
@@ -3475,8 +3728,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3475
3728
|
* {@link AuthenticationResource.login}.
|
|
3476
3729
|
*
|
|
3477
3730
|
* @param payload - The social-login body.
|
|
3478
|
-
* @param payload.provider - OAuth provider
|
|
3479
|
-
* `'google'`; the type is left open for forward-compatibility.
|
|
3731
|
+
* @param payload.provider - OAuth provider; currently exactly `'google'`.
|
|
3480
3732
|
* @param payload.token - The provider-issued OAuth/ID token.
|
|
3481
3733
|
* @param payload.has_accepted_terms - Whether the user has accepted the
|
|
3482
3734
|
* terms of service.
|
|
@@ -3489,8 +3741,12 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3489
3741
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3490
3742
|
* "name": "Multica Test",
|
|
3491
3743
|
* "email": "user@example.com",
|
|
3744
|
+
* "telephone": null,
|
|
3745
|
+
* "government_id": "",
|
|
3492
3746
|
* "is_email_verified": true,
|
|
3493
|
-
* "has_accepted_terms": true
|
|
3747
|
+
* "has_accepted_terms": true,
|
|
3748
|
+
* "created_at": "2026-05-12T13:45:11Z",
|
|
3749
|
+
* "to_be_deleted_at": null
|
|
3494
3750
|
* },
|
|
3495
3751
|
* "accounts": [
|
|
3496
3752
|
* {
|
|
@@ -3503,7 +3759,8 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3503
3759
|
* ]
|
|
3504
3760
|
* }
|
|
3505
3761
|
* ```
|
|
3506
|
-
* @throws {ValidationError} If `provider`
|
|
3762
|
+
* @throws {ValidationError} If `provider` is not `google`, `token` is
|
|
3763
|
+
* missing, or `has_accepted_terms` is not a boolean.
|
|
3507
3764
|
* @throws {ApiError} `400` if the provider token is rejected.
|
|
3508
3765
|
*
|
|
3509
3766
|
* @example
|
|
@@ -3516,8 +3773,8 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3516
3773
|
* ```
|
|
3517
3774
|
*/
|
|
3518
3775
|
socialLogin(payload: {
|
|
3519
|
-
/** OAuth provider. The API
|
|
3520
|
-
provider: 'google'
|
|
3776
|
+
/** OAuth provider. The current API accepts only `google`. */
|
|
3777
|
+
provider: 'google';
|
|
3521
3778
|
token: string;
|
|
3522
3779
|
has_accepted_terms: boolean;
|
|
3523
3780
|
}): Promise<ILoginResponse>;
|
|
@@ -3534,7 +3791,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3534
3791
|
*
|
|
3535
3792
|
* @param payload - Social provider and provider-issued access/ID token.
|
|
3536
3793
|
* @returns Resolves when the API acknowledges that the identity was linked.
|
|
3537
|
-
* @throws {ValidationError} If
|
|
3794
|
+
* @throws {ValidationError} If `provider` is not `google` or `token` is empty.
|
|
3538
3795
|
* @throws {ApiError} `400` for an invalid provider token or `401` for
|
|
3539
3796
|
* missing/invalid Assinafy credentials.
|
|
3540
3797
|
*
|
|
@@ -3547,7 +3804,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3547
3804
|
* ```
|
|
3548
3805
|
*/
|
|
3549
3806
|
linkSocialLogin(payload: {
|
|
3550
|
-
provider: 'google'
|
|
3807
|
+
provider: 'google';
|
|
3551
3808
|
token: string;
|
|
3552
3809
|
}): Promise<void>;
|
|
3553
3810
|
/**
|
|
@@ -3696,7 +3953,9 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3696
3953
|
*
|
|
3697
3954
|
* @param payload - The reset-password body.
|
|
3698
3955
|
* @param payload.email - The user's email address.
|
|
3699
|
-
* @param payload.token - The reset token from the emailed link.
|
|
3956
|
+
* @param payload.token - The reset token from the emailed link. The current
|
|
3957
|
+
* schema leaves it optional even though the operation description says the
|
|
3958
|
+
* reset uses that token.
|
|
3700
3959
|
* @param payload.new_password - The new password to set.
|
|
3701
3960
|
* @returns `{ email }` — the address whose password was reset. Response
|
|
3702
3961
|
* shape:
|
|
@@ -3747,7 +4006,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
3747
4006
|
* @param payload - The field to create. `type` and `name` are required;
|
|
3748
4007
|
* `type` must be one of the platform field types (see
|
|
3749
4008
|
* {@link FieldsResource.listTypes}); `regex` may be a string or `null`,
|
|
3750
|
-
* and `is_required` is optional. `is_active` is a
|
|
4009
|
+
* and `is_required` is optional. `is_active` is a compatibility extension.
|
|
3751
4010
|
* @param accountId - Override the client's default account ID.
|
|
3752
4011
|
* @returns The created field definition. Response shape:
|
|
3753
4012
|
* ```jsonc
|
|
@@ -3852,9 +4111,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3852
4111
|
* (`PUT /accounts/{accountId}/fields/{fieldId}`).
|
|
3853
4112
|
*
|
|
3854
4113
|
* @param fieldId - The field definition to update.
|
|
3855
|
-
* @param payload -
|
|
3856
|
-
* `
|
|
3857
|
-
* compatibility extensions.
|
|
4114
|
+
* @param payload - Fields are `name`, nullable `regex`, and `is_active`;
|
|
4115
|
+
* `type` and `is_required` are compatibility extensions.
|
|
3858
4116
|
* @param accountId - Override the client's default account ID.
|
|
3859
4117
|
* @returns The updated field definition. Response shape:
|
|
3860
4118
|
* ```jsonc
|
|
@@ -3907,9 +4165,9 @@ declare class FieldsResource extends BaseResource {
|
|
|
3907
4165
|
* Validate a single value against a field definition
|
|
3908
4166
|
* (`POST /accounts/{accountId}/fields/{fieldId}/validate`).
|
|
3909
4167
|
*
|
|
3910
|
-
* The
|
|
3911
|
-
* `signerAccessCode` is
|
|
3912
|
-
*
|
|
4168
|
+
* The operation uses the client's API-key/Bearer authentication.
|
|
4169
|
+
* `signerAccessCode` is a compatibility query and is sent as
|
|
4170
|
+
* `signer-access-code` when supplied.
|
|
3913
4171
|
*
|
|
3914
4172
|
* @param fieldId - The field definition to validate against.
|
|
3915
4173
|
* @param value - The value to check (validated against the field's
|
|
@@ -3923,7 +4181,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3923
4181
|
* "error_message": ""
|
|
3924
4182
|
* }
|
|
3925
4183
|
* ```
|
|
3926
|
-
* @throws {ValidationError} If `fieldId` or the account ID is missing
|
|
4184
|
+
* @throws {ValidationError} If `fieldId` or the account ID is missing, or
|
|
4185
|
+
* `value` is `undefined`.
|
|
3927
4186
|
* @throws {ApiError} If the API rejects the request.
|
|
3928
4187
|
*
|
|
3929
4188
|
* @example
|
|
@@ -3938,14 +4197,14 @@ declare class FieldsResource extends BaseResource {
|
|
|
3938
4197
|
validate(fieldId: string, value: unknown, options?: {
|
|
3939
4198
|
signerAccessCode?: string;
|
|
3940
4199
|
accountId?: string;
|
|
3941
|
-
}): Promise<
|
|
4200
|
+
}): Promise<IFieldValidationResponse>;
|
|
3942
4201
|
/**
|
|
3943
4202
|
* Validate multiple values at once
|
|
3944
4203
|
* (`POST /accounts/{accountId}/fields/validate-multiple`).
|
|
3945
4204
|
*
|
|
3946
4205
|
* The request body is the array of `{ field_id, value }` entries itself
|
|
3947
4206
|
* (not wrapped in an object). The optional `signerAccessCode` query is the
|
|
3948
|
-
* same
|
|
4207
|
+
* same compatibility extension described on
|
|
3949
4208
|
* {@link FieldsResource.validate}.
|
|
3950
4209
|
*
|
|
3951
4210
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
@@ -3953,8 +4212,8 @@ declare class FieldsResource extends BaseResource {
|
|
|
3953
4212
|
* @returns One validation result per entry. Response shape:
|
|
3954
4213
|
* ```jsonc
|
|
3955
4214
|
* [
|
|
3956
|
-
* { "type": "cpf", "success": true, "error_message": "" },
|
|
3957
|
-
* { "type": "text", "success": true, "error_message": "" }
|
|
4215
|
+
* { "field_id": "field-cpf", "type": "cpf", "success": true, "error_message": "" },
|
|
4216
|
+
* { "field_id": "field-name", "type": "text", "success": true, "error_message": "" }
|
|
3958
4217
|
* ]
|
|
3959
4218
|
* ```
|
|
3960
4219
|
* @throws {ValidationError} If `entries` is empty or the account ID is missing.
|
|
@@ -3973,11 +4232,15 @@ declare class FieldsResource extends BaseResource {
|
|
|
3973
4232
|
validateMultiple(entries: IFieldValidateMultipleEntry[], options?: {
|
|
3974
4233
|
signerAccessCode?: string;
|
|
3975
4234
|
accountId?: string;
|
|
3976
|
-
}): Promise<
|
|
4235
|
+
}): Promise<IFieldValidationMultipleResult[]>;
|
|
3977
4236
|
/**
|
|
3978
4237
|
* List the platform's supported field types (`GET /field-types`).
|
|
3979
4238
|
*
|
|
3980
|
-
*
|
|
4239
|
+
* The catalog is server-controlled. CPF validation expects 11 digits;
|
|
4240
|
+
* CNPJ accepts 14 characters, including letters A–Z in positions 1–12,
|
|
4241
|
+
* with numeric check digits in positions 13–14. Punctuation is ignored.
|
|
4242
|
+
*
|
|
4243
|
+
* @returns The current catalogue of field types. Response shape:
|
|
3981
4244
|
* ```jsonc
|
|
3982
4245
|
* [
|
|
3983
4246
|
* { "type": "personName", "name": "Nome" },
|
|
@@ -4004,6 +4267,7 @@ declare class FieldsResource extends BaseResource {
|
|
|
4004
4267
|
* public exception and can be called without an access code.
|
|
4005
4268
|
*/
|
|
4006
4269
|
declare class SignerDocumentsResource extends BaseResource {
|
|
4270
|
+
constructor(http: AxiosInstance, defaultAccountId?: string, logger?: Logger, publicHttp?: AxiosInstance);
|
|
4007
4271
|
/**
|
|
4008
4272
|
* Fetch the document currently awaiting a given signer
|
|
4009
4273
|
* (`GET /signers/{signer_id}/document?signer-access-code=…`).
|
|
@@ -4040,7 +4304,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4040
4304
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
4041
4305
|
* }
|
|
4042
4306
|
* ```
|
|
4043
|
-
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing
|
|
4307
|
+
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing,
|
|
4308
|
+
* or a supplied `search` value is not a string.
|
|
4044
4309
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
4045
4310
|
*
|
|
4046
4311
|
* @example
|
|
@@ -4103,9 +4368,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4103
4368
|
*
|
|
4104
4369
|
* The signer-side counterpart of {@link DocumentResource.search}, scoped to
|
|
4105
4370
|
* 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.
|
|
4371
|
+
* Like {@link SignerDocumentsResource.list}, it requires the
|
|
4372
|
+
* `signer-access-code` query parameter.
|
|
4109
4373
|
*
|
|
4110
4374
|
* @param signerId - The signer whose documents are searched.
|
|
4111
4375
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
@@ -4133,19 +4397,22 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4133
4397
|
* artifact names, exposed by the API as a public signer-link endpoint. The
|
|
4134
4398
|
* optional access-code argument is retained for compatibility with deployed
|
|
4135
4399
|
* environments that still accept or require the legacy query parameter. The
|
|
4136
|
-
* `certificated` and `bundle`
|
|
4137
|
-
*
|
|
4400
|
+
* `certificated` and `bundle` exist only once the document is fully signed.
|
|
4401
|
+
* `pades` exists only when the document had a Digital Certificate signer.
|
|
4402
|
+
* A bundle contains original, certificated, and certificate-page artifacts,
|
|
4403
|
+
* plus PAdES when present.
|
|
4138
4404
|
*
|
|
4139
4405
|
* @param signerId - The signer requesting the download.
|
|
4140
4406
|
* @param documentId - The document to download.
|
|
4141
4407
|
* @param artifactName - Which artifact to fetch (`original`, `certificated`,
|
|
4142
|
-
* `certificate-page`, or `bundle`).
|
|
4408
|
+
* `certificate-page`, `pades`, or `bundle`).
|
|
4143
4409
|
* @param signerAccessCode - Optional legacy signer access code. Omit it for
|
|
4144
4410
|
* 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
|
-
*
|
|
4411
|
+
* @returns The raw artifact bytes as a Node `Buffer` (PDF except for the
|
|
4412
|
+
* ZIP `bundle`).
|
|
4413
|
+
* @throws {ValidationError} If `signerId` or `documentId` is missing,
|
|
4414
|
+
* `artifactName` is not one of the five documented names, or an explicitly
|
|
4415
|
+
* supplied legacy `signerAccessCode` is blank.
|
|
4149
4416
|
* @throws {ApiError} `404` if the artifact does not exist yet.
|
|
4150
4417
|
*
|
|
4151
4418
|
* @example
|
|
@@ -4166,6 +4433,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4166
4433
|
* Batch shortcut for a signer who has multiple pending documents under the
|
|
4167
4434
|
* same access code — it signs each with their stored signature/initials
|
|
4168
4435
|
* rather than field-by-field (contrast {@link SignerDocumentsResource.sign}).
|
|
4436
|
+
* Every document must use the `virtual` assignment method.
|
|
4169
4437
|
* The `document_ids` array goes in the request body; the access code
|
|
4170
4438
|
* authenticates via the `signer-access-code` query param.
|
|
4171
4439
|
*
|
|
@@ -4226,8 +4494,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4226
4494
|
* prompt for {@link SignerDocumentsResource.uploadSignature} before signing.
|
|
4227
4495
|
*
|
|
4228
4496
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4229
|
-
* @returns The signer profile.
|
|
4230
|
-
*
|
|
4497
|
+
* @returns The signer profile. `has_signature`, `has_initial`, and
|
|
4498
|
+
* `is_signature_reusable` are optional compatibility flags:
|
|
4231
4499
|
* ```jsonc
|
|
4232
4500
|
* {
|
|
4233
4501
|
* "resource": "signer",
|
|
@@ -4316,34 +4584,35 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4316
4584
|
* the signed document. Only the provided fields are sent — `undefined`/`null`
|
|
4317
4585
|
* entries are stripped by {@link cleanParams} before the request — so you can
|
|
4318
4586
|
* pass just the fields the signer changed. The access code authenticates via
|
|
4319
|
-
* the `signer-access-code` query param.
|
|
4320
|
-
*
|
|
4321
|
-
*
|
|
4587
|
+
* the `signer-access-code` query param. For `DigitalCertificate`, pass
|
|
4588
|
+
* `has_accepted_terms: true` here or call
|
|
4589
|
+
* {@link SignerDocumentsResource.acceptTerms} before fetching the assignment.
|
|
4322
4590
|
*
|
|
4323
4591
|
* @param documentId - The document the signer is confirming data for.
|
|
4324
4592
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4325
4593
|
* @param payload - Any of the official `full_name`, `email`, or
|
|
4326
|
-
* `government_id` fields. Fields left out are not
|
|
4594
|
+
* `government_id`, or `has_accepted_terms` fields. Fields left out are not
|
|
4595
|
+
* sent.
|
|
4327
4596
|
* @returns The confirmed signer in the full {@link ISigner} response shape.
|
|
4328
|
-
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing
|
|
4597
|
+
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
4598
|
+
* or a supplied identity value is malformed.
|
|
4329
4599
|
* @throws {ApiError} If the access code is invalid/expired or a value fails
|
|
4330
4600
|
* validation.
|
|
4331
4601
|
*
|
|
4332
4602
|
* @example
|
|
4333
4603
|
* ```ts
|
|
4334
|
-
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00' }
|
|
4604
|
+
* // body → { full_name: 'Example Signer', government_id: '123.456.789-00', has_accepted_terms: true }
|
|
4335
4605
|
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
4336
4606
|
* full_name: 'Example Signer',
|
|
4337
4607
|
* government_id: '123.456.789-00',
|
|
4608
|
+
* has_accepted_terms: true,
|
|
4338
4609
|
* });
|
|
4339
|
-
* await client.signerDocuments.acceptTerms(accessCode);
|
|
4340
4610
|
* ```
|
|
4341
4611
|
*/
|
|
4342
4612
|
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner>;
|
|
4343
4613
|
/**
|
|
4344
4614
|
* @deprecated Compatibility overload preserving the previous wire shape.
|
|
4345
|
-
* `whatsapp_phone_number`
|
|
4346
|
-
* pass-through fields. Call `acceptTerms()` explicitly for legal consent.
|
|
4615
|
+
* `whatsapp_phone_number` is a compatibility pass-through field.
|
|
4347
4616
|
*/
|
|
4348
4617
|
confirmData(documentId: string, signerAccessCode: string, payload: ILegacyConfirmSignerDataPayload): Promise<ISigner>;
|
|
4349
4618
|
/**
|
|
@@ -4391,8 +4660,8 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4391
4660
|
* custom signing UI). Returns bytes, not JSON.
|
|
4392
4661
|
*
|
|
4393
4662
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4394
|
-
* @param imageType -
|
|
4395
|
-
* `'initial'`.
|
|
4663
|
+
* @param imageType - Server-defined image category; known values are
|
|
4664
|
+
* `'signature'` (default) and `'initial'`.
|
|
4396
4665
|
* @returns The image bytes as a Node `Buffer` (PNG by default).
|
|
4397
4666
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
4398
4667
|
* @throws {ApiError} `404` if the signer has no such image stored; `401`/`403`
|
|
@@ -4404,16 +4673,22 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4404
4673
|
* await fs.writeFile('signature.png', png);
|
|
4405
4674
|
* ```
|
|
4406
4675
|
*/
|
|
4407
|
-
downloadSignature(signerAccessCode: string, imageType?:
|
|
4676
|
+
downloadSignature(signerAccessCode: string, imageType?: SignatureImageType): Promise<Buffer>;
|
|
4408
4677
|
/**
|
|
4409
4678
|
* Fetch the assignment (document + fields) as the signer sees it
|
|
4410
4679
|
* (`GET /sign?signer-access-code=…`).
|
|
4411
4680
|
*
|
|
4412
4681
|
* The entry point for a custom signing UI: resolves the access code to the
|
|
4413
4682
|
* document, its pages, and the {@link ISignFieldEntry}-addressable items the
|
|
4414
|
-
* signer must fill.
|
|
4415
|
-
*
|
|
4416
|
-
* `hasAcceptedTerms: true`
|
|
4683
|
+
* signer must fill. The server answers `409` while the document is still
|
|
4684
|
+
* being prepared; retry that response with backoff. For ordinary signers,
|
|
4685
|
+
* `hasAcceptedTerms: true` records terms acceptance on this request.
|
|
4686
|
+
* Digital-certificate signers must confirm their data and accept terms
|
|
4687
|
+
* before this request; otherwise it returns `400`. The query flag is too
|
|
4688
|
+
* late to open that gate, so use `confirmData(..., { has_accepted_terms:
|
|
4689
|
+
* true })` or `acceptTerms()` first.
|
|
4690
|
+
* The API records this read as the signer having viewed the assignment, so
|
|
4691
|
+
* the SDK never automatically replays this particular `GET` after a `429`.
|
|
4417
4692
|
*
|
|
4418
4693
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
4419
4694
|
* @param hasAcceptedTerms - Maps to the `has_accepted_terms` query param
|
|
@@ -4425,8 +4700,9 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4425
4700
|
* from which the `itemId` / `fieldId` / `pageId` values for
|
|
4426
4701
|
* {@link SignerDocumentsResource.sign} are read.
|
|
4427
4702
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
4428
|
-
* @throws {ApiError} `
|
|
4429
|
-
* `
|
|
4703
|
+
* @throws {ApiError} `400` when DigitalCertificate identity/terms are not
|
|
4704
|
+
* confirmed; `401`/`403` if the access code is invalid or expired; `409`
|
|
4705
|
+
* while the document is still being prepared.
|
|
4430
4706
|
*
|
|
4431
4707
|
* @example
|
|
4432
4708
|
* ```ts
|
|
@@ -4444,6 +4720,9 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4444
4720
|
* the request body, each entry addressing one item resolved from
|
|
4445
4721
|
* {@link SignerDocumentsResource.getAssignment}. The access code
|
|
4446
4722
|
* authenticates via the `signer-access-code` query param.
|
|
4723
|
+
* Virtual signers must call {@link SignerDocumentsResource.confirmData}
|
|
4724
|
+
* first. Digital Certificate signers cannot use this endpoint; use the
|
|
4725
|
+
* certificate start/complete API flow instead.
|
|
4447
4726
|
*
|
|
4448
4727
|
* @param documentId - The document being signed.
|
|
4449
4728
|
* @param assignmentId - The assignment within that document.
|
|
@@ -4545,8 +4824,13 @@ declare class UserResource extends BaseResource {
|
|
|
4545
4824
|
* "documents_uploaded": 42,
|
|
4546
4825
|
* "documents_sent": 37,
|
|
4547
4826
|
* "signature_requests": 61,
|
|
4548
|
-
* "
|
|
4549
|
-
* "
|
|
4827
|
+
* "signature_requests_notification_email": 55,
|
|
4828
|
+
* "signature_requests_notification_whatsapp": 18,
|
|
4829
|
+
* "signature_requests_notification_bypass": 3,
|
|
4830
|
+
* "signature_requests_verification_email": 48,
|
|
4831
|
+
* "signature_requests_verification_whatsapp": 6,
|
|
4832
|
+
* "signature_requests_verification_bypass": 3,
|
|
4833
|
+
* "signature_requests_verification_digital_certificate": 4,
|
|
4550
4834
|
* "signature_requests_viewed": 44,
|
|
4551
4835
|
* "signature_requests_completed": 52,
|
|
4552
4836
|
* "documents_certified": 30
|
|
@@ -4566,6 +4850,61 @@ declare class UserResource extends BaseResource {
|
|
|
4566
4850
|
* ```
|
|
4567
4851
|
*/
|
|
4568
4852
|
getStats(params?: IDocumentStatsParams): Promise<IDocumentStatsRow[]>;
|
|
4853
|
+
/**
|
|
4854
|
+
* Return the authenticated user's owner-facing document e-mail settings
|
|
4855
|
+
* (`GET /users/self/notification-preferences`).
|
|
4856
|
+
*
|
|
4857
|
+
* Request body: none. Authentication: `X-Api-Key` or Bearer token.
|
|
4858
|
+
*
|
|
4859
|
+
* @returns The complete nine-key preference map:
|
|
4860
|
+
* ```json
|
|
4861
|
+
* {
|
|
4862
|
+
* "DocumentCompleted": true,
|
|
4863
|
+
* "SignerDeclined": true,
|
|
4864
|
+
* "DocumentCancelled": true,
|
|
4865
|
+
* "DocumentAboutToExpire": true,
|
|
4866
|
+
* "DocumentExpired": true,
|
|
4867
|
+
* "DocumentExpirationReset": true,
|
|
4868
|
+
* "DocumentProcessingFailed": true,
|
|
4869
|
+
* "TemplateProcessingFailed": true,
|
|
4870
|
+
* "SignerWhatsappFailed": true
|
|
4871
|
+
* }
|
|
4872
|
+
* ```
|
|
4873
|
+
* @throws {ApiError} `401` when credentials are missing/invalid, or `500`
|
|
4874
|
+
* when the API cannot load the preferences.
|
|
4875
|
+
*
|
|
4876
|
+
* @example
|
|
4877
|
+
* ```ts
|
|
4878
|
+
* const preferences = await client.users.getNotificationPreferences();
|
|
4879
|
+
* ```
|
|
4880
|
+
*/
|
|
4881
|
+
getNotificationPreferences(): Promise<INotificationPreferences>;
|
|
4882
|
+
/**
|
|
4883
|
+
* Merge owner-facing document e-mail settings for the authenticated user
|
|
4884
|
+
* (`PUT /users/self/notification-preferences`). Omitted keys retain their
|
|
4885
|
+
* current values; account/security e-mails are not configurable here.
|
|
4886
|
+
*
|
|
4887
|
+
* @param preferences - One or more of the nine documented keys, each with
|
|
4888
|
+
* a boolean value. Request example:
|
|
4889
|
+
* ```json
|
|
4890
|
+
* { "DocumentCompleted": true, "SignerDeclined": false }
|
|
4891
|
+
* ```
|
|
4892
|
+
* @returns The complete updated map; its shape is identical to
|
|
4893
|
+
* {@link UserResource.getNotificationPreferences}.
|
|
4894
|
+
* @throws {ValidationError} Before requesting when the map is empty, has an
|
|
4895
|
+
* unknown key, or contains a non-boolean value.
|
|
4896
|
+
* @throws {ApiError} `400` if the API rejects the map, `401` for invalid
|
|
4897
|
+
* credentials, or `500` on a server error.
|
|
4898
|
+
*
|
|
4899
|
+
* @example
|
|
4900
|
+
* ```ts
|
|
4901
|
+
* await client.users.updateNotificationPreferences({
|
|
4902
|
+
* SignerDeclined: false,
|
|
4903
|
+
* DocumentExpired: false,
|
|
4904
|
+
* });
|
|
4905
|
+
* ```
|
|
4906
|
+
*/
|
|
4907
|
+
updateNotificationPreferences(preferences: IUpdateNotificationPreferences): Promise<INotificationPreferences>;
|
|
4569
4908
|
}
|
|
4570
4909
|
|
|
4571
4910
|
/**
|
|
@@ -4608,9 +4947,8 @@ declare class WebhookVerifier {
|
|
|
4608
4947
|
*/
|
|
4609
4948
|
verify(payload: string | Buffer, signature: string): boolean;
|
|
4610
4949
|
/**
|
|
4611
|
-
* Parse the raw webhook body into a JSON object.
|
|
4612
|
-
*
|
|
4613
|
-
* tolerant of both the observed rich envelope and legacy `{ type, data }`.
|
|
4950
|
+
* Parse the raw webhook body into a JSON object. Both the rich envelope and
|
|
4951
|
+
* compatibility `{ type, data }` form are accepted.
|
|
4614
4952
|
*
|
|
4615
4953
|
* @param payload - Raw UTF-8 JSON request body.
|
|
4616
4954
|
* @returns The object envelope, or `null` for malformed JSON, primitives,
|
|
@@ -4713,11 +5051,16 @@ declare class AssinafyClient {
|
|
|
4713
5051
|
* authenticates protected operations; `accountId` sets the default
|
|
4714
5052
|
* workspace used by every account-scoped resource; `baseUrl` (default the
|
|
4715
5053
|
* production API), `timeout`
|
|
4716
|
-
* (default 30 s), `maxRetries` (default 2, for HTTP 429 on
|
|
5054
|
+
* (default 30 s), `maxRetries` (default 2, for HTTP 429 on replay-safe
|
|
4717
5055
|
* requests), `webhookSecret` (enables
|
|
4718
5056
|
* {@link AssinafyClient.webhookVerifier}) and `logger` are optional.
|
|
4719
|
-
*
|
|
4720
|
-
* `
|
|
5057
|
+
* Automatic retries cover `GET`, `HEAD`, `OPTIONS`, and `DELETE`, except
|
|
5058
|
+
* `GET /sign` because that read records a signer view. An
|
|
5059
|
+
* `Idempotency-Key` opts advanced/custom requests into SDK replay only;
|
|
5060
|
+
* confirm that the target route actually deduplicates that key first.
|
|
5061
|
+
*
|
|
5062
|
+
* @throws {ValidationError} If `timeout` / `maxRetries` is invalid or
|
|
5063
|
+
* `baseUrl` is not an absolute HTTP(S) URL.
|
|
4721
5064
|
*
|
|
4722
5065
|
* @example
|
|
4723
5066
|
* ```ts
|
|
@@ -4736,6 +5079,7 @@ declare class AssinafyClient {
|
|
|
4736
5079
|
* @param options - Extra client options (`baseUrl`, `timeout`, `maxRetries`,
|
|
4737
5080
|
* `webhookSecret`, `logger`), minus `apiKey`/`accountId`.
|
|
4738
5081
|
* @returns A configured {@link AssinafyClient}.
|
|
5082
|
+
* @throws {ValidationError} If an extra client option is invalid.
|
|
4739
5083
|
*
|
|
4740
5084
|
* @example
|
|
4741
5085
|
* ```ts
|
|
@@ -4755,6 +5099,8 @@ declare class AssinafyClient {
|
|
|
4755
5099
|
*
|
|
4756
5100
|
* @param config - Loosely-typed configuration ({@link ClientConfigInput}).
|
|
4757
5101
|
* @returns A configured {@link AssinafyClient}.
|
|
5102
|
+
* @throws {ValidationError} If `config` is not an object or contains an
|
|
5103
|
+
* invalid timeout, retry count, or base URL.
|
|
4758
5104
|
*
|
|
4759
5105
|
* @example
|
|
4760
5106
|
* ```ts
|
|
@@ -4766,23 +5112,20 @@ declare class AssinafyClient {
|
|
|
4766
5112
|
*/
|
|
4767
5113
|
static fromConfig(config: ClientConfigInput): AssinafyClient;
|
|
4768
5114
|
/**
|
|
4769
|
-
* Flagship helper: upload a PDF,
|
|
4770
|
-
*
|
|
5115
|
+
* Flagship helper: upload a PDF, ensure each signer exists, and open a
|
|
5116
|
+
* **virtual** signature assignment — the whole "send this
|
|
4771
5117
|
* document for signature" flow in a single call.
|
|
4772
5118
|
*
|
|
4773
5119
|
* Sequence of API calls:
|
|
4774
5120
|
* 1. `POST /accounts/{accountId}/documents` — upload the PDF
|
|
4775
5121
|
* ({@link DocumentResource.upload}).
|
|
4776
|
-
* 2.
|
|
4777
|
-
* ({@link DocumentResource.waitUntilReady}).
|
|
4778
|
-
* 3. For each signer, reuse an existing signer by email or
|
|
5122
|
+
* 2. For each signer, reuse an existing signer by email or
|
|
4779
5123
|
* `POST /accounts/{accountId}/signers` to create one
|
|
4780
5124
|
* ({@link SignerResource.create} — idempotent by email).
|
|
4781
|
-
*
|
|
5125
|
+
* 3. `POST /documents/{id}/assignments` with `method: 'virtual'` and the
|
|
4782
5126
|
* collected signer IDs ({@link AssignmentResource.create}).
|
|
4783
|
-
*
|
|
4784
|
-
*
|
|
4785
|
-
* the upload snapshot is returned, avoiding only this final round-trip.
|
|
5127
|
+
* 4. When `waitForReady` is not `false`, poll `GET /documents/{id}` until
|
|
5128
|
+
* processing finishes; otherwise return the upload response immediately.
|
|
4786
5129
|
*
|
|
4787
5130
|
* @param options - Workflow options.
|
|
4788
5131
|
* @param options.source - The PDF to upload, as a file path or in-memory
|
|
@@ -4790,24 +5133,29 @@ declare class AssinafyClient {
|
|
|
4790
5133
|
* @param options.signers - Signers to request signatures from — at least one
|
|
4791
5134
|
* is required. Each is `{ name, email?, whatsapp_phone_number? | phone?,
|
|
4792
5135
|
* cpf?, metadata? }`; a signer needs an email or a WhatsApp number to be
|
|
4793
|
-
* notified.
|
|
5136
|
+
* notified. Phone-only signers automatically use WhatsApp for verification
|
|
5137
|
+
* and notification, which requires a paid plan and incurs the channel cost;
|
|
5138
|
+
* signers with e-mail default to the e-mail channel.
|
|
4794
5139
|
* @param options.message - Optional invitation message attached to the
|
|
4795
5140
|
* assignment.
|
|
4796
5141
|
* @param options.metadata - Optional metadata attached to the uploaded
|
|
4797
5142
|
* document.
|
|
4798
|
-
* @param options.waitForReady -
|
|
4799
|
-
*
|
|
4800
|
-
* `
|
|
4801
|
-
*
|
|
5143
|
+
* @param options.waitForReady - Wait for document processing before
|
|
5144
|
+
* returning. Defaults to `true`. Virtual assignments are created directly
|
|
5145
|
+
* from `uploaded`, `metadata_processing`, or `metadata_ready`, as allowed by
|
|
5146
|
+
* the API; only `collect` assignments require pre-rendered pages.
|
|
5147
|
+
* @param options.waitOptions - Optional `maxWaitMs` / `pollIntervalMs`
|
|
5148
|
+
* forwarded to {@link DocumentResource.waitUntilReady}.
|
|
4802
5149
|
* @param options.expiresAt - Optional ISO-8601 assignment expiry, e.g.
|
|
4803
5150
|
* `'2026-08-01T00:00:00Z'`.
|
|
4804
|
-
* @param options.copyReceivers - Optional
|
|
4805
|
-
*
|
|
4806
|
-
* plans
|
|
5151
|
+
* @param options.copyReceivers - Optional existing signer IDs (not email
|
|
5152
|
+
* addresses) that receive a copy. See the caveat on
|
|
5153
|
+
* {@link ICreateAssignmentPayload.copy_receivers}; some plans silently drop
|
|
5154
|
+
* the field.
|
|
4807
5155
|
* @param options.accountId - Override the client's default account ID.
|
|
4808
5156
|
* @returns `{ document, assignment, signer_ids }`. `document` is the
|
|
4809
5157
|
* re-fetched {@link IDocumentDetailsResponse} when `waitForReady` (the
|
|
4810
|
-
* default), otherwise the {@link IDocumentUploadResponse} upload
|
|
5158
|
+
* default), otherwise the {@link IDocumentUploadResponse} upload response;
|
|
4811
5159
|
* `signer_ids` are the created/reused signer IDs in signer order:
|
|
4812
5160
|
* ```jsonc
|
|
4813
5161
|
* {
|
|
@@ -4838,10 +5186,16 @@ declare class AssinafyClient {
|
|
|
4838
5186
|
* "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
|
|
4839
5187
|
* }
|
|
4840
5188
|
* ```
|
|
4841
|
-
*
|
|
4842
|
-
*
|
|
4843
|
-
*
|
|
4844
|
-
* {@link
|
|
5189
|
+
* This workflow is not transactional. If any post-upload step fails, its
|
|
5190
|
+
* {@link AssinafyError} includes the uploaded `documentId`, accumulated
|
|
5191
|
+
* `signerIds`, and `assignmentId` (once created) in `context`; a
|
|
5192
|
+
* {@link ValidationError} also exposes them in `errors`. Inspect those IDs
|
|
5193
|
+
* before retrying. The SDK does not auto-delete successfully created data.
|
|
5194
|
+
*
|
|
5195
|
+
* @throws {ValidationError} If the workflow/options or a signer is invalid,
|
|
5196
|
+
* the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
|
|
5197
|
+
* enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
|
|
5198
|
+
* timeout.
|
|
4845
5199
|
* @throws {ApiError} If any underlying API call is rejected.
|
|
4846
5200
|
*
|
|
4847
5201
|
* @example
|
|
@@ -4854,9 +5208,9 @@ declare class AssinafyClient {
|
|
|
4854
5208
|
* ],
|
|
4855
5209
|
* message: 'Please sign the attached agreement.',
|
|
4856
5210
|
* });
|
|
4857
|
-
* console.log(document.status); // '
|
|
5211
|
+
* console.log(document.status); // usually 'pending_signature'
|
|
4858
5212
|
* console.log(signer_ids.length); // 2
|
|
4859
|
-
* console.log(assignment.signing_urls);
|
|
5213
|
+
* console.log(assignment.signing_urls?.length); // one protected link per signer
|
|
4860
5214
|
* ```
|
|
4861
5215
|
*/
|
|
4862
5216
|
uploadAndRequestSignatures(options: {
|
|
@@ -4865,6 +5219,10 @@ declare class AssinafyClient {
|
|
|
4865
5219
|
message?: string;
|
|
4866
5220
|
metadata?: Record<string, unknown>;
|
|
4867
5221
|
waitForReady?: boolean;
|
|
5222
|
+
waitOptions?: {
|
|
5223
|
+
maxWaitMs?: number;
|
|
5224
|
+
pollIntervalMs?: number;
|
|
5225
|
+
};
|
|
4868
5226
|
expiresAt?: string;
|
|
4869
5227
|
copyReceivers?: string[];
|
|
4870
5228
|
accountId?: string;
|
|
@@ -4876,8 +5234,13 @@ declare class AssinafyClient {
|
|
|
4876
5234
|
*
|
|
4877
5235
|
* @returns The configured `AxiosInstance` — auth headers, base URL, timeout,
|
|
4878
5236
|
* and the HTTP 429 retry interceptor are already applied. Automatic retries
|
|
4879
|
-
* are limited to `GET`, `HEAD`, `OPTIONS`,
|
|
4880
|
-
* `
|
|
5237
|
+
* are limited to read-safe `GET`, `HEAD`, `OPTIONS`, and `DELETE` requests;
|
|
5238
|
+
* `GET /sign` is excluded because it records that the assignment was viewed.
|
|
5239
|
+
* An `Idempotency-Key` opts a custom request into SDK replay only after the
|
|
5240
|
+
* caller confirms that the target route deduplicates it server-side.
|
|
5241
|
+
* Same-origin absolute URLs are supported; cross-origin requests are
|
|
5242
|
+
* rejected before dispatch, and credentials are removed from cross-origin
|
|
5243
|
+
* redirects. Use a separate axios client for unrelated hosts.
|
|
4881
5244
|
*
|
|
4882
5245
|
* @example
|
|
4883
5246
|
* ```ts
|
|
@@ -4936,11 +5299,11 @@ declare class ApiError extends AssinafyError {
|
|
|
4936
5299
|
*/
|
|
4937
5300
|
static fromResponse(statusCode: number, responseData: unknown): ApiError;
|
|
4938
5301
|
}
|
|
4939
|
-
/** Thrown when
|
|
5302
|
+
/** Thrown when SDK validation fails, including invalid input or workflow state. */
|
|
4940
5303
|
declare class ValidationError extends AssinafyError {
|
|
4941
5304
|
readonly errors: Record<string, unknown>;
|
|
4942
5305
|
/**
|
|
4943
|
-
* Create
|
|
5306
|
+
* Create an SDK validation failure.
|
|
4944
5307
|
*
|
|
4945
5308
|
* @param message - Human-readable validation summary.
|
|
4946
5309
|
* @param errors - Field/value diagnostics for programmatic handling.
|
|
@@ -4968,4 +5331,6 @@ declare class NetworkError extends AssinafyError {
|
|
|
4968
5331
|
constructor(message: string, options?: ErrorOptions);
|
|
4969
5332
|
}
|
|
4970
5333
|
|
|
4971
|
-
|
|
5334
|
+
declare const SDK_USER_AGENT: string;
|
|
5335
|
+
|
|
5336
|
+
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_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 };
|