@assinafy/sdk 2.11.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This ledger maps the official
4
4
  [`GET /v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json)
5
- contract to the public SDK API: 90 paths, 118 HTTP operations, and 49 component
5
+ contract to the public SDK API: 112 paths, 147 HTTP operations, and 62 component
6
6
  schemas.
7
7
 
8
8
  All paths below include the `/v1` prefix shown by the OpenAPI document, except
@@ -13,17 +13,19 @@ the corresponding relative path without repeating that prefix.
13
13
  Status meanings:
14
14
 
15
15
  - **Covered** — a public, typed SDK method sends the operation.
16
+ - **Not exposed** — official route the API reserves for Assinafy's own pages;
17
+ integrations must not call it.
16
18
  - **Compatibility extension** — route retained for existing integrations but
17
- absent from the current OpenAPI path set and excluded from the 118-operation
19
+ absent from the current OpenAPI path set and excluded from the 147-operation
18
20
  total.
19
21
 
20
- ## Accounts — 10/10
22
+ ## Accounts — 13/13
21
23
 
22
24
  | Method | Path | SDK method | Status |
23
25
  | --- | --- | --- | --- |
24
26
  | `GET` | `/v1/accounts` | `client.workspaces.list()` | Covered |
25
27
  | `POST` | `/v1/accounts` | `client.workspaces.create(payload)` | Covered |
26
- | `GET` | `/v1/accounts/{accountId}` | `client.workspaces.get(accountId)` | Covered |
28
+ | `GET` | `/v1/accounts/{accountId}` | `client.workspaces.get(accountId, options?)` | Covered |
27
29
  | `PUT` | `/v1/accounts/{accountId}` | `client.workspaces.update(accountId, payload)` | Covered |
28
30
  | `DELETE` | `/v1/accounts/{accountId}` | `client.workspaces.delete(accountId, options?)` | Covered |
29
31
  | `GET` | `/v1/accounts/{accountId}/theme` | `client.workspaces.getTheme(accountId)` | Covered |
@@ -31,6 +33,9 @@ Status meanings:
31
33
  | `POST` | `/v1/accounts/{accountId}/logo` | `client.workspaces.uploadLogo(accountId, source)` | Covered |
32
34
  | `DELETE` | `/v1/accounts/{accountId}/logo` | `client.workspaces.deleteLogo(accountId)` | Covered |
33
35
  | `GET` | `/v1/accounts/{accountId}/stats` | `client.workspaces.getStats(accountId, params?)` | Covered |
36
+ | `GET` | `/v1/accounts/{accountId}/usage` | `client.workspaces.getUsage(accountId)` | Covered |
37
+ | `GET` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.getNotificationPolicy(accountId)` | Covered |
38
+ | `PUT` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.updateNotificationPolicy(accountId, payload)` | Covered |
34
39
 
35
40
  ## Assignments — 10/10
36
41
 
@@ -69,10 +74,42 @@ Status meanings:
69
74
  | `GET` | `/v1/accounts/{accountId}/contracts` | `client.contracts.list(params?, accountId?)` | Covered |
70
75
  | `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract` | `client.contracts.get(documentId, accountId?)` | Covered |
71
76
  | `PUT` | `/v1/accounts/{accountId}/documents/{documentId}/contract` | `client.contracts.set(documentId, payload, accountId?)` | Covered |
72
- | `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract/related` | `client.contracts.listRelated(documentId, accountId?)` | Covered |
77
+ | `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract/related` | `client.contracts.listRelated(documentId, accountId?, params?)` | Covered |
73
78
  | `POST` | `/v1/accounts/{accountId}/documents/{documentId}/contract/renew` | `client.contracts.renew(documentId, payload, accountId?)` | Covered |
74
79
  | `POST` | `/v1/accounts/{accountId}/documents/{documentId}/contract/terminate` | `client.contracts.terminate(documentId, payload?, accountId?)` | Covered |
75
80
 
81
+ ## Embedded signing — 6/6
82
+
83
+ Server side only: the iframe and its `postMessage` handshake run in the
84
+ browser. The session exchange is called by Assinafy's embed page with the
85
+ single-use token, and spending it from an integration would break the frame.
86
+
87
+ | Method | Path | SDK method | Status |
88
+ | --- | --- | --- | --- |
89
+ | `GET` | `/v1/accounts/{accountId}/embed-origins` | `client.embed.listOrigins(accountId?)` | Covered |
90
+ | `POST` | `/v1/accounts/{accountId}/embed-origins` | `client.embed.addOrigin(origin, accountId?)` | Covered |
91
+ | `PUT` | `/v1/accounts/{accountId}/embed-origins/{originId}` | `client.embed.updateOrigin(originId, origin, accountId?)` | Covered |
92
+ | `DELETE` | `/v1/accounts/{accountId}/embed-origins/{originId}` | `client.embed.deleteOrigin(originId, accountId?)` | Covered |
93
+ | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/embed-sessions` | `client.embed.createSession(documentId, assignmentId, signerId)` | Covered |
94
+ | `POST` | `/v1/embed/sessions/{token}/exchange` | — | Not exposed |
95
+
96
+ ## Envelopes — 12/12
97
+
98
+ | Method | Path | SDK method | Status |
99
+ | --- | --- | --- | --- |
100
+ | `GET` | `/v1/accounts/{accountId}/envelopes` | `client.envelopes.list(params?, accountId?)` | Covered |
101
+ | `POST` | `/v1/accounts/{accountId}/envelopes` | `client.envelopes.create(payload, options?, accountId?)` | Covered |
102
+ | `POST` | `/v1/accounts/{accountId}/envelopes/estimate-cost` | `client.envelopes.estimateCost(payload, accountId?)` | Covered |
103
+ | `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.get(envelopeId, accountId?)` | Covered |
104
+ | `PATCH` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.update(envelopeId, payload, accountId?)` | Covered |
105
+ | `DELETE` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.delete(envelopeId, accountId?)` | Covered |
106
+ | `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/activities` | `client.envelopes.listActivities(envelopeId, params?, accountId?)` | Covered |
107
+ | `PUT` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/cancel` | `client.envelopes.cancel(envelopeId, accountId?)` | Covered |
108
+ | `POST` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/documents` | `client.envelopes.addDocument(envelopeId, payload, accountId?)` | Covered |
109
+ | `DELETE` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}` | `client.envelopes.removeDocument(envelopeId, documentId, accountId?)` | Covered |
110
+ | `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/download/{artifactName}` | `client.envelopes.download(envelopeId, artifactName, accountId?)` | Covered |
111
+ | `PUT` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/resend` | `client.envelopes.resendNotification(envelopeId, signerId, accountId?)` | Covered |
112
+
76
113
  ## Documents — 18/18
