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