@assinafy/cli 2.6.0 → 2.7.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.
Files changed (37) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.en.md +50 -20
  3. package/README.md +38 -10
  4. package/THIRD_PARTY_NOTICES.md +1 -1
  5. package/dist/api.cjs +235 -34
  6. package/dist/api.cjs.map +1 -1
  7. package/dist/api.js +234 -34
  8. package/dist/api.js.map +1 -1
  9. package/dist/cli.cjs +365 -68
  10. package/dist/types/api/client.d.ts +2 -0
  11. package/dist/types/api/client.d.ts.map +1 -1
  12. package/dist/types/api/contract-types.d.ts +110 -0
  13. package/dist/types/api/contract-types.d.ts.map +1 -0
  14. package/dist/types/api/index.d.ts +2 -0
  15. package/dist/types/api/index.d.ts.map +1 -1
  16. package/dist/types/api/resources/assignments.d.ts +2 -2
  17. package/dist/types/api/resources/assignments.d.ts.map +1 -1
  18. package/dist/types/api/resources/authentication.d.ts +3 -3
  19. package/dist/types/api/resources/authentication.d.ts.map +1 -1
  20. package/dist/types/api/resources/contracts.d.ts +19 -0
  21. package/dist/types/api/resources/contracts.d.ts.map +1 -0
  22. package/dist/types/api/resources/documents.d.ts +4 -3
  23. package/dist/types/api/resources/documents.d.ts.map +1 -1
  24. package/dist/types/api/resources/webhooks.d.ts +4 -3
  25. package/dist/types/api/resources/webhooks.d.ts.map +1 -1
  26. package/dist/types/api/types.d.ts +69 -18
  27. package/dist/types/api/types.d.ts.map +1 -1
  28. package/dist/types/api/utils.d.ts +8 -2
  29. package/dist/types/api/utils.d.ts.map +1 -1
  30. package/docs/README.md +2 -1
  31. package/docs/api-operations.json +49 -1
  32. package/docs/api-reference.md +1454 -295
  33. package/docs/contracts.md +128 -0
  34. package/docs/documents.md +7 -4
  35. package/docs/oauth-guide.md +5 -5
  36. package/docs/sdk-reference.md +156 -15
  37. package/package.json +2 -2
package/CONTRIBUTING.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributing
2
2
 
3
- Use Node.js 24 LTS for development; Node.js 22.12 and 26 remain CI compatibility
3
+ Use Node.js 26 LTS for development; Node.js 22.12 and 24 remain CI compatibility
4
4
  targets. Install exactly from the lockfile and run the complete local gate:
5
5
 
