@assinafy/sdk 2.7.0 → 2.8.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: 81 paths, 106 HTTP operations, and 44 component
5
+ contract to the public SDK API: 85 paths, 112 HTTP operations, and 45 component
6
6
  schemas.
7
7
 
8
8
  All paths below include the `/v1` prefix shown by the OpenAPI document, except
@@ -14,7 +14,7 @@ Status meanings:
14
14
 
15
15
  - **Covered** — a public, typed SDK method sends the operation.
16
16
  - **Compatibility extension** — route retained for existing integrations but
17
- absent from the current OpenAPI path set and excluded from the 106-operation
17
+ absent from the current OpenAPI path set and excluded from the 112-operation
18
18
  total.
19
19
 
20
20
  ## Accounts — 10/10
@@ -32,7 +32,7 @@ Status meanings:
32
32
  | `DELETE` | `/v1/accounts/{accountId}/logo` | `client.workspaces.deleteLogo(accountId)` | Covered |
33
33
  | `GET` | `/v1/accounts/{accountId}/stats` | `client.workspaces.getStats(accountId, params?)` | Covered |
34
34
 
35
- ## Assignments — 7/7
35
+ ## Assignments — 10/10
36
36
 
37
37
  | Method | Path | SDK method | Status |
38
38
  | --- | --- | --- | --- |
@@ -43,6 +43,9 @@ Status meanings:
43
43
  | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/estimate-resend-cost` | `client.assignments.estimateResendCost(documentId, assignmentId, signerId)` | Covered |
44
44
  | `PUT` | `/v1/documents/{documentId}/assignments/{assignmentId}/reset-expiration` | `client.assignments.resetExpiration(documentId, assignmentId, expiresAt)` | Covered |
45
45
  | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/whatsapp-notifications` | `client.assignments.listWhatsAppNotifications(documentId, assignmentId)` | Covered |
46
+ | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification` | `client.assignments.getIdentityVerification(documentId, assignmentId, signerId)` | Covered |
47
+ | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}` | `client.assignments.downloadIdentityVerificationImage(documentId, assignmentId, signerId, name)` | Covered |
48
+ | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review` | `client.assignments.reviewIdentityVerification(documentId, assignmentId, signerId, payload)` | Covered |
46
49
 
47
50
  ## Authentication — 10/10
48
51
 
@@ -122,18 +125,22 @@ ordinary OAuth applications use the two SDK methods listed below.
122
125
  | `PUT` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.update(signerId, payload, accountId?)` | Covered |
123
126
  | `DELETE` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.delete(signerId, accountId?)` | Covered |
124
127
 
125
- ## Signing and public flows — 17/17
128
+ ## Signing and public flows — 19/19
126
129
 
127
- All methods in this section use the auth-free transport. Most signer operations
128
- authenticate with the `signer-access-code` query parameter required by the
129
- OpenAPI security scheme. The artifact download is explicitly public and accepts
130
+ All access-code methods in this section use the auth-free transport and reject
131
+ a missing or blank code; they authenticate with the `signer-access-code` query
132
+ parameter required by the OpenAPI security scheme. The signer document list and
133
+ search also accept workspace credentials; only the explicit `listAsWorkspace` /
134
+ `searchAsWorkspace` methods send them, and never with an access code. The artifact download is explicitly public and accepts
130
135
  an optional fourth access-code argument only for legacy compatibility.
131
136
 
132
137
  | Method | Path | SDK method | Status |
133
138
  | --- | --- | --- | --- |
134
139
  | `GET` | `/v1/public/documents/{documentId}` | `client.documents.getPublic(documentId)` | Covered |
135
- | `PUT` | `/v1/public/documents/{documentId}/send-token` | `client.documents.sendToken(documentId, email)` | Covered |
140
+ | `PUT` | `/v1/public/documents/{documentId}/send-token` | `client.documents.sendToken(documentId, recipient, channel?)` | Covered |
136
141
  | `GET` | `/v1/signers/self` | `client.signerDocuments.self(accessCode)` | Covered |
142
+ | `GET` | `/v1/signers/identity-verification` | `client.signerDocuments.getIdentityVerification(accessCode)` | Covered |
143
+ | `POST` | `/v1/signers/identity-verification` | `client.signerDocuments.startIdentityVerification(accessCode, payload)` | Covered |
137
144
  | `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode)` | Covered |
138
145
  | `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode, hasAcceptedTerms?)` | Covered |
139
146
  | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}` | `client.signerDocuments.sign(documentId, assignmentId, accessCode, entries)` | Covered |