77
114
 
78
115
  | Method | Path | SDK method | Status |
@@ -81,14 +118,14 @@ Status meanings:
81
118
  | `POST` | `/v1/accounts/{accountId}/documents` | `client.documents.upload(source, options?)` | Covered |
82
119
  | `GET` | `/v1/accounts/{accountId}/documents/search` | `client.documents.search(params?, accountId?)` | Covered |
83
120
  | `GET` | `/v1/documents/statuses` | `client.documents.statuses()` | Covered |
84
- | `GET` | `/v1/documents/{documentId}` | `client.documents.details(documentId)` / `get(documentId)` | Covered |
121
+ | `GET` | `/v1/documents/{documentId}` | `client.documents.details(documentId, options?)` / `get(documentId, options?)` | Covered |
85
122
  | `DELETE` | `/v1/documents/{documentId}` | `client.documents.delete(documentId)` | Covered |
86
123
  | `PATCH` | `/v1/documents/{documentId}` | `client.documents.rename(documentId, name)` | Covered |
87
124
  | `GET` | `/v1/documents/{documentId}/activities` | `client.documents.activities(documentId, params?)` / `client.documents.listActivities(documentId, params?)` | Covered |
88
125
  | `GET` | `/v1/documents/{documentId}/download/{artifactName}` | `client.documents.download(documentId, artifactName)` | Covered |
89
126
  | `GET` | `/v1/documents/{documentSignatureHash}/verify` | `client.documents.verify(documentSignatureHash)` | Covered |
