@assinafy/sdk 3.1.0 → 4.0.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/CHANGELOG.md +133 -30
- package/README.en.md +16 -17
- package/README.md +16 -19
- package/SECURITY.md +10 -10
- package/dist/index.d.mts +1086 -1303
- package/dist/index.d.ts +1086 -1303
- package/dist/index.js +1282 -1590
- package/dist/index.mjs +1282 -1589
- package/docs/API_COVERAGE.md +49 -56
- package/docs/COMPATIBILITY.md +46 -266
- package/docs/README.en.md +143 -156
- package/docs/README.md +130 -152
- package/docs/RELEASING.md +25 -28
- package/package.json +5 -4
package/docs/API_COVERAGE.md
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This ledger maps the official
|
|
4
4
|
[`GET /v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json)
|
|
5
|
-
contract to the public SDK API:
|
|
6
|
-
schemas.
|
|
7
|
-
63 schemas); those methods require a deployment that serves them.
|
|
5
|
+
contract to the public SDK API: 121 paths, 158 HTTP operations, and 63 component
|
|
6
|
+
schemas.
|
|
8
7
|
|
|
9
8
|
All paths below include the `/v1` prefix shown by the OpenAPI document, except
|
|
10
9
|
the RFC 8615 `.well-known` document, which is served at the host root. The
|
|
@@ -14,11 +13,11 @@ the corresponding relative path without repeating that prefix.
|
|
|
14
13
|
Status meanings:
|
|
15
14
|
|
|
16
15
|
- **Covered** — a public, typed SDK method sends the operation.
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
integrations
|
|
16
|
+
- **Not exposed** — official route reserved for Assinafy's own pages and app:
|
|
17
|
+
the embed session exchange, and the session, password, two-factor and API
|
|
18
|
+
key routes (integrations authenticate with an API key or OAuth instead).
|
|
20
19
|
- **Compatibility extension** — route retained for existing integrations but
|
|
21
|
-
absent from the current OpenAPI path set and excluded from the
|
|
20
|
+
absent from the current OpenAPI path set and excluded from the 158-operation
|
|
22
21
|
total.
|
|
23
22
|
|
|
24
23
|
## Accounts — 13/13
|
|
@@ -39,7 +38,7 @@ Status meanings:
|
|
|
39
38
|
| `GET` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.getNotificationPolicy(accountId)` | Covered |
|
|
40
39
|
| `PUT` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.updateNotificationPolicy(accountId, payload)` | Covered |
|
|
41
40
|
|
|
42
|
-
## Assignments —
|
|
41
|
+
## Assignments — 12/12
|
|
43
42
|
|
|
44
43
|
| Method | Path | SDK method | Status |
|
|
45
44
|
| --- | --- | --- | --- |
|
|
@@ -53,21 +52,32 @@ Status meanings:
|
|
|
53
52
|
| `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification` | `client.assignments.getIdentityVerification(documentId, assignmentId, signerId)` | Covered |
|
|
54
53
|
| `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}` | `client.assignments.downloadIdentityVerificationImage(documentId, assignmentId, signerId, name)` | Covered |
|
|
55
54
|
| `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review` | `client.assignments.reviewIdentityVerification(documentId, assignmentId, signerId, payload)` | Covered |
|
|
55
|
+
| `GET` | `/v1/documents/{documentId}/signer-capacities` | `client.assignments.getSignerCapacities(documentId)` | Covered |
|
|
56
|
+
| `GET` | `/v1/documents/{documentId}/notification-history` | `client.assignments.getNotificationHistory(documentId)` | Covered |
|
|
56
57
|
|
|
57
|
-
## Authentication —
|
|
58
|
+
## Authentication — not exposed (15)
|
|
59
|
+
|
|
60
|
+
Session, password, two-factor and API key routes belong to the Assinafy app.
|
|
61
|
+
Integrations authenticate with an API key (`apiKey`), created by the user in
|
|
62
|
+
the app, or with an OAuth 2.1 access token (`token`, from `client.oauth`).
|
|
58
63
|
|
|
59
64
|
| Method | Path | SDK method | Status |
|
|
60
65
|
| --- | --- | --- | --- |
|
|
61
|
-
| `POST` | `/v1/login` |
|
|
62
|
-
| `POST` | `/v1/authentication/mfa/verify` |
|
|
63
|
-
| `PUT` | `/v1/authentication/request-password-reset` |
|
|
64
|
-
| `PUT` | `/v1/authentication/reset-password` |
|
|
65
|
-
| `PUT` | `/v1/authentication/change-password` |
|
|
66
|
-
| `POST` | `/v1/authentication/social-login` |
|
|
67
|
-
| `POST` | `/v1/auth/link-social-login` |
|
|
68
|
-
| `GET` | `/v1/users/api-keys` |
|
|
69
|
-
| `POST` | `/v1/users/api-keys` |
|
|
70
|
-
| `DELETE` | `/v1/users/api-keys` |
|
|
66
|
+
| `POST` | `/v1/login` | — | Not exposed |
|
|
67
|
+
| `POST` | `/v1/authentication/mfa/verify` | — | Not exposed |
|
|
68
|
+
| `PUT` | `/v1/authentication/request-password-reset` | — | Not exposed |
|
|
69
|
+
| `PUT` | `/v1/authentication/reset-password` | — | Not exposed |
|
|
70
|
+
| `PUT` | `/v1/authentication/change-password` | — | Not exposed |
|
|
71
|
+
| `POST` | `/v1/authentication/social-login` | — | Not exposed |
|
|
72
|
+
| `POST` | `/v1/auth/link-social-login` | — | Not exposed |
|
|
73
|
+
| `GET` | `/v1/users/api-keys` | — | Not exposed |
|
|
74
|
+
| `POST` | `/v1/users/api-keys` | — | Not exposed |
|
|
75
|
+
| `DELETE` | `/v1/users/api-keys` | — | Not exposed |
|
|
76
|
+
| `GET` | `/v1/users/self/mfa` | — | Not exposed |
|
|
77
|
+
| `POST` | `/v1/users/self/mfa/totp` | — | Not exposed |
|
|
78
|
+
| `PUT` | `/v1/users/self/mfa/totp/confirm` | — | Not exposed |
|
|
79
|
+
| `POST` | `/v1/users/self/mfa/recovery-codes` | — | Not exposed |
|
|
80
|
+
| `DELETE` | `/v1/users/self/mfa/{customId}` | — | Not exposed |
|
|
71
81
|
|
|
72
82
|
## Contract lifecycle management (CLM) — 6/6
|
|
73
83
|
|
|
@@ -95,7 +105,7 @@ single-use token, and spending it from an integration would break the frame.
|
|
|
95
105
|
| `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/embed-sessions` | `client.embed.createSession(documentId, assignmentId, signerId)` | Covered |
|
|
96
106
|
| `POST` | `/v1/embed/sessions/{token}/exchange` | — | Not exposed |
|
|
97
107
|
|
|
98
|
-
## Envelopes —
|
|
108
|
+
## Envelopes — 13/13
|
|
99
109
|
|
|
100
110
|
| Method | Path | SDK method | Status |
|
|
101
111
|
| --- | --- | --- | --- |
|
|
@@ -111,8 +121,19 @@ single-use token, and spending it from an integration would break the frame.
|
|
|
111
121
|
| `DELETE` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}` | `client.envelopes.removeDocument(envelopeId, documentId, accountId?)` | Covered |
|
|
112
122
|
| `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/download/{artifactName}` | `client.envelopes.download(envelopeId, artifactName, accountId?)` | Covered |
|
|
113
123
|
| `PUT` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/resend` | `client.envelopes.resendNotification(envelopeId, signerId, accountId?)` | Covered |
|
|
124
|
+
| `POST` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/estimate-resend-cost` | `client.envelopes.estimateResendCost(envelopeId, signerId, accountId?)` | Covered |
|
|
114
125
|
|
|
115
|
-
##
|
|
126
|
+
## Scheduled sends — 5/5
|
|
127
|
+
|
|
128
|
+
| Method | Path | SDK method | Status |
|
|
129
|
+
| --- | --- | --- | --- |
|
|
130
|
+
| `POST` | `/v1/documents/{documentId}/scheduled-sends` | `client.scheduledSends.createAssignment(documentId, payload)` | Covered |
|
|
131
|
+
| `POST` | `/v1/accounts/{accountId}/scheduled-sends` | `client.scheduledSends.createEnvelope(payload, accountId?)` | Covered |
|
|
132
|
+
| `GET` | `/v1/accounts/{accountId}/scheduled-sends` | `client.scheduledSends.list(params?, accountId?)` | Covered |
|
|
133
|
+
| `PUT` | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/cancel` | `client.scheduledSends.cancel(scheduledSendId, accountId?)` | Covered |
|
|
134
|
+
| `PUT` | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/send` | `client.scheduledSends.sendNow(scheduledSendId, accountId?)` | Covered |
|
|
135
|
+
|
|
136
|
+
## Documents — 21/21
|
|
116
137
|
|
|
117
138
|
| Method | Path | SDK method | Status |
|
|
118
139
|
| --- | --- | --- | --- |
|
|
@@ -123,6 +144,9 @@ single-use token, and spending it from an integration would break the frame.
|
|
|
123
144
|
| `GET` | `/v1/documents/{documentId}` | `client.documents.details(documentId, options?)` / `get(documentId, options?)` | Covered |
|
|
124
145
|
| `DELETE` | `/v1/documents/{documentId}` | `client.documents.delete(documentId)` | Covered |
|
|
125
146
|
| `PATCH` | `/v1/documents/{documentId}` | `client.documents.rename(documentId, name)` | Covered |
|
|
147
|
+
| `PUT` | `/v1/documents/{documentId}/cancel` | `client.documents.cancel(documentId)` | Covered |
|
|
148
|
+
| `GET` | `/v1/documents/{documentId}/watchers` | `client.documents.listWatchers(documentId)` | Covered |
|
|
149
|
+
| `PUT` | `/v1/documents/{documentId}/watchers` | `client.documents.setWatchers(documentId, watcherIds)` | Covered |
|
|
126
150
|
| `GET` | `/v1/documents/{documentId}/activities` | `client.documents.activities(documentId, params?)` / `client.documents.listActivities(documentId, params?)` | Covered |
|
|
127
151
|
| `GET` | `/v1/documents/{documentId}/download/{artifactName}` | `client.documents.download(documentId, artifactName)` | Covered |
|
|
128
152
|
| `GET` | `/v1/documents/{documentSignatureHash}/verify` | `client.documents.verify(documentSignatureHash)` | Covered |
|
|
@@ -189,7 +213,7 @@ validation with a signer code (see Fields) also runs on the auth-free transport.
|
|
|
189
213
|
| Method | Path | SDK method | Status |
|
|
190
214
|
| --- | --- | --- | --- |
|
|
191
215
|
| `GET` | `/v1/public/documents/{documentId}` | `client.documents.getPublic(documentId)` | Covered |
|
|
192
|
-
| `PUT` | `/v1/public/documents/{documentId}/send-token` | `client.documents.sendToken(documentId, recipient
|
|
216
|
+
| `PUT` | `/v1/public/documents/{documentId}/send-token` | `client.documents.sendToken(documentId, recipient)` | Covered |
|
|
193
217
|
| `GET` | `/v1/signers/self` | `client.signerDocuments.self(accessCode)` | Covered |
|
|
194
218
|
| `GET` | `/v1/signers/identity-verification` | `client.signerDocuments.getIdentityVerification(accessCode)` | Covered |
|
|
195
219
|
| `POST` | `/v1/signers/identity-verification` | `client.signerDocuments.startIdentityVerification(accessCode, payload)` | Covered |
|
|
@@ -231,7 +255,7 @@ validation with a signer code (see Fields) also runs on the auth-free transport.
|
|
|
231
255
|
Five additional routes are documented separately under
|
|
232
256
|
[Template compatibility routes](#template-compatibility-routes).
|
|
233
257
|
|
|
234
|
-
## Users —
|
|
258
|
+
## Users — 6/6
|
|
235
259
|
|
|
236
260
|
| Method | Path | SDK method | Status |
|
|
237
261
|
| --- | --- | --- | --- |
|
|
@@ -241,11 +265,6 @@ Five additional routes are documented separately under
|
|
|
241
265
|
| `PUT` | `/v1/users/self/notification-preferences` | `client.users.updateNotificationPreferences(preferences)` | Covered |
|
|
242
266
|
| `GET` | `/v1/users/self/push-preferences` | `client.users.getPushPreferences()` | Covered |
|
|
243
267
|
| `PUT` | `/v1/users/self/push-preferences` | `client.users.updatePushPreferences(preferences)` | Covered |
|
|
244
|
-
| `GET` | `/v1/users/self/mfa` | `client.users.getMfa()` | Covered |
|
|
245
|
-
| `POST` | `/v1/users/self/mfa/totp` | `client.users.startTotpEnrollment(label?)` | Covered |
|
|
246
|
-
| `PUT` | `/v1/users/self/mfa/totp/confirm` | `client.users.confirmTotpEnrollment(payload)` | Covered |
|
|
247
|
-
| `POST` | `/v1/users/self/mfa/recovery-codes` | `client.users.regenerateRecoveryCodes(proof)` | Covered |
|
|
248
|
-
| `DELETE` | `/v1/users/self/mfa/{customId}` | `client.users.deleteMfaMethod(methodId, proof)` | Covered |
|
|
249
268
|
|
|
250
269
|
## Webhooks — 15/15
|
|
251
270
|
|
|
@@ -270,7 +289,7 @@ Five additional routes are documented separately under
|
|
|
270
289
|
## Template compatibility routes
|
|
271
290
|
|
|
272
291
|
These routes are available to existing integrations but do not appear in the
|
|
273
|
-
current OpenAPI path set. They are excluded from the official
|
|
292
|
+
current OpenAPI path set. They are excluded from the official 158-operation
|
|
274
293
|
coverage count.
|
|
275
294
|
|
|
276
295
|
| Method | Path | SDK method | Status |
|
|
@@ -281,17 +300,6 @@ coverage count.
|
|
|
281
300
|
| `DELETE` | `/v1/accounts/{accountId}/templates/{templateId}` | `client.templates.delete(templateId, accountId?)` | Compatibility extension |
|
|
282
301
|
| `GET` | `/v1/accounts/{accountId}/templates/{templateId}/pages/{pageId}/download` | `client.templates.downloadPage(templateId, pageId, accountId?)` | Compatibility extension |
|
|
283
302
|
|
|
284
|
-
## Browser URL helpers
|
|
285
|
-
|
|
286
|
-
Two browser URL helpers used by older deployments are live but absent from the
|
|
287
|
-
current OpenAPI path set, so they are likewise excluded from the official
|
|
288
|
-
147-operation coverage count.
|
|
289
|
-
|
|
290
|
-
| Method | Path | SDK method | Status |
|
|
291
|
-
| --- | --- | --- | --- |
|
|
292
|
-
| `GET` | `/v1/auth/authenticate` | `client.auth.getSocialLoginUrl()` | Compatibility extension |
|
|
293
|
-
| `GET` | `/v1/login-callback` | `client.auth.getSocialLoginCallbackUrl()` | Compatibility extension |
|
|
294
|
-
|
|
295
303
|
## SDK conveniences
|
|
296
304
|
|
|
297
305
|
These helpers compose or derive official operations and therefore do not add to
|
|
@@ -320,21 +328,6 @@ the endpoint count:
|
|
|
320
328
|
|
|
321
329
|
For request and response payload definitions, use the exported TypeScript
|
|
322
330
|
interfaces and each method's JSDoc examples together with the
|
|
323
|
-
[official API reference](https://api.assinafy.com.br/v1/docs).
|
|
331
|
+
[official API reference](https://api.assinafy.com.br/v1/docs). Response
|
|
324
332
|
variants that require compatibility handling are recorded in
|
|
325
333
|
[COMPATIBILITY.md](COMPATIBILITY.md).
|
|
326
|
-
|
|
327
|
-
## Additional staging operations — 10/10
|
|
328
|
-
|
|
329
|
-
| Method | Path | SDK method | Status |
|
|
330
|
-
| --- | --- | --- | --- |
|
|
331
|
-
| `GET` | `/v1/documents/{documentId}/signer-capacities` | `client.assignments.getSignerCapacities(documentId)` | Covered (staging) |
|
|
332
|
-
| `GET` | `/v1/documents/{documentId}/notification-history` | `client.assignments.getNotificationHistory(documentId)` | Covered (staging) |
|
|
333
|
-
| `GET` | `/v1/documents/{documentId}/watchers` | `client.documents.listWatchers(documentId)` | Covered (staging) |
|
|
334
|
-
| `PUT` | `/v1/documents/{documentId}/watchers` | `client.documents.setWatchers(documentId, watcherIds)` | Covered (staging) |
|
|
335
|
-
| `POST` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/estimate-resend-cost` | `client.envelopes.estimateResendCost(envelopeId, signerId, accountId?)` | Covered (staging) |
|
|
336
|
-
| `POST` | `/v1/documents/{documentId}/scheduled-sends` | `client.scheduledSends.createAssignment(documentId, payload)` | Covered (staging) |
|
|
337
|
-
| `POST` | `/v1/accounts/{accountId}/scheduled-sends` | `client.scheduledSends.createEnvelope(payload, accountId?)` | Covered (staging) |
|
|
338
|
-
| `GET` | `/v1/accounts/{accountId}/scheduled-sends` | `client.scheduledSends.list(params?, accountId?)` | Covered (staging) |
|
|
339
|
-
| `PUT` | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/cancel` | `client.scheduledSends.cancel(scheduledSendId, accountId?)` | Covered (staging) |
|
|
340
|
-
| `PUT` | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/send` | `client.scheduledSends.sendNow(scheduledSendId, accountId?)` | Covered (staging) |
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -6,46 +6,6 @@ New integrations should send the published request shape. Compatibility paths
|
|
|
6
6
|
are narrow, typed, and used only when a caller selects one or when a validation
|
|
7
7
|
response unambiguously requests an older shape.
|
|
8
8
|
|
|
9
|
-
## Host availability
|
|
10
|
-
|
|
11
|
-
The production contract includes these account and authenticated-user routes:
|
|
12
|
-
|
|
13
|
-
```text
|
|
14
|
-
GET, POST /v1/accounts
|
|
15
|
-
GET, PUT, DELETE /v1/accounts/{accountId}
|
|
16
|
-
GET, POST, DELETE /v1/accounts/{accountId}/logo
|
|
17
|
-
GET /v1/accounts/{accountId}/theme
|
|
18
|
-
GET /v1/accounts/{accountId}/stats
|
|
19
|
-
GET /v1/accounts/{accountId}/usage
|
|
20
|
-
GET, PUT /v1/accounts/{accountId}/notification-policy
|
|
21
|
-
GET, POST, PUT, DELETE /v1/accounts/{accountId}/embed-origins (and per-origin routes)
|
|
22
|
-
GET, POST, PATCH, PUT, DELETE /v1/accounts/{accountId}/envelopes (and per-envelope routes)
|
|
23
|
-
GET /v1/users/self
|
|
24
|
-
GET, PUT /v1/users/self/notification-preferences
|
|
25
|
-
GET, PUT /v1/users/self/push-preferences
|
|
26
|
-
GET /v1/users/self/stats
|
|
27
|
-
GET /v1/users/self/mfa (and the two-factor management routes)
|
|
28
|
-
POST /v1/authentication/mfa/verify
|
|
29
|
-
GET, POST /v1/accounts/{accountId}/webhooks/endpoints (and per-endpoint routes)
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Sandbox deployments can return `404` for user statistics, account statistics,
|
|
33
|
-
notification preferences, two-factor routes, webhook endpoint routes, envelopes,
|
|
34
|
-
embedded signing, usage, notification policy, push preferences, the signing-page
|
|
35
|
-
theme/logo and certified-copy routes while production serves them. The SDK keeps the official paths and response types. A
|
|
36
|
-
sandbox `404` does not cause the client to route a request elsewhere.
|
|
37
|
-
|
|
38
|
-
Two browser URL helpers used by older deployments remain available:
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
GET /v1/auth/authenticate
|
|
42
|
-
GET /v1/login-callback
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
They map to `auth.getSocialLoginUrl()` and
|
|
46
|
-
`auth.getSocialLoginCallbackUrl()` and are not part of the official
|
|
47
|
-
147-operation total.
|
|
48
|
-
|
|
49
9
|
The SDK also includes the production contract additions for:
|
|
50
10
|
|
|
51
11
|
- the `pades` document artifact;
|
|
@@ -61,27 +21,9 @@ Older signer-self responses can omit `has_signature`, `has_initial`, and
|
|
|
61
21
|
`is_signature_reusable`; assignment signers can omit `notification_history`.
|
|
62
22
|
Those fields are optional in the SDK response types.
|
|
63
23
|
|
|
64
|
-
## Staging additions
|
|
65
|
-
|
|
66
|
-
Staging publishes 157 operations; production publishes 147. The additional
|
|
67
|
-
operations expose scheduled assignments/envelopes (`client.scheduledSends`),
|
|
68
|
-
document watchers, signer capacities, notification delivery/open history, and
|
|
69
|
-
envelope reminder estimates. They are marked **Covered (staging)** in the
|
|
70
|
-
coverage ledger. No method falls back to another environment.
|
|
71
|
-
|
|
72
|
-
Assignment creation and estimates also accept nullable `sign_as`; it is a
|
|
73
|
-
sender-stated certificate label, not an identity claim. Signature-image upload
|
|
74
|
-
accepts PNG and, on staging, JPEG. Plan prices are deployment-specific: use
|
|
75
|
-
cost estimates and pass `max_total_credits` when creating a signing request.
|
|
76
|
-
|
|
77
|
-
Run `ASSINAFY_CONTRACT_ENV=staging ASSINAFY_OPENAPI_URL=... bun run audit:api`
|
|
78
|
-
to validate the staging specification. OAuth discovery checks target the public
|
|
79
|
-
production and sandbox deployments.
|
|
80
|
-
Keep the selected deployment URL in local configuration.
|
|
81
|
-
|
|
82
24
|
## Contract lifecycle management (CLM)
|
|
83
25
|
|
|
84
|
-
|
|
26
|
+
The API exposes the six contract lifecycle operations under
|
|
85
27
|
`/v1/accounts/{accountId}` through `client.contracts`. They track terms on an
|
|
86
28
|
existing document, link signed amendment/renewal/termination instruments, run
|
|
87
29
|
the hourly renewal and expiration lifecycle, and expose portfolio filters.
|
|
@@ -108,14 +50,10 @@ unexpected failure. Refusals of the contract routes themselves carry a
|
|
|
108
50
|
machine-readable `ApiError.code` (`ContractChanged`, `NoContractTerms`,
|
|
109
51
|
`PlanRestricted`) and, for a `400`, `ApiError.fieldErrors`.
|
|
110
52
|
|
|
111
|
-
A
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
plan-gated. Signed amendments wait and the lifecycle catches up after the plan
|
|
116
|
-
returns, as defined by the production integration guide.
|
|
117
|
-
Staging publishes the six CLM operations and activity paging. Deployment
|
|
118
|
-
availability remains explicit: configure `baseUrl` for the environment being used.
|
|
53
|
+
A workspace whose plan does not include contract tracking receives `403`; the
|
|
54
|
+
SDK does not reinterpret it. Read operations remain available after a plan
|
|
55
|
+
lapses; writes are plan-gated. Signed amendments wait and the lifecycle catches
|
|
56
|
+
up after the plan returns, as defined by the API's integration guide.
|
|
119
57
|
|
|
120
58
|
`documents.details()` can expose `has_contract` only in a workspace context and
|
|
121
59
|
only when contract tracking is available. A missing key means unknown, not
|
|
@@ -128,7 +66,8 @@ catalog with `webhooks.listEventTypes()`.
|
|
|
128
66
|
`DocumentStatsRow` separates notification-channel counters from verification
|
|
129
67
|
method counters. Notification counters are not mutually exclusive.
|
|
130
68
|
`signature_requests_verification_{email,whatsapp,bypass,digital_certificate}`
|
|
131
|
-
are mutually exclusive and sum to `signature_requests
|
|
69
|
+
are mutually exclusive and sum to `signature_requests` minus the
|
|
70
|
+
`IdDocumentFaceMatchBasic` requests, which have no counter. Older unsuffixed email
|
|
132
71
|
and WhatsApp counters remain optional.
|
|
133
72
|
|
|
134
73
|
## OAuth uses separate API and authorization hosts
|
|
@@ -149,14 +88,13 @@ base URL's **origin**, not from `baseUrl` itself, and
|
|
|
149
88
|
`getAuthorizationServerMetadata()` issues a cross-host request on the
|
|
150
89
|
credential-free transport.
|
|
151
90
|
|
|
152
|
-
|
|
153
|
-
`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
sandbox issuer from its API origin:
|
|
91
|
+
Discover the issuer from the API origin instead of hardcoding it: without an
|
|
92
|
+
argument, `getAuthorizationServerMetadata()` and `createAuthorizationUrl()`
|
|
93
|
+
read the protected-resource document of the configured `baseUrl` and use the
|
|
94
|
+
authorization server it names.
|
|
157
95
|
|
|
158
96
|
```ts
|
|
159
|
-
const client = new AssinafyClient({ baseUrl: 'https://
|
|
97
|
+
const client = new AssinafyClient({ baseUrl: 'https://api.assinafy.com.br/v1' });
|
|
160
98
|
const metadata = await client.oauth.getAuthorizationServerMetadata();
|
|
161
99
|
const request = await client.oauth.createAuthorizationUrl({
|
|
162
100
|
clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
@@ -165,9 +103,8 @@ const request = await client.oauth.createAuthorizationUrl({
|
|
|
165
103
|
});
|
|
166
104
|
```
|
|
167
105
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
connection in one environment. Token, revocation and userinfo requests use the
|
|
106
|
+
Keep each connection's issuer, client, credentials, workspace ID and `baseUrl`
|
|
107
|
+
together. Token, revocation and userinfo requests use the
|
|
171
108
|
configured `baseUrl`. Use a temporary HTTPS tunnel for local callbacks and
|
|
172
109
|
register its exact callback URL before starting the connection.
|
|
173
110
|
|
|
@@ -215,7 +152,7 @@ const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_S
|
|
|
215
152
|
|
|
216
153
|
### Document activities
|
|
217
154
|
|
|
218
|
-
|
|
155
|
+
`GET /v1/documents/{documentId}/activities` is paginated: 20 entries
|
|
219
156
|
per page by default, with `page`, `per-page` (at most 50, as above), and `sort`
|
|
220
157
|
(`-id` for newest first, the default; `id` for oldest first). A page beyond the
|
|
221
158
|
end returns an empty `data` array. `envelopes.listActivities()` reads an
|
|
@@ -225,7 +162,7 @@ envelope's trail the same way.
|
|
|
225
162
|
`IDocumentActivity[]`, normalizing an absent body to `[]`. It accepts `per_page`
|
|
226
163
|
as an alias for `per-page`, with the hyphenated form taking precedence. It makes
|
|
227
164
|
one request. Use `documents.listActivities()` to receive `{ data, meta }`, with
|
|
228
|
-
`current_page`, `per_page`, `total` and `last_page` parsed from the
|
|
165
|
+
`current_page`, `per_page`, `total` and `last_page` parsed from the
|
|
229
166
|
`X-Pagination-*` headers. `meta` is absent when the server sends no pagination
|
|
230
167
|
headers.
|
|
231
168
|
|
|
@@ -238,23 +175,18 @@ for (let page = 1; ; page++) {
|
|
|
238
175
|
page, 'per-page': 50, sort: 'id',
|
|
239
176
|
});
|
|
240
177
|
events.push(...data);
|
|
241
|
-
//
|
|
178
|
+
// A response without pagination headers has no meta: stop after it.
|
|
242
179
|
if (!meta?.last_page || page >= meta.last_page || data.length === 0) break;
|
|
243
180
|
}
|
|
244
181
|
```
|
|
245
182
|
|
|
246
|
-
|
|
183
|
+
The change from an unpaged history to a default page of 20 affects
|
|
247
184
|
existing clients even without an SDK upgrade: a successful request no longer
|
|
248
185
|
implies a complete activity log. SDK 2.9.1 and earlier cannot request later
|
|
249
186
|
pages through `activities()`. Integrations that need the full history must
|
|
250
187
|
upgrade to SDK 2.10.0 or later and explicitly traverse
|
|
251
188
|
pages. This SDK change does not automatically fetch the entire history.
|
|
252
189
|
|
|
253
|
-
Sandbox still serves an unpaged activity log and may ignore these parameters.
|
|
254
|
-
Do not use a loop that waits for an empty page on that deployment: it can keep
|
|
255
|
-
returning the same full log. A successful sandbox call does not verify production
|
|
256
|
-
pagination.
|
|
257
|
-
|
|
258
190
|
## Assignment list account context
|
|
259
191
|
|
|
260
192
|
`GET /v1/assignments` takes the workspace in the camel-case `accountId` query
|
|
@@ -337,27 +269,17 @@ const result = await client.documents.detachTag(documentId, tag.id);
|
|
|
337
269
|
The API accepts a tag color with or without a leading `#` and returns the
|
|
338
270
|
stored six-character value without it. Unknown tag names are not the normal
|
|
339
271
|
attachment input; create or list the tag first and send its ID. An empty array
|
|
340
|
-
passed to `replaceTags` detaches every tag.
|
|
341
|
-
|
|
342
|
-
Older sandbox deployments interpret those same string arrays as **tag names**:
|
|
343
|
-
sending an ID creates a new tag whose name is that ID. On such a deployment,
|
|
344
|
-
pass the existing tag's `name` intentionally to attach it. `detachTag` still
|
|
345
|
-
takes an ID. The SDK sends the supplied strings unchanged; it does not retry a
|
|
346
|
-
successful mutation or infer an ID-to-name translation. Check the returned tag
|
|
347
|
-
IDs and names when selecting the deployment's input shape.
|
|
272
|
+
passed to `replaceTags` detaches every tag. The SDK sends the supplied strings
|
|
273
|
+
unchanged; it does not retry a successful mutation or translate names to IDs.
|
|
348
274
|
|
|
349
275
|
## Account branding fields
|
|
350
276
|
|
|
351
277
|
The official account create/update request schemas define `name` and
|
|
352
278
|
`notification_sender_type`. The response includes `primary_color` and
|
|
353
|
-
`secondary_color`.
|
|
354
|
-
create/update
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Some sandbox plans reject `notification_sender_type` during account creation
|
|
358
|
-
while accepting it on update. If that occurs, create with `{ name }` and apply
|
|
359
|
-
the sender type in a separate update. `getTheme`, `downloadLogo`, `uploadLogo`,
|
|
360
|
-
and `deleteLogo` are official operations.
|
|
279
|
+
`secondary_color`. The SDK also retains those two color fields as optional
|
|
280
|
+
create/update inputs. Account colors must be six hexadecimal characters without
|
|
281
|
+
a leading `#`. `getTheme`, `downloadLogo`, `uploadLogo`, and `deleteLogo` are
|
|
282
|
+
official operations.
|
|
361
283
|
|
|
362
284
|
`workspaces.delete(accountId, { force: true })` requests cancellation of an
|
|
363
285
|
active paid subscription as part of account deletion. It is not a general
|
|
@@ -368,7 +290,7 @@ override for unrelated deletion restrictions.
|
|
|
368
290
|
The official field-create body defines `type`, `name`, nullable `regex`, and
|
|
369
291
|
`is_required`; update defines `name`, nullable `regex`, and `is_active`. The SDK
|
|
370
292
|
also retains `is_active` on create and `type` or `is_required` on update for
|
|
371
|
-
|
|
293
|
+
API versions that accept them. New code should prefer the operation-specific
|
|
372
294
|
official fields.
|
|
373
295
|
|
|
374
296
|
Field validation authenticates with the workspace credentials or with a signer
|
|
@@ -385,8 +307,7 @@ the API strips formatting itself and keeps the letters of an alphanumeric CNPJ
|
|
|
385
307
|
inputs remain accepted:
|
|
386
308
|
|
|
387
309
|
- `phone` is normalized to `whatsapp_phone_number` before transmission;
|
|
388
|
-
- `cpf` is normalized to digits and forwarded
|
|
389
|
-
- create-time `metadata` is forwarded unchanged.
|
|
310
|
+
- `cpf` is normalized to digits and forwarded.
|
|
390
311
|
|
|
391
312
|
New integrations should use the official fields, including `government_id`. `cpf` is not an alias for the official update field, and signer
|
|
392
313
|
responses do not return it.
|
|
@@ -485,7 +406,7 @@ as a `Buffer`. `thumbnail()` and `downloadPage()` accept `{ artifact:
|
|
|
485
406
|
The production signer `confirm-data` body contains `email`,
|
|
486
407
|
`whatsapp_phone_number` and `has_accepted_terms`: the signer sends the contact
|
|
487
408
|
their channel needs, saved only when they have none. It answers `data: []`, so
|
|
488
|
-
`confirmData()` resolves to `null`; older
|
|
409
|
+
`confirmData()` resolves to `null`; older API versions read `full_name` and
|
|
489
410
|
`government_id` and return the signer, so the SDK still forwards those fields.
|
|
490
411
|
A certificate signer must confirm data and accept terms before
|
|
491
412
|
`getAssignment()`; either send `has_accepted_terms: true` with `confirmData()`
|
|
@@ -503,179 +424,38 @@ documentId })`, and `expand: ['envelope']` names the envelope.
|
|
|
503
424
|
viewed the assignment. The SDK therefore excludes this request from automatic
|
|
504
425
|
HTTP 429 replay.
|
|
505
426
|
|
|
506
|
-
`sign()` sends
|
|
507
|
-
|
|
427
|
+
`sign()` sends an array of `{ itemId, fieldId, pageId, value }` for collect
|
|
428
|
+
assignments, or `[]` for a virtual assignment, whose entries the API ignores. A virtual signer must confirm their data
|
|
508
429
|
before signing and should use `signMultiple()`, which accepts only virtual
|
|
509
430
|
documents. Certificate signers cannot use `sign()`; they complete the
|
|
510
431
|
certificate-start and certificate-complete browser flow.
|
|
511
432
|
|
|
512
|
-
Signature image upload sends raw
|
|
513
|
-
`
|
|
514
|
-
|
|
515
|
-
|
|
433
|
+
Signature image upload sends raw image bytes: PNG by default
|
|
434
|
+
(`Content-Type: image/png`), or JPEG with `contentType: 'image/jpeg'`.
|
|
435
|
+
The upload always replaces the stored image of that type; `reuse: true` marks
|
|
436
|
+
it reusable on later documents. Other media types remain a deprecated overload. The API answers `400` with
|
|
437
|
+
`SignatureImageInvalid` for a file that is not PNG or JPEG and
|
|
438
|
+
`SignatureImageBlank` for a blank image.
|
|
516
439
|
|
|
517
|
-
##
|
|
440
|
+
## Uploads and expiration reset
|
|
518
441
|
|
|
519
|
-
Document upload
|
|
520
|
-
|
|
521
|
-
|
|
442
|
+
Document and template upload accept PDF, DOC, DOCX or ODT, at most 25 MB and
|
|
443
|
+
2,000 pages. The multipart body carries only the `file` part; its filename keeps
|
|
444
|
+
the real extension, which the API uses to recognise the format.
|
|
522
445
|
|
|
523
446
|
Assignment expiration accepts an ISO-8601 date (ending at 23:59 UTC), a
|
|
524
447
|
date-time without an offset (UTC), or an offset-aware date-time. The
|
|
525
448
|
reset-expiration schema requires the `expires_at` key itself; send `null` to
|
|
526
449
|
remove the expiration. The SDK always sends that key.
|
|
527
450
|
|
|
528
|
-
## Resend-cost
|
|
529
|
-
|
|
530
|
-
Production answers the compact `ResendCostEstimate` (`total`,
|
|
531
|
-
`has_sufficient_credits`, nullable `credit_balance`); older deployments return
|
|
532
|
-
the full `ICostEstimate`, so the SDK exposes `IResendCostEstimate`:
|
|
533
|
-
|
|
534
|
-
```ts
|
|
535
|
-
const estimate = await client.assignments.estimateResendCost(
|
|
536
|
-
documentId,
|
|
537
|
-
assignmentId,
|
|
538
|
-
signerId,
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
if ('total_credits' in estimate) {
|
|
542
|
-
console.log(estimate.has_sufficient_resources);
|
|
543
|
-
} else {
|
|
544
|
-
console.log(estimate.total, estimate.has_sufficient_credits);
|
|
545
|
-
}
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
The SDK does not add absent balance fields.
|
|
549
|
-
|
|
550
|
-
## Public document and signer download
|
|
551
|
-
|
|
552
|
-
The official public-document response is the full `Document` schema. Compact
|
|
553
|
-
responses can contain only `id`, `name`, `page_count`, and `created_by`.
|
|
554
|
-
`IPublicDocumentInfo` requires `id` and `name`, keeps expanded fields optional,
|
|
555
|
-
and retains the compact fields:
|
|
556
|
-
|
|
557
|
-
```ts
|
|
558
|
-
const document = await client.documents.getPublic(documentId);
|
|
559
|
-
const pages = document.pages?.length ?? Number(document.page_count ?? 0);
|
|
560
|
-
```
|
|
451
|
+
## Resend-cost responses
|
|
561
452
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
returning HTML bytes. The certified-copy link download
|
|
566
|
-
(`downloadCertifiedCopy(token)`) behaves the same way for an expired link; ask
|
|
567
|
-
for a new link with `resendCertifiedCopyFromLink(token)`.
|
|
568
|
-
|
|
569
|
-
## Empty acknowledgements
|
|
570
|
-
|
|
571
|
-
Several write operations return a success envelope without `data`; older
|
|
572
|
-
responses can use an empty array or object. Methods with no meaningful result
|
|
573
|
-
resolve to `Promise<void>` after validating the HTTP and envelope status. This
|
|
574
|
-
applies to signer OTP verification, signature-image upload, bulk signer
|
|
575
|
-
actions, and deletions without a documented result. `acceptTerms()` returns
|
|
576
|
-
the signer's `{ full_name, email, has_accepted_terms }`. Tag deletion and
|
|
577
|
-
document-tag detachment preserve `{ deleted: boolean }` and
|
|
578
|
-
`{ detached: boolean }`.
|
|
579
|
-
|
|
580
|
-
## WhatsApp notification buttons
|
|
581
|
-
|
|
582
|
-
The published notification button schema requires `text`. Production strips
|
|
583
|
-
button URLs; the sandbox returns `url`, so the SDK types it as optional. A
|
|
584
|
-
button URL can contain a signer access or verification value; treat it as a
|
|
585
|
-
credential and never log it. `sent_at` is an ISO-8601 string.
|
|
586
|
-
|
|
587
|
-
## Webhook delivery
|
|
588
|
-
|
|
589
|
-
Assinafy sends webhook events as HTTP `POST` JSON requests with
|
|
590
|
-
`Connection: close`, `webhook-id` and `webhook-timestamp` headers, and a
|
|
591
|
-
`webhook-signature` header on signing-enabled endpoints. Every active endpoint
|
|
592
|
-
subscribed to an event receives it independently. Any `2xx` is successful.
|
|
593
|
-
Connection failures, timeouts, `408`, `429`, and `5xx` receive up to six
|
|
594
|
-
attempts about ten minutes apart. After ten failed deliveries in a row, the
|
|
595
|
-
endpoint is held and probed after 3, 15, and 60 minutes, then every six hours.
|
|
596
|
-
Success replays missed events oldest first. `webhooks.retryDispatch()` sends
|
|
597
|
-
once immediately, even while held. The first 2,000 response characters and the
|
|
598
|
-
delivery entry are retained for seven days.
|
|
599
|
-
|
|
600
|
-
The common body contains `id`, `event`, nullable `message`, nullable `payload`,
|
|
601
|
-
nullable `origin`, Unix-second `created_at`, polymorphic `subject` and `object`,
|
|
602
|
-
and `account_id`. Deduplicate on the `webhook-id` header, which also tells
|
|
603
|
-
deliveries of the same event to different endpoints apart, and accept unknown
|
|
604
|
-
fields.
|
|
605
|
-
|
|
606
|
-
## Webhook endpoints and signatures
|
|
607
|
-
|
|
608
|
-
An account has 1 webhook endpoint, or up to 3 on paid plans. The subscription
|
|
609
|
-
routes (`webhooks.register()`, `get()`, `inactivate()`) act on the account's
|
|
610
|
-
oldest endpoint; the endpoint routes address each one by ID. Exact registered
|
|
611
|
-
URLs can also filter `listEndpoints(accountId?, { url })` and identify the
|
|
612
|
-
target of `deleteEndpointByUrl(url, accountId?)`.
|
|
613
|
-
|
|
614
|
-
New or changed endpoint URLs must use HTTPS. Endpoint responses expose
|
|
615
|
-
`is_held` and `held_since`; dispatch entries expose `webhook_id`, `attempt`,
|
|
616
|
-
`kind`, `will_retry`, and `duration_ms`. `testEndpoint()` sends one signed
|
|
617
|
-
`webhook_test` event (not subscribable, `payload` and `origin` `null`), also to a
|
|
618
|
-
held or inactive endpoint, without lifting or counting toward a hold; it is
|
|
619
|
-
limited to 10 per user every 10 minutes. `rotateEndpointSecret(endpointId,
|
|
620
|
-
accountId?, { keep_previous: true })` keeps the old secret signing beside the
|
|
621
|
-
new one for 24 hours (`previous_secret_expires_at`); each delivery then carries
|
|
622
|
-
two `v1,` entries, which `verifySignature()` accepts. `createEndpoint()` returns
|
|
623
|
-
`IWebhookEndpointCreateResponse` with `secret` when signing is enabled.
|
|
624
|
-
`updateEndpoint()` returns the same shape and includes `secret` when that
|
|
625
|
-
request turns signing on. Store the value securely. OAuth applications cannot
|
|
626
|
-
read it afterward, but can rotate it with `webhooks:write`.
|
|
627
|
-
|
|
628
|
-
Signing-enabled endpoints follow Standard Webhooks:
|
|
629
|
-
`webhook-signature` holds space-separated `v1,<base64>` entries, each an
|
|
630
|
-
HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
|
|
631
|
-
base64-decoded part of the `whsec_` secret.
|
|
632
|
-
`webhookVerifier.verifySignature()` implements this, with a 300-second
|
|
633
|
-
timestamp tolerance by default; non-finite or negative windows fail closed.
|
|
634
|
-
The secret-read route is not available to OAuth applications. The earlier
|
|
635
|
-
`webhookVerifier.verify()` (hex HMAC over the
|
|
636
|
-
body alone) is deprecated; it never matched an Assinafy signature.
|
|
637
|
-
|
|
638
|
-
Older sandbox deployments can omit `secret` from creation/update responses and
|
|
639
|
-
return `404` for deletion by URL. API-key integrations can still read/rotate
|
|
640
|
-
the secret and delete by ID. OAuth integrations can rotate a lost secret where
|
|
641
|
-
the production route is available.
|
|
642
|
-
|
|
643
|
-
## Refusal codes, idempotency and Bypass
|
|
644
|
-
|
|
645
|
-
- Error bodies carry a string `code` and, for a field `400`, `errors[]`; the SDK
|
|
646
|
-
exposes them as `ApiError.code` and `ApiError.fieldErrors`. The generic `404`
|
|
647
|
-
body's numeric `code: 0` is ignored.
|
|
648
|
-
- Only envelope creation and template document creation deduplicate an
|
|
649
|
-
`Idempotency-Key`; other routes ignore it, so the SDK sends it only from
|
|
650
|
-
`envelopes.create()` and `documents.createFromTemplate()`. Assignment creation
|
|
651
|
-
answers a retry with `400`.
|
|
652
|
-
- `Bypass` verification and notification are enabled per account and absent
|
|
653
|
-
from the published request enums; the SDK accepts them with the pairing the
|
|
654
|
-
API applies: the `Bypass` notification with `Bypass`, `DigitalCertificate` or
|
|
655
|
-
`IdDocumentFaceMatchBasic` verification, and `Bypass` verification with any
|
|
656
|
-
notification.
|
|
657
|
-
- The embed session exchange route belongs to Assinafy's embed page and is not
|
|
658
|
-
exposed.
|
|
659
|
-
|
|
660
|
-
Usage is documented in the [manual](README.en.md#envelopes) and in each
|
|
661
|
-
method's JSDoc.
|
|
662
|
-
|
|
663
|
-
## Authentication isolation
|
|
664
|
-
|
|
665
|
-
Public documents, login and social login, password reset, OAuth URLs, and
|
|
666
|
-
signer-access-code flows use a separate HTTP transport without `X-Api-Key` or
|
|
667
|
-
`Authorization` defaults. A credentialless `new AssinafyClient()` can drive
|
|
668
|
-
those flows, and credentials configured for protected resources are not sent.
|
|
669
|
-
|
|
670
|
-
Protected methods use the authenticated transport and receive the API's normal
|
|
671
|
-
`401` response when credentials are absent or invalid. The authenticated
|
|
672
|
-
transport accepts same-origin absolute URLs, rejects cross-origin requests
|
|
673
|
-
before dispatch, and treats credentials as redirect-sensitive. Use a separate
|
|
674
|
-
HTTP client for unrelated origins.
|
|
453
|
+
Both reminder estimates answer the compact `ResendCostEstimate`
|
|
454
|
+
(`IResendCostEstimate`): `total`, the `breakdown`, a nullable `credit_balance`
|
|
455
|
+
and `has_sufficient_credits`.
|
|
675
456
|
|
|
676
457
|
## Authenticated-user response variants
|
|
677
458
|
|
|
678
|
-
`GET /users/self`
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
`is_password_set` is optional.
|
|
459
|
+
`GET /users/self` answers `{ user, accounts }` while the published schema
|
|
460
|
+
documents a bare `AuthUser`. `users.getCurrent()` accepts both forms and returns
|
|
461
|
+
the user as `IAuthenticatedUser`.
|