6
6
  ```bash
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  The official command-line interface and Node.js SDK for the [Assinafy API](https://api.assinafy.com.br/v1/docs), a Brazilian digital-signature platform. Upload PDFs, manage signers, request signatures, track activity history, and download certified documents — from a terminal, a shell script, or an application.
6
6
 
7
- The CLI is a single self-contained executable. It prints human-readable tables by default and structured JSON with `--json`, so the same commands serve both interactive use and automation. The same package exposes a fully typed SDK at `@assinafy/cli/api` covering all 112 published API operations.
7
+ The CLI is a single self-contained executable. It prints human-readable tables by default and structured JSON with `--json`, so the same commands serve both interactive use and automation. The same package exposes a fully typed SDK at `@assinafy/cli/api` covering all 118 published API operations.
8
8
 
9
9
  This document reads top to bottom: install, authenticate, send your first signature request, then understand the model well enough to automate it. The [command reference](#command-reference) and [SDK](#nodejs-sdk) sections near the end are lookup tables you can jump to once the flow makes sense.
10
10
 
@@ -17,20 +17,21 @@ This document reads top to bottom: install, authenticate, send your first signat
17
17
  5. [How signing works](#how-signing-works)
18
18
  6. [The complete owner workflow](#the-complete-owner-workflow)
19
19
  7. [The signer side](#the-signer-side)
20
- 8. [Webhooks](#webhooks)
21
- 9. [Output and scripting](#output-and-scripting)
22
- 10. [Configuration](#configuration)
23
- 11. [Command reference](#command-reference)
24
- 12. [Node.js SDK](#nodejs-sdk)
25
- 13. [Security](#security)
26
- 14. [Development](#development)
27
- 15. [Release](#release)
28
- 16. [Contract boundaries](#contract-boundaries)
29
- 17. [License](#license)
20
+ 8. [Contract tracking (CLM)](#contract-tracking-clm)
21
+ 9. [Webhooks](#webhooks)
22
+ 10. [Output and scripting](#output-and-scripting)
23
+ 11. [Configuration](#configuration)
24
+ 12. [Command reference](#command-reference)
25
+ 13. [Node.js SDK](#nodejs-sdk)
26
+ 14. [Security](#security)
27
+ 15. [Development](#development)
28
+ 16. [Release](#release)
29
+ 17. [Contract boundaries](#contract-boundaries)
30
+ 18. [License](#license)
30
31
 
31
32
  ## Requirements
32
33
 
33
- - Node.js `>=22.12.0`. Node.js 24 LTS is recommended and is what CI publishes with; CI also tests 22 and 26.
34
+ - Node.js `>=22.12.0`. Node.js 26 LTS is recommended and is what CI publishes with; CI also tests 22 and 24.
34
35
  - HTTPS with TLS 1.2 or higher to reach the Assinafy API; supported Node.js versions use that minimum by default.
35
36
  - An Assinafy account and an API key or consented OAuth connection (see [Authentication](#authentication)).
36
37
  - Linux, macOS, or Windows. Release archives ship for `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`, `windows-x64`, and `windows-arm64`.
@@ -250,7 +251,7 @@ Where email or WhatsApp verification is configured, the signer also confirms a 6
250
251
 
251
252
  For A1/A3 certificates, use Assinafy's hosted signing page or integrate Web PKI with the SDK. After document review and terms acceptance, `signer certificate-start --json` returns `{ "token": "..." }`. Have the browser sign that operation on the signer's device, then set `ASSINAFY_CERTIFICATE_TOKEN` to the same token and run `signer certificate-complete --json`; it returns `{ "signerName": "..." }`. Private keys and passwords/PINs stay on the device. Wait for `certificated` status and download `--artifact pades` or `bundle`. The ordinary `sign` command does not perform this handshake. These two production routes use the signing application's payloads and are not yet OpenAPI paths.
252
253
 
253
- Before estimating or creating a certificate assignment, set the signer's CPF/CNPJ with `signers.update(signerId, { government_id })`, or `assinafy signers update <signerId> --cpf '<signer-CPF-or-CNPJ>'`. The update command sends `government_id`. Creating a signer by email may reuse an existing record without updating it. Each certificate signer needs a matching certificate and an individual signing step.
254
+ Before estimating or creating a certificate assignment, set the signer's CPF/CNPJ with `signers.update(signerId, { government_id })`, or `assinafy signers update <signerId> --government-id '<signer-CPF-or-CNPJ>'`. The update command sends `government_id`. Creating a signer by email may reuse an existing record without updating it. Each certificate signer needs a matching certificate and an individual signing step.
254
255
 
255
256
  For biometrics, create or explicitly update the signer with a valid CPF, estimate cost and create an `IdDocumentFaceMatchBasic` assignment. Present the document, terms and biometric-processing consent, then use the signer's private access code:
256
257
 
@@ -282,6 +283,29 @@ Single-document confirmation, signing, and decline commands verify that the acce
282
283
 
283
284
  Owner API credentials are stripped from every public and signer-side request, so an access-code flow can never leak your workspace key. The published signer artifact download is public; passing `--access-code` adds an identity preflight that confirms the code belongs to the signer being downloaded for.
284
285
 
286
+ ## Contract tracking (CLM)
287
+
288
+ Contract tracking records counterparty, value, dates, renewal settings and signed amendments on an existing document. Upload and signing remain separate. Writes need a plan with contract tracking; reads remain available when that plan lapses. OAuth uses `documents:read` and `documents:write`.
289
+
290
+ Upload the document and persist its ID first. Set draft terms, activate them when lifecycle tracking should begin, and use separate uploaded documents for signed amendments. An amendment's delta applies after certification, in signing order.
291
+
292
+ ```bash
293
+ assinafy documents upload contract.pdf --wait --json
294
+ assinafy contracts set <documentId> --data '{"status":"draft","counterparty_name":"Example Company","value":1200.50,"currency":"BRL","start_date":"2027-01-01","end_date":"2027-12-31","auto_renew":false,"renewal_term_months":12,"notice_period_days":30}'
295
+ assinafy contracts get <documentId> --json
296
+ assinafy contracts set <documentId> --data '{"status":"active","updated_at":"<returned timestamp>"}'
297
+ assinafy contracts list --status active --ending-within-days 30 --expand document --page 1
298
+ assinafy contracts set <amendmentId> --data '{"parent_document_id":"<documentId>","relation_type":"amendment","value":1500}'
299
+ assinafy contracts related <amendmentId> --json
300
+ assinafy contracts renew <documentId> --data '{"term":1,"updated_at":"<returned timestamp>"}'
301
+ assinafy contracts terminate <documentId> --data '{"reason":"Agreed termination","updated_at":"<returned timestamp>"}'
302
+ assinafy documents activities <documentId> --page 2 --sort id
303
+ ```
304
+
305
+ Replace IDs and timestamps with your integration's values. Renew and terminate prompt for confirmation; `--yes` supports automation. Send the `updated_at` from your latest read with each write. A `409 ContractChanged` requires a fresh read and a decision about whether the change still applies. Renewal requires the current `term` or a later `end_date`, preventing a repeated request from renewing twice. The SDK never retries writes automatically.
306
+
307
+ Omitted terms stay unchanged; null clears them, and `external_references` replaces the complete list. On a pending amendment, null removes a proposed change; `parent_document_id: null` unlinks it. Applied amendments are read-only. Hourly lifecycle processing uses Brasília calendar days and may email the contract owner according to notification preferences. A lapsed plan pauses processing. Subscribe explicitly to contract webhook events and reconcile missed changes by paging `contracts list --sort=-updated_at`. See the [complete SDK payloads and responses](docs/sdk-reference.md#contracts-clientcontracts) and [command help](docs/contracts.md).
308
+
285
309
  ## Webhooks
286
310
 
287
311
  Polling works, but webhooks are the right way to react to signing events. A workspace can register 1 webhook endpoint, or up to 3 on paid plans. Each endpoint has its own URL, events, active flag, and signing setting, and every active endpoint subscribed to an event receives it independently.
@@ -306,9 +330,9 @@ assinafy webhooks retry <dispatchId> # redeliver one event
306
330
  assinafy webhooks verify body.json --id <webhook-id> --timestamp <webhook-timestamp> --signature <webhook-signature>
307
331
  ```