90
- | `GET` | `/v1/documents/{documentId}/thumbnail` | `client.documents.thumbnail(documentId)` | Covered |
91
- | `GET` | `/v1/documents/{documentId}/pages/{pageId}/download` | `client.documents.downloadPage(documentId, pageId)` | Covered |
127
+ | `GET` | `/v1/documents/{documentId}/thumbnail` | `client.documents.thumbnail(documentId, options?)` | Covered |
128
+ | `GET` | `/v1/documents/{documentId}/pages/{pageId}/download` | `client.documents.downloadPage(documentId, pageId, options?)` | Covered |
92
129
  | `GET` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.listTags(documentId, accountId?)` | Covered |
93
130
  | `PUT` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.replaceTags(documentId, tagIds, accountId?)` | Covered |
94
131
  | `POST` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.addTags(documentId, tagIds, accountId?)` | Covered |
@@ -136,14 +173,16 @@ ordinary OAuth applications use the two SDK methods listed below.
136
173
  | `PUT` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.update(signerId, payload, accountId?)` | Covered |
137
174
  | `DELETE` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.delete(signerId, accountId?)` | Covered |
138
175
 
139
- ## Signing and public flows — 19/19
176
+ ## Signing and public flows — 24/24
140
177
 
141
178
  All access-code methods in this section use the auth-free transport and reject
142
179
  a missing or blank code; they authenticate with the `signer-access-code` query
143
180
  parameter required by the OpenAPI security scheme. The signer document list and
144
181
  search also accept workspace credentials; only the explicit `listAsWorkspace` /
145
- `searchAsWorkspace` methods send them, and never with an access code. The artifact download is explicitly public and accepts
146
- an optional fourth access-code argument only for legacy compatibility.
182
+ `searchAsWorkspace` methods send them, and never with an access code. The signer
183
+ artifact download and the certified-copy link download do not follow redirects,
184
+ so an expired link surfaces as an error instead of an HTML page. Field
185
+ validation with a signer code (see Fields) also runs on the auth-free transport.
147
186
 
148
187
  | Method | Path | SDK method | Status |
149
188
  | --- | --- | --- | --- |
@@ -152,8 +191,13 @@ an optional fourth access-code argument only for legacy compatibility.
152
191
  | `GET` | `/v1/signers/self` | `client.signerDocuments.self(accessCode)` | Covered |
153
192
  | `GET` | `/v1/signers/identity-verification` | `client.signerDocuments.getIdentityVerification(accessCode)` | Covered |
154
193
  | `POST` | `/v1/signers/identity-verification` | `client.signerDocuments.startIdentityVerification(accessCode, payload)` | Covered |
155
- | `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode)` | Covered |
156
- | `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode, hasAcceptedTerms?)` | Covered |
194
+ | `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode, options?)` | Covered |
195
+ | `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode, options?)` | Covered |
196
+ | `GET` | `/v1/sign/theme` | `client.signerDocuments.getTheme(accessCode)` | Covered |
197
+ | `GET` | `/v1/sign/logo` | `client.signerDocuments.downloadLogo(accessCode)` | Covered |
198
+ | `POST` | `/v1/sign/certified-copy` | `client.signerDocuments.resendCertifiedCopy(accessCode, documentId?)` | Covered |
199
+ | `GET` | `/v1/signers/downloads/{token}` | `client.signerDocuments.downloadCertifiedCopy(token, artifact?)` | Covered |
200
+ | `POST` | `/v1/signers/downloads/{token}/resend` | `client.signerDocuments.resendCertifiedCopyFromLink(token)` | Covered |
157
201
  | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}` | `client.signerDocuments.sign(documentId, assignmentId, accessCode, entries)` | Covered |
158
202
  | `PUT` | `/v1/documents/{documentId}/assignments/{assignmentId}/reject` | `client.signerDocuments.decline(documentId, assignmentId, accessCode, reason)` | Covered |
159
203
  | `PUT` | `/v1/signers/documents/sign-multiple` | `client.signerDocuments.signMultiple(documentIds, accessCode)` | Covered |