@@ -145,8 +152,8 @@ an optional fourth access-code argument only for legacy compatibility.
145
152
  | `PUT` | `/v1/signers/accept-terms` | `client.signerDocuments.acceptTerms(accessCode)` | Covered |
146
153
  | `POST` | `/v1/signature` | `client.signerDocuments.uploadSignature(accessCode, image, options?)` | Covered |
147
154
  | `GET` | `/v1/signature/{signatureType}` | `client.signerDocuments.downloadSignature(accessCode, signatureType)` | Covered |
148
- | `GET` | `/v1/signers/{signerId}/documents` | `client.signerDocuments.list(signerId, accessCode, params?)` | Covered |
149
- | `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search)` | Covered |
155
+ | `GET` | `/v1/signers/{signerId}/documents` | `client.signerDocuments.list(signerId, accessCode, params?)` / `client.signerDocuments.listAsWorkspace(signerId, params?)` | Covered |
156
+ | `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search)` / `client.signerDocuments.searchAsWorkspace(signerId, search?)` | Covered |
150
157
  | `GET` | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `client.signerDocuments.download(signerId, documentId, artifactName)` | Covered |
151
158
 
152
159
  ## Tags — 4/4
@@ -181,7 +188,7 @@ Five additional routes are documented separately under
181
188
  | `POST` | `/v1/users/self/mfa/recovery-codes` | `client.users.regenerateRecoveryCodes(proof)` | Covered |
182
189
  | `DELETE` | `/v1/users/self/mfa/{customId}` | `client.users.deleteMfaMethod(methodId, proof)` | Covered |
183
190
 
184
- ## Webhooks — 13/13
191
+ ## Webhooks — 14/14
185
192
 
186
193
  | Method | Path | SDK method | Status |
187
194
  | --- | --- | --- | --- |
@@ -191,8 +198,9 @@ Five additional routes are documented separately under
191
198
  | `GET` | `/v1/webhooks/event-types` | `client.webhooks.listEventTypes()` | Covered |
192
199
  | `GET` | `/v1/accounts/{accountId}/webhooks` | `client.webhooks.listDispatches(params?, accountId?)` | Covered |
193
200
  | `POST` | `/v1/accounts/{accountId}/webhooks/{historyId}/retry` | `client.webhooks.retryDispatch(historyId, accountId?)` | Covered |
194
- | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.listEndpoints(accountId?)` | Covered |
201
+ | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.listEndpoints(accountId?, params?)` | Covered |
195
202
  | `POST` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.createEndpoint(payload, accountId?)` | Covered |
203
+ | `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.deleteEndpointByUrl(url, accountId?)` | Covered |
196
204
  | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.getEndpoint(endpointId, accountId?)` | Covered |
