@assinafy/cli 2.7.1 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +2 -0
- package/README.en.md +75 -67
- package/README.md +39 -25
- package/THIRD_PARTY_NOTICES.md +8 -8
- package/dist/api.cjs +701 -93
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +696 -93
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +2390 -694
- package/dist/types/api/client.d.ts +7 -0
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/api/envelope-types.d.ts +73 -0
- package/dist/types/api/envelope-types.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +4 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/resources/assignments.d.ts +7 -1
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/contracts.d.ts +3 -1
- package/dist/types/api/resources/contracts.d.ts.map +1 -1
- package/dist/types/api/resources/documents.d.ts +25 -6
- package/dist/types/api/resources/documents.d.ts.map +1 -1
- package/dist/types/api/resources/embed.d.ts +14 -0
- package/dist/types/api/resources/embed.d.ts.map +1 -0
- package/dist/types/api/resources/envelopes.d.ts +37 -0
- package/dist/types/api/resources/envelopes.d.ts.map +1 -0
- package/dist/types/api/resources/scheduled-sends.d.ts +11 -0
- package/dist/types/api/resources/scheduled-sends.d.ts.map +1 -0
- package/dist/types/api/resources/signer-documents.d.ts +23 -11
- package/dist/types/api/resources/signer-documents.d.ts.map +1 -1
- package/dist/types/api/resources/signers.d.ts +1 -1
- package/dist/types/api/resources/signers.d.ts.map +1 -1
- package/dist/types/api/resources/users.d.ts +3 -1
- package/dist/types/api/resources/users.d.ts.map +1 -1
- package/dist/types/api/resources/webhooks.d.ts +6 -2
- package/dist/types/api/resources/webhooks.d.ts.map +1 -1
- package/dist/types/api/resources/workspaces.d.ts +9 -2
- package/dist/types/api/resources/workspaces.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +138 -8
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/api/utils.d.ts +9 -0
- package/dist/types/api/utils.d.ts.map +1 -1
- package/docs/README.md +5 -1
- package/docs/api-operations-staging.json +1262 -0
- package/docs/api-operations.json +234 -2
- package/docs/api-reference-staging.md +18466 -0
- package/docs/api-reference.md +11562 -3718
- package/docs/assignments.md +62 -14
- package/docs/contracts.md +4 -3
- package/docs/documents.md +75 -27
- package/docs/embed.md +119 -0
- package/docs/envelopes.md +239 -0
- package/docs/scheduled-sends.md +63 -0
- package/docs/sdk-reference.md +278 -30
- package/docs/send.md +15 -11
- package/docs/signer.md +84 -3
- package/docs/users.md +41 -0
- package/docs/webhooks.md +22 -6
- package/docs/workspaces.md +66 -3
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +4 -4
package/.env.example
CHANGED
package/README.en.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @assinafy/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
_[Leia em português](README.md) · English_
|
|
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
|
|
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 147 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
|
|
|
@@ -80,11 +80,11 @@ npx @assinafy/cli whoami
|
|
|
80
80
|
|
|
81
81
|
Use an API key for direct owner integrations, OAuth for customer-consented marketplace connections, or a user JWT for user-session operations.
|
|
82
82
|
|
|
83
|
-
| Credential
|
|
84
|
-
|
|
|
85
|
-
| API key
|
|
83
|
+
| Credential | Header sent | Use it for |
|
|
84
|
+
| ------------------ | ------------------------------- | --------------------------------------------------------------------- |
|
|
85
|
+
| API key | `X-Api-Key: <key>` | Direct owner integrations and permitted account operations. |
|
|
86
86
|
| OAuth access token | `Authorization: Bearer <token>` | Marketplace connections, limited to granted scopes and one workspace. |
|
|
87
|
-
| User JWT
|
|
87
|
+
| User JWT | `Authorization: Bearer <jwt>` | User sessions and permitted account operations. |
|
|
88
88
|
|
|
89
89
|
Generate an API key from the Assinafy dashboard, or from the CLI with an existing session:
|
|
90
90
|
|
|
@@ -281,11 +281,17 @@ assinafy signer sign <documentId> <assignmentId> --entries '[]'
|
|
|
281
281
|
|
|
282
282
|
Single-document confirmation, signing, and decline commands verify that the access code matches the requested document and assignment before writing.
|
|
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.
|
|
284
|
+
Owner API credentials are stripped from every public and signer-side request, so an access-code flow can never leak your workspace key. Original signer downloads require `--access-code`; completed copies use `signer download-copy` with `ASSINAFY_DOWNLOAD_TOKEN`. Legacy artifact call forms remain available, subject to server restrictions.
|
|
285
|
+
|
|
286
|
+
## Envelopes and embedded signing
|
|
287
|
+
|
|
288
|
+
Use `envelopes estimate-cost|create` after uploading and processing up to 20 documents. Creation accepts an idempotency key and credit ceiling. Documents retain their own assignments and certificates. `embed origins` manages exact application origins, and `embed session` mints a private single-use iframe URL for an embedded Email/Whatsapp signer. Owner credentials stay on the backend. See [complete envelope and iframe flows](docs/sdk-reference.md#envelopes-clientenvelopes).
|
|
289
|
+
|
|
290
|
+
`workspaces usage` reads plan/balances, `workspaces notification-policy` controls workspace alerts, and `users push-preferences` controls mobile push preferences. `signer certified-copy` sends a fresh certified-copy link to the original signing contact. All request/response contracts are in the [SDK reference](docs/sdk-reference.md).
|
|
285
291
|
|
|
286
292
|
## Contract tracking (CLM)
|
|
287
293
|
|
|
288
|
-
Contract tracking records counterparty, value, dates, renewal settings and signed amendments on an existing document. Upload and signing remain separate.
|
|
294
|
+
Contract tracking records counterparty, value, dates, renewal settings and signed amendments on an existing document. Upload and signing remain separate. Contract tracking is included in every standard plan, including Free; writes require the feature to be active; reads remain available when that plan lapses. OAuth uses `documents:read` and `documents:write`.
|
|
289
295
|
|
|
290
296
|
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
297
|
|
|
@@ -330,7 +336,7 @@ assinafy webhooks retry <dispatchId> # redeliver one event
|
|
|
330
336
|
assinafy webhooks verify body.json --id <webhook-id> --timestamp <webhook-timestamp> --signature <webhook-signature>
|
|
331
337
|
```
|
|
332
338
|
|
|
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.
|
|
339
|
+
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 unless `--keep-previous` requests a 24-hour overlap. 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.
|
|
334
340
|
|
|
335
341
|
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`.
|
|
336
342
|
|
|
@@ -344,7 +350,7 @@ import { WebhookVerifier } from '@assinafy/cli/api';
|
|
|
344
350
|
const verifier = new WebhookVerifier(process.env.ASSINAFY_WEBHOOK_SECRET);
|
|
345
351
|
// rawBody: the Buffer exactly as received; headers: the request headers
|
|
346
352
|
if (!verifier.verifyDelivery(rawBody, headers)) {
|
|
347
|
-
|
|
353
|
+
// answer 401 and drop the delivery
|
|
348
354
|
}
|
|
349
355
|
const event = verifier.extractEvent(rawBody);
|
|
350
356
|
```
|
|
@@ -378,12 +384,12 @@ JSON errors carry a stable shape:
|
|
|
378
384
|
|
|
379
385
|
```json
|
|
380
386
|
{
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
+
"error": {
|
|
388
|
+
"message": "Saldo insuficiente. (document doc_abc123 exists; 2 signer(s) created or reused)",
|
|
389
|
+
"code": "api_error",
|
|
390
|
+
"statusCode": 402,
|
|
391
|
+
"details": { "documentId": "doc_abc123", "signerIds": ["sig_1", "sig_2"] }
|
|
392
|
+
}
|
|
387
393
|
}
|
|
388
394
|
```
|
|
389
395
|
|
|
@@ -397,19 +403,19 @@ Every setting resolves as **CLI flag → environment variable → config-file pr
|
|
|
397
403
|
|
|
398
404
|
Empty optional settings are ignored, including `.env.example` defaults. Configurations with invalid profile field types are ignored for reads and rejected by mutations.
|
|
399
405
|
|
|
400
|
-
| What
|
|
401
|
-
|
|
|
402
|
-
| API key (sent as `X-Api-Key`)
|
|
403
|
-
| OAuth access token or user JWT (sent as `Bearer`) | `--token`
|
|
404
|
-
| Default account / workspace ID
|
|
405
|
-
| API base URL
|
|
406
|
-
| Config profile
|
|
407
|
-
| Config directory
|
|
408
|
-
| Webhook endpoint signing secret (`whsec_`)
|
|
409
|
-
| Password / new password
|
|
410
|
-
| Social provider / reset token
|
|
411
|
-
| Signer access code / email or WhatsApp OTP
|
|
412
|
-
| Web PKI operation token
|
|
406
|
+
| What | Flag | Environment variable |
|
|
407
|
+
| ------------------------------------------------- | ------------------------------------ | ------------------------------------------------------------ |
|
|
408
|
+
| API key (sent as `X-Api-Key`) | `--api-key` | `ASSINAFY_API_KEY` |
|
|
409
|
+
| OAuth access token or user JWT (sent as `Bearer`) | `--token` | `ASSINAFY_TOKEN` |
|
|
410
|
+
| Default account / workspace ID | `--account-id` | `ASSINAFY_ACCOUNT_ID` |
|
|
411
|
+
| API base URL | `--base-url` | `ASSINAFY_BASE_URL` |
|
|
412
|
+
| Config profile | `-p, --profile` | `ASSINAFY_PROFILE` |
|
|
413
|
+
| Config directory | — | `ASSINAFY_CONFIG_DIR` |
|
|
414
|
+
| Webhook endpoint signing secret (`whsec_`) | _(config only)_ | `ASSINAFY_WEBHOOK_SECRET` |
|
|
415
|
+
| Password / new password | `--password` / `--new-password` | `ASSINAFY_PASSWORD` / `ASSINAFY_NEW_PASSWORD` |
|
|
416
|
+
| Social provider / reset token | `--provider-token` / `--reset-token` | `ASSINAFY_PROVIDER_TOKEN` / `ASSINAFY_RESET_TOKEN` |
|
|
417
|
+
| Signer access code / email or WhatsApp OTP | `--access-code` / `--code` | `ASSINAFY_SIGNER_ACCESS_CODE` / `ASSINAFY_VERIFICATION_CODE` |
|
|
418
|
+
| Web PKI operation token | `--certificate-token` | `ASSINAFY_CERTIFICATE_TOKEN` |
|
|
413
419
|
|
|
414
420
|
`.env.example` documents every CLI and installer environment variable.
|
|
415
421
|
|
|
@@ -444,7 +450,7 @@ Assinafy runs a **separate sandbox** at `https://sandbox.assinafy.com.br/v1`. It
|
|
|
444
450
|
|
|
445
451
|
## Command reference
|
|
446
452
|
|
|
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
|
|
453
|
+
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 147 published operations, and the [SDK reference](./docs/sdk-reference.md) maps each SDK method to its operation.
|
|
448
454
|
|
|
449
455
|
Global flags accepted by every command: `--api-key`, `--token`, `--account-id`, `--base-url`, `-p, --profile`, `--json`, `-q, --quiet`. `assinafy -v` prints the version.
|
|
450
456
|
|
|
@@ -463,30 +469,30 @@ assinafy send contract.pdf \
|
|
|
463
469
|
|
|
464
470
|
### `documents`
|
|
465
471
|
|
|
466
|
-
| Command
|
|
467
|
-
|
|
|
468
|
-
| `documents upload <file> [--name] [--metadata] [--wait]`
|
|
469
|
-
| `documents list [--status] [--method] [--tags] [--page] [--per-page] [--search] [--sort]` | List documents
|
|
470
|
-
| `documents search [query] [--status] [--page] [--per-page] [--sort]`
|
|
471
|
-
| `documents get <id>`
|
|
472
|
-
| `documents rename <id> <name>`
|
|
473
|
-
| `documents download <id> [--artifact] [-o] [--force]`
|
|
474
|
-
| `documents thumbnail <id> [-o] [--force]`
|
|
475
|
-
| `documents download-page <id> <pageId> [-o] [--force]`
|
|
476
|
-
| `documents activities <id>`
|
|
477
|
-
| `documents delete <id> [-y]`
|
|
478
|
-
| `documents tags <id>`
|
|
479
|
-
| `documents tags-set <id> [tags...]`
|
|
480
|
-
| `documents tags-add <id> <tags...>`
|
|
481
|
-
| `documents tags-remove <id> <tagId>`
|
|
482
|
-
| `documents create-from-template <templateId> --signers <json> [...]`
|
|
483
|
-
| `documents estimate-template-cost <templateId> --signers <json>`
|
|
484
|
-
| `documents verify <hash>`
|
|
485
|
-
| `documents statuses`
|
|
486
|
-
| `documents public <id>`
|
|
487
|
-
| `documents send-token <id> --recipient <email>`
|
|
488
|
-
| `documents progress <id>`
|
|
489
|
-
| `documents wait <id> [--timeout] [--interval]`
|
|
472
|
+
| Command | Description |
|
|
473
|
+
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
474
|
+
| `documents upload <file> [--name] [--metadata] [--wait]` | Upload a PDF (max 25 MiB) |
|
|
475
|
+
| `documents list [--status] [--method] [--tags] [--page] [--per-page] [--search] [--sort]` | List documents |
|
|
476
|
+
| `documents search [query] [--status] [--page] [--per-page] [--sort]` | Lightweight type-ahead search |
|
|
477
|
+
| `documents get <id>` | Show document details |
|
|
478
|
+
| `documents rename <id> <name>` | Rename a document (before signing starts) |
|
|
479
|
+
| `documents download <id> [--artifact] [-o] [--force]` | Download an artifact (`original`/`certificated`/`certificate-page`/`pades` PDFs, or `bundle` ZIP) |
|
|
480
|
+
| `documents thumbnail <id> [-o] [--force]` | Download the thumbnail (JPEG) |
|
|
481
|
+
| `documents download-page <id> <pageId> [-o] [--force]` | Download one page (JPEG) |
|
|
482
|
+
| `documents activities <id>` | Activity log |
|
|
483
|
+
| `documents delete <id> [-y]` | Delete a document |
|
|
484
|
+
| `documents tags <id>` | List attached tags |
|
|
485
|
+
| `documents tags-set <id> [tags...]` | Replace the tag set by name (none detaches all) |
|
|
486
|
+
| `documents tags-add <id> <tags...>` | Attach tags by name |
|
|
487
|
+
| `documents tags-remove <id> <tagId>` | Detach one tag |
|
|
488
|
+
| `documents create-from-template <templateId> --signers <json> [...]` | Create from a template |
|
|
489
|
+
| `documents estimate-template-cost <templateId> --signers <json>` | Estimate template cost |
|
|
490
|
+
| `documents verify <hash>` | Verify by signature hash (public) |
|
|
491
|
+
| `documents statuses` | List every document status and whether it is deletable |
|
|
492
|
+
| `documents public <id>` | Public unauthenticated lookup |
|
|
493
|
+
| `documents send-token <id> --recipient <email>` | Email a one-time access token to a pending signer (email channel only) |
|
|
494
|
+
| `documents progress <id>` | Signing progress |
|
|
495
|
+
| `documents wait <id> [--timeout] [--interval]` | Poll until ready, failed, or timed out |
|
|
490
496
|
|
|
491
497
|
### `signers`
|
|
492
498
|
|
|
@@ -549,7 +555,7 @@ Field definitions are what `--method collect` assignments gather. Run `fields ty
|
|
|
549
555
|
|
|
550
556
|
`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`
|
|
551
557
|
|
|
552
|
-
`documents` and `search` use owner authentication when `--access-code` is omitted. The
|
|
558
|
+
`documents` and `search` use owner authentication when `--access-code` is omitted. The original-artifact `download` requires it on the current API, although the optional CLI flag remains for compatibility. Certified copies use `download-copy` and a private download token. Other signer commands require `--access-code <code>`. Use `ASSINAFY_SIGNER_ACCESS_CODE` to keep the code out of process arguments.
|
|
553
559
|
|
|
554
560
|
### `auth`
|
|
555
561
|
|
|
@@ -575,15 +581,15 @@ The same package ships a typed SDK. It covers every published operation, unwraps
|
|
|
575
581
|
import { AssinafyClient, ApiError, PartialWorkflowError } from '@assinafy/cli/api';
|
|
576
582
|
|
|
577
583
|
const client = AssinafyClient.create(
|
|
578
|
-
|
|
579
|
-
|
|
584
|
+
process.env.ASSINAFY_API_KEY!,
|
|
585
|
+
process.env.ASSINAFY_ACCOUNT_ID!,
|
|
580
586
|
);
|
|
581
587
|
|
|
582
588
|
const { data, meta } = await client.documents.list({ status: 'pending_signature' });
|
|
583
589
|
|
|
584
590
|
const document = await client.documents.upload(
|
|
585
|
-
|
|
586
|
-
|
|
591
|
+
{ filePath: './contract.pdf' },
|
|
592
|
+
{ name: 'Service agreement', metadata: { external_id: 'order-123' } },
|
|
587
593
|
);
|
|
588
594
|
await client.documents.waitUntilReady(document.id);
|
|
589
595
|
```
|
|
@@ -594,13 +600,13 @@ Errors are typed: `ValidationError` for local input, `ApiError` (with `statusCod
|
|
|
594
600
|
|
|
595
601
|
```ts
|
|
596
602
|
try {
|
|
597
|
-
|
|
603
|
+
await client.uploadAndRequestSignatures({ source: { filePath: './contract.pdf' }, signers });
|
|
598
604
|
} catch (error) {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
605
|
+
if (error instanceof PartialWorkflowError) {
|
|
606
|
+
console.error({ documentId: error.documentId, signerIds: error.signerIds });
|
|
607
|
+
// Inspect the document before resuming; signer IDs can belong to reused records.
|
|
608
|
+
}
|
|
609
|
+
throw error;
|
|
604
610
|
}
|
|
605
611
|
```
|
|
606
612
|
|
|
@@ -647,9 +653,9 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
|
|
|
647
653
|
|
|
648
654
|
## Contract boundaries
|
|
649
655
|
|
|
650
|
-
- The production OpenAPI publishes
|
|
656
|
+
- The production OpenAPI publishes 147 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.
|
|
651
657
|
- 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.
|
|
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
|
|
658
|
+
- 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 147 OpenAPI operations.
|
|
653
659
|
- `send-token` sends the email-only body `{ "channel": "email", "recipient": "..." }`; WhatsApp and the older `{ "email" }` body are rejected by the API with `400`.
|
|
654
660
|
- `signer documents` and `signer search` accept the workspace API key or token when `--access-code` is omitted.
|
|
655
661
|
- 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.
|
|
@@ -657,3 +663,5 @@ The [release runbook](./docs/releasing.md) covers tags, trusted publishing, and
|
|
|
657
663
|
## License
|
|
658
664
|
|
|
659
665
|
MIT © Assinafy
|
|
666
|
+
|
|
667
|
+
Staging publishes additional scheduled-send, watcher, signer-capacity, delivery-history and envelope-reminder-estimate operations. Set `ASSINAFY_BASE_URL=https://api.angry-pisco.stage.assinafy.com.br/v1` with staging credentials. See [SDK flows](docs/sdk-reference.md#scheduled-sends-clientscheduledsends) and [complete staging HTTP contracts](docs/api-reference-staging.md).
|
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# @assinafy/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
_Português · [Read in English](README.en.md)_
|
|
4
4
|
|
|
5
|
-
CLI e SDK TypeScript para as
|
|
5
|
+
CLI e SDK TypeScript para as 147 operações de produção e 157 de staging publicadas da [API Assinafy](https://api.assinafy.com.br/v1/docs): documentos, signatários, assinaturas, templates, contratos, envelopes, assinatura incorporada, OAuth e webhooks.
|
|
6
|
+
|
|
7
|
+
Staging também oferece envios agendados, observadores, capacidades dos signatários e histórico de entrega: [fluxos e contratos](docs/sdk-reference.md#scheduled-sends-clientscheduledsends). Configure `ASSINAFY_BASE_URL=https://api.angry-pisco.stage.assinafy.com.br/v1` com credenciais próprias.
|
|
6
8
|
|
|
7
9
|
## Instalação
|
|
8
10
|
|
|
@@ -36,13 +38,13 @@ assinafy workspaces list --json
|
|
|
36
38
|
|
|
37
39
|
A precedência da CLI é flag → ambiente → perfil → padrão. As credenciais são escolhidas juntas no primeiro nível preenchido; a chave de API vence o token quando ambos são informados no mesmo nível.
|
|
38
40
|
|
|
39
|
-
| Valor
|
|
40
|
-
|
|
|
41
|
-
| Chave de API | `ASSINAFY_API_KEY`
|
|
42
|
-
| Bearer token | `ASSINAFY_TOKEN`
|
|
43
|
-
| Workspace
|
|
44
|
-
| URL base
|
|
45
|
-
| Perfil
|
|
41
|
+
| Valor | Variável |
|
|
42
|
+
| ------------ | --------------------- |
|
|
43
|
+
| Chave de API | `ASSINAFY_API_KEY` |
|
|
44
|
+
| Bearer token | `ASSINAFY_TOKEN` |
|
|
45
|
+
| Workspace | `ASSINAFY_ACCOUNT_ID` |
|
|
46
|
+
| URL base | `ASSINAFY_BASE_URL` |
|
|
47
|
+
| Perfil | `ASSINAFY_PROFILE` |
|
|
46
48
|
|
|
47
49
|
Produção usa `https://api.assinafy.com.br/v1`; sandbox usa `https://sandbox.assinafy.com.br/v1` e credenciais próprias. HTTPS/TLS 1.2+ é obrigatório. Consulte [.env.example](.env.example) para as demais variáveis seguras.
|
|
48
50
|
|
|
@@ -73,17 +75,17 @@ O PDF deve ser não vazio e ter no máximo 25 MiB. Persista o ID antes de aguard
|
|
|
73
75
|
```bash
|
|
74
76
|
assinafy assignments estimate-cost "$DOCUMENT_ID" --signer-ids "$SIGNER_ID" --json
|
|
75
77
|
assinafy assignments create "$DOCUMENT_ID" \
|
|
76
|
-
--signer-ids "$SIGNER_ID" --message 'Revise e assine' --json
|
|
78
|
+
--signer-ids "$SIGNER_ID" --message 'Revise e assine' --max-total-credits 0 --json
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
Leia custo, saldo e bloqueios antes da escrita. A operação pode consumir créditos e enviar convites. `notification_methods: []` assume Email em produção; informe o canal para escolhê-lo explicitamente.
|
|
80
82
|
|
|
81
|
-
| Verificação
|
|
82
|
-
|
|
|
83
|
-
| `Email`
|
|
84
|
-
| `Whatsapp`
|
|
85
|
-
| `IdDocumentFaceMatchBasic` | `Email` ou `Whatsapp` | CPF, recurso biométrico, consentimento e créditos
|
|
86
|
-
| `DigitalCertificate`
|
|
83
|
+
| Verificação | Notificação válida | Requisitos adicionais |
|
|
84
|
+
| -------------------------- | --------------------- | ------------------------------------------------------------- |
|
|
85
|
+
| `Email` | `Email` | E-mail do signatário |
|
|
86
|
+
| `Whatsapp` | `Whatsapp` | Telefone e créditos |
|
|
87
|
+
| `IdDocumentFaceMatchBasic` | `Email` ou `Whatsapp` | CPF, recurso biométrico, consentimento e créditos |
|
|
88
|
+
| `DigitalCertificate` | `Email` ou `Whatsapp` | CPF/CNPJ correspondente, recurso, créditos e passo individual |
|
|
87
89
|
|
|
88
90
|
Passos explícitos são contíguos a partir de 1. Um signatário com certificado fica sozinho no passo. Assignments `collect` usam as páginas e entradas reais; `virtual` assina com `entries: []`. Os formatos completos estão em [assignments](docs/assignments.md).
|
|
89
91
|
|
|
@@ -139,23 +141,35 @@ Confirme a disponibilidade do artefato; `document_ready` significa a última ass
|
|
|
139
141
|
import { AssinafyClient } from '@assinafy/cli/api';
|
|
140
142
|
|
|
141
143
|
const client = new AssinafyClient({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
token: process.env.ASSINAFY_TOKEN!,
|
|
145
|
+
accountId: process.env.ASSINAFY_ACCOUNT_ID!,
|
|
144
146
|
});
|
|
145
147
|
|
|
146
148
|
const result = await client.uploadAndRequestSignatures({
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
source: { filePath: './contrato.pdf' },
|
|
150
|
+
signers: [
|
|
151
|
+
{
|
|
152
|
+
name: 'Ana Lima',
|
|
153
|
+
email: 'ana@example.com',
|
|
154
|
+
verification_method: 'Email',
|
|
155
|
+
notification_methods: ['Email'],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
waitForReady: true,
|
|
153
159
|
});
|
|
154
160
|
console.log(result.document.id, result.assignment.id, result.signer_ids);
|
|
155
161
|
```
|
|
156
162
|
|
|
157
163
|
Respostas envelopadas resolvem para `data`; listas paginadas retornam `{ data, meta? }`; binários retornam `Buffer`. `ValidationError`, `ApiError`, `NetworkError` e `PartialWorkflowError` preservam dados úteis sem carregar a configuração Axios com segredos. A [referência do SDK](docs/sdk-reference.md) descreve todos os recursos, aliases, tipos, payloads e erros.
|
|
158
164
|
|
|
165
|
+
## Envelopes, assinatura incorporada e notificações
|
|
166
|
+
|
|
167
|
+
`envelopes estimate-cost|create` envia até 20 documentos para até 20 signatários. Faça upload e aguarde cada PDF primeiro; use `max_total_credits` e uma chave de idempotência na criação. Cada documento mantém sua própria assinatura e certificado. Veja o [fluxo completo de envelopes](docs/sdk-reference.md#envelopes-clientenvelopes).
|
|
168
|
+
|
|
169
|
+
`embed origins` cadastra a origem HTTPS da aplicação; `embed session` gera a URL privada de uso único para um signatário `embedded: true`. Email e WhatsApp continuam exigindo OTP. Integre o iframe no frontend e mantenha a chave de API no backend. Veja [assinatura incorporada](docs/sdk-reference.md#embedded-signing-clientembed).
|
|
170
|
+
|
|
171
|
+
`workspaces usage` informa saldo e plano; `workspaces notification-policy` controla alertas da conta e `users push-preferences` controla push no celular. `signer certified-copy` reenvia a cópia certificada ao contato original; `download-copy` usa `ASSINAFY_DOWNLOAD_TOKEN`.
|
|
172
|
+
|
|
159
173
|
## Templates, contratos e webhooks
|
|
160
174
|
|
|
161
175
|
- Templates: `templates list` e `documents create-from-template`; papéis recebem IDs existentes ou descritores inline.
|
|
@@ -164,7 +178,7 @@ Respostas envelopadas resolvem para `data`; listas paginadas retornam `{ data, m
|
|
|
164
178
|
|
|
165
179
|
## Referências e desenvolvimento
|
|
166
180
|
|
|
167
|
-
- [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as
|
|
181
|
+
- [Referência HTTP](docs/api-reference.md): parâmetros e requisições/respostas de todas as 147 operações publicadas.
|
|
168
182
|
- [Referência do SDK](docs/sdk-reference.md): métodos, helpers, compatibilidade e fluxos adicionais.
|
|
169
183
|
- [Comandos](docs/README.md): documentos, signatários, assignments, signer, OAuth, auth, workspaces, usuários, templates, contratos, tags, fields, webhooks e configuração.
|
|
170
184
|
- [Segurança](SECURITY.md), [contribuição](CONTRIBUTING.md) e [releases](docs/releasing.md).
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The self-contained Assinafy CLI bundle includes the following third-party software. Each section preserves the license notice distributed by that package.
|
|
4
4
|
|
|
5
|
-
## @clack/core 1.
|
|
5
|
+
## @clack/core 1.6.0
|
|
6
6
|
|
|
7
7
|
License: MIT
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ Source: git+https://github.com/bombshell-dev/clack.git
|
|
|
18
18
|
|
|
19
19
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
## @clack/prompts 1.
|
|
21
|
+
## @clack/prompts 1.9.0
|
|
22
22
|
|
|
23
23
|
License: MIT
|
|
24
24
|
|
|
@@ -34,7 +34,7 @@ Source: git+https://github.com/bombshell-dev/clack.git
|
|
|
34
34
|
|
|
35
35
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
36
36
|
|
|
37
|
-
## @commander-js/extra-typings 15.
|
|
37
|
+
## @commander-js/extra-typings 15.1.0
|
|
38
38
|
|
|
39
39
|
License: MIT
|
|
40
40
|
|
|
@@ -62,7 +62,7 @@ Source: git+https://github.com/commander-js/extra-typings.git
|
|
|
62
62
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
63
|
SOFTWARE.
|
|
64
64
|
|
|
65
|
-
## @types/node
|
|
65
|
+
## @types/node 26.6.6
|
|
66
66
|
|
|
67
67
|
License: MIT
|
|
68
68
|
|
|
@@ -124,7 +124,7 @@ Source: git+https://github.com/alexindigo/asynckit.git
|
|
|
124
124
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
125
125
|
SOFTWARE.
|
|
126
126
|
|
|
127
|
-
## axios 1.
|
|
127
|
+
## axios 1.21.0
|
|
128
128
|
|
|
129
129
|
License: MIT
|
|
130
130
|
|
|
@@ -192,7 +192,7 @@ Source: git://github.com/felixge/node-combined-stream.git
|
|
|
192
192
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
193
193
|
THE SOFTWARE.
|
|
194
194
|
|
|
195
|
-
## commander 15.
|
|
195
|
+
## commander 15.1.0
|
|
196
196
|
|
|
197
197
|
License: MIT
|
|
198
198
|
|
|
@@ -915,7 +915,7 @@ Source: git+https://github.com/Rob--W/proxy-from-env.git
|
|
|
915
915
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
916
916
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
917
917
|
|
|
918
|
-
## sisteransi
|
|
918
|
+
## sisteransi 2.0.0
|
|
919
919
|
|
|
920
920
|
License: MIT
|
|
921
921
|
|
|
@@ -943,7 +943,7 @@ Source: https://github.com/terkelg/sisteransi
|
|
|
943
943
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
944
944
|
SOFTWARE.
|
|
945
945
|
|
|
946
|
-
## undici-types
|
|
946
|
+
## undici-types 8.9.0
|
|
947
947
|
|
|
948
948
|
License: MIT
|
|
949
949
|
|