@assinafy/sdk 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.5.1] - 2026-09-28
11
+
12
+ ### Fixed
13
+
14
+ - JSDoc reference corrections: missing response payloads and examples added to
15
+ public methods (`OAuthError.upgrade()`, `parseWwwAuthenticate()`,
16
+ `signerDocuments.search()`, `signerDocuments.confirmData()`,
17
+ `signerDocuments.getAssignment()`, `users.updateNotificationPreferences()`),
18
+ and stale `@throws` clauses corrected on `documents.details()` and
19
+ `signerDocuments.getCurrent()`. No behavior changes.
20
+ - `README.en.md` reaches parity with the pt-BR README: the Environments
21
+ section (sandbox base URL and explicit `issuer`/`authorizationEndpoint`
22
+ configuration), the verification/notification channel table with per-signer
23
+ costs, and the A1/A3 certificate-media note.
24
+ - The two browser URL helpers (`auth.getSocialLoginUrl()`,
25
+ `auth.getSocialLoginCallbackUrl()`) are listed in the coverage ledger's
26
+ compatibility extensions.
27
+ - OAuth callback examples use reserved example domains, and the CONTRIBUTING
28
+ live-test examples point at the sandbox API.
29
+
10
30
  ## [2.5.0] - 2026-09-25
11
31
 
12
32
  ### Added
@@ -305,8 +325,9 @@ type, or API surface changed.
305
325
  request credentials or user payloads.
306
326
  - Restored the official name-only signer request and account
307
327
  `notification_sender_type` field. Both are now represented exactly as the
308
- OpenAPI defines them; the live audit records the sandbox's lagging rejection
309
- of `notification_sender_type` without blocking unrelated endpoint tests.
328
+ OpenAPI defines them; the sandbox's lagging rejection of
329
+ `notification_sender_type` is recorded as a known deployment divergence
330
+ without blocking unrelated endpoint tests.
310
331
  - Restored the official public, code-free signer artifact download while
311
332
  retaining an optional access-code argument for legacy deployments, and made
312
333
  owner-only assignment-signer fields optional in signer-context responses.
@@ -320,12 +341,13 @@ type, or API surface changed.
320
341
  - Clarified that webhook HMAC verification is an opt-in utility: the current
321
342
  Assinafy OpenAPI document does not specify a signing header or algorithm.
322
343
 
323
- ### Earlier 2.1.0 audit work (completed 2026-07-19)
344
+ ### Additional fixes (completed 2026-07-19)
324
345
 
325
- Full audit against the live sandbox API (`https://sandbox.assinafy.com.br/v1`)
326
- and the OpenAPI reference: every safely runnable operation was probed, fixture-
327
- or legal-consent-dependent operations were recorded as explicit skips, and the
328
- SDK was reconciled against the observed request/response shapes.
346
+ Validated against the live sandbox API (`https://sandbox.assinafy.com.br/v1`)
347
+ and the OpenAPI reference: every safely runnable operation was exercised live,
348
+ operations that depend on fixtures or legal consent were recorded as explicit
349
+ skips, and the SDK was brought in line with the observed request/response
350
+ shapes.
329
351
 
330
352
  #### Fixed
331
353
 
@@ -506,10 +528,11 @@ SDK was reconciled against the observed request/response shapes.
506
528
 
507
529
  ## [1.5.0] - 2026-06-05
508
530
 
