@assinafy/sdk 2.7.1 → 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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.8.0] - 2026-10-16
11
+
12
+ ### Added
13
+
14
+ - Identity-document and face verification: `IdDocumentFaceMatchBasic` on
15
+ assignment and template creation and cost estimation,
16
+ `signerDocuments.getIdentityVerification()` and
17
+ `startIdentityVerification()`, and account-side
18
+ `assignments.getIdentityVerification()`,
19
+ `downloadIdentityVerificationImage()` and `reviewIdentityVerification()`.
20
+ Includes typed provider state, evidence, decisions, webhook events and the
21
+ `pending_identity_review` document status.
22
+ - `webhooks.deleteEndpointByUrl()` deletes an endpoint using its exact
23
+ registered URL. `listEndpoints()` accepts an optional second argument
24
+ `{ url }` to filter by that URL.
25
+ - `webhooks.createEndpoint()` returns `IWebhookEndpointCreateResponse`,
26
+ exposing the signing `secret` supplied at creation so OAuth applications can
27
+ store it without calling the API-key-only secret endpoint.
28
+
29
+ ### Fixed
30
+
31
+ - Reject dot-segment resource IDs before URL normalization can change the
32
+ requested route, and prevent redirect hooks from changing the destination
33
+ after credential checks.
34
+ - Reject invalid webhook timestamp tolerances instead of accepting stale
35
+ signed deliveries with a non-finite replay window.
36
+ - Search every matching signer page for an exact email so idempotent creation
37
+ reuses an existing signer beyond the first 50 substring matches.
38
+ - Let the API validate template signing order using its role definitions, so
39
+ copy receivers and editors are not counted as certificate signing peers.
40
+ - Return processed documents waiting for identity review from
41
+ `documents.waitUntilReady()`.
42
+ - Correct digital-certificate pricing to 0.5 credits plus notification in
43
+ method references and integration examples, and fix optional-page access in
44
+ TypeScript examples.
45
+
10
46
  ## [2.7.1] - 2026-10-12
11
47
 
12
48
  ### Added
@@ -798,7 +834,8 @@ signer fields with `cpf` and `whatsapp_phone_number`.
798
834
  - High-level `uploadAndRequestSignatures` helper on `AssinafyClient`.
799
835
  - `PaginatedResult<T>` with parsed `X-Pagination-*` header meta.
800
836
 