308
332
 
309
- Omitting `--events` subscribes to `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document`, and `document_processing_failed`. `endpoints update` changes only the flags given (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); disabling signing discards the secret. `rotate-secret` invalidates the previous secret immediately. A duplicate URL within the workspace returns `400`; creating past the plan limit returns `403`. Secret read and rotation are not available to OAuth applications. `retry` re-sends only to that delivery's endpoint, and only while it is active.
333
+ Omitting `--events` subscribes to `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document`, and `document_processing_failed`. `endpoints update` changes only the flags given (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); disabling signing discards the secret. `rotate-secret` invalidates the previous secret immediately. A duplicate URL within the workspace returns `400`; creating past the plan limit returns `403`. OAuth applications cannot read an existing signing secret; `webhooks:write` permits rotation and returns the new secret. Enabling signing on an existing endpoint also returns the new secret once. New or changed webhook URLs require HTTPS. `retry` re-sends only to that delivery's endpoint, and only while it is active.
310
334
 
311
- Creating a signed endpoint returns `secret` once, including through OAuth; store it securely. The CLI prints it in human and JSON output. OAuth applications that lose it must delete and recreate the endpoint. `endpoints list --url <url>` filters by the exact registered URL; `endpoints delete-by-url --url <url>` deletes by that URL and requires confirmation or `--yes`.
335
+ Creating a signed endpoint returns `secret` once, including through OAuth; store it securely. The CLI prints it in human and JSON output. OAuth applications that lose it can rotate the secret with `webhooks:write` and store the new value. `endpoints list --url <url>` filters by the exact registered URL; `endpoints delete-by-url --url <url>` deletes by that URL and requires confirmation or `--yes`.
312
336
 