197
205
  | `PUT` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.updateEndpoint(endpointId, payload, accountId?)` | Covered |
198
206
  | `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.deleteEndpoint(endpointId, accountId?)` | Covered |
@@ -202,7 +210,7 @@ Five additional routes are documented separately under
202
210
  ## Template compatibility routes
203
211
 
204
212
  These routes are available to existing integrations but do not appear in the
205
- current OpenAPI path set. They are excluded from the official 106-operation
213
+ current OpenAPI path set. They are excluded from the official 112-operation
206
214
  coverage count.
207
215
 
208
216
  | Method | Path | SDK method | Status |
@@ -217,7 +225,7 @@ coverage count.
217
225
 
218
226
  Two browser URL helpers used by older deployments are live but absent from the
219
227
  current OpenAPI path set, so they are likewise excluded from the official
220
- 106-operation coverage count.
228
+ 112-operation coverage count.
221
229
 
222
230
  | Method | Path | SDK method | Status |
223
231
  | --- | --- | --- | --- |
@@ -38,7 +38,7 @@ GET /v1/login-callback
38
38
 
39
39
  They map to `auth.getSocialLoginUrl()` and
40
40
  `auth.getSocialLoginCallbackUrl()` and are not part of the official
41
- 106-operation total.
41
+ 112-operation total.
42
42
 
43
43
  The SDK also includes the production contract additions for:
44
44
 
@@ -194,34 +194,23 @@ and returns the JPEG bytes as a `Buffer`.
194
194
 
195
195
  ## Public send-token request
196
196
 
197
- The official operation requires a recipient and a channel (`email` is the only
198
- documented channel):
197
+ The operation requires both `channel` and `recipient`; `email` is the only
198
+ channel, and the response `data` is `{ document, channel, recipient }`:
199
199
 
200
200
  ```http
201
201
  PUT /v1/public/documents/{documentId}/send-token
202
202
  Content-Type: application/json
203
203
 
204
- { "recipient": "signer@example.com", "channel": "email" }
204
+ { "channel": "email", "recipient": "signer@example.com" }
205
205
  ```
206
206
 
207
207
  ```ts
208
- await client.documents.sendToken(documentId, 'signer@example.com', 'email');
208
+ const { recipient } = await client.documents.sendToken(documentId, 'signer@example.com');
209
209
  ```
210
210
 
211
- The two-argument overload sends the legacy `{ email }` shape, which current
212
- deployments still accept:
213
-
214
- ```ts
215
- await client.documents.sendToken(documentId, 'signer@example.com');
216
- ```
217
-
218
- When a deployment rejects `{ email }` with a validation response naming
219
- `recipient` or `channel` as required, the SDK retries the documented shape
220
- automatically. Other errors are returned unchanged.
221
-
222
211
  ## Document tags
223
212
 
224
- Replace and attach requests require existing tag IDs:
213
+ The published contract specifies existing tag IDs for replace and attach:
225
214
 
226
215
  ```ts
227
216
  const tag = await client.tags.create({ name: 'Contracts', color: '#ff8800' });
@@ -236,6 +225,13 @@ stored six-character value without it. Unknown tag names are not the normal
236
225
  attachment input; create or list the tag first and send its ID. An empty array
237
226
  passed to `replaceTags` detaches every tag.
238
227
 
228
+ Older sandbox deployments interpret those same string arrays as **tag names**:
229
+ sending an ID creates a new tag whose name is that ID. On such a deployment,
230
+ pass the existing tag's `name` intentionally to attach it. `detachTag` still
231
+ takes an ID. The SDK sends the supplied strings unchanged; it does not retry a
232
+ successful mutation or infer an ID-to-name translation. Check the returned tag
233
+ IDs and names when selecting the deployment's input shape.
234
+
239
235
  ## Account branding fields
240
236
 
241
237
  The official account create/update request schemas define `name` and
@@ -284,9 +280,38 @@ responses do not return it.
284
280
 