@@ -164,8 +208,8 @@ an optional fourth access-code argument only for legacy compatibility.
164
208
  | `POST` | `/v1/signature` | `client.signerDocuments.uploadSignature(accessCode, image, options?)` | Covered |
165
209
  | `GET` | `/v1/signature/{signatureType}` | `client.signerDocuments.downloadSignature(accessCode, signatureType)` | Covered |
166
210
  | `GET` | `/v1/signers/{signerId}/documents` | `client.signerDocuments.list(signerId, accessCode, params?)` / `client.signerDocuments.listAsWorkspace(signerId, params?)` | Covered |
167
- | `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search)` / `client.signerDocuments.searchAsWorkspace(signerId, search?)` | Covered |
168
- | `GET` | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `client.signerDocuments.download(signerId, documentId, artifactName)` | Covered |
211
+ | `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search?, params?)` / `client.signerDocuments.searchAsWorkspace(signerId, search?, params?)` | Covered |
212
+ | `GET` | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `client.signerDocuments.download(signerId, documentId, 'original', accessCode)` | Covered |
169
213
 
170
214
  ## Tags — 4/4
171
215
 
@@ -185,7 +229,7 @@ an optional fourth access-code argument only for legacy compatibility.
185
229
  Five additional routes are documented separately under
186
230
  [Template compatibility routes](#template-compatibility-routes).
187
231
 
188
- ## Users — 9/9
232
+ ## Users — 11/11
189
233
 
190
234
  | Method | Path | SDK method | Status |
191
235
  | --- | --- | --- | --- |
@@ -193,13 +237,15 @@ Five additional routes are documented separately under
193
237
  | `GET` | `/v1/users/self/stats` | `client.users.getStats(params?)` | Covered |
194
238
  | `GET` | `/v1/users/self/notification-preferences` | `client.users.getNotificationPreferences()` | Covered |
195
239
  | `PUT` | `/v1/users/self/notification-preferences` | `client.users.updateNotificationPreferences(preferences)` | Covered |
240
+ | `GET` | `/v1/users/self/push-preferences` | `client.users.getPushPreferences()` | Covered |
241
+ | `PUT` | `/v1/users/self/push-preferences` | `client.users.updatePushPreferences(preferences)` | Covered |
196
242
  | `GET` | `/v1/users/self/mfa` | `client.users.getMfa()` | Covered |
197
243
  | `POST` | `/v1/users/self/mfa/totp` | `client.users.startTotpEnrollment(label?)` | Covered |
198
244
  | `PUT` | `/v1/users/self/mfa/totp/confirm` | `client.users.confirmTotpEnrollment(payload)` | Covered |
199
245
  | `POST` | `/v1/users/self/mfa/recovery-codes` | `client.users.regenerateRecoveryCodes(proof)` | Covered |
200
246
  | `DELETE` | `/v1/users/self/mfa/{customId}` | `client.users.deleteMfaMethod(methodId, proof)` | Covered |
201
247
 
202
- ## Webhooks — 14/14
248
+ ## Webhooks — 15/15
203
249
 
204
250
  | Method | Path | SDK method | Status |
205
251
  | --- | --- | --- | --- |
@@ -216,12 +262,13 @@ Five additional routes are documented separately under
216
262
  | `PUT` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.updateEndpoint(endpointId, payload, accountId?)` | Covered |
217
263
  | `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.deleteEndpoint(endpointId, accountId?)` | Covered |
218
264
  | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret` | `client.webhooks.getEndpointSecret(endpointId, accountId?)` | Covered |
219
- | `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate` | `client.webhooks.rotateEndpointSecret(endpointId, accountId?)` | Covered |
265
+ | `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate` | `client.webhooks.rotateEndpointSecret(endpointId, accountId?, options?)` | Covered |
266
+ | `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/test` | `client.webhooks.testEndpoint(endpointId, accountId?)` | Covered |
220
267
 
221
268
  ## Template compatibility routes
222
269
 
223
270
  These routes are available to existing integrations but do not appear in the
224
- current OpenAPI path set. They are excluded from the official 118-operation
271
+ current OpenAPI path set. They are excluded from the official 147-operation
225
272
  coverage count.
226
273
 
227
274
  | Method | Path | SDK method | Status |
@@ -236,7 +283,7 @@ coverage count.
236
283
 
237
284
  Two browser URL helpers used by older deployments are live but absent from the
238
285
  current OpenAPI path set, so they are likewise excluded from the official
239
- 118-operation coverage count.
286
+ 147-operation coverage count.
240
287
 
241
288
  | Method | Path | SDK method | Status |
242
289
  | --- | --- | --- | --- |
@@ -16,8 +16,13 @@ GET, PUT, DELETE /v1/accounts/{accountId}
16
16
  GET, POST, DELETE /v1/accounts/{accountId}/logo
17
17
  GET /v1/accounts/{accountId}/theme
18
18
  GET /v1/accounts/{accountId}/stats
19
+ GET /v1/accounts/{accountId}/usage
20
+ GET, PUT /v1/accounts/{accountId}/notification-policy
21
+ GET, POST, PUT, DELETE /v1/accounts/{accountId}/embed-origins (and per-origin routes)
22
+ GET, POST, PATCH, PUT, DELETE /v1/accounts/{accountId}/envelopes (and per-envelope routes)
19
23
  GET /v1/users/self
20
24
  GET, PUT /v1/users/self/notification-preferences
25
+ GET, PUT /v1/users/self/push-preferences
21
26
  GET /v1/users/self/stats
22
27
  GET /v1/users/self/mfa (and the two-factor management routes)
23
28
  POST /v1/authentication/mfa/verify
@@ -25,8 +30,9 @@ GET, POST /v1/accounts/{accountId}/webhooks/endpoints (and per-endpoint
25
30
  ```
26
31
 
27
32
  Sandbox deployments can return `404` for user statistics, account statistics,
28
- notification preferences, two-factor routes, or webhook endpoint routes while still accepting the production methods on
29
- the production host. The SDK keeps the official paths and response types. A
33
+ notification preferences, two-factor routes, webhook endpoint routes, envelopes,
34
+ embedded signing, usage, notification policy, push preferences, the signing-page
35
+ theme/logo and certified-copy routes while production serves them. The SDK keeps the official paths and response types. A
30
36
  sandbox `404` does not cause the client to route a request elsewhere.
31
37
 
32
38
  Two browser URL helpers used by older deployments remain available:
@@ -38,7 +44,7 @@ GET /v1/login-callback
38
44
 
39
45
  They map to `auth.getSocialLoginUrl()` and
40
46
  `auth.getSocialLoginCallbackUrl()` and are not part of the official
41
- 118-operation total.
47
+ 147-operation total.
42
48
 
43
49
  The SDK also includes the production contract additions for:
44
50
 
@@ -80,8 +86,9 @@ An amendment's `apply_error` is human-readable text, not a stable code. Do not
80
86
  parse it to select localized guidance. The published causes are a missing
81
87
  contract-tracking plan, a parent that cannot accept the delta, an earlier signed
82
88
  instrument still pending, a later signed instrument already applied, and an
83
- unexpected failure. A machine-readable error code requires an API contract
84
- addition before the SDK can expose it.
89
+ unexpected failure. Refusals of the contract routes themselves carry a
90
+ machine-readable `ApiError.code` (`ContractChanged`, `NoContractTerms`,
91
+ `PlanRestricted`) and, for a `400`, `ApiError.fieldErrors`.
85
92
 
86
93
  A sandbox may return the generic `404` while these routes are not deployed, or
87
94
  `403` while its workspace plan does not include contract tracking. The SDK does
@@ -174,9 +181,10 @@ loud, so neither surfaces as an error a caller could react to:
174
181
  and the response falls back to the default of 20 rows. The SDK normalizes
175
182
  `per_page` to `per-page` on every list method, and an explicit `per-page`
176
183
  wins if both are supplied.
177
- - `per-page` is clamped to **50**. A request for 100 returns 50 rows with a
178
- `200`, so page-size arithmetic based on the requested value is wrong by half.
179
- That maximum is exported as `MAX_LIST_PAGE_SIZE`.
184
+ - `per-page` is capped at **50** (default 20) on every paginated list. A
185
+ request for 100 returns 50 rows with a `200`, so page-size arithmetic based
186
+ on the requested value is wrong by half. That maximum is exported as
187
+ `MAX_LIST_PAGE_SIZE`.
180
188
 
181
189
  ```ts
182
190
  import { MAX_LIST_PAGE_SIZE } from '@assinafy/sdk';
@@ -191,10 +199,10 @@ const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_S
191
199
  ### Document activities
192
200
 
193
201
  Production `GET /v1/documents/{documentId}/activities` is paginated: 20 entries
194
- per page by default, with `page`, `per-page` (documented maximum 100), and `sort`
202
+ per page by default, with `page`, `per-page` (at most 50, as above), and `sort`
195
203
  (`-id` for newest first, the default; `id` for oldest first). A page beyond the
196
- end returns an empty `data` array. Its documented limit differs from the observed
197
- 50-row cap above; the SDK forwards the requested size without clamping it.
204
+ end returns an empty `data` array. `envelopes.listActivities()` reads an
205
+ envelope's trail the same way.
198
206
 
199
207
  `documents.activities(documentId, params?)` continues to return
200
208
  `IDocumentActivity[]`, normalizing an absent body to `[]`. It accepts `per_page`
@@ -210,7 +218,7 @@ import type { IDocumentActivity } from '@assinafy/sdk';
210
218
  const events: IDocumentActivity[] = [];
211
219
  for (let page = 1; ; page++) {
212
220
  const { data, meta } = await client.documents.listActivities('document-id', {
213
- page, 'per-page': 100, sort: 'id',
221
+ page, 'per-page': 50, sort: 'id',
214
222
  });
215
223
  events.push(...data);
216
224
  // Unpaged sandbox responses have no meta and must be consumed only once.
@@ -232,9 +240,10 @@ pagination.
232
240
 
233
241
  ## Assignment list account context
234
242
 
235
- `GET /v1/assignments` requires the workspace in the camel-case `accountId`
236
- query parameter even though most account-scoped routes place it in the path.
237
- The SDK obtains it from the optional method argument or the client default:
243
+ `GET /v1/assignments` takes the workspace in the camel-case `accountId` query
244
+ parameter (required unless an OAuth token names it) even though most
245
+ account-scoped routes place it in the path. The SDK always sends it, from the
246
+ optional method argument or the client default:
238
247
 
239
248
  ```ts
240
249
  const page = await client.assignments.list(
@@ -345,9 +354,10 @@ also retains `is_active` on create and `type` or `is_required` on update for
345
354
  deployments that accept them. New code should prefer the operation-specific
346
355
  official fields.
347
356
 
348
- The field-validation schemas omit the `signer-access-code` query parameter used
349
- by some signer portals. `fields.validate()` and `validateMultiple()` retain the
350
- typed `signerAccessCode` option for those environments.
357
+ Field validation authenticates with the workspace credentials or with a signer
358
+ access code. With `signerAccessCode`, `fields.validate()` and
359
+ `validateMultiple()` send the code as the `signer-access-code` query on the
360
+ credential-free transport, so it never travels with the API key or token.
351
361
 
352
362
  ## Signer request extensions
353
363
 
@@ -364,6 +374,11 @@ inputs remain accepted:
364
374
  New integrations should use the official fields, including `government_id`. `cpf` is not an alias for the official update field, and signer
365
375
  responses do not return it.
366
376
 
377
+ On update, `null` or `''` clears `email`, `whatsapp_phone_number` (stored as
378
+ `null`) and `government_id`; `full_name` cannot be cleared. Changing the e-mail
379
+ or phone of a signer who has not verified yet issues new codes, and an open
380
+ embed frame then reports `session_expired`.
381
+
367
382
  ## Digital certificate and collect placement
368
383
 
369
384
  `DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
@@ -424,8 +439,9 @@ retaining the other document fields.
424
439
  belongs to the document creator. Do not infer the absence of a decline merely
425
440
  because that field is missing for another authenticated user.
426
441
 
427
- Owner and signer downloads accept `original`, `certificated`,
428
- `certificate-page`, `pades`, and `bundle`:
442
+ Owner downloads accept `original`, `certificated`, `certificate-page`, `pades`,
443
+ and `bundle`; a signer with an access code can download only `original` (the
444
+ certified copy is sent to them instead):
429
445
 
430
446
  - `pades` exists only when the document had an ICP-Brasil certificate signer;
431
447
  - `bundle` is a ZIP containing `original`, `certificated`, and
@@ -435,16 +451,29 @@ Owner and signer downloads accept `original`, `certificated`,
435
451
 
436
452
  Document and page download URLs in JSON responses are protected. Prefer the
437
453
  typed download methods so credentials are applied and binary data is returned
438
- as a `Buffer`.
454
+ as a `Buffer`. `thumbnail()` and `downloadPage()` accept `{ artifact:
455
+ 'certificated' }` for the signed render (`404` until certified, `503` with
456
+ `Retry-After` while it is produced). `details()` accepts `expand:
457
+ ['envelope_id', 'envelope']`; those keys never appear in lists or webhooks.
439
458
 
440
459
  ## Signer-side preconditions
441
460
 
442
- The signer `confirm-data` body contains `full_name`, `email`,
443
- `government_id`, and `has_accepted_terms`. A certificate signer must confirm
444
- data and accept terms before `getAssignment()`; either send
445
- `has_accepted_terms: true` with `confirmData()` or call `acceptTerms()` first.
446
- The `has_accepted_terms` query on `getAssignment()` is too late to open that
447
- gate for a certificate signer.
461
+ The production signer `confirm-data` body contains `email`,
462
+ `whatsapp_phone_number` and `has_accepted_terms`: the signer sends the contact
463
+ their channel needs, saved only when they have none. It answers `data: []`, so
464
+ `confirmData()` resolves to `null`; older deployments read `full_name` and
465
+ `government_id` and return the signer, so the SDK still forwards those fields.
466
+ A certificate signer must confirm data and accept terms before
467
+ `getAssignment()`; either send `has_accepted_terms: true` with `confirmData()`
468
+ or call `acceptTerms()` first. The `has_accepted_terms` query on
469
+ `getAssignment()` is too late to open that gate for a certificate signer.
470
+
471
+ Signer reads return `ISigningDocument`. A code closes 30 minutes after its
472
+ signer is done (with every document of an envelope); reads then return only
473
+ `id`, `name`, `status`, `current_signer`, `certified_copy` and `envelope`, with
474
+ `is_signer_access_closed: true`, and every other signer route answers `410`.
475
+ An envelope code opens another of its documents with `getAssignment(code, {
476
+ documentId })`, and `expand: ['envelope']` names the envelope.
448
477
 
449
478
  `getAssignment()` uses `GET /sign`, but the API records the signer as having
450
479
  viewed the assignment. The SDK therefore excludes this request from automatic
@@ -474,8 +503,9 @@ remove the expiration. The SDK always sends that key.
474
503
 
475
504
  ## Resend-cost response variants
476
505
 
477
- The official resend-cost response is `ICostEstimate`. Older deployments can
478
- return a compact branch, so the SDK exposes `IResendCostEstimate`:
506
+ Production answers the compact `ResendCostEstimate` (`total`,
507
+ `has_sufficient_credits`, nullable `credit_balance`); older deployments return
508
+ the full `ICostEstimate`, so the SDK exposes `IResendCostEstimate`:
479
509
 
480
510
  ```ts
481
511
  const estimate = await client.assignments.estimateResendCost(
@@ -505,25 +535,30 @@ const document = await client.documents.getPublic(documentId);
505
535
  const pages = document.pages?.length ?? Number(document.page_count ?? 0);
506
536
  ```
507
537
 
508
- Signer artifact download is public in the OpenAPI document and requires no
509
- access-code query in the official three-argument call. An optional fourth code
510
- is available only for older deployments that require it.
538
+ Signer artifact download requires the access code and offers only `original`;
539
+ without a usable code the API redirects to its expired-link page. The SDK does
540
+ not follow that redirect, so the call throws `ApiError` (`302`) instead of
541
+ returning HTML bytes. The certified-copy link download
542
+ (`downloadCertifiedCopy(token)`) behaves the same way for an expired link; ask
543
+ for a new link with `resendCertifiedCopyFromLink(token)`.
511
544
 
512
545
  ## Empty acknowledgements
513
546
 
514
547
  Several write operations return a success envelope without `data`; older
515
548
  responses can use an empty array or object. Methods with no meaningful result
516
549
  resolve to `Promise<void>` after validating the HTTP and envelope status. This
517
- applies to token dispatch, signer OTP and terms, signature-image upload, bulk
518
- signer actions, and deletions without a documented result. Tag deletion and
550
+ applies to signer OTP verification, signature-image upload, bulk signer
551
+ actions, and deletions without a documented result. `acceptTerms()` returns
552
+ the signer's `{ full_name, email, has_accepted_terms }`. Tag deletion and
519
553
  document-tag detachment preserve `{ deleted: boolean }` and
520
554
  `{ detached: boolean }`.
521
555
 
522
556
  ## WhatsApp notification buttons
523
557
 
524
- The published notification button schema requires `text`. Some deployments
525
- also return `url`, so the SDK types it as optional. A button URL can contain a
526
- signer access or verification value; treat it as a credential and never log it.
558
+ The published notification button schema requires `text`. Production strips
559
+ button URLs; the sandbox returns `url`, so the SDK types it as optional. A
560
+ button URL can contain a signer access or verification value; treat it as a
561
+ credential and never log it. `sent_at` is an ISO-8601 string.
527
562
 
528
563
  ## Webhook delivery
529
564
 
@@ -554,7 +589,13 @@ target of `deleteEndpointByUrl(url, accountId?)`.
554
589
 
555
590
  New or changed endpoint URLs must use HTTPS. Endpoint responses expose
556
591
  `is_held` and `held_since`; dispatch entries expose `webhook_id`, `attempt`,
557
- `kind`, and `will_retry`. `createEndpoint()` returns
592
+ `kind`, `will_retry`, and `duration_ms`. `testEndpoint()` sends one signed
593
+ `webhook_test` event (not subscribable, `payload` and `origin` `null`), also to a
594
+ held or inactive endpoint, without lifting or counting toward a hold; it is
595
+ limited to 10 per user every 10 minutes. `rotateEndpointSecret(endpointId,
596
+ accountId?, { keep_previous: true })` keeps the old secret signing beside the
597
+ new one for 24 hours (`previous_secret_expires_at`); each delivery then carries
598
+ two `v1,` entries, which `verifySignature()` accepts. `createEndpoint()` returns
558
599
  `IWebhookEndpointCreateResponse` with `secret` when signing is enabled.
559
600
  `updateEndpoint()` returns the same shape and includes `secret` when that
560
601
  request turns signing on. Store the value securely. OAuth applications cannot
@@ -575,6 +616,24 @@ return `404` for deletion by URL. API-key integrations can still read/rotate
575
616
  the secret and delete by ID. OAuth integrations can rotate a lost secret where
576
617
  the production route is available.
577
618
 
619
+ ## Refusal codes, idempotency and Bypass
620
+
621
+ - Error bodies carry a string `code` and, for a field `400`, `errors[]`; the SDK
622
+ exposes them as `ApiError.code` and `ApiError.fieldErrors`. The generic `404`
623
+ body's numeric `code: 0` is ignored.
624
+ - Only envelope creation and template document creation deduplicate an
625
+ `Idempotency-Key`; other routes ignore it, so the SDK sends it only from
626
+ `envelopes.create()` and `documents.createFromTemplate()`. Assignment creation
627
+ answers a retry with `400`.
628
+ - `Bypass` verification and notification are enabled per account and absent
629
+ from the published request enums; the SDK accepts them with the pairing the
630
+ API applies (Bypass verification with `Email`, `Whatsapp` or `Bypass`).
631
+ - The embed session exchange route belongs to Assinafy's embed page and is not
632
+ exposed.
633
+
634
+ Usage is documented in the [manual](README.en.md#envelopes) and in each
635
+ method's JSDoc.
636
+
578
637
  ## Authentication isolation
579
638
 
580
639
  Public documents, login and social login, password reset, OAuth URLs, and