801
- [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.7.1...HEAD
837
+ [Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v2.8.0...HEAD
838
+ [2.8.0]: https://github.com/assinafy/typescript-sdk/releases/tag/v2.8.0
802
839
  [2.7.1]: https://github.com/assinafy/typescript-sdk/compare/v2.7.0...v2.7.1
803
840
  [2.7.0]: https://github.com/assinafy/typescript-sdk/compare/v2.6.0...v2.7.0
804
841
  [2.6.0]: https://github.com/assinafy/typescript-sdk/compare/v2.5.2...v2.6.0
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  TypeScript SDK for the [Assinafy API](https://api.assinafy.com.br/v1/docs) — a Brazilian digital signature platform.
6
6
 
7
- Covers all 106 operations in the current official OpenAPI document: accounts,
7
+ Covers all 112 operations in the current official OpenAPI document: accounts,
8
8
  authentication, OAuth 2.1 applications, users, documents, assignments, signers,
9
9
  signer-side flows, templates, tags, fields, webhooks, branding, statistics, and
10
10
  the high-level `uploadAndRequestSignatures` workflow. Five additional
@@ -339,7 +339,7 @@ The configuration object accepted by `fromConfig` has the exported type
339
339
 
340
340
  ## Endpoint coverage
341
341
 
342
- All 106 operations documented at https://api.assinafy.com.br/v1/docs are
342
+ All 112 operations documented at https://api.assinafy.com.br/v1/docs are
343
343
  covered. The table below is the resource-level summary; the detailed operation
344
344
  ledger is in [docs/API_COVERAGE.md](docs/API_COVERAGE.md).
345
345
 
@@ -347,16 +347,16 @@ ledger is in [docs/API_COVERAGE.md](docs/API_COVERAGE.md).
347
347
  | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
348
348
  | `client.documents` | list, **search**, upload, details, get, **rename**, activities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress |
349
349
  | `client.signers` | create, get, list, update, delete, findByEmail |
350
- | `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications |
350
+ | `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification |
351
351
  | `client.templates` | create, list, get, update, delete, downloadPage |
352
352
  | `client.tags` | list, create, update, delete |
353
353
  | `client.workspaces` | create, list, get, update, delete, getTheme, downloadLogo, uploadLogo, deleteLogo, getStats |
354
- | `client.webhooks` | listEndpoints, createEndpoint, getEndpoint, updateEndpoint, deleteEndpoint, getEndpointSecret, rotateEndpointSecret, register, get, inactivate, listEventTypes, listDispatches, retryDispatch |
354
+ | `client.webhooks` | listEndpoints, createEndpoint, getEndpoint, updateEndpoint, deleteEndpoint, deleteEndpointByUrl, getEndpointSecret, rotateEndpointSecret, register, get, inactivate, listEventTypes, listDispatches, retryDispatch |
355
355
  | `client.fields` | create, list, get, update, delete, validate, validateMultiple, listTypes |
356
356
  | `client.oauth` | **getProtectedResourceMetadata**, **getAuthorizationServerMetadata**, **createAuthorizationUrl**, **readAuthorizationCallback**, **exchangeCode**, **refreshToken**, **revokeToken**, **getUserInfo** |
357
357
  | `client.auth` | getSocialLoginUrl, getSocialLoginCallbackUrl, login, verifyMfa, socialLogin, linkSocialLogin, createApiKey, getApiKey, deleteApiKey, changePassword, requestPasswordReset, resetPassword |
358
358
  | `client.users` | getCurrent, getStats, getNotificationPreferences, updateNotificationPreferences, getMfa, startTotpEnrollment, confirmTotpEnrollment, regenerateRecoveryCodes, deleteMfaMethod |
359
- | `client.signerDocuments` | getCurrent, list, search, listAsWorkspace, searchAsWorkspace, download, signMultiple, declineMultiple, self, acceptTerms, verifyEmail, confirmData, uploadSignature, downloadSignature, getAssignment, sign, decline |
359
+ | `client.signerDocuments` | getCurrent, list, search, listAsWorkspace, searchAsWorkspace, download, signMultiple, declineMultiple, self, getIdentityVerification, startIdentityVerification, acceptTerms, verifyEmail, confirmData, uploadSignature, downloadSignature, getAssignment, sign, decline |
360
360
  | `client.webhookVerifier` | verifySignature, extractEvent, getEventType, getEventData |
361
361
 
362
362
  Every HTTP wrapper has TypeScript-checked request/response shapes and
@@ -429,7 +429,7 @@ type DocumentUploadShape = {
429
429
  ```
430
430
 
431
431
  `DocumentStatus` covers `uploading`, `uploaded`, `metadata_processing`,
432
- `metadata_ready`, `pending_signature`, `expired`, `certificating`,
432
+ `metadata_ready`, `pending_signature`, `pending_identity_review`, `expired`, `certificating`,
433
433
  `certificated`, `rejected_by_signer`, `rejected_by_user`, and `failed`.
434
434
 
435
435
  Uploads must be PDFs, at most 25 MB and at most 2,000 pages (the byte limit is
@@ -603,6 +603,52 @@ before signing. A `DigitalCertificate` signer cannot call `sign`; that branch
603
603
  uses Assinafy's certificate flow, described in
604
604
  [ICP-Brasil digital certificate](#icp-brasil-digital-certificate).
605
605
 
606
+ #### Identity-document verification branch
607
+
608
+ For a separate assignment configured with `verification_method:
609
+ 'IdDocumentFaceMatchBasic'`, enable the **ID Document + Face Match** feature
610
+ and register a valid CPF in the signer's `government_id`. Either notification
611
+ channel is supported; estimate the fee before creating the assignment.
612
+ `self.verification_method` tells a custom signing portal to use this branch
613
+ instead of the email/WhatsApp OTP step.
614
+
615
+ ```ts
616
+ const state = await signerClient.signerDocuments.getIdentityVerification(accessCode);
617
+ // Only after the signer's explicit biometric-processing consent:
618
+ if (state.can_start && signerConsented) {
619
+ const capture = await signerClient.signerDocuments.startIdentityVerification(
620
+ accessCode, { consent: true },
621
+ );
622
+ response.redirect(capture.url); // preserve the fragment; never log or store this bearer URL
623
+ }
624
+ ```
625
+
626
+ An existing `Pending` session exposes its capture link in `state.url`.
627
+ Only no session or `Expired` allows a new start; `Declined` and `Abandoned`
628
+ require a new document/assignment. An elapsed `expires_at` alone does not
629
+ authorize a restart. Once `Approved` or `InReview`, continue with data/terms
630
+ confirmation and signing. `InReview` holds certification; after everyone
631
+ signs the document becomes `pending_identity_review`.
632
+
633
+ ```ts
634
+ // Account-side review, using workspace credentials:
635
+ const review = await client.assignments.getIdentityVerification(documentId, assignmentId, signerId);
636
+ const image = review.images[0];
637
+ if (image) {
638
+ const bytes = await client.assignments.downloadIdentityVerificationImage(documentId, assignmentId, signerId, image);
639
+ // Show to the authorized reviewer without caching or logging the evidence.
640
+ }
641
+ // Send only the account reviewer's explicit decision:
642
+ await client.assignments.reviewIdentityVerification(documentId, assignmentId, signerId, {
643
+ decision: 'Approved', note: 'Verified independently.',
644
+ });
645
+ ```
646
+
647
+ Approval permits certification after all signatures and reviews are complete.
648
+ `Rejected` cancels the document and notifies signers and copy receivers; the
649
+ optional note (up to 2000 characters, or null) stays hidden from them.
650
+ Images are available only while `InReview`.
651
+
606
652
  ### 6. Observe completion and download artifacts
607
653
 
608
654
  Subscribe to `document_ready` for event-driven completion — on an endpoint with
@@ -862,7 +908,8 @@ to `Email`.
862
908
  | --- | --- | --- | --- |
863
909
  | `Email` *(default)* | One-time code (OTP) by email | `Email` | Free |
864
910
  | `Whatsapp` | One-time code (OTP) by WhatsApp | `Whatsapp` | 0.45 credit (the notification), paid plans only |
865
- | `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 |
911
+ | `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` | 0.5 credits + the notification |
912
+ | `IdDocumentFaceMatchBasic` | Hosted identity-document, face and liveness verification | `Email` **or** `Whatsapp` | Use `estimateCost()` |
866
913
 
867
914
  Exactly one notification method per signer. The SDK rejects an invalid
868
915
  combination before the request; the API would answer `400`.
@@ -909,7 +956,7 @@ forward them outside the signing flow.
909
956
 
910
957
  `DigitalCertificate` requires the account feature, a CPF or CNPJ in the
911
958
  signer's `government_id`, and exactly one certificate signer in that signing
912
- step. It costs two credits per certificate signer in addition to the selected
959
+ step. It costs 0.5 credits per certificate signer in addition to the selected
913
960
  notification cost.
914
961
 
915
962
  **A1 and A3 are certificate media**, chosen by the signer in their browser at
@@ -1024,6 +1071,10 @@ await client.tags.delete(tag.id, { force: true }); // detach everywhere,
1024
1071
 
1025
1072
  Attach/detach tags on a specific document via `client.documents.listTags / replaceTags / addTags / detachTag` (see [Documents](#documents)).
1026
1073
 
1074
+ The published attachment contract takes tag IDs. Older sandbox deployments
1075
+ instead interpret strings as names and create ID-named tags for ID inputs;
1076
+ pass existing names intentionally there. See [document tag compatibility](docs/COMPATIBILITY.md#document-tags).
1077
+
1027
1078
  ### Workspaces
1028
1079
 
1029
1080
  The official create/update request schemas define `name` and
@@ -1083,7 +1134,7 @@ await client.fields.get(fieldId);
1083
1134
  await client.fields.update(fieldId, { name: 'Updated Name' });
1084
1135
  await client.fields.delete(fieldId);
1085
1136
 
1086
- // Validate a single value (signer-access-code only required for signer-side calls)
1137
+ // Workspace credentials apply; signerAccessCode is an optional legacy query.
1087
1138
  await client.fields.validate(fieldId, '400.676.228-36', { signerAccessCode });
1088
1139
 
1089
1140
  // Validate multiple values at once
@@ -1182,7 +1233,8 @@ Replacing an already confirmed authenticator also needs `password` or
1182
1233
  An account has 1 webhook endpoint, or up to 3 on paid plans. Every active
1183
1234
  endpoint subscribed to an event receives it independently. OAuth tokens need
1184
1235
  `account:read` to read endpoints and `webhooks:write` to change them; the
1185
- signing secret is available only with an API key.
1236
+ creation response includes `secret` when signing is enabled. Store it then,
1237
+ including for OAuth integrations; reading or rotating it later requires an API key.
1186
1238
 
1187
1239
  ```ts
1188
1240
  const endpoint = await client.webhooks.createEndpoint({
@@ -1194,12 +1246,15 @@ const endpoint = await client.webhooks.createEndpoint({
1194
1246
  });
1195
1247
  // → { id, name, url, email, events, is_active, signing_enabled, created_at, updated_at }
1196
1248
 
1197
- const { secret } = await client.webhooks.getEndpointSecret(endpoint.id); // 'whsec_…'
1249
+ const secret = endpoint.secret; // 'whsec_…'; store securely at creation
1198
1250
  await client.webhooks.listEndpoints(); // IWebhookEndpoint[]
1251
+ await client.webhooks.listEndpoints(undefined, { url: endpoint.url }); // exact URL filter
1199
1252
  await client.webhooks.getEndpoint(endpoint.id);
1200
1253
  await client.webhooks.updateEndpoint(endpoint.id, { is_active: false }); // only the fields sent
1201
1254
  await client.webhooks.rotateEndpointSecret(endpoint.id); // the old secret stops at once
1202
1255
  await client.webhooks.deleteEndpoint(endpoint.id); // frees the plan slot
1256
+ // Alternative when the integration kept only the registered URL:
1257
+ // await client.webhooks.deleteEndpointByUrl(endpoint.url);
1203
1258
 
1204
1259
  await client.webhooks.listEventTypes();
1205
1260
  const history = await client.webhooks.listDispatches({
@@ -1286,6 +1341,11 @@ Event-specific values are:
1286
1341
  | `signer_whatsapp_verified` | `Signer` | `Document` | `signer_whatsapp_phone_number` |
1287
1342
  | `signer_data_confirmed` | `Signer` | `Document` | `signer_email` |
1288
1343
  | `signer_viewed_document` | `Signer` | `Document` | `signer_full_name` |
1344
+ | `signer_identity_verified` | `Signer` | `Document` | `signer_full_name`, `evidence` when available |
1345
+ | `signer_identity_verification_failed` | `Signer` | `Document` | `signer_full_name`, `reason` |
1346
+ | `signer_identity_review_required` | `Signer` | `Document` | `signer_full_name`, `reason_codes` |
1347
+ | `signer_identity_review_approved` | `Signer` | `Document` | `signer_full_name`, `reviewer_id`, `reviewer_name`, `reason_codes` |
1348
+ | `signer_identity_review_rejected` | `Signer` | `Document` | `signer_full_name`, `reviewer_id`, `reviewer_name`, `note` |
1289
1349
  | `signer_signed_document` | `Signer` | `Document` | `signer_full_name` |
1290
1350
  | `signer_rejected_document` | `Signer` | `Document` | `signer_full_name` |
1291
1351
  | `user_rejected_document` | `User` | `Document` | `user_name` |
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  SDK oficial em TypeScript para a [API Assinafy](https://api.assinafy.com.br/v1/docs) — plataforma
6
6
  brasileira de assinatura eletrônica de documentos.
7
7
 
8
- Cobre as 106 operações do documento OpenAPI oficial: contas, autenticação, aplicações OAuth 2.1,
8
+ Cobre as 112 operações do documento OpenAPI oficial: contas, autenticação, aplicações OAuth 2.1,
9
9
  usuários, documentos, assignments, signatários, fluxos do lado do signatário, templates, tags,
10
10
  campos, webhooks, identidade visual, estatísticas e o fluxo de alto nível
11
11
  `uploadAndRequestSignatures`. Cinco rotas adicionais de gestão de templates usadas por integrações
@@ -324,7 +324,7 @@ O objeto aceito por `fromConfig` tem o tipo exportado `ClientConfigInput`.
324
324
 
325
325
  ## Cobertura de endpoints
326
326
 
327
- As 106 operações documentadas em https://api.assinafy.com.br/v1/docs estão cobertas. A tabela abaixo
327
+ As 112 operações documentadas em https://api.assinafy.com.br/v1/docs estão cobertas. A tabela abaixo
328
328
  é o resumo por recurso; o mapa detalhado por operação está em
329
329
  [docs/API_COVERAGE.md](docs/API_COVERAGE.md).
330
330
 
@@ -332,16 +332,16 @@ As 106 operações documentadas em https://api.assinafy.com.br/v1/docs estão co
332
332
  | --- | --- |
333
333
  | `client.documents` | list, search, upload, details, get, rename, activities, waitUntilReady, download, thumbnail, downloadPage, statuses, delete, verify, createFromTemplate, estimateCostFromTemplate, getPublic, sendToken, listTags, replaceTags, addTags, detachTag, isFullySigned, getSigningProgress |
334
334
  | `client.signers` | create, get, list, update, delete, findByEmail |
335
- | `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications |
335
+ | `client.assignments` | list, create, estimateCost, resetExpiration, resendNotification, estimateResendCost, listWhatsAppNotifications, getIdentityVerification, downloadIdentityVerificationImage, reviewIdentityVerification |
336
336
  | `client.templates` | create, list, get, update, delete, downloadPage |
337
337
  | `client.tags` | list, create, update, delete |
338
338
  | `client.workspaces` | create, list, get, update, delete, getTheme, downloadLogo, uploadLogo, deleteLogo, getStats |
339
- | `client.webhooks` | listEndpoints, createEndpoint, getEndpoint, updateEndpoint, deleteEndpoint, getEndpointSecret, rotateEndpointSecret, register, get, inactivate, listEventTypes, listDispatches, retryDispatch |
339
+ | `client.webhooks` | listEndpoints, createEndpoint, getEndpoint, updateEndpoint, deleteEndpoint, deleteEndpointByUrl, getEndpointSecret, rotateEndpointSecret, register, get, inactivate, listEventTypes, listDispatches, retryDispatch |
340
340
  | `client.fields` | create, list, get, update, delete, validate, validateMultiple, listTypes |
341
341
  | `client.oauth` | **getProtectedResourceMetadata**, **getAuthorizationServerMetadata**, **createAuthorizationUrl**, **readAuthorizationCallback**, **exchangeCode**, **refreshToken**, **revokeToken**, **getUserInfo** |
342
342
  | `client.auth` | getSocialLoginUrl, getSocialLoginCallbackUrl, login, verifyMfa, socialLogin, linkSocialLogin, createApiKey, getApiKey, deleteApiKey, changePassword, requestPasswordReset, resetPassword |
343
343
  | `client.users` | getCurrent, getStats, getNotificationPreferences, updateNotificationPreferences, getMfa, startTotpEnrollment, confirmTotpEnrollment, regenerateRecoveryCodes, deleteMfaMethod |
344
- | `client.signerDocuments` | getCurrent, list, search, listAsWorkspace, searchAsWorkspace, download, signMultiple, declineMultiple, self, acceptTerms, verifyEmail, confirmData, uploadSignature, downloadSignature, getAssignment, sign, decline |
344
+ | `client.signerDocuments` | getCurrent, list, search, listAsWorkspace, searchAsWorkspace, download, signMultiple, declineMultiple, self, getIdentityVerification, startIdentityVerification, acceptTerms, verifyEmail, confirmData, uploadSignature, downloadSignature, getAssignment, sign, decline |
345
345
  | `client.webhookVerifier` | verifySignature, extractEvent, getEventType, getEventData |
346
346
 
347
347
  Todo wrapper HTTP tem tipos de requisição e resposta verificados pelo TypeScript e JSDoc por método,
@@ -407,7 +407,7 @@ type DocumentUploadShape = {
407
407
  ```
408
408
 
409
409
  `DocumentStatus` cobre `uploading`, `uploaded`, `metadata_processing`, `metadata_ready`,
410
- `pending_signature`, `expired`, `certificating`, `certificated`, `rejected_by_signer`,
410
+ `pending_signature`, `pending_identity_review`, `expired`, `certificating`, `certificated`, `rejected_by_signer`,
411
411
  `rejected_by_user` e `failed`.
412
412
 
413
413
  O envio precisa ser um PDF de no máximo 25 MB e 2.000 páginas (o limite em bytes está exportado
@@ -573,6 +573,53 @@ assinar. Um signatário `DigitalCertificate` não pode usar `sign`; esse ramo pa
573
573
  certificado da Assinafy, descrito em
574
574
  [Certificado digital ICP-Brasil](#certificado-digital-icp-brasil).
575
575
 
576
+ #### Ramo de verificação do documento de identidade
577
+
578
+ Para um assignment separado com `verification_method:
579
+ 'IdDocumentFaceMatchBasic'`, habilite **ID Document + Face Match** e cadastre
580
+ um CPF válido no `government_id` do signatário. Os dois canais de notificação
581
+ são aceitos; estime o custo antes de criar o assignment.
582
+ `self.verification_method` informa ao portal que deve usar este ramo em vez
583
+ da etapa de código de uso único por e-mail/WhatsApp.
584
+
585
+ ```ts
586
+ const estado = await clienteSignatario.signerDocuments.getIdentityVerification(accessCode);
587
+ // Somente após consentimento explícito do signatário para o tratamento biométrico:
588
+ if (estado.can_start && signatarioConsentiu) {
589
+ const captura = await clienteSignatario.signerDocuments.startIdentityVerification(
590
+ accessCode, { consent: true },
591
+ );
592
+ response.redirect(captura.url); // preserve o fragmento; não registre nem armazene esta URL credencial
593
+ }
594
+ ```
595
+
596
+ Uma sessão `Pending` existente expõe o link de captura em `estado.url`.
597
+ Só a ausência de sessão ou `Expired` permite iniciar outra; `Declined` e
598
+ `Abandoned` exigem novo documento/assignment. O simples vencimento de
599
+ `expires_at` não autoriza reinício. Em `Approved` ou `InReview`, continue
600
+ com confirmação dos dados/termos e assinatura. `InReview` segura a
601
+ certificação; depois que todos assinam, o documento fica
602
+ `pending_identity_review`.
603
+
604
+ ```ts
605
+ // Lado da conta, com credenciais do workspace:
606
+ const revisao = await client.assignments.getIdentityVerification(documentId, assignmentId, signerId);
607
+ const imagem = revisao.images[0];
608
+ if (imagem) {
609
+ const bytes = await client.assignments.downloadIdentityVerificationImage(documentId, assignmentId, signerId, imagem);
610
+ // Exiba ao revisor autorizado sem cache nem log das evidências.
611
+ }
612
+ // Envie somente a decisão explícita do revisor da conta:
613
+ await client.assignments.reviewIdentityVerification(documentId, assignmentId, signerId, {
614
+ decision: 'Approved', note: 'Identidade conferida independentemente.',
615
+ });
616
+ ```
617
+
618
+ A aprovação permite certificar depois de todas as assinaturas e aprovações.
619
+ `Rejected` cancela o documento e notifica signatários e destinatários de cópia;
620
+ a nota opcional (até 2000 caracteres, ou null) não é mostrada a eles.
621
+ As imagens só ficam disponíveis em `InReview`.
622
+
576
623
  ### 6. Acompanhe a conclusão e baixe os artefatos
577
624
 
578
625
  Assine o evento `document_ready` para saber da conclusão por evento — em um endpoint com
@@ -821,7 +868,8 @@ que faltar é inferido. Sem nenhum dos dois, ambos assumem `Email`.
821
868
  | --- | --- | --- | --- |
822
869
  | `Email` *(padrão)* | Código de uso único (OTP) por e-mail | `Email` | Gratuito |
823
870
  | `Whatsapp` | Código de uso único (OTP) por WhatsApp | `Whatsapp` | 0,45 crédito (a notificação), só em planos pagos |
824
- | `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada** | `Email` **ou** `Whatsapp` | 2 créditos + a notificação |
871
+ | `DigitalCertificate` | O signatário assina com o **próprio certificado ICP-Brasil — A1 ou A3 —** pela extensão Web PKI, gerando uma assinatura **PAdES qualificada** | `Email` **ou** `Whatsapp` | 0,5 crédito + a notificação |
872
+ | `IdDocumentFaceMatchBasic` | Documento de identidade, foto e prova de vida em sessão hospedada | `Email` **ou** `Whatsapp` | Consulte `estimateCost()` |
825
873
 
826
874
  Apenas um método de notificação por signatário. O SDK recusa uma combinação inválida antes da
827
875
  requisição; a API responderia `400`.
@@ -867,7 +915,7 @@ nem encaminhe fora do fluxo de assinatura.
867
915
 
868
916
  `DigitalCertificate` exige o recurso **Certificado Digital** na conta (planos Standard e Pro), CPF ou
869
917
  CNPJ em `government_id` do signatário, e exatamente **um signatário por certificado naquele passo de
870
- assinatura**. Custa 2 créditos por signatário, além do custo da notificação escolhida.
918
+ assinatura**. Custa 0,5 crédito por signatário, além do custo da notificação escolhida.
871
919
 
872
920
  **A1 e A3 são mídias de certificado**, escolhidas pelo próprio signatário no navegador na hora de
873
921
  assinar: A1 fica em software (um arquivo na máquina) e A3 em hardware (token ou cartão). A API
@@ -992,6 +1040,10 @@ await client.tags.delete(tag.id, { force: true }); // desanexa de tudo e
992
1040
  Anexe/desanexe tags em um documento específico com `client.documents.listTags / replaceTags /
993
1041
  addTags / detachTag` (veja [Documentos](#documentos)).
994
1042
 
1043
+ O contrato publicado usa IDs para anexar tags. Sandboxes antigos interpretam
1044
+ essas strings como nomes e criam tags com o ID como nome; nesses ambientes,
1045
+ envie nomes existentes intencionalmente. Veja a [compatibilidade de tags](docs/COMPATIBILITY.md#document-tags).
1046
+
995
1047
  ### Workspaces
996
1048
 
997
1049
  Os schemas oficiais de criação/atualização definem `name` e `notification_sender_type`. O sandbox
@@ -1051,7 +1103,7 @@ await client.fields.get(fieldId);
1051
1103
  await client.fields.update(fieldId, { name: 'Nome atualizado' });
1052
1104
  await client.fields.delete(fieldId);
1053
1105
 
1054
- // Valida um único valor (o código de acesso só é exigido nas chamadas do signatário)
1106
+ // Usa credenciais do workspace; signerAccessCode é uma query legada opcional.
1055
1107
  await client.fields.validate(fieldId, '400.676.228-36', { signerAccessCode });
1056
1108
 
1057
1109
  // Valida vários valores de uma vez
@@ -1152,7 +1204,8 @@ Trocar um autenticador já confirmado exige também `password` ou `reauth_code`
1152
1204
 
1153
1205
  Uma conta tem 1 endpoint de webhook, ou até 3 nos planos pagos. Cada endpoint ativo inscrito em um
1154
1206
  evento o recebe, de forma independente. Tokens OAuth exigem `account:read` para ler endpoints e
1155
- `webhooks:write` para alterá-los; o segredo de assinatura só é acessível com chave de API.
1207
+ `webhooks:write` para alterá-los. Com assinatura ativa, a criação devolve `secret`: guarde-o também
1208
+ nas integrações OAuth. Ler ou rotacionar esse segredo depois exige chave de API.
1156
1209
 
1157
1210
  ```ts
1158
1211
  const endpoint = await client.webhooks.createEndpoint({
@@ -1164,12 +1217,15 @@ const endpoint = await client.webhooks.createEndpoint({
1164
1217
  });
1165
1218
  // → { id, name, url, email, events, is_active, signing_enabled, created_at, updated_at }
1166
1219
 
1167
- const { secret } = await client.webhooks.getEndpointSecret(endpoint.id); // 'whsec_…'
1220
+ const secret = endpoint.secret; // 'whsec_…'; guarde em armazenamento seguro na criação
1168
1221
  await client.webhooks.listEndpoints(); // IWebhookEndpoint[]
1222
+ await client.webhooks.listEndpoints(undefined, { url: endpoint.url }); // filtro exato por URL
1169
1223
  await client.webhooks.getEndpoint(endpoint.id);
1170
1224
  await client.webhooks.updateEndpoint(endpoint.id, { is_active: false }); // só os campos enviados
1171
1225
  await client.webhooks.rotateEndpointSecret(endpoint.id); // o segredo antigo para na hora
1172
1226
  await client.webhooks.deleteEndpoint(endpoint.id); // libera a vaga do plano
1227
+ // Alternativa quando a integração guardou somente a URL:
1228
+ // await client.webhooks.deleteEndpointByUrl(endpoint.url);
1173
1229
 
1174
1230
  await client.webhooks.listEventTypes();
1175
1231
  const historico = await client.webhooks.listDispatches({
@@ -1250,6 +1306,11 @@ Os valores por evento são:
1250
1306
  | `signer_whatsapp_verified` | `Signer` | `Document` | `signer_whatsapp_phone_number` |
1251
1307
  | `signer_data_confirmed` | `Signer` | `Document` | `signer_email` |
1252
1308
  | `signer_viewed_document` | `Signer` | `Document` | `signer_full_name` |
1309
+ | `signer_identity_verified` | `Signer` | `Document` | `signer_full_name`, `evidence` quando disponível |
1310
+ | `signer_identity_verification_failed` | `Signer` | `Document` | `signer_full_name`, `reason` |
1311
+ | `signer_identity_review_required` | `Signer` | `Document` | `signer_full_name`, `reason_codes` |
1312
+ | `signer_identity_review_approved` | `Signer` | `Document` | `signer_full_name`, `reviewer_id`, `reviewer_name`, `reason_codes` |
1313
+ | `signer_identity_review_rejected` | `Signer` | `Document` | `signer_full_name`, `reviewer_id`, `reviewer_name`, `note` |
1253
1314
  | `signer_signed_document` | `Signer` | `Document` | `signer_full_name` |
1254
1315
  | `signer_rejected_document` | `Signer` | `Document` | `signer_full_name` |
1255
1316
  | `user_rejected_document` | `User` | `Document` | `user_name` |