285
281
  `DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
286
282
  signer's `government_id`, and exactly one certificate signer in that signing
287
- step. It costs two credits per signer in addition to the selected notification
283
+ step. It costs 0.5 credits per signer in addition to the selected notification
288
284
  cost. Notification methods remain `Email` and `Whatsapp`.
289
285
 
286
+ Template role IDs do not reveal which entries are signers, editors or copy
287
+ receivers. The SDK validates each entry's channel and positive `step`, then
288
+ lets the API enforce role-aware signing order and certificate isolation.
289
+
290
+ ## Identity document and face verification
291
+
292
+ `IdDocumentFaceMatchBasic` requires the **ID Document + Face Match** feature and
293
+ a valid CPF in the signer's `government_id` (a CNPJ is not sufficient). It
294
+ accepts either notification channel. Use assignment or template cost estimation
295
+ for its current per-signer fee before creating the assignment.
296
+
297
+ `signerDocuments.self()` exposes `verification_method` before verification.
298
+ For this method, obtain explicit biometric consent and call
299
+ `startIdentityVerification(accessCode, { consent: true })`; preserve the entire
300
+ returned bearer URL, including its fragment, and keep it out of logs and
301
+ browser storage. `getIdentityVerification()` returns `can_start`, `status`,
302
+ `url`, `expires_at`, and `completed_at`. Only no session or an `Expired` session
303
+ allows another start. `expires_at` is the capture-link expiry, not a processing
304
+ or review deadline. `Declined` and `Abandoned` require a new document/assignment.
305
+
306
+ `InReview` permits signing but holds certification. Once everyone has signed,
307
+ the document is `pending_identity_review`. Account reviewers use
308
+ `assignments.getIdentityVerification()`, `downloadIdentityVerificationImage()`
309
+ and `reviewIdentityVerification()`. Evidence images are available only while
310
+ the review is open and must not be cached. Approval permits certification after
311
+ all reviews are approved; rejection cancels the document and notifies signers
312
+ and copy receivers. The optional nullable note (2000 characters maximum) is
313
+ recorded in activity and sent to the provider, but hidden from signers.
314
+
290
315
  For a `collect` assignment, each field can include `display_settings`.
291
316
  `left`, `top`, `width`, `height`, and `fontSize` are required; `fontFamily` and
292
317
  `backgroundColor` are optional. Values use Assinafy's 150-DPI page-image pixels
@@ -424,17 +449,30 @@ fields.
424
449
 
425
450
  An account has 1 webhook endpoint, or up to 3 on paid plans. The subscription
426
451
  routes (`webhooks.register()`, `get()`, `inactivate()`) act on the account's
427
- oldest endpoint; the endpoint routes address each one by ID.
452
+ oldest endpoint; the endpoint routes address each one by ID. Exact registered
453
+ URLs can also filter `listEndpoints(accountId?, { url })` and identify the
454
+ target of `deleteEndpointByUrl(url, accountId?)`.
455
+
456
+ `createEndpoint()` returns `IWebhookEndpointCreateResponse` with `secret` when
457
+ signing is enabled. Store that value securely at creation, including for OAuth
458
+ applications: they cannot read or rotate the secret afterward. If an OAuth
459
+ application loses it, delete and recreate its endpoint.
428
460
 
429
461
  Signing-enabled endpoints follow Standard Webhooks:
430
462
  `webhook-signature` holds space-separated `v1,<base64>` entries, each an
431
463
  HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
432
464
  base64-decoded part of the `whsec_` secret.
433
465
  `webhookVerifier.verifySignature()` implements this, with a 300-second
434
- timestamp tolerance by default. The signing-secret routes are not available to
466
+ timestamp tolerance by default; non-finite or negative windows fail closed.
467
+ The signing-secret routes are not available to
435
468
  OAuth applications. The earlier `webhookVerifier.verify()` (hex HMAC over the
436
469
  body alone) is deprecated; it never matched an Assinafy signature.
437
470
 
471
+ Older sandbox deployments can omit `secret` from the creation response and
472
+ return `404` for deletion by URL. API-key integrations can still use the secret
473
+ read/rotation and deletion-by-ID routes. OAuth integrations need a deployment
474
+ that returns the creation secret to configure signed endpoints.
475
+
438
476
  ## Authentication isolation
439
477
 
440
478
  Public documents, login and social login, password reset, OAuth URLs, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/sdk",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "packageManager": "bun@1.4.0",
5
5
  "description": "TypeScript SDK for Assinafy API - Digital signature platform",
6
6
  "type": "commonjs",
@@ -63,7 +63,7 @@
63
63
  "bugs": {
64
64
  "url": "https://github.com/assinafy/typescript-sdk/issues"
65
65
  },
66
- "homepage": "https://github.com/assinafy/typescript-sdk/#readme",
66
+ "homepage": "https://www.assinafy.com.br",
67
67
  "devDependencies": {
68
68
  "@arethetypeswrong/cli": "^0.18.5",
69
69
  "@eslint/js": "^10.0.1",