313
337
  `webhooks register`, `webhooks get`, and `webhooks inactivate` remain and act on the workspace's oldest endpoint.
314
338
 
@@ -325,7 +349,7 @@ if (!verifier.verifyDelivery(rawBody, headers)) {
325
349
  const event = verifier.extractEvent(rawBody);
326
350
  ```
327
351
 
328
- `verifyDelivery` compares the HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` in constant time and rejects timestamps more than 5 minutes from your clock. Answer with a `2xx` quickly: a failure is retried once after 3 seconds, and 10 consecutive failed events pause the endpoint until a delivery succeeds. `document_ready` means the last signer signed, not that upload processing finished. Treat events as signals and confirm state through the API before irreversible actions.
352
+ `verifyDelivery` compares the HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` in constant time and rejects timestamps more than 5 minutes from your clock. Answer with a `2xx` quickly: connection errors, timeouts, `408`, `429` and `5xx` receive up to six total attempts about ten minutes apart; other failed statuses are final. Ten consecutive failures pause the endpoint until a probe succeeds; missed events then resume oldest first. `document_ready` means the last signer signed, not that upload processing finished. Treat events as signals and confirm state through the API before irreversible actions.
329
353
 
330
354
  ## Output and scripting
331
355
 
@@ -420,7 +444,7 @@ Assinafy runs a **separate sandbox** at `https://sandbox.assinafy.com.br/v1`. It
420
444
 
421
445
  ## Command reference
422
446
 
423
- Run `assinafy <command> --help` for the full flags of any command. Every command's help output is mirrored under [`docs/`](./docs), the [API reference](./docs/api-reference.md) holds the official request/response payloads for all 93 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
447
+ Run `assinafy <command> --help` for the full flags of any command. Every command's help output is mirrored under [`docs/`](./docs), the [API reference](./docs/api-reference.md) holds the official request/response payloads for all 118 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
424
448
 
425
449
  Global flags accepted by every command: `--api-key`, `--token`, `--account-id`, `--base-url`, `-p, --profile`, `--json`, `-q, --quiet`. `assinafy -v` prints the version.
426
450
 
@@ -489,6 +513,12 @@ assinafy assignments reset-expiration doc_123 asg_1 --expires-at "2026-12-31T23:
489
513
 
490
514
  `list [--search] [--sort]` · `get <id>` · `download-page <templateId> <pageId> [-o] [--force]`
491
515
 
516
+ ### `contracts`
517
+
518
+ `list` · `get <documentId>` · `set <documentId> --data <json>` · `related <documentId>` · `renew <documentId> --data <json> [-y]` · `terminate <documentId> [--data <json>] [-y]`
519
+
520
+ List filters, complete JSON payloads, conflict handling and lifecycle behavior are in [Contract tracking](#contract-tracking-clm) and the [SDK reference](docs/sdk-reference.md#contracts-clientcontracts).
521
+
492
522
  ### `tags`
493
523
 
494
524
  `list [--search]` · `create --name [--color]` · `update <id> [--name] [--color] [--clear-color]` · `delete <id> [--force] [-y]`
@@ -519,7 +549,7 @@ Field definitions are what `--method collect` assignments gather. Run `fields ty
519
549
 
520
550
  `document <signerId>` · `documents <signerId>` · `search <signerId> <query>` · `download <signerId> <documentId> <artifact>` · `self` · `accept-terms` · `verify-code --code` (alias `verify-email`) · `certificate-start` · `certificate-complete --certificate-token` · `confirm-data <documentId>` · `upload-signature --file` · `download-signature` · `assignment` · `sign <documentId> <assignmentId> --entries` · `decline <documentId> <assignmentId> --reason` · `sign-multiple --document-ids` · `decline-multiple --document-ids --reason`
521
551
 
522
- Every signer command except the public artifact `download` requires `--access-code <code>`; `download` accepts it optionally for an identity preflight. Use `ASSINAFY_SIGNER_ACCESS_CODE` to keep the code out of process arguments.
552
+ `documents` and `search` use owner authentication when `--access-code` is omitted. The public artifact `download` accepts it optionally for an identity preflight. Other signer commands require `--access-code <code>`. Use `ASSINAFY_SIGNER_ACCESS_CODE` to keep the code out of process arguments.
523
553
 
524
554
  ### `auth`
525
555
 
@@ -617,9 +647,9 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
617
647
 
618
648
  ## Contract boundaries
619
649
 
620
- - The production OpenAPI publishes 112 operations and the SDK implements all of them. Sandbox deployments can lag individual routes — account/user statistics and user notification preferences may return route-level 404s there despite being documented in production.
650
+ - The production OpenAPI publishes 118 operations and the SDK implements all of them. Sandbox deployments can lag individual routes — account/user statistics and user notification preferences may return route-level 404s there despite being documented in production.
621
651
  - The SDK keeps two platform-compatible template routes (`GET /accounts/{id}/templates/{id}` and its page download) that are absent from the published OpenAPI paths.
622
- - Certificate start/complete are deployed production extensions of the public signing frontend, exposed as `signerDocuments.startCertificate(accessCode)` and `signerDocuments.completeCertificate(accessCode, token)`. Start posts `{ "signer-access-code": code }` and returns `{ token }`; complete posts `{ "signer-access-code": code, token }` and returns `{ signerName }`. Both also carry the access code in the query string and strip owner credentials. They supplement, but are not part of, the 112 OpenAPI operations.
652
+ - Certificate start/complete are deployed production extensions of the public signing frontend, exposed as `signerDocuments.startCertificate(accessCode)` and `signerDocuments.completeCertificate(accessCode, token)`. Start posts `{ "signer-access-code": code }` and returns `{ token }`; complete posts `{ "signer-access-code": code, token }` and returns `{ signerName }`. Both also carry the access code in the query string and strip owner credentials. They supplement, but are not part of, the 118 OpenAPI operations.
623
653
  - `send-token` sends the email-only body `{ "channel": "email", "recipient": "..." }`; WhatsApp and the older `{ "email" }` body are rejected by the API with `400`.
624
654
  - `signer documents` and `signer search` accept the workspace API key or token when `--access-code` is omitted.
625
655
  - Webhook signatures follow Standard Webhooks; `WebhookVerifier.verifyDelivery` implements the published scheme. The older `verify(body, signature)` method is deprecated and does not match Assinafy deliveries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  *Português · [Read in English](README.en.md)*
4
4
 
5
- A CLI e o SDK Node.js da [API Assinafy](https://api.assinafy.com.br/v1/docs) permitem enviar PDFs, cadastrar signatários, solicitar assinaturas, acompanhar o processamento e baixar documentos certificados. O pacote inclui um executável para terminal e um SDK TypeScript em `@assinafy/cli/api`, com acesso às 112 operações publicadas.
5
+ A CLI e o SDK Node.js da [API Assinafy](https://api.assinafy.com.br/v1/docs) permitem enviar PDFs, cadastrar signatários, solicitar assinaturas, acompanhar o processamento e baixar documentos certificados. O pacote inclui um executável para terminal e um SDK TypeScript em `@assinafy/cli/api`, com acesso às 118 operações publicadas.
6
6
 
7
7
  Este guia segue o fluxo de uma integração: instalação, autenticação, envio, assinatura e armazenamento do resultado. A [referência do SDK](docs/sdk-reference.md) documenta cada método; a [referência HTTP](docs/api-reference.md) contém os parâmetros e os payloads completos de requisição e resposta publicados pela Assinafy.
8
8
 
@@ -15,15 +15,16 @@ Este guia segue o fluxo de uma integração: instalação, autenticação, envio
15
15
  5. [Fluxo completo do documento](#fluxo-completo-do-documento)
16
16
  6. [Verificação, ordem e templates](#verificação-ordem-e-templates)
17
17
  7. [Fluxo do signatário](#fluxo-do-signatário)
18
- 8. [Eventos e webhooks](#eventos-e-webhooks)
19
- 9. [SDK Node.js](#sdk-nodejs)
20
- 10. [Saída, erros e automação](#saída-erros-e-automação)
21
- 11. [Referência de comandos](#referência-de-comandos)
22
- 12. [Desenvolvimento e publicação](#desenvolvimento-e-publicação)
18
+ 8. [Gestão de contratos (CLM)](#gestão-de-contratos-clm)
19
+ 9. [Eventos e webhooks](#eventos-e-webhooks)
20
+ 10. [SDK Node.js](#sdk-nodejs)
21
+ 11. [Saída, erros e automação](#saída-erros-e-automação)
22
+ 12. [Referência de comandos](#referência-de-comandos)
23
+ 13. [Desenvolvimento e publicação](#desenvolvimento-e-publicação)
23
24
 
24
25
  ## Requisitos e instalação
25
26
 
26
- Use [Node.js 24 LTS](https://nodejs.org/en/about/previous-releases) atualizado. O mínimo suportado é `22.12.0`; a CI também verifica as linhas 22 e 26. A CLI funciona em Linux, macOS e Windows, em x64 e ARM64. Os arquivos de release incluem o executável JavaScript e exigem Node.js instalado. A API Assinafy exige HTTPS com TLS 1.2 ou superior, o mínimo padrão das versões suportadas do Node.js.
27
+ Use [Node.js 26 LTS](https://nodejs.org/en/about/previous-releases) atualizado. O mínimo suportado é `22.12.0`; a CI também verifica as linhas 22 e 24. A CLI funciona em Linux, macOS e Windows, em x64 e ARM64. Os arquivos de release incluem o executável JavaScript e exigem Node.js instalado. A API Assinafy exige HTTPS com TLS 1.2 ou superior, o mínimo padrão das versões suportadas do Node.js.
27
28
 
28
29
  Instale uma versão publicada e fixe essa versão nas automações:
29
30
 
@@ -345,6 +346,32 @@ assinafy signer sign "$DOCUMENT_ID" example_assignment --entries '[]'
345
346
 
346
347
  Os comandos de confirmação de dados, assinatura e recusa de um único documento verificam se o código de acesso corresponde ao documento e ao assignment antes de enviar a alteração.
347
348
 
349
+ ## Gestão de contratos (CLM)
350
+
351
+ O acompanhamento de contratos registra contraparte, valor, vigência, renovação e vínculos de aditivos em um documento existente. Não altera o envio nem a assinatura. As escritas exigem um plano com gestão de contratos; as leituras continuam disponíveis se o plano expirar. Com OAuth, use `documents:read` para ler e `documents:write` para alterar.
352
+
353
+ 1. Faça o upload do PDF e salve o ID retornado, mesmo se a gravação dos termos falhar.
354
+ 2. Cadastre os termos em rascunho. Ative-os quando o contrato deva entrar no acompanhamento automático.
355
+ 3. Para um aditivo, faça outro upload e vincule esse documento ao contrato. Os termos propostos passam ao contrato após a certificação do aditivo, em ordem de assinatura.
356
+ 4. Acompanhe vencimentos, atividades e webhooks. Renove informando o período atual (`term`) ou uma data final posterior; encerre com `terminate` quando necessário.
357
+
358
+ ```bash
359
+ assinafy documents upload contrato.pdf --wait --json
360
+ assinafy contracts set <documentId> --data '{"status":"draft","counterparty_name":"Empresa Exemplo","value":1200.50,"currency":"BRL","start_date":"2027-01-01","end_date":"2027-12-31","auto_renew":false,"renewal_term_months":12,"notice_period_days":30}'
361
+ assinafy contracts get <documentId> --json
362
+ assinafy contracts set <documentId> --data '{"status":"active","updated_at":"<timestamp retornado>"}'
363
+ assinafy contracts list --status active --ending-within-days 30 --expand document --page 1
364
+ assinafy contracts set <amendmentId> --data '{"parent_document_id":"<documentId>","relation_type":"amendment","value":1500}'
365
+ assinafy contracts related <amendmentId> --json
366
+ assinafy contracts renew <documentId> --data '{"term":1,"updated_at":"<timestamp retornado>"}'
367
+ assinafy contracts terminate <documentId> --data '{"reason":"Encerramento acordado","updated_at":"<timestamp retornado>"}'
368
+ assinafy documents activities <documentId> --page 2 --sort id
369
+ ```
370
+
371
+ Substitua IDs e timestamps pelos valores da sua integração. `renew` e `terminate` pedem confirmação; `--yes` permite automação. A cada escrita, envie o `updated_at` da leitura mais recente: `409 ContractChanged` exige nova leitura antes de decidir como continuar. O SDK não repete escritas automaticamente. Campos omitidos permanecem; `null` limpa um termo, e `external_references` substitui a lista inteira. Em um aditivo pendente, `null` remove a alteração proposta; `parent_document_id: null` desfaz o vínculo. Aditivos aplicados são somente leitura.
372
+
373
+ O processamento horário usa o calendário de Brasília e pode enviar avisos ao responsável conforme suas preferências. Um plano sem CLM pausa esse processamento. Eventos de contrato devem ser inscritos explicitamente no webhook; para recuperar eventos perdidos, percorra `contracts list --sort=-updated_at`. Veja os [payloads e respostas completos do SDK](docs/sdk-reference.md#contracts-clientcontracts) e a [ajuda dos comandos](docs/contracts.md).
374
+
348
375
  ## Eventos e webhooks
349
376
 
350
377
  Cada workspace pode cadastrar 1 endpoint de webhook, ou até 3 nos planos pagos. Cada endpoint tem URL, eventos, estado e assinatura próprios, e todo endpoint ativo inscrito em um evento o recebe de forma independente.
@@ -359,9 +386,9 @@ assinafy webhooks dispatches --endpoint "$ENDPOINT_ID" --delivered false --json
359
386
  assinafy webhooks verify corpo.json --id "$WEBHOOK_ID" --timestamp "$WEBHOOK_TIMESTAMP" --signature "$WEBHOOK_SIGNATURE"
360
387
  ```
361
388
 
362
- Sem `--events`, o endpoint recebe `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document` e `document_processing_failed`. `endpoints update <id>` altera apenas as opções informadas (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); desativar a assinatura descarta o segredo. `endpoints rotate-secret <id>` gera um novo segredo e invalida o anterior imediatamente. `endpoints delete <id>` remove o endpoint e libera a vaga. URLs repetidas no mesmo workspace retornam `400`; criar acima do limite do plano retorna `403`. A leitura e a rotação do segredo não estão disponíveis para aplicativos OAuth.
389
+ Sem `--events`, o endpoint recebe `document_ready`, `document_prepared`, `signer_signed_document`, `signer_rejected_document` e `document_processing_failed`. `endpoints update <id>` altera apenas as opções informadas (`--active`/`--inactive`, `--signing`/`--no-signing`, `--url`, `--email`, `--name`, `--events`); desativar a assinatura descarta o segredo. `endpoints rotate-secret <id>` gera um novo segredo e invalida o anterior imediatamente. `endpoints delete <id>` remove o endpoint e libera a vaga. URLs repetidas no mesmo workspace retornam `400`; criar acima do limite do plano retorna `403`. Aplicativos OAuth não podem ler um segredo existente; `webhooks:write` permite rotacioná-lo e receber o novo segredo. Ativar assinatura em um endpoint existente também retorna o novo segredo uma vez. URLs novas ou alteradas exigem HTTPS.
363
390
 
364
- Com `--signing`, a criação retorna `secret` uma vez, inclusive via OAuth; armazene-o com segurança. A CLI o mostra em texto e em JSON. Aplicativos OAuth que perderem esse segredo precisam excluir e recriar o endpoint. `endpoints list --url <url>` filtra pela URL exata; `endpoints delete-by-url --url <url>` remove por essa mesma URL e pede confirmação ou `--yes`.
391
+ Com `--signing`, a criação retorna `secret` uma vez, inclusive via OAuth; armazene-o com segurança. A CLI o mostra em texto e em JSON. Aplicativos OAuth que perderem esse segredo podem rotacioná-lo com `webhooks:write` e guardar o novo valor. `endpoints list --url <url>` filtra pela URL exata; `endpoints delete-by-url --url <url>` remove por essa mesma URL e pede confirmação ou `--yes`.
365
392
 
366
393
  `webhooks register`, `webhooks get` e `webhooks inactivate` continuam disponíveis e atuam sobre o endpoint mais antigo do workspace.
367
394
 
@@ -378,7 +405,7 @@ if (!verifier.verifyDelivery(rawBody, headers)) {
378
405
  const event = verifier.extractEvent(rawBody);
379
406
  ```
380
407
 
381
- `verifyDelivery` compara em tempo constante o HMAC-SHA256 de `{webhook-id}.{webhook-timestamp}.{corpo}` e rejeita carimbos de tempo com mais de 5 minutos de diferença. Responda com `2xx` rapidamente; uma falha é tentada novamente uma vez após 3 segundos, e 10 eventos seguidos com falha pausam o endpoint até uma entrega funcionar. `webhooks retry <dispatchId>` reenvia uma entrega para o endpoint dela, desde que esteja ativo.
408
+ `verifyDelivery` compara em tempo constante o HMAC-SHA256 de `{webhook-id}.{webhook-timestamp}.{corpo}` e rejeita carimbos de tempo com mais de 5 minutos de diferença. Responda com `2xx` rapidamente; falhas de conexão, timeout, `408`, `429` e `5xx` recebem até seis tentativas, com cerca de dez minutos entre elas; outros erros são finais. Dez falhas seguidas pausam o endpoint até uma sondagem funcionar; os eventos pendentes voltam em ordem cronológica. `webhooks retry <dispatchId>` reenvia uma entrega para o endpoint dela, desde que esteja ativo.
382
409
 
383
410
  `document_ready` indica a assinatura pelo último signatário, não o término do processamento inicial do upload. Processe eventos de forma idempotente, consulte `event-types` para a lista vigente e confirme estado e artefatos pela API antes de ações irreversíveis.
384
411
 
@@ -462,6 +489,7 @@ No SDK, `ValidationError` indica entrada inválida; `ApiError` carrega `statusCo
462
489
  | [`workspaces`](docs/workspaces.md) / `accounts` | Cadastro, consulta, tema, logo e estatísticas. |
463
490
  | [`users`](docs/users.md) | Perfil, estatísticas e preferências de notificação. |
464
491
  | [`templates`](docs/templates.md) | Listagem, detalhes e páginas de templates. |
492
+ | [`contracts`](docs/contracts.md) | Termos, aditivos, renovações e encerramento de contratos. |
465
493
  | [`tags`](docs/tags.md) | Organização dos documentos por tags. |
466
494
  | [`fields`](docs/fields.md) | Definições, tipos e validação de campos. |
467
495
  | [`webhooks`](docs/webhooks.md) | Endpoints de webhook, segredos de assinatura e acompanhamento das entregas. |
@@ -499,7 +499,7 @@ Source: git+https://github.com/43081j/fast-wrap-ansi.git
499
499
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
500
500
  SOFTWARE.
501
501
 
502
- ## follow-redirects 1.16.0
502
+ ## follow-redirects 1.16.2
503
503
 
504
504
  License: MIT
505
505