509
- Full production-readiness audit against [the live API docs](https://api.assinafy.com.br/v1/docs),
510
- re-verified end-to-end against the live **sandbox** (`https://sandbox.assinafy.com.br/v1`).
511
- Closes the last coverage gap (Template create/update/delete), removes a dead
512
- endpoint, tightens types to the real wire shapes, and modernises the toolchain.
531
+ Full coverage of [the live API docs](https://api.assinafy.com.br/v1/docs),
532
+ re-validated end-to-end against the live **sandbox**
533
+ (`https://sandbox.assinafy.com.br/v1`). Closes the last coverage gap (Template
534
+ create/update/delete), removes a dead endpoint, tightens types to the real
535
+ wire shapes, and modernises the toolchain.
513
536
 
514
537
  ### Removed
515
538
 
@@ -584,9 +607,9 @@ including template create/get/update/downloadPage/delete.
584
607
 
585
608
  ## [1.4.0] - 2026-05-27
586
609
 
587
- Full file-by-file audit against [the live API docs](https://api.assinafy.com.br/v1/docs),
588
- re-validated end-to-end against the live API. Closes the last coverage gap (Tags)
589
- and fixes signer-creation and type accuracy.
610
+ Full coverage of [the live API docs](https://api.assinafy.com.br/v1/docs),
611
+ re-validated end-to-end against the live API. Closes the last coverage gap
612
+ (Tags) and fixes signer-creation and type accuracy.
590
613
 
591
614
  ### Added
592
615
 
@@ -628,8 +651,8 @@ CPF normalisation. All read and write paths re-verified against the live API
628
651
 
629
652
  ## [1.3.0] - 2026-05-12
630
653
 
631
- 100% endpoint coverage of [the live API docs](https://api.assinafy.com.br/v1/docs).
632
- Audited file-by-file and validated end-to-end against the live API.
654
+ 100% endpoint coverage of [the live API docs](https://api.assinafy.com.br/v1/docs),
655
+ validated end-to-end against the live API.
633
656
 
634
657
  ### Added
635
658
 
@@ -669,8 +692,8 @@ live API.
669
692
 
670
693
  ## [1.2.0] - 2026-05-06
671
694
 
672
- Full API parity audit. Adds the Template resource and missing Document operations, and aligns signer
673
- fields (`cpf`, `whatsapp_phone_number`) with the PHP SDK and n8n node.
695
+ Adds the Template resource and missing Document operations, and expands the
696
+ signer fields with `cpf` and `whatsapp_phone_number`.
674
697
 
675
698
  ### Added
676
699
 
@@ -681,7 +704,7 @@ fields (`cpf`, `whatsapp_phone_number`) with the PHP SDK and n8n node.
681
704
  - `createFromTemplate(templateId, signers, options?, accountId?)` — `POST /accounts/{accountId}/templates/{templateId}/documents`
682
705
  - `estimateCostFromTemplate(templateId, signers, accountId?)` — `POST /accounts/{accountId}/templates/{templateId}/documents/estimate-cost`
683
706
  - `verify(hash)` — `GET /documents/{hash}/verify`
684
- - **`cpf` field** in `ICreateSignerPayload`, `IUpdateSignerPayload`, `ISigner`, and `IUploadAndRequestSignaturesSigner`. The `normaliseSignerPayload` helper strips non-digit characters before sending (mirrors PHP SDK `sanitizeDocument` behaviour).
707
+ - **`cpf` field** in `ICreateSignerPayload`, `IUpdateSignerPayload`, `ISigner`, and `IUploadAndRequestSignaturesSigner`. The `normaliseSignerPayload` helper strips non-digit characters before sending.
685
708
  - New types: `ITemplateListItem`, `ITemplateListResponse`, `ITemplateDetailsResponse`, `ITemplateRole`, `ITemplateSigner`, `ICreateDocumentFromTemplateOptions`.
686
709
  - `TemplateResource` exported from `index.ts`.
687
710
 
@@ -702,7 +725,11 @@ fields (`cpf`, `whatsapp_phone_number`) with the PHP SDK and n8n node.
702
725
  - High-level `uploadAndRequestSignatures` helper on `AssinafyClient`.
703
726
  - `PaginatedResult<T>` with parsed `X-Pagination-*` header meta.
704
727
 
705
- [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.4.0...HEAD
728
+ [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.5.1...HEAD
729
+ [2.5.1]: https://github.com/assinafy/typescript-sdk/compare/v2.5.0...v2.5.1
730
+ [2.5.0]: https://github.com/assinafy/typescript-sdk/compare/v2.4.2...v2.5.0
731
+ [2.4.2]: https://github.com/assinafy/typescript-sdk/compare/v2.4.1...v2.4.2
732
+ [2.4.1]: https://github.com/assinafy/typescript-sdk/compare/v2.4.0...v2.4.1
706
733
  [2.4.0]: https://github.com/assinafy/typescript-sdk/compare/v2.3.0...v2.4.0
707
734
  [2.3.0]: https://github.com/assinafy/typescript-sdk/compare/v2.2.0...v2.3.0
708
735
  [2.2.0]: https://github.com/assinafy/typescript-sdk/compare/v2.1.2...v2.2.0
package/README.en.md CHANGED
@@ -45,7 +45,8 @@ afterwards.
45
45
  [signer-side endpoints](#signer-side-endpoints)
46
46
 
47
47
  **Everything else** — [High-level helper](#high-level-helper) ·
48
- [Errors](#errors) · [Development](#development) · [License](#license)
48
+ [Errors](#errors) · [Environments](#environments) ·
49
+ [Development](#development) · [License](#license)
49
50
 
50
51
  ## Requirements
51
52
 
@@ -172,18 +173,18 @@ const client = new AssinafyClient(); // no credentials needed
172
173
  // completes PKCE, `nonce` validates the id_token.
173
174
  const request = await client.oauth.createAuthorizationUrl({
174
175
  clientId: process.env.ASSINAFY_CLIENT_ID!,
175
- redirectUri: 'https://myapp.com/oauth/callback',
176
+ redirectUri: 'https://myapp.example.com/oauth/callback',
176
177
  scopes: ['documents:read', 'documents:write', 'offline_access'],
177
178
  });
178
179
  session.oauth = request;
179
180
  response.redirect(request.url); // full page navigation
180
181
 
181
- // 2 — on https://myapp.com/oauth/callback
182
+ // 2 — on https://myapp.example.com/oauth/callback
182
183
  const { code } = client.oauth.readAuthorizationCallback(query, session.oauth);
183
184
  const tokens = await client.oauth.exchangeCode({
184
185
  code,
185
186
  codeVerifier: session.oauth.codeVerifier,
186
- redirectUri: 'https://myapp.com/oauth/callback',
187
+ redirectUri: 'https://myapp.example.com/oauth/callback',
187
188
  clientId: process.env.ASSINAFY_CLIENT_ID!,
188
189
  clientSecret: process.env.ASSINAFY_CLIENT_SECRET, // confidential apps only
189
190
  });
@@ -575,8 +576,8 @@ can sign in parallel.
575
576
  accessCode, entries)` with a non-empty array of
576
577
  `{ itemId, fieldId, pageId, value }`. A virtual signer must confirm their data
577
578
  before signing. A `DigitalCertificate` signer cannot call `sign`; that branch
578
- uses Assinafy's certificate-start and certificate-complete flow, which is not
579
- part of this SDK's current 89-operation surface.
579
+ uses Assinafy's certificate flow, described in
580
+ [ICP-Brasil digital certificate](#icp-brasil-digital-certificate).
580
581
 
581
582
  ### 5. Observe completion and download artifacts
582
583
 
@@ -826,6 +827,19 @@ Keep the email flow as the default. Enable either branch below only after the
826
827
  workspace has the required plan or feature and the returned cost estimate is
827
828
  acceptable.
828
829
 
830
+ The verification method and the notification method are **coupled**: send one,
831
+ both, or neither — the missing side is inferred. With neither, both default
832
+ to `Email`.
833
+
834
+ | Verification | How the signer proves who they are | Allowed notification | Cost per signer |
835
+ | --- | --- | --- | --- |
836
+ | `Email` *(default)* | One-time code (OTP) by email | `Email` | Free |
837
+ | `Whatsapp` | One-time code (OTP) by WhatsApp | `Whatsapp` | 0.45 credit (the notification), paid plans only |
838
+ | `DigitalCertificate` | The signer signs with their **own ICP-Brasil certificate — A1 or A3 —** through the Web PKI extension, producing a **qualified PAdES signature** | `Email` **or** `Whatsapp` | 2 credits + the notification |
839
+
840
+ Exactly one notification method per signer. The SDK rejects an invalid
841
+ combination before the request; the API would answer `400`.
842
+
829
843
  #### WhatsApp verification and notification
830
844
 
831
845
  WhatsApp is available only on paid subscriptions and costs 0.45 credit per
@@ -871,6 +885,14 @@ signer's `government_id`, and exactly one certificate signer in that signing
871
885
  step. It costs two credits per certificate signer in addition to the selected
872
886
  notification cost.
873
887
 
888
+ **A1 and A3 are certificate media**, chosen by the signer in their browser at
889
+ signing time: A1 lives in software (a file on the machine) and A3 in hardware
890
+ (a token or smartcard). The API models both with the single
891
+ `DigitalCertificate` value — there is no `A1`/`A3` field to send, and the
892
+ resulting PAdES signature is qualified in either case. Certificate signers
893
+ complete a Web PKI handshake on two production-only routes that are not part
894
+ of this SDK.
895
+
874
896
  ```ts
875
897
  const certificateSigner = await client.signers.update(signerId, {
876
898
  government_id: '390.533.447-05',
@@ -1340,7 +1362,8 @@ whether to retry the workflow.
1340
1362
  ## Errors
1341
1363
 
1342
1364
  HTTP methods reject with an `AssinafyError` subclass. Synchronous helpers such
1343
- as `getSocialLoginUrl()` can throw `ValidationError` before any request.
1365
+ as `getSocialLoginUrl()` and `readAuthorizationCallback()` can throw
1366
+ `ValidationError` before any request.
1344
1367
 
1345
1368
  ```ts
1346
1369
  import { ApiError, OAuthError, ValidationError, NetworkError, AssinafyError } from '@assinafy/sdk';
@@ -1365,6 +1388,34 @@ try {
1365
1388
  }
1366
1389
  ```
1367
1390
 
1391
+ ## Environments
1392
+
1393
+ | | |
1394
+ | --- | --- |
1395
+ | Production | `https://api.assinafy.com.br/v1` |
1396
+ | Sandbox | `https://sandbox.assinafy.com.br/v1` |
1397
+
1398
+ The sandbox runs its own authorization server at
1399
+ `https://auth-sandbox.assinafy.com.br`, with the consent screen at
1400
+ `/oauth/authorize`. Its discovery documents are unreachable: nginx refuses
1401
+ paths that start with a dot, so pass the endpoints explicitly:
1402
+
1403
+ ```ts
1404
+ const client = new AssinafyClient({ baseUrl: 'https://sandbox.assinafy.com.br/v1' });
1405
+
1406
+ const request = await client.oauth.createAuthorizationUrl({
1407
+ clientId: process.env.ASSINAFY_CLIENT_ID!,
1408
+ redirectUri: 'https://myapp.example.com/oauth/callback',
1409
+ scopes: ['documents:read'],
1410
+ issuer: 'https://auth-sandbox.assinafy.com.br',
1411
+ authorizationEndpoint: 'https://auth-sandbox.assinafy.com.br/oauth/authorize',
1412
+ });
1413
+ ```
1414
+
1415
+ The token, revocation and userinfo endpoints follow the configured `baseUrl`.
1416
+ Confirm that the sandbox exposes them before running the exchange step
1417
+ there — see [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
1418
+
1368
1419
  ## Development
1369
1420
 
1370
1421
  ```bash
package/README.md CHANGED
@@ -165,18 +165,18 @@ const client = new AssinafyClient(); // nenhuma credencial nece
165
165
  // PKCE e `nonce` valida o id_token.
166
166
  const requisicao = await client.oauth.createAuthorizationUrl({
167
167
  clientId: process.env.ASSINAFY_CLIENT_ID!,
168
- redirectUri: 'https://meuapp.com.br/oauth/callback',
168
+ redirectUri: 'https://meuapp.exemplo.com.br/oauth/callback',
169
169
  scopes: ['documents:read', 'documents:write', 'offline_access'],
170
170
  });
171
171
  sessao.oauth = requisicao;
172
172
  resposta.redirect(requisicao.url); // navegação de página inteira
173
173
 
174
- // 2 — em https://meuapp.com.br/oauth/callback
174
+ // 2 — em https://meuapp.exemplo.com.br/oauth/callback
175
175
  const { code } = client.oauth.readAuthorizationCallback(query, sessao.oauth);
176
176
  const tokens = await client.oauth.exchangeCode({
177
177
  code,
178
178
  codeVerifier: sessao.oauth.codeVerifier,
179
- redirectUri: 'https://meuapp.com.br/oauth/callback',
179
+ redirectUri: 'https://meuapp.exemplo.com.br/oauth/callback',
180
180
  clientId: process.env.ASSINAFY_CLIENT_ID!,
181
181
  clientSecret: process.env.ASSINAFY_CLIENT_SECRET, // só aplicações confidenciais
182
182
  });
@@ -1379,7 +1379,7 @@ const client = new AssinafyClient({ baseUrl: 'https://sandbox.assinafy.com.br/v1
1379
1379
 
1380
1380
  const requisicao = await client.oauth.createAuthorizationUrl({
1381
1381
  clientId: process.env.ASSINAFY_CLIENT_ID!,
1382
- redirectUri: 'https://meuapp.com.br/oauth/callback',
1382
+ redirectUri: 'https://meuapp.exemplo.com.br/oauth/callback',
1383
1383
  scopes: ['documents:read'],
1384
1384
  issuer: 'https://auth-sandbox.assinafy.com.br',
1385
1385
  authorizationEndpoint: 'https://auth-sandbox.assinafy.com.br/oauth/authorize',
package/dist/index.d.mts CHANGED
@@ -361,6 +361,7 @@ interface IAssignment {
361
361
  sender_email?: string;
362
362
  method: AssignmentMethod;
363
363
  expires_at?: string | null;
364
+ /** Compatibility extension; absent from the OpenAPI Assignment schema. */
364
365
  expiration?: string;
365
366
  message?: string | null;
366
367
  signers: IAssignmentSigner[];
@@ -1099,6 +1100,7 @@ interface IWhatsAppNotification {
1099
1100
  sent_at: number;
1100
1101
  header: string;
1101
1102
  body: string;
1103
+ /** Compatibility extension: the spec documents only `text`; `url` is retained for deployments that send link buttons. */
1102
1104
  buttons: Array<{
1103
1105
  text: string;
1104
1106
  url?: string;
@@ -1604,8 +1606,7 @@ declare class DocumentResource extends BaseResource {
1604
1606
  * "updated_at": "2026-07-19T17:24:46Z"
1605
1607
  * }
1606
1608
  * ```
1607
- * @throws {ValidationError} If `documentId` is missing or `artifactName` is
1608
- * not one of the five documented artifact names.
1609
+ * @throws {ValidationError} If `documentId` is missing.
1609
1610
  * @throws {ApiError} `404` if the document does not exist.
1610
1611
  *
1611
1612
  * @example
@@ -2133,7 +2134,8 @@ declare class DocumentResource extends BaseResource {
2133
2134
  sendToken(documentId: string, email: string): Promise<void>;
2134
2135
  sendToken(documentId: string, recipient: string, channel: SendTokenChannel): Promise<void>;
2135
2136
  /**
2136
- * Quick boolean check: has every signer completed their assignment?
2137
+ * Quick boolean check (`GET /documents/{documentId}`): has every signer
2138
+ * completed their assignment?
2137
2139
  *
2138
2140
  * A computed convenience over {@link DocumentResource.details} (one `GET
2139
2141
  * /documents/{documentId}`). Returns `true` when the document status is
@@ -2155,7 +2157,8 @@ declare class DocumentResource extends BaseResource {
2155
2157
  */
2156
2158
  isFullySigned(documentId: string): Promise<boolean>;
2157
2159
  /**
2158
- * Summarise signing progress for UI display.
2160
+ * Summarise signing progress for UI display
2161
+ * (`GET /documents/{documentId}`).
2159
2162
  *
2160
2163
  * A computed convenience over {@link DocumentResource.details} (one `GET
2161
2164
  * /documents/{documentId}`). `total` and `signed` come from the assignment
@@ -2922,11 +2925,11 @@ declare class AssignmentResource extends BaseResource {
2922
2925
  * @param documentId - The document the assignment would be created on.
2923
2926
  * @param payload - `method` plus channel-only signer descriptors and/or
2924
2927
  * `collect`-mode `entries`. Create-only fields and signer IDs are not part
2925
- * of this request schema. `blocking_reason` may be `PendingPayment`,
2926
- * `InsufficientDocuments`, or `InsufficientCredits`.
2928
+ * of this request schema.
2927
2929
  * @returns an {@link ICostEstimate} with `total_credits`, balances, a
2928
- * line-item `breakdown`, and a `has_sufficient_resources` gate. Response
2929
- * shape:
2930
+ * line-item `breakdown`, and a `has_sufficient_resources` gate.
2931
+ * `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
2932
+ * `InsufficientCredits`. Response shape:
2930
2933
  * ```jsonc
2931
2934
  * {
2932
2935
  * "documents": 1,
@@ -3860,7 +3863,7 @@ declare class AuthenticationResource extends BaseResource {
3860
3863
  * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
3861
3864
  * "user": {
3862
3865
  * "id": "md3j6p9w8b7y6qvqaoy5er42",
3863
- * "name": "Multica Test",
3866
+ * "name": "Empresa Exemplo",
3864
3867
  * "email": "user@example.com",
3865
3868
  * "telephone": null,
3866
3869
  * "government_id": "",
@@ -3872,7 +3875,7 @@ declare class AuthenticationResource extends BaseResource {
3872
3875
  * "accounts": [
3873
3876
  * {
3874
3877
  * "id": "acc_example",
3875
- * "name": "Multica Test",
3878
+ * "name": "Empresa Exemplo",
3876
3879
  * "roles": ["Owner"],
3877
3880
  * "is_delete_allowed": true,
3878
3881
  * "created_at": "2026-05-12T13:45:11Z"
@@ -3911,7 +3914,7 @@ declare class AuthenticationResource extends BaseResource {
3911
3914
  * "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
3912
3915
  * "user": {
3913
3916
  * "id": "md3j6p9w8b7y6qvqaoy5er42",
3914
- * "name": "Multica Test",
3917
+ * "name": "Empresa Exemplo",
3915
3918
  * "email": "user@example.com",
3916
3919
  * "telephone": null,
3917
3920
  * "government_id": "",
@@ -3923,7 +3926,7 @@ declare class AuthenticationResource extends BaseResource {
3923
3926
  * "accounts": [
3924
3927
  * {
3925
3928
  * "id": "acc_example",
3926
- * "name": "Multica Test",
3929
+ * "name": "Empresa Exemplo",
3927
3930
  * "roles": ["Owner"],
3928
3931
  * "is_delete_allowed": true,
3929
3932
  * "created_at": "2026-05-12T13:45:11Z"
@@ -4985,8 +4988,7 @@ declare class SignerDocumentsResource extends BaseResource {
4985
4988
  * "updated_at": "2026-07-19T14:56:56Z"
4986
4989
  * }
4987
4990
  * ```
4988
- * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing,
4989
- * or a supplied `search` value is not a string.
4991
+ * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
4990
4992
  * @throws {ApiError} If the access code is invalid or expired.
4991
4993
  *
4992
4994
  * @example
@@ -5056,7 +5058,29 @@ declare class SignerDocumentsResource extends BaseResource {
5056
5058
  * @param signerAccessCode - The signer's access code, from their signing link.
5057
5059
  * @param search - Free-text term matched against the document name.
5058
5060
  * @returns Matching documents for that signer, in the compact
5059
- * {@link IDocumentListItem} shape, with pagination in `meta`.
5061
+ * {@link IDocumentListItem} shape, with pagination in `meta`:
5062
+ * ```jsonc
5063
+ * {
5064
+ * "data": [
5065
+ * {
5066
+ * "id": "103acccd24234c07858ffddf6d84",
5067
+ * "account_id": "acc_example",
5068
+ * "template_id": null,
5069
+ * "name": "Service agreement.pdf",
5070
+ * "status": "pending_signature",
5071
+ * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
5072
+ * "is_closed": false,
5073
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
5074
+ * "decline_reason": null,
5075
+ * "declined_by": null,
5076
+ * "tags": [],
5077
+ * "created_at": "2026-07-19T14:56:54Z",
5078
+ * "updated_at": "2026-07-19T14:56:56Z"
5079
+ * }
5080
+ * ],
5081
+ * "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
5082
+ * }
5083
+ * ```
5060
5084
  * @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
5061
5085
  * @throws {ApiError} If the access code is invalid or expired.
5062
5086
  *
@@ -5274,7 +5298,17 @@ declare class SignerDocumentsResource extends BaseResource {
5274
5298
  * @param payload - Any of the official `full_name`, `email`, or
5275
5299
  * `government_id`, or `has_accepted_terms` fields. Fields left out are not
5276
5300
  * sent.
5277
- * @returns The confirmed signer in the full {@link ISigner} response shape.
5301
+ * @returns The confirmed signer in the full {@link ISigner} response shape:
5302
+ * ```jsonc
5303
+ * {
5304
+ * "resource": "signer",
5305
+ * "id": "19e6b92e7895332ed9708535d8c",
5306
+ * "full_name": "Example Signer",
5307
+ * "email": "signer@example.com",
5308
+ * "whatsapp_phone_number": null,
5309
+ * "has_accepted_terms": true
5310
+ * }
5311
+ * ```
5278
5312
  * @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
5279
5313
  * or a supplied identity value is malformed.
5280
5314
  * @throws {ApiError} If the access code is invalid/expired or a value fails
@@ -5379,7 +5413,48 @@ declare class SignerDocumentsResource extends BaseResource {
5379
5413
  * @returns The document to sign, including its `assignment` (the
5380
5414
  * {@link IAssignment} shape: `signers`, `items`, `summary`, `signing_urls`)
5381
5415
  * from which the `itemId` / `fieldId` / `pageId` values for
5382
- * {@link SignerDocumentsResource.sign} are read.
5416
+ * {@link SignerDocumentsResource.sign} are read:
5417
+ * ```jsonc
5418
+ * {
5419
+ * "resource": "document",
5420
+ * "id": "103acccd24234c07858ffddf6d84",
5421
+ * "account_id": "acc_example",
5422
+ * "template_id": null,
5423
+ * "name": "Service agreement.pdf",
5424
+ * "status": "pending_signature",
5425
+ * "artifacts": {
5426
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
5427
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
5428
+ * },
5429
+ * "is_closed": false,
5430
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
5431
+ * "decline_reason": null,
5432
+ * "declined_by": null,
5433
+ * "tags": [],
5434
+ * "assignment": {
5435
+ * "id": "1032c55c58bb00a8dc35db916751",
5436
+ * "method": "virtual",
5437
+ * "sender_email": "sender@example.com",
5438
+ * "expires_at": null,
5439
+ * "signers": [
5440
+ * { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
5441
+ * "full_name": "Example Signer", "notified": true, "completed": false }
5442
+ * ],
5443
+ * "items": [
5444
+ * { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
5445
+ * "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
5446
+ * "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
5447
+ * ],
5448
+ * "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
5449
+ * },
5450
+ * "pages": [
5451
+ * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
5452
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
5453
+ * ],
5454
+ * "created_at": "2026-07-19T14:56:54Z",
5455
+ * "updated_at": "2026-07-19T14:56:56Z"
5456
+ * }
5457
+ * ```
5383
5458
  * @throws {ValidationError} If `signerAccessCode` is missing.
5384
5459
  * @throws {ApiError} `400` when DigitalCertificate identity/terms are not
5385
5460
  * confirmed; `401`/`403` if the access code is invalid or expired; `409`
@@ -5570,8 +5645,20 @@ declare class UserResource extends BaseResource {
5570
5645
  * ```json
5571
5646
  * { "DocumentCompleted": true, "SignerDeclined": false }
5572
5647
  * ```
5573
- * @returns The complete updated map; its shape is identical to
5574
- * {@link UserResource.getNotificationPreferences}.
5648
+ * @returns The complete updated nine-key preference map:
5649
+ * ```json
5650
+ * {
5651
+ * "DocumentCompleted": true,
5652
+ * "SignerDeclined": false,
5653
+ * "DocumentCancelled": true,
5654
+ * "DocumentAboutToExpire": true,
5655
+ * "DocumentExpired": false,
5656
+ * "DocumentExpirationReset": true,
5657
+ * "DocumentProcessingFailed": true,
5658
+ * "TemplateProcessingFailed": true,
5659
+ * "SignerWhatsappFailed": true
5660
+ * }
5661
+ * ```
5575
5662
  * @throws {ValidationError} Before requesting when the map is empty, has an
5576
5663
  * unknown key, or contains a non-boolean value.
5577
5664
  * @throws {ApiError} `400` if the API rejects the map, `401` for invalid
@@ -5878,7 +5965,10 @@ declare class AssinafyClient {
5878
5965
  * the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
5879
5966
  * enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
5880
5967
  * timeout.
5881
- * @throws {ApiError} If any underlying API call is rejected.
5968
+ * @throws {ApiError} If any underlying API call is rejected — see the
5969
+ * `@throws` of {@link DocumentResource.upload}, {@link SignerResource.create},
5970
+ * {@link AssignmentResource.create}, and
5971
+ * {@link DocumentResource.waitUntilReady} for the per-step statuses.
5882
5972
  *
5883
5973
  * @example
5884
5974
  * ```ts
@@ -5965,7 +6055,16 @@ interface IAuthenticateChallenge {
5965
6055
  *
5966
6056
  * @param value - Raw header value, or `undefined` when absent.
5967
6057
  * @returns The parsed challenge, or `undefined` when there is no header or it
5968
- * carries no scheme.
6058
+ * carries no scheme. Malformed input never throws; it yields `undefined` or a
6059
+ * scheme-only challenge.
6060
+ *
6061
+ * @example
6062
+ * ```ts
6063
+ * const challenge = parseWwwAuthenticate(
6064
+ * 'Bearer error="insufficient_scope", scope="documents:read"',
6065
+ * );
6066
+ * // → { scheme: 'Bearer', error: 'insufficient_scope', scope: 'documents:read' }
6067
+ * ```
5969
6068
  */
5970
6069
  declare function parseWwwAuthenticate(value: string | undefined): IAuthenticateChallenge | undefined;
5971
6070
 
@@ -6033,7 +6132,9 @@ declare class ApiError extends AssinafyError {
6033
6132
  * ones with no structured body to explain them. Anything else falls back to
6034
6133
  * the stable message.
6035
6134
  * @returns An `ApiError` retaining the original response body in
6036
- * {@link ApiError.responseData}; `message` is truncated for legibility.
6135
+ * {@link ApiError.responseData}. A JSON `message` is used verbatim; only an
6136
+ * unstructured text body is whitespace-collapsed and truncated for
6137
+ * legibility.
6037
6138
  *
6038
6139
  * @example
6039
6140
  * ```ts
@@ -6093,6 +6194,16 @@ declare class OAuthError extends ApiError {
6093
6194
  * @param error - Any thrown value.
6094
6195
  * @returns An `OAuthError` when the body carries a non-empty string
6095
6196
  * `error`, else the original value.
6197
+ *
6198
+ * @example
6199
+ * ```ts
6200
+ * const apiError = ApiError.fromResponse(400, {
6201
+ * error: 'invalid_grant',
6202
+ * error_description: 'The provided authorization grant is invalid.',
6203
+ * });
6204
+ * const upgraded = OAuthError.upgrade(apiError);
6205
+ * // upgraded instanceof OAuthError → true, .error → 'invalid_grant'
6206
+ * ```
6096
6207
  */
6097
6208
  static upgrade(error: unknown): unknown;
6098
6209
  }