@assinafy/sdk 2.5.0 → 2.5.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/dist/index.mjs CHANGED
@@ -80,7 +80,9 @@ var ApiError = class _ApiError extends AssinafyError {
80
80
  * ones with no structured body to explain them. Anything else falls back to
81
81
  * the stable message.
82
82
  * @returns An `ApiError` retaining the original response body in
83
- * {@link ApiError.responseData}; `message` is truncated for legibility.
83
+ * {@link ApiError.responseData}. A JSON `message` is used verbatim; only an
84
+ * unstructured text body is whitespace-collapsed and truncated for
85
+ * legibility.
84
86
  *
85
87
  * @example
86
88
  * ```ts
@@ -133,6 +135,16 @@ var OAuthError = class _OAuthError extends ApiError {
133
135
  * @param error - Any thrown value.
134
136
  * @returns An `OAuthError` when the body carries a non-empty string
135
137
  * `error`, else the original value.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const apiError = ApiError.fromResponse(400, {
142
+ * error: 'invalid_grant',
143
+ * error_description: 'The provided authorization grant is invalid.',
144
+ * });
145
+ * const upgraded = OAuthError.upgrade(apiError);
146
+ * // upgraded instanceof OAuthError → true, .error → 'invalid_grant'
147
+ * ```
136
148
  */
137
149
  static upgrade(error) {
138
150
  if (!(error instanceof ApiError) || error instanceof _OAuthError) return error;
@@ -141,12 +153,14 @@ var OAuthError = class _OAuthError extends ApiError {
141
153
  const code = body["error"];
142
154
  if (typeof code !== "string" || code.length === 0) return error;
143
155
  const description = body["error_description"];
144
- return new _OAuthError(
156
+ const upgraded = new _OAuthError(
145
157
  code,
146
158
  typeof description === "string" && description.length > 0 ? description : null,
147
159
  error.statusCode,
148
160
  body
149
161
  );
162
+ if (error.challenge !== void 0) upgraded.challenge = error.challenge;
163
+ return upgraded;
150
164
  }
151
165
  };
152
166
  var ValidationError = class extends AssinafyError {
@@ -450,6 +464,9 @@ function nextRetryDelayMs(headers, attempt, maxDelayMs = 3e4) {
450
464
  return Math.min(backoffMs(attempt), maxDelayMs);
451
465
  }
452
466
 
467
+ // src/resources/base.ts
468
+ import { AxiosError } from "axios";
469
+
453
470
  // src/support/path.ts
454
471
  function encodePathSegment(value) {
455
472
  return encodeURIComponent(value).replace(
@@ -574,7 +591,7 @@ import axios2 from "axios";
574
591
  // package.json
575
592
  var package_default = {
576
593
  name: "@assinafy/sdk",
577
- version: "2.5.0",
594
+ version: "2.5.2",
578
595
  packageManager: "bun@1.4.0",
579
596
  description: "TypeScript SDK for Assinafy API - Digital signature platform",
580
597
  type: "commonjs",
@@ -655,7 +672,7 @@ var package_default = {
655
672
  },
656
673
  overrides: {
657
674
  esbuild: "0.28.2",
658
- "brace-expansion": "5.0.9"
675
+ "brace-expansion": "5.0.12"
659
676
  },
660
677
  files: [
661
678
  "dist",
@@ -880,7 +897,10 @@ var BaseResource = class {
880
897
  };
881
898
  function assertSuccessful(response) {
882
899
  if (response.status < 200 || response.status >= 300) {
883
- throw ApiError.fromResponse(response.status, response.data);
900
+ throw toSdkError(
901
+ new AxiosError("Request failed", void 0, response.config, void 0, response),
902
+ "API request failed"
903
+ );
884
904
  }
885
905
  return response;
886
906
  }
@@ -1259,6 +1279,28 @@ var AssignmentResource = class extends BaseResource {
1259
1279
  * `DigitalCertificate` costs two credits, requires the feature plus a
1260
1280
  * signer `government_id`, and that signer must be alone in its step.
1261
1281
  *
1282
+ * Request body (`application/json`):
1283
+ * ```jsonc
1284
+ * {
1285
+ * "method": "virtual",
1286
+ * "signers": [
1287
+ * {
1288
+ * "id": "signer_example",
1289
+ * "verification_method": "Email",
1290
+ * "notification_methods": [
1291
+ * "Email"
1292
+ * ],
1293
+ * "step": 1
1294
+ * }
1295
+ * ],
1296
+ * "message": "Please sign this document.",
1297
+ * "expires_at": "2027-12-31T23:59:59Z",
1298
+ * "copy_receivers": [
1299
+ * "copy_signer_example"
1300
+ * ]
1301
+ * }
1302
+ * ```
1303
+ *
1262
1304
  * @param documentId - The document to request signatures on.
1263
1305
  * @param payload - Signers plus optional `method` (defaults to `virtual`),
1264
1306
  * `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
@@ -1377,14 +1419,29 @@ var AssignmentResource = class extends BaseResource {
1377
1419
  * email notification, and 0.45 for WhatsApp notification; a digital
1378
1420
  * certificate charge is added on top of its notification cost.
1379
1421
  *
1422
+ * Request body (`application/json`):
1423
+ * ```jsonc
1424
+ * {
1425
+ * "method": "virtual",
1426
+ * "signers": [
1427
+ * {
1428
+ * "verification_method": "Email",
1429
+ * "notification_methods": [
1430
+ * "Email"
1431
+ * ]
1432
+ * }
1433
+ * ]
1434
+ * }
1435
+ * ```
1436
+ *
1380
1437
  * @param documentId - The document the assignment would be created on.
1381
1438
  * @param payload - `method` plus channel-only signer descriptors and/or
1382
1439
  * `collect`-mode `entries`. Create-only fields and signer IDs are not part
1383
- * of this request schema. `blocking_reason` may be `PendingPayment`,
1384
- * `InsufficientDocuments`, or `InsufficientCredits`.
1440
+ * of this request schema.
1385
1441
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
1386
- * line-item `breakdown`, and a `has_sufficient_resources` gate. Response
1387
- * shape:
1442
+ * line-item `breakdown`, and a `has_sufficient_resources` gate.
1443
+ * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
1444
+ * `InsufficientCredits`. Response shape:
1388
1445
  * ```jsonc
1389
1446
  * {
1390
1447
  * "documents": 1,
@@ -1432,6 +1489,13 @@ var AssignmentResource = class extends BaseResource {
1432
1489
  * is retained as a compatibility value and, unlike ordinary nullable
1433
1490
  * inputs, is intentionally not stripped from the body.
1434
1491
  *
1492
+ * Request body (`application/json`):
1493
+ * ```jsonc
1494
+ * {
1495
+ * "expires_at": "2027-12-31T23:59:59Z"
1496
+ * }
1497
+ * ```
1498
+ *
1435
1499
  * @param documentId - The document the assignment belongs to.
1436
1500
  * @param assignmentId - The assignment to update.
1437
1501
  * @param expiresAt - New expiry as an ISO-8601 date/time string. `null` is
@@ -1847,6 +1911,13 @@ var DocumentResource = class extends BaseResource {
1847
1911
  * {@link DocumentResource.upload} — that avoids the extra round-trip and
1848
1912
  * the processing race entirely.
1849
1913
  *
1914
+ * Request body (`application/json`):
1915
+ * ```jsonc
1916
+ * {
1917
+ * "name": "Service agreement.pdf"
1918
+ * }
1919
+ * ```
1920
+ *
1850
1921
  * @param documentId - The document to rename.
1851
1922
  * @param name - The new display name (max 255 chars), e.g.
1852
1923
  * `'Service agreement.pdf'`. The API removes diacritics and replaces
@@ -1937,8 +2008,7 @@ var DocumentResource = class extends BaseResource {
1937
2008
  * "updated_at": "2026-07-19T17:24:46Z"
1938
2009
  * }
1939
2010
  * ```
1940
- * @throws {ValidationError} If `documentId` is missing or `artifactName` is
1941
- * not one of the five documented artifact names.
2011
+ * @throws {ValidationError} If `documentId` is missing.
1942
2012
  * @throws {ApiError} `404` if the document does not exist.
1943
2013
  *
1944
2014
  * @example
@@ -2258,6 +2328,15 @@ var DocumentResource = class extends BaseResource {
2258
2328
  * overwrites the existing set — use
2259
2329
  * {@link DocumentResource.addTags} to append.
2260
2330
  *
2331
+ * Request body (`application/json`):
2332
+ * ```jsonc
2333
+ * {
2334
+ * "tags": [
2335
+ * "tag_example"
2336
+ * ]
2337
+ * }
2338
+ * ```
2339
+ *
2261
2340
  * @param documentId - The document to retag.
2262
2341
  * @param tags - The complete desired set of tag IDs (`[]` clears all).
2263
2342
  * @param accountId - Override the client's default account ID.
@@ -2300,6 +2379,15 @@ var DocumentResource = class extends BaseResource {
2300
2379
  * present is a no-op. To replace the whole set instead, use
2301
2380
  * {@link DocumentResource.replaceTags}.
2302
2381
  *
2382
+ * Request body (`application/json`):
2383
+ * ```jsonc
2384
+ * {
2385
+ * "tags": [
2386
+ * "tag_example"
2387
+ * ]
2388
+ * }
2389
+ * ```
2390
+ *
2303
2391
  * @param documentId - The document to tag.
2304
2392
  * @param tags - Tag IDs to attach (must be non-empty).
2305
2393
  * @param accountId - Override the client's default account ID.
@@ -2375,6 +2463,35 @@ var DocumentResource = class extends BaseResource {
2375
2463
  * `options` may add `name`, `message`, `expires_at`, `editor_fields`, and
2376
2464
  * tag names in `tags` (unknown names are created automatically).
2377
2465
  *
2466
+ * Request body (`application/json`):
2467
+ * ```jsonc
2468
+ * {
2469
+ * "signers": [
2470
+ * {
2471
+ * "role_id": "signing_role_example",
2472
+ * "id": "signer_example",
2473
+ * "verification_method": "Email",
2474
+ * "notification_methods": [
2475
+ * "Email"
2476
+ * ],
2477
+ * "step": 1
2478
+ * }
2479
+ * ],
2480
+ * "name": "Service agreement.pdf",
2481
+ * "message": "Please sign this document.",
2482
+ * "expires_at": "2027-12-31T23:59:59Z",
2483
+ * "editor_fields": [
2484
+ * {
2485
+ * "field_id": "editor_field_example",
2486
+ * "value": "Example Company"
2487
+ * }
2488
+ * ],
2489
+ * "tags": [
2490
+ * "Contracts"
2491
+ * ]
2492
+ * }
2493
+ * ```
2494
+ *
2378
2495
  * @param templateId - The template to instantiate.
2379
2496
  * @param signers - Role-to-signer bindings (each with `role_id` and `id`,
2380
2497
  * plus optional `verification_method`, `notification_methods`, `step`).
@@ -2458,6 +2575,21 @@ var DocumentResource = class extends BaseResource {
2458
2575
  * `DigitalCertificate` adds two credits per signer and has the same feature,
2459
2576
  * `government_id`, and signing-step prerequisites as document creation.
2460
2577
  *
2578
+ * Request body (`application/json`):
2579
+ * ```jsonc
2580
+ * {
2581
+ * "signers": [
2582
+ * {
2583
+ * "role_id": "signing_role_example",
2584
+ * "verification_method": "Email",
2585
+ * "notification_methods": [
2586
+ * "Email"
2587
+ * ]
2588
+ * }
2589
+ * ]
2590
+ * }
2591
+ * ```
2592
+ *
2461
2593
  * @param templateId - The template that would be instantiated.
2462
2594
  * @param signers - One channel descriptor per template role. Cost requests
2463
2595
  * use only `role_id`, `verification_method`, and `notification_methods`;
@@ -2658,7 +2790,8 @@ var DocumentResource = class extends BaseResource {
2658
2790
  }
2659
2791
  }
2660
2792
  /**
2661
- * Quick boolean check: has every signer completed their assignment?
2793
+ * Quick boolean check (`GET /documents/{documentId}`): has every signer
2794
+ * completed their assignment?
2662
2795
  *
2663
2796
  * A computed convenience over {@link DocumentResource.details} (one `GET
2664
2797
  * /documents/{documentId}`). Returns `true` when the document status is
@@ -2688,7 +2821,8 @@ var DocumentResource = class extends BaseResource {
2688
2821
  return false;
2689
2822
  }
2690
2823
  /**
2691
- * Summarise signing progress for UI display.
2824
+ * Summarise signing progress for UI display
2825
+ * (`GET /documents/{documentId}`).
2692
2826
  *
2693
2827
  * A computed convenience over {@link DocumentResource.details} (one `GET
2694
2828
  * /documents/{documentId}`). `total` and `signed` come from the assignment
@@ -2831,6 +2965,19 @@ var SignerResource = class extends BaseResource {
2831
2965
  * A reused signer is returned unchanged; this method does not overwrite its
2832
2966
  * existing name, phone, CPF, or metadata with the create payload.
2833
2967
  *
2968
+ * Request body (`application/json`):
2969
+ * ```jsonc
2970
+ * {
2971
+ * "full_name": "Example Signer",
2972
+ * "email": "signer@example.com",
2973
+ * "whatsapp_phone_number": "+5548999990000",
2974
+ * "cpf": "39053344705",
2975
+ * "metadata": {
2976
+ * "reference": "customer_example"
2977
+ * }
2978
+ * }
2979
+ * ```
2980
+ *
2834
2981
  * @param payload - The signer to create. The official fields are required
2835
2982
  * `full_name` plus optional `email` and E.164 `whatsapp_phone_number`.
2836
2983
  * `phone`, `cpf`, and `metadata` are compatibility extensions; the SDK
@@ -2982,6 +3129,16 @@ var SignerResource = class extends BaseResource {
2982
3129
  * while it belongs to an in-flight document; changing an unverified channel
2983
3130
  * rotates its access/verification codes, so resend the notification.
2984
3131
  *
3132
+ * Request body (`application/json`):
3133
+ * ```jsonc
3134
+ * {
3135
+ * "full_name": "Example Signer",
3136
+ * "email": "signer@example.com",
3137
+ * "whatsapp_phone_number": "+5548999990000",
3138
+ * "government_id": "39053344705"
3139
+ * }
3140
+ * ```
3141
+ *
2985
3142
  * @param signerId - The signer to update.
2986
3143
  * @param payload - Fields to change. The official `government_id` field and
2987
3144
  * legacy `cpf` extension are stripped to digits before sending.
@@ -3201,6 +3358,16 @@ var WorkspaceResource = class extends BaseResource {
3201
3358
  /**
3202
3359
  * Create a new workspace (`POST /accounts`).
3203
3360
  *
3361
+ * Request body (`application/json`):
3362
+ * ```jsonc
3363
+ * {
3364
+ * "name": "Example Workspace",
3365
+ * "notification_sender_type": "Account",
3366
+ * "primary_color": "336699",
3367
+ * "secondary_color": "ffffff"
3368
+ * }
3369
+ * ```
3370
+ *
3204
3371
  * @param payload - Official fields are workspace `name` (required) and
3205
3372
  * optional `notification_sender_type` (`User` or `Account`). Optional brand
3206
3373
  * colours use six hex characters without
@@ -3481,6 +3648,16 @@ var WorkspaceResource = class extends BaseResource {
3481
3648
  /**
3482
3649
  * Update a workspace (`PUT /accounts/{accountId}`).
3483
3650
  *
3651
+ * Request body (`application/json`):
3652
+ * ```jsonc
3653
+ * {
3654
+ * "name": "Example Workspace",
3655
+ * "notification_sender_type": "Account",
3656
+ * "primary_color": "336699",
3657
+ * "secondary_color": null
3658
+ * }
3659
+ * ```
3660
+ *
3484
3661
  * @param accountId - The workspace to update.
3485
3662
  * @param payload - Official fields are `name` and
3486
3663
  * `notification_sender_type` (`User` or `Account`). Brand colours use six
@@ -3541,6 +3718,13 @@ var WorkspaceResource = class extends BaseResource {
3541
3718
  * proceeds with deletion; it is not documented as a blanket override for
3542
3719
  * unrelated restrictions. The flag is sent in the request body.
3543
3720
  *
3721
+ * Request body (`application/json`):
3722
+ * ```jsonc
3723
+ * {
3724
+ * "force": true
3725
+ * }
3726
+ * ```
3727
+ *
3544
3728
  * @param accountId - The workspace to delete.
3545
3729
  * @param options - Set `force: true` to cancel an active paid subscription
3546
3730
  * and proceed with deletion.
@@ -3611,6 +3795,19 @@ var WebhookResource = class extends BaseResource {
3611
3795
  * `signer_rejected_document`, `document_processing_failed`).
3612
3796
  * OAuth tokens need the `webhooks:write` scope.
3613
3797
  *
3798
+ * Request body (`application/json`):
3799
+ * ```jsonc
3800
+ * {
3801
+ * "events": [
3802
+ * "document_ready",
3803
+ * "document_prepared"
3804
+ * ],
3805
+ * "is_active": true,
3806
+ * "url": "https://myapp.example.com/webhooks/assinafy",
3807
+ * "email": "operations@example.com"
3808
+ * }
3809
+ * ```
3810
+ *
3614
3811
  * @param payload - Subscription details. `url` and `email` are required;
3615
3812
  * `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
3616
3813
  * defaults to `true`.
@@ -3672,7 +3869,7 @@ var WebhookResource = class extends BaseResource {
3672
3869
  events: [...payload.events && payload.events.length > 0 ? payload.events : DEFAULT_WEBHOOK_EVENTS],
3673
3870
  is_active: payload.is_active ?? true
3674
3871
  };
3675
- this.logger.info("Registering webhook", { url: payload.url });
3872
+ this.logger.info("Registering webhook");
3676
3873
  return this.call(
3677
3874
  "Failed to register webhook",
3678
3875
  () => this.http.put(
@@ -4134,6 +4331,14 @@ var TemplateResource = class extends BaseResource {
4134
4331
  * `undefined` keys before sending. Unlike uploads, `name` here is a plain
4135
4332
  * display name and is **not** forced to end in `.pdf`.
4136
4333
  *
4334
+ * Request body (`application/json`):
4335
+ * ```jsonc
4336
+ * {
4337
+ * "name": "Service agreement.pdf",
4338
+ * "message": "Please sign this document."
4339
+ * }
4340
+ * ```
4341
+ *
4137
4342
  * @param templateId - The template to update.
4138
4343
  * @param payload - `name` and/or `message`; both optional.
4139
4344
  * @param accountId - Override the client's default account ID.
@@ -4314,6 +4519,14 @@ var TagResource = class extends BaseResource {
4314
4519
  * and `'ff8800'` both persist as `'ff8800'`. Omit `color`
4315
4520
  * (or pass `null`) for no color.
4316
4521
  *
4522
+ * Request body (`application/json`):
4523
+ * ```jsonc
4524
+ * {
4525
+ * "name": "Contracts",
4526
+ * "color": "ff8800"
4527
+ * }
4528
+ * ```
4529
+ *
4317
4530
  * @param payload - `name` (required, max 64 characters; trimmed with
4318
4531
  * internal whitespace collapsed) and optional `color`.
4319
4532
  * @param accountId - Override the client's default account ID.
@@ -4363,6 +4576,14 @@ var TagResource = class extends BaseResource {
4363
4576
  * leading `#` on `color` is accepted and stripped by the API
4364
4577
  * (`'#112233'` → `'112233'`).
4365
4578
  *
4579
+ * Request body (`application/json`):
4580
+ * ```jsonc
4581
+ * {
4582
+ * "name": "Signed contracts",
4583
+ * "color": null
4584
+ * }
4585
+ * ```
4586
+ *
4366
4587
  * @param tagId - The tag to update.
4367
4588
  * @param payload - `name` and/or `color`. `color: null` clears the color;
4368
4589
  * omit a field to leave it unchanged.
@@ -4521,6 +4742,14 @@ var AuthenticationResource = class extends BaseResource {
4521
4742
  * `X-Api-Key` (see {@link AuthenticationResource.createApiKey}) instead of
4522
4743
  * storing a password.
4523
4744
  *
4745
+ * Request body (`application/json`):
4746
+ * ```jsonc
4747
+ * {
4748
+ * "email": "user@example.com",
4749
+ * "password": "example-password"
4750
+ * }
4751
+ * ```
4752
+ *
4524
4753
  * @param email - The user's email address, e.g. `'user@example.com'`.
4525
4754
  * @param password - The user's password.
4526
4755
  * @returns An {@link ILoginResponse} with the access token, user, and
@@ -4530,7 +4759,7 @@ var AuthenticationResource = class extends BaseResource {
4530
4759
  * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
4531
4760
  * "user": {
4532
4761
  * "id": "md3j6p9w8b7y6qvqaoy5er42",
4533
- * "name": "Multica Test",
4762
+ * "name": "Empresa Exemplo",
4534
4763
  * "email": "user@example.com",
4535
4764
  * "telephone": null,
4536
4765
  * "government_id": "",
@@ -4542,7 +4771,7 @@ var AuthenticationResource = class extends BaseResource {
4542
4771
  * "accounts": [
4543
4772
  * {
4544
4773
  * "id": "acc_example",
4545
- * "name": "Multica Test",
4774
+ * "name": "Empresa Exemplo",
4546
4775
  * "roles": ["Owner"],
4547
4776
  * "is_delete_allowed": true,
4548
4777
  * "created_at": "2026-05-12T13:45:11Z"
@@ -4576,6 +4805,15 @@ var AuthenticationResource = class extends BaseResource {
4576
4805
  * Assinafy JWT. Returns the same {@link ILoginResponse} shape as
4577
4806
  * {@link AuthenticationResource.login}.
4578
4807
  *
4808
+ * Request body (`application/json`):
4809
+ * ```jsonc
4810
+ * {
4811
+ * "provider": "google",
4812
+ * "token": "provider_token_example",
4813
+ * "has_accepted_terms": true
4814
+ * }
4815
+ * ```
4816
+ *
4579
4817
  * @param payload - The social-login body.
4580
4818
  * @param payload.provider - OAuth provider; currently exactly `'google'`.
4581
4819
  * @param payload.token - The provider-issued OAuth/ID token.
@@ -4588,7 +4826,7 @@ var AuthenticationResource = class extends BaseResource {
4588
4826
  * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
4589
4827
  * "user": {
4590
4828
  * "id": "md3j6p9w8b7y6qvqaoy5er42",
4591
- * "name": "Multica Test",
4829
+ * "name": "Empresa Exemplo",
4592
4830
  * "email": "user@example.com",
4593
4831
  * "telephone": null,
4594
4832
  * "government_id": "",
@@ -4600,7 +4838,7 @@ var AuthenticationResource = class extends BaseResource {
4600
4838
  * "accounts": [
4601
4839
  * {
4602
4840
  * "id": "acc_example",
4603
- * "name": "Multica Test",
4841
+ * "name": "Empresa Exemplo",
4604
4842
  * "roles": ["Owner"],
4605
4843
  * "is_delete_allowed": true,
4606
4844
  * "created_at": "2026-05-12T13:45:11Z"
@@ -4650,6 +4888,14 @@ var AuthenticationResource = class extends BaseResource {
4650
4888
  * The response is the standard status/message acknowledgement with no data,
4651
4889
  * so this method resolves to `void`.
4652
4890
  *
4891
+ * Request body (`application/json`):
4892
+ * ```jsonc
4893
+ * {
4894
+ * "provider": "google",
4895
+ * "token": "provider_token_example"
4896
+ * }
4897
+ * ```
4898
+ *
4653
4899
  * @param payload - Social provider and provider-issued access/ID token.
4654
4900
  * @returns Resolves when the API acknowledges that the identity was linked.
4655
4901
  * @throws {ValidationError} If `provider` is not `google` or `token` is empty.
@@ -4686,6 +4932,13 @@ var AuthenticationResource = class extends BaseResource {
4686
4932
  * a masked value. Calling this again rotates the key, invalidating the
4687
4933
  * previous one.
4688
4934
  *
4935
+ * Request body (`application/json`):
4936
+ * ```jsonc
4937
+ * {
4938
+ * "password": "example-password"
4939
+ * }
4940
+ * ```
4941
+ *
4689
4942
  * @param password - The current user's password, required to authorize
4690
4943
  * key generation.
4691
4944
  * @returns An {@link IApiKeyResponse} containing the new key. Response
@@ -4773,6 +5026,15 @@ var AuthenticationResource = class extends BaseResource {
4773
5026
  * Requires the current password as a confirmation. On success the API
4774
5027
  * echoes back the affected `email`.
4775
5028
  *
5029
+ * Request body (`application/json`):
5030
+ * ```jsonc
5031
+ * {
5032
+ * "email": "user@example.com",
5033
+ * "password": "example-password",
5034
+ * "new_password": "new-example-password"
5035
+ * }
5036
+ * ```
5037
+ *
4776
5038
  * @param payload - The change-password body.
4777
5039
  * @param payload.email - The user's email address.
4778
5040
  * @param payload.password - The current password.
@@ -4819,6 +5081,13 @@ var AuthenticationResource = class extends BaseResource {
4819
5081
  * Triggers Assinafy to email a reset link/token to the given address.
4820
5082
  * Complete the flow with {@link AuthenticationResource.resetPassword}.
4821
5083
  *
5084
+ * Request body (`application/json`):
5085
+ * ```jsonc
5086
+ * {
5087
+ * "email": "user@example.com"
5088
+ * }
5089
+ * ```
5090
+ *
4822
5091
  * @param email - The email address to send the reset link to.
4823
5092
  * @returns `{ email }` — the address the reset link was sent to. Response
4824
5093
  * shape:
@@ -4850,6 +5119,15 @@ var AuthenticationResource = class extends BaseResource {
4850
5119
  * {@link AuthenticationResource.requestPasswordReset} and sets the new
4851
5120
  * password. On success the API echoes back the affected `email`.
4852
5121
  *
5122
+ * Request body (`application/json`):
5123
+ * ```jsonc
5124
+ * {
5125
+ * "email": "user@example.com",
5126
+ * "token": "reset_token_example",
5127
+ * "new_password": "new-example-password"
5128
+ * }
5129
+ * ```
5130
+ *
4853
5131
  * @param payload - The reset-password body.
4854
5132
  * @param payload.email - The user's email address.
4855
5133
  * @param payload.token - The reset token from the emailed link. The current
@@ -5072,8 +5350,8 @@ var OAuthResource = class extends BaseResource {
5072
5350
  * ```ts
5073
5351
  * const request = await client.oauth.createAuthorizationUrl({
5074
5352
  * clientId: process.env.ASSINAFY_CLIENT_ID!,
5075
- * redirectUri: 'https://myapp.com/oauth/callback',
5076
- * scopes: ['documents:read', 'documents:write', 'offline_access'],
5353
+ * redirectUri: 'https://myapp.example.com/oauth/callback',
5354
+ * scopes: ['documents:read', 'documents:write', 'account:read', 'offline_access'],
5077
5355
  * });
5078
5356
  * session.oauth = request;
5079
5357
  * response.redirect(request.url);
@@ -5160,8 +5438,8 @@ var OAuthResource = class extends BaseResource {
5160
5438
  * ```
5161
5439
  * @throws {ValidationError} If `state` is missing or does not match, `iss`
5162
5440
  * is absent or disagrees with the expected issuer, or a successful response
5163
- * carries no `code`. In every case the response is not yours — stop, do not
5164
- * exchange.
5441
+ * carries no `code`, or a protocol parameter appears more than once.
5442
+ * Reject such responses without exchanging the code.
5165
5443
  * @throws {OAuthError} If the server returned `error` (e.g.
5166
5444
  * `access_denied`, `invalid_scope`, `invalid_request`,
5167
5445
  * `unsupported_response_type`, `invalid_target`).
@@ -5174,9 +5452,9 @@ var OAuthResource = class extends BaseResource {
5174
5452
  * const tokens = await client.oauth.exchangeCode({
5175
5453
  * code,
5176
5454
  * codeVerifier: stored.codeVerifier,
5177
- * redirectUri: 'https://myapp.com/oauth/callback',
5455
+ * redirectUri: 'https://myapp.example.com/oauth/callback',
5178
5456
  * clientId: process.env.ASSINAFY_CLIENT_ID!,
5179
- * clientSecret: process.env.ASSINAFY_CLIENT_SECRET,
5457
+ * clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
5180
5458
  * });
5181
5459
  * });
5182
5460
  * ```
@@ -5185,6 +5463,11 @@ var OAuthResource = class extends BaseResource {
5185
5463
  assertRecord(expected, "expected authorization request");
5186
5464
  assertNonEmptyString(expected.state, "expected.state");
5187
5465
  const query = toSearchParams(params);
5466
+ for (const key of ["state", "iss", "code", "error", "error_description"]) {
5467
+ if (query.getAll(key).length > 1) {
5468
+ throw new ValidationError(`OAuth callback must not repeat ${key}`);
5469
+ }
5470
+ }
5188
5471
  const state = query.get("state");
5189
5472
  if (state === null || !constantTimeEquals(state, expected.state)) {
5190
5473
  throw new ValidationError(
@@ -5221,6 +5504,12 @@ var OAuthResource = class extends BaseResource {
5221
5504
  * a browser. Every value must match the authorization request exactly, or
5222
5505
  * the API answers `invalid_grant`.
5223
5506
  *
5507
+ * Request body (`application/x-www-form-urlencoded`; omit `client_secret`
5508
+ * for public applications):
5509
+ * ```text
5510
+ * grant_type=authorization_code&code=code_example&redirect_uri=https%3A%2F%2Fmyapp.example.com%2Foauth%2Fcallback&client_id=client_example&client_secret=secret_example&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&resource=https%3A%2F%2Fapi.assinafy.com.br
5511
+ * ```
5512
+ *
5224
5513
  * @param options - Exchange options.
5225
5514
  * @param options.code - The code from
5226
5515
  * {@link OAuthResource.readAuthorizationCallback}.
@@ -5256,9 +5545,9 @@ var OAuthResource = class extends BaseResource {
5256
5545
  * const tokens = await client.oauth.exchangeCode({
5257
5546
  * code,
5258
5547
  * codeVerifier: session.oauth.codeVerifier,
5259
- * redirectUri: 'https://myapp.com/oauth/callback',
5548
+ * redirectUri: 'https://myapp.example.com/oauth/callback',
5260
5549
  * clientId: process.env.ASSINAFY_CLIENT_ID!,
5261
- * clientSecret: process.env.ASSINAFY_CLIENT_SECRET,
5550
+ * clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
5262
5551
  * });
5263
5552
  * ```
5264
5553
  */
@@ -5294,6 +5583,12 @@ var OAuthResource = class extends BaseResource {
5294
5583
  * only expires if it goes 30 days without a refresh; after that the user
5295
5584
  * has to reconnect.
5296
5585
  *
5586
+ * Request body (`application/x-www-form-urlencoded`; omit `client_secret`
5587
+ * for public applications):
5588
+ * ```text
5589
+ * grant_type=refresh_token&refresh_token=refresh_token_example&client_id=client_example&client_secret=secret_example&resource=https%3A%2F%2Fapi.assinafy.com.br
5590
+ * ```
5591
+ *
5297
5592
  * @param options - Refresh options.
5298
5593
  * @param options.refreshToken - The current refresh token.
5299
5594
  * @param options.clientId - The application's `client_id`.
@@ -5324,7 +5619,7 @@ var OAuthResource = class extends BaseResource {
5324
5619
  * const tokens = await client.oauth.refreshToken({
5325
5620
  * refreshToken: connection.refreshToken,
5326
5621
  * clientId: process.env.ASSINAFY_CLIENT_ID!,
5327
- * clientSecret: process.env.ASSINAFY_CLIENT_SECRET,
5622
+ * clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
5328
5623
  * });
5329
5624
  * await connection.save({ refreshToken: tokens.refresh_token });
5330
5625
  * ```
@@ -5378,7 +5673,7 @@ var OAuthResource = class extends BaseResource {
5378
5673
  * token: connection.refreshToken,
5379
5674
  * tokenTypeHint: 'refresh_token',
5380
5675
  * clientId: process.env.ASSINAFY_CLIENT_ID!,
5381
- * clientSecret: process.env.ASSINAFY_CLIENT_SECRET,
5676
+ * clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
5382
5677
  * });
5383
5678
  * ```
5384
5679
  */
@@ -5421,8 +5716,8 @@ var OAuthResource = class extends BaseResource {
5421
5716
  * "email_verified": true
5422
5717
  * }
5423
5718
  * ```
5424
- * `sub` is the stable user identifier; the rest are `null` when their scope
5425
- * was not granted.
5719
+ * `sub` is the stable user identifier; other claims may be omitted or
5720
+ * `null` when their scope was not granted.
5426
5721
  * @throws {ValidationError} If `accessToken` is supplied but empty.
5427
5722
  * @throws {ApiError} `401` when the token is missing, expired or revoked;
5428
5723
  * `403` when the `openid` scope was not granted — its `WWW-Authenticate`
@@ -5592,8 +5887,9 @@ function toSearchParams(params) {
5592
5887
  assertRecord(params, "callback parameters");
5593
5888
  const search = new URLSearchParams();
5594
5889
  for (const [key, value] of Object.entries(params)) {
5595
- const first = Array.isArray(value) ? value[0] : value;
5596
- if (typeof first === "string") search.set(key, first);
5890
+ for (const item of Array.isArray(value) ? value : [value]) {
5891
+ if (typeof item === "string") search.append(key, item);
5892
+ }
5597
5893
  }
5598
5894
  return search;
5599
5895
  }
@@ -5603,6 +5899,17 @@ var FieldsResource = class extends BaseResource {
5603
5899
  /**
5604
5900
  * Create a field definition (`POST /accounts/{accountId}/fields`).
5605
5901
  *
5902
+ * Request body (`application/json`):
5903
+ * ```jsonc
5904
+ * {
5905
+ * "type": "text",
5906
+ * "name": "Reference",
5907
+ * "regex": null,
5908
+ * "is_required": true,
5909
+ * "is_active": true
5910
+ * }
5911
+ * ```
5912
+ *
5606
5913
  * @param payload - The field to create. `type` and `name` are required;
5607
5914
  * `type` must be one of the platform field types (see
5608
5915
  * {@link FieldsResource.listTypes}); `regex` may be a string or `null`,
@@ -5747,6 +6054,15 @@ var FieldsResource = class extends BaseResource {
5747
6054
  * Update a field definition
5748
6055
  * (`PUT /accounts/{accountId}/fields/{fieldId}`).
5749
6056
  *
6057
+ * Request body (`application/json`):
6058
+ * ```jsonc
6059
+ * {
6060
+ * "name": "Customer reference",
6061
+ * "regex": null,
6062
+ * "is_active": true
6063
+ * }
6064
+ * ```
6065
+ *
5750
6066
  * @param fieldId - The field definition to update.
5751
6067
  * @param payload - Fields are `name`, nullable `regex`, and `is_active`;
5752
6068
  * `type` and `is_required` are compatibility extensions.
@@ -5835,6 +6151,13 @@ var FieldsResource = class extends BaseResource {
5835
6151
  * `signerAccessCode` is a compatibility query and is sent as
5836
6152
  * `signer-access-code` when supplied.
5837
6153
  *
6154
+ * Request body (`application/json`):
6155
+ * ```jsonc
6156
+ * {
6157
+ * "value": "Example value"
6158
+ * }
6159
+ * ```
6160
+ *
5838
6161
  * @param fieldId - The field definition to validate against.
5839
6162
  * @param value - The value to check (validated against the field's
5840
6163
  * type/regex). Sent as `{ value }` in the request body.
@@ -5887,6 +6210,16 @@ var FieldsResource = class extends BaseResource {
5887
6210
  * same compatibility extension described on
5888
6211
  * {@link FieldsResource.validate}.
5889
6212
  *
6213
+ * Request body (`application/json`):
6214
+ * ```jsonc
6215
+ * [
6216
+ * {
6217
+ * "field_id": "field_example",
6218
+ * "value": "Example value"
6219
+ * }
6220
+ * ]
6221
+ * ```
6222
+ *
5890
6223
  * @param entries - Non-empty array of `{ field_id, value }` pairs.
5891
6224
  * @param options - Account override and optional legacy `signerAccessCode`.
5892
6225
  * @returns One validation result per entry. Response shape:
@@ -6015,8 +6348,7 @@ var SignerDocumentsResource = class extends BaseResource {
6015
6348
  * "updated_at": "2026-07-19T14:56:56Z"
6016
6349
  * }
6017
6350
  * ```
6018
- * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing,
6019
- * or a supplied `search` value is not a string.
6351
+ * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
6020
6352
  * @throws {ApiError} If the access code is invalid or expired.
6021
6353
  *
6022
6354
  * @example
@@ -6104,7 +6436,29 @@ var SignerDocumentsResource = class extends BaseResource {
6104
6436
  * @param signerAccessCode - The signer's access code, from their signing link.
6105
6437
  * @param search - Free-text term matched against the document name.
6106
6438
  * @returns Matching documents for that signer, in the compact
6107
- * {@link IDocumentListItem} shape, with pagination in `meta`.
6439
+ * {@link IDocumentListItem} shape, with pagination in `meta`:
6440
+ * ```jsonc
6441
+ * {
6442
+ * "data": [
6443
+ * {
6444
+ * "id": "103acccd24234c07858ffddf6d84",
6445
+ * "account_id": "acc_example",
6446
+ * "template_id": null,
6447
+ * "name": "Service agreement.pdf",
6448
+ * "status": "pending_signature",
6449
+ * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
6450
+ * "is_closed": false,
6451
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
6452
+ * "decline_reason": null,
6453
+ * "declined_by": null,
6454
+ * "tags": [],
6455
+ * "created_at": "2026-07-19T14:56:54Z",
6456
+ * "updated_at": "2026-07-19T14:56:56Z"
6457
+ * }
6458
+ * ],
6459
+ * "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
6460
+ * }
6461
+ * ```
6108
6462
  * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
6109
6463
  * @throws {ApiError} If the access code is invalid or expired.
6110
6464
  *
@@ -6193,6 +6547,15 @@ var SignerDocumentsResource = class extends BaseResource {
6193
6547
  * The `document_ids` array goes in the request body; the access code
6194
6548
  * authenticates via the `signer-access-code` query param.
6195
6549
  *
6550
+ * Request body (`application/json`):
6551
+ * ```jsonc
6552
+ * {
6553
+ * "document_ids": [
6554
+ * "document_example"
6555
+ * ]
6556
+ * }
6557
+ * ```
6558
+ *
6196
6559
  * @param documentIds - Non-empty array of document IDs to sign.
6197
6560
  * @param signerAccessCode - The signer's access code, from their signing link.
6198
6561
  * @returns Resolves when the API acknowledges the operation. The documented
@@ -6212,9 +6575,7 @@ var SignerDocumentsResource = class extends BaseResource {
6212
6575
  * ```
6213
6576
  */
6214
6577
  async signMultiple(documentIds, signerAccessCode) {
6215
- if (!Array.isArray(documentIds) || documentIds.length === 0 || documentIds.some((id) => typeof id !== "string" || !id.trim())) {
6216
- throw new ValidationError("documentIds must be a non-empty array of non-empty IDs");
6217
- }
6578
+ assertDocumentIds(documentIds);
6218
6579
  const code = this.requireId(signerAccessCode, "signer-access-code");
6219
6580
  return this.callVoid(
6220
6581
  "Failed to sign multiple documents",
@@ -6234,6 +6595,16 @@ var SignerDocumentsResource = class extends BaseResource {
6234
6595
  * Both `document_ids` and `decline_reason` go in the request body; the access
6235
6596
  * code authenticates via the `signer-access-code` query param.
6236
6597
  *
6598
+ * Request body (`application/json`):
6599
+ * ```jsonc
6600
+ * {
6601
+ * "document_ids": [
6602
+ * "document_example"
6603
+ * ],
6604
+ * "decline_reason": "The document needs a correction."
6605
+ * }
6606
+ * ```
6607
+ *
6237
6608
  * @param documentIds - Non-empty array of document IDs to decline.
6238
6609
  * @param declineReason - Free-text reason shown to the sender (required).
6239
6610
  * @param signerAccessCode - The signer's access code, from their signing link.
@@ -6254,12 +6625,8 @@ var SignerDocumentsResource = class extends BaseResource {
6254
6625
  * ```
6255
6626
  */
6256
6627
  async declineMultiple(documentIds, declineReason, signerAccessCode) {
6257
- if (!Array.isArray(documentIds) || documentIds.length === 0 || documentIds.some((id) => typeof id !== "string" || !id.trim())) {
6258
- throw new ValidationError("documentIds must be a non-empty array of non-empty IDs");
6259
- }
6260
- if (typeof declineReason !== "string" || !declineReason.trim()) {
6261
- throw new ValidationError("declineReason is required");
6262
- }
6628
+ assertDocumentIds(documentIds);
6629
+ assertDeclineReason(declineReason);
6263
6630
  const code = this.requireId(signerAccessCode, "signer-access-code");
6264
6631
  return this.callVoid(
6265
6632
  "Failed to decline multiple documents",
@@ -6353,6 +6720,13 @@ var SignerDocumentsResource = class extends BaseResource {
6353
6720
  * **body carries only `verification-code`** (putting the access code in the
6354
6721
  * body leaves the request unauthenticated → `401`).
6355
6722
  *
6723
+ * Request body (`application/json`):
6724
+ * ```jsonc
6725
+ * {
6726
+ * "verification-code": "123456"
6727
+ * }
6728
+ * ```
6729
+ *
6356
6730
  * @param payload - `signerAccessCode` (the signing-link code) and
6357
6731
  * `verificationCode` (the OTP the signer received).
6358
6732
  * @returns Resolves when the API acknowledges the operation. The response
@@ -6490,7 +6864,48 @@ var SignerDocumentsResource = class extends BaseResource {
6490
6864
  * @returns The document to sign, including its `assignment` (the
6491
6865
  * {@link IAssignment} shape: `signers`, `items`, `summary`, `signing_urls`)
6492
6866
  * from which the `itemId` / `fieldId` / `pageId` values for
6493
- * {@link SignerDocumentsResource.sign} are read.
6867
+ * {@link SignerDocumentsResource.sign} are read:
6868
+ * ```jsonc
6869
+ * {
6870
+ * "resource": "document",
6871
+ * "id": "103acccd24234c07858ffddf6d84",
6872
+ * "account_id": "acc_example",
6873
+ * "template_id": null,
6874
+ * "name": "Service agreement.pdf",
6875
+ * "status": "pending_signature",
6876
+ * "artifacts": {
6877
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
6878
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
6879
+ * },
6880
+ * "is_closed": false,
6881
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
6882
+ * "decline_reason": null,
6883
+ * "declined_by": null,
6884
+ * "tags": [],
6885
+ * "assignment": {
6886
+ * "id": "1032c55c58bb00a8dc35db916751",
6887
+ * "method": "virtual",
6888
+ * "sender_email": "sender@example.com",
6889
+ * "expires_at": null,
6890
+ * "signers": [
6891
+ * { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
6892
+ * "full_name": "Example Signer", "notified": true, "completed": false }
6893
+ * ],
6894
+ * "items": [
6895
+ * { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
6896
+ * "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
6897
+ * "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
6898
+ * ],
6899
+ * "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
6900
+ * },
6901
+ * "pages": [
6902
+ * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
6903
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
6904
+ * ],
6905
+ * "created_at": "2026-07-19T14:56:54Z",
6906
+ * "updated_at": "2026-07-19T14:56:56Z"
6907
+ * }
6908
+ * ```
6494
6909
  * @throws {ValidationError} If `signerAccessCode` is missing.
6495
6910
  * @throws {ApiError} `400` when DigitalCertificate identity/terms are not
6496
6911
  * confirmed; `401`/`403` if the access code is invalid or expired; `409`
@@ -6530,6 +6945,18 @@ var SignerDocumentsResource = class extends BaseResource {
6530
6945
  * first. Digital Certificate signers cannot use this endpoint; use the
6531
6946
  * certificate start/complete API flow instead.
6532
6947
  *
6948
+ * Request body (`application/json`):
6949
+ * ```jsonc
6950
+ * [
6951
+ * {
6952
+ * "itemId": "item_example",
6953
+ * "fieldId": "field_example",
6954
+ * "pageId": "page_example",
6955
+ * "value": "Example Signer"
6956
+ * }
6957
+ * ]
6958
+ * ```
6959
+ *
6533
6960
  * @param documentId - The document being signed.
6534
6961
  * @param assignmentId - The assignment within that document.
6535
6962
  * @param signerAccessCode - The signer's access code, from their signing link.
@@ -6587,6 +7014,13 @@ var SignerDocumentsResource = class extends BaseResource {
6587
7014
  * delete the document via `documents.delete`; there is no workspace "cancel"
6588
7015
  * endpoint.)
6589
7016
  *
7017
+ * Request body (`application/json`):
7018
+ * ```jsonc
7019
+ * {
7020
+ * "decline_reason": "The document needs a correction."
7021
+ * }
7022
+ * ```
7023
+ *
6590
7024
  * @param documentId - The document being declined.
6591
7025
  * @param assignmentId - The assignment within that document.
6592
7026
  * @param signerAccessCode - The signer's access code, from their signing link.
@@ -6612,9 +7046,7 @@ var SignerDocumentsResource = class extends BaseResource {
6612
7046
  const did = this.requireId(documentId, "Document ID");
6613
7047
  const aid = this.requireId(assignmentId, "Assignment ID");
6614
7048
  const code = this.requireId(signerAccessCode, "signer-access-code");
6615
- if (typeof declineReason !== "string" || !declineReason.trim()) {
6616
- throw new ValidationError("declineReason is required");
6617
- }
7049
+ assertDeclineReason(declineReason);
6618
7050
  return this.callVoid(
6619
7051
  "Failed to decline assignment",
6620
7052
  () => this.http.put(
@@ -6625,6 +7057,16 @@ var SignerDocumentsResource = class extends BaseResource {
6625
7057
  );
6626
7058
  }
6627
7059
  };
7060
+ function assertDocumentIds(documentIds) {
7061
+ if (!Array.isArray(documentIds) || documentIds.length === 0 || documentIds.some((id) => typeof id !== "string" || !id.trim())) {
7062
+ throw new ValidationError("documentIds must be a non-empty array of non-empty IDs");
7063
+ }
7064
+ }
7065
+ function assertDeclineReason(declineReason) {
7066
+ if (typeof declineReason !== "string" || !declineReason.trim()) {
7067
+ throw new ValidationError("declineReason is required");
7068
+ }
7069
+ }
6628
7070
  function validateConfirmDataPayload(payload) {
6629
7071
  for (const key of ["full_name", "government_id"]) {
6630
7072
  if (payload[key] !== void 0 && typeof payload[key] !== "string") {
@@ -6765,13 +7207,40 @@ var UserResource = class extends BaseResource {
6765
7207
  * (`PUT /users/self/notification-preferences`). Omitted keys retain their
6766
7208
  * current values; account/security e-mails are not configurable here.
6767
7209
  *
7210
+ * Request body (`application/json`):
7211
+ * ```jsonc
7212
+ * {
7213
+ * "DocumentCompleted": true,
7214
+ * "SignerDeclined": true,
7215
+ * "DocumentCancelled": true,
7216
+ * "DocumentAboutToExpire": true,
7217
+ * "DocumentExpired": true,
7218
+ * "DocumentExpirationReset": true,
7219
+ * "DocumentProcessingFailed": true,
7220
+ * "TemplateProcessingFailed": true,
7221
+ * "SignerWhatsappFailed": true
7222
+ * }
7223
+ * ```
7224
+ *
6768
7225
  * @param preferences - One or more of the nine documented keys, each with
6769
7226
  * a boolean value. Request example:
6770
7227
  * ```json
6771
7228
  * { "DocumentCompleted": true, "SignerDeclined": false }
6772
7229
  * ```
6773
- * @returns The complete updated map; its shape is identical to
6774
- * {@link UserResource.getNotificationPreferences}.
7230
+ * @returns The complete updated nine-key preference map:
7231
+ * ```json
7232
+ * {
7233
+ * "DocumentCompleted": true,
7234
+ * "SignerDeclined": false,
7235
+ * "DocumentCancelled": true,
7236
+ * "DocumentAboutToExpire": true,
7237
+ * "DocumentExpired": false,
7238
+ * "DocumentExpirationReset": true,
7239
+ * "DocumentProcessingFailed": true,
7240
+ * "TemplateProcessingFailed": true,
7241
+ * "SignerWhatsappFailed": true
7242
+ * }
7243
+ * ```
6775
7244
  * @throws {ValidationError} Before requesting when the map is empty, has an
6776
7245
  * unknown key, or contains a non-boolean value.
6777
7246
  * @throws {ApiError} `400` if the API rejects the map, `401` for invalid
@@ -7223,7 +7692,10 @@ var AssinafyClient = class _AssinafyClient {
7223
7692
  * the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
7224
7693
  * enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
7225
7694
  * timeout.
7226
- * @throws {ApiError} If any underlying API call is rejected.
7695
+ * @throws {ApiError} If any underlying API call is rejected — see the
7696
+ * `@throws` of {@link DocumentResource.upload}, {@link SignerResource.create},
7697
+ * {@link AssignmentResource.create}, and
7698
+ * {@link DocumentResource.waitUntilReady} for the per-step statuses.
7227
7699
  *
7228
7700
  * @example
7229
7701
  * ```ts