@assinafy/sdk 2.10.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -1
- package/README.en.md +89 -1649
- package/README.md +87 -1607
- package/dist/index.d.mts +1646 -340
- package/dist/index.d.ts +1646 -340
- package/dist/index.js +1740 -311
- package/dist/index.mjs +1738 -311
- package/docs/API_COVERAGE.md +67 -20
- package/docs/COMPATIBILITY.md +127 -64
- package/docs/README.en.md +1863 -0
- package/docs/README.md +1818 -0
- package/docs/RELEASING.md +1 -1
- package/package.json +3 -2
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: 112 paths, 147 HTTP operations, and 62 component
|
|
6
6
|
schemas.
|
|
7
7
|
|
|
8
8
|
All paths below include the `/v1` prefix shown by the OpenAPI document, except
|
|
@@ -13,17 +13,19 @@ 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 the API reserves for Assinafy's own pages;
|
|
17
|
+
integrations must not call it.
|
|
16
18
|
- **Compatibility extension** — route retained for existing integrations but
|
|
17
|
-
absent from the current OpenAPI path set and excluded from the
|
|
19
|
+
absent from the current OpenAPI path set and excluded from the 147-operation
|
|
18
20
|
total.
|
|
19
21
|
|
|
20
|
-
## Accounts —
|
|
22
|
+
## Accounts — 13/13
|
|
21
23
|
|
|
22
24
|
| Method | Path | SDK method | Status |
|
|
23
25
|
| --- | --- | --- | --- |
|
|
24
26
|
| `GET` | `/v1/accounts` | `client.workspaces.list()` | Covered |
|
|
25
27
|
| `POST` | `/v1/accounts` | `client.workspaces.create(payload)` | Covered |
|
|
26
|
-
| `GET` | `/v1/accounts/{accountId}` | `client.workspaces.get(accountId)` | Covered |
|
|
28
|
+
| `GET` | `/v1/accounts/{accountId}` | `client.workspaces.get(accountId, options?)` | Covered |
|
|
27
29
|
| `PUT` | `/v1/accounts/{accountId}` | `client.workspaces.update(accountId, payload)` | Covered |
|
|
28
30
|
| `DELETE` | `/v1/accounts/{accountId}` | `client.workspaces.delete(accountId, options?)` | Covered |
|
|
29
31
|
| `GET` | `/v1/accounts/{accountId}/theme` | `client.workspaces.getTheme(accountId)` | Covered |
|
|
@@ -31,6 +33,9 @@ Status meanings:
|
|
|
31
33
|
| `POST` | `/v1/accounts/{accountId}/logo` | `client.workspaces.uploadLogo(accountId, source)` | Covered |
|
|
32
34
|
| `DELETE` | `/v1/accounts/{accountId}/logo` | `client.workspaces.deleteLogo(accountId)` | Covered |
|
|
33
35
|
| `GET` | `/v1/accounts/{accountId}/stats` | `client.workspaces.getStats(accountId, params?)` | Covered |
|
|
36
|
+
| `GET` | `/v1/accounts/{accountId}/usage` | `client.workspaces.getUsage(accountId)` | Covered |
|
|
37
|
+
| `GET` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.getNotificationPolicy(accountId)` | Covered |
|
|
38
|
+
| `PUT` | `/v1/accounts/{accountId}/notification-policy` | `client.workspaces.updateNotificationPolicy(accountId, payload)` | Covered |
|
|
34
39
|
|
|
35
40
|
## Assignments — 10/10
|
|
36
41
|
|
|
@@ -69,10 +74,42 @@ Status meanings:
|
|
|
69
74
|
| `GET` | `/v1/accounts/{accountId}/contracts` | `client.contracts.list(params?, accountId?)` | Covered |
|
|
70
75
|
| `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract` | `client.contracts.get(documentId, accountId?)` | Covered |
|
|
71
76
|
| `PUT` | `/v1/accounts/{accountId}/documents/{documentId}/contract` | `client.contracts.set(documentId, payload, accountId?)` | Covered |
|
|
72
|
-
| `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract/related` | `client.contracts.listRelated(documentId, accountId?)` | Covered |
|
|
77
|
+
| `GET` | `/v1/accounts/{accountId}/documents/{documentId}/contract/related` | `client.contracts.listRelated(documentId, accountId?, params?)` | Covered |
|
|
73
78
|
| `POST` | `/v1/accounts/{accountId}/documents/{documentId}/contract/renew` | `client.contracts.renew(documentId, payload, accountId?)` | Covered |
|
|
74
79
|
| `POST` | `/v1/accounts/{accountId}/documents/{documentId}/contract/terminate` | `client.contracts.terminate(documentId, payload?, accountId?)` | Covered |
|
|
75
80
|
|
|
81
|
+
## Embedded signing — 6/6
|
|
82
|
+
|
|
83
|
+
Server side only: the iframe and its `postMessage` handshake run in the
|
|
84
|
+
browser. The session exchange is called by Assinafy's embed page with the
|
|
85
|
+
single-use token, and spending it from an integration would break the frame.
|
|
86
|
+
|
|
87
|
+
| Method | Path | SDK method | Status |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| `GET` | `/v1/accounts/{accountId}/embed-origins` | `client.embed.listOrigins(accountId?)` | Covered |
|
|
90
|
+
| `POST` | `/v1/accounts/{accountId}/embed-origins` | `client.embed.addOrigin(origin, accountId?)` | Covered |
|
|
91
|
+
| `PUT` | `/v1/accounts/{accountId}/embed-origins/{originId}` | `client.embed.updateOrigin(originId, origin, accountId?)` | Covered |
|
|
92
|
+
| `DELETE` | `/v1/accounts/{accountId}/embed-origins/{originId}` | `client.embed.deleteOrigin(originId, accountId?)` | Covered |
|
|
93
|
+
| `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/embed-sessions` | `client.embed.createSession(documentId, assignmentId, signerId)` | Covered |
|
|
94
|
+
| `POST` | `/v1/embed/sessions/{token}/exchange` | — | Not exposed |
|
|
95
|
+
|
|
96
|
+
## Envelopes — 12/12
|
|
97
|
+
|
|
98
|
+
| Method | Path | SDK method | Status |
|
|
99
|
+
| --- | --- | --- | --- |
|
|
100
|
+
| `GET` | `/v1/accounts/{accountId}/envelopes` | `client.envelopes.list(params?, accountId?)` | Covered |
|
|
101
|
+
| `POST` | `/v1/accounts/{accountId}/envelopes` | `client.envelopes.create(payload, options?, accountId?)` | Covered |
|
|
102
|
+
| `POST` | `/v1/accounts/{accountId}/envelopes/estimate-cost` | `client.envelopes.estimateCost(payload, accountId?)` | Covered |
|
|
103
|
+
| `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.get(envelopeId, accountId?)` | Covered |
|
|
104
|
+
| `PATCH` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.update(envelopeId, payload, accountId?)` | Covered |
|
|
105
|
+
| `DELETE` | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `client.envelopes.delete(envelopeId, accountId?)` | Covered |
|
|
106
|
+
| `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/activities` | `client.envelopes.listActivities(envelopeId, params?, accountId?)` | Covered |
|
|
107
|
+
| `PUT` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/cancel` | `client.envelopes.cancel(envelopeId, accountId?)` | Covered |
|
|
108
|
+
| `POST` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/documents` | `client.envelopes.addDocument(envelopeId, payload, accountId?)` | Covered |
|
|
109
|
+
| `DELETE` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}` | `client.envelopes.removeDocument(envelopeId, documentId, accountId?)` | Covered |
|
|
110
|
+
| `GET` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/download/{artifactName}` | `client.envelopes.download(envelopeId, artifactName, accountId?)` | Covered |
|
|
111
|
+
| `PUT` | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/resend` | `client.envelopes.resendNotification(envelopeId, signerId, accountId?)` | Covered |
|
|
112
|
+
|
|
76
113
|
## Documents — 18/18
|
|
77
114
|
|
|
78
115
|
| Method | Path | SDK method | Status |
|
|
@@ -81,14 +118,14 @@ Status meanings:
|
|
|
81
118
|
| `POST` | `/v1/accounts/{accountId}/documents` | `client.documents.upload(source, options?)` | Covered |
|
|
82
119
|
| `GET` | `/v1/accounts/{accountId}/documents/search` | `client.documents.search(params?, accountId?)` | Covered |
|
|
83
120
|
| `GET` | `/v1/documents/statuses` | `client.documents.statuses()` | Covered |
|
|
84
|
-
| `GET` | `/v1/documents/{documentId}` | `client.documents.details(documentId)` / `get(documentId)` | Covered |
|
|
121
|
+
| `GET` | `/v1/documents/{documentId}` | `client.documents.details(documentId, options?)` / `get(documentId, options?)` | Covered |
|
|
85
122
|
| `DELETE` | `/v1/documents/{documentId}` | `client.documents.delete(documentId)` | Covered |
|
|
86
123
|
| `PATCH` | `/v1/documents/{documentId}` | `client.documents.rename(documentId, name)` | Covered |
|
|
87
124
|
| `GET` | `/v1/documents/{documentId}/activities` | `client.documents.activities(documentId, params?)` / `client.documents.listActivities(documentId, params?)` | Covered |
|
|
88
125
|
| `GET` | `/v1/documents/{documentId}/download/{artifactName}` | `client.documents.download(documentId, artifactName)` | Covered |
|
|
89
126
|
| `GET` | `/v1/documents/{documentSignatureHash}/verify` | `client.documents.verify(documentSignatureHash)` | Covered |
|
|
90
|
-
| `GET` | `/v1/documents/{documentId}/thumbnail` | `client.documents.thumbnail(documentId)` | Covered |
|
|
91
|
-
| `GET` | `/v1/documents/{documentId}/pages/{pageId}/download` | `client.documents.downloadPage(documentId, pageId)` | Covered |
|
|
127
|
+
| `GET` | `/v1/documents/{documentId}/thumbnail` | `client.documents.thumbnail(documentId, options?)` | Covered |
|
|
128
|
+
| `GET` | `/v1/documents/{documentId}/pages/{pageId}/download` | `client.documents.downloadPage(documentId, pageId, options?)` | Covered |
|
|
92
129
|
| `GET` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.listTags(documentId, accountId?)` | Covered |
|
|
93
130
|
| `PUT` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.replaceTags(documentId, tagIds, accountId?)` | Covered |
|
|
94
131
|
| `POST` | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `client.documents.addTags(documentId, tagIds, accountId?)` | Covered |
|
|
@@ -136,14 +173,16 @@ ordinary OAuth applications use the two SDK methods listed below.
|
|
|
136
173
|
| `PUT` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.update(signerId, payload, accountId?)` | Covered |
|
|
137
174
|
| `DELETE` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.delete(signerId, accountId?)` | Covered |
|
|
138
175
|
|
|
139
|
-
## Signing and public flows —
|
|
176
|
+
## Signing and public flows — 24/24
|
|
140
177
|
|
|
141
178
|
All access-code methods in this section use the auth-free transport and reject
|
|
142
179
|
a missing or blank code; they authenticate with the `signer-access-code` query
|
|
143
180
|
parameter required by the OpenAPI security scheme. The signer document list and
|
|
144
181
|
search also accept workspace credentials; only the explicit `listAsWorkspace` /
|
|
145
|
-
`searchAsWorkspace` methods send them, and never with an access code. The
|
|
146
|
-
|
|
182
|
+
`searchAsWorkspace` methods send them, and never with an access code. The signer
|
|
183
|
+
artifact download and the certified-copy link download do not follow redirects,
|
|
184
|
+
so an expired link surfaces as an error instead of an HTML page. Field
|
|
185
|
+
validation with a signer code (see Fields) also runs on the auth-free transport.
|
|
147
186
|
|
|
148
187
|
| Method | Path | SDK method | Status |
|
|
149
188
|
| --- | --- | --- | --- |
|
|
@@ -152,8 +191,13 @@ an optional fourth access-code argument only for legacy compatibility.
|
|
|
152
191
|
| `GET` | `/v1/signers/self` | `client.signerDocuments.self(accessCode)` | Covered |
|
|
153
192
|
| `GET` | `/v1/signers/identity-verification` | `client.signerDocuments.getIdentityVerification(accessCode)` | Covered |
|
|
154
193
|
| `POST` | `/v1/signers/identity-verification` | `client.signerDocuments.startIdentityVerification(accessCode, payload)` | Covered |
|
|
155
|
-
| `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode)` | Covered |
|
|
156
|
-
| `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode,
|
|
194
|
+
| `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode, options?)` | Covered |
|
|
195
|
+
| `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode, options?)` | Covered |
|
|
196
|
+
| `GET` | `/v1/sign/theme` | `client.signerDocuments.getTheme(accessCode)` | Covered |
|
|
197
|
+
| `GET` | `/v1/sign/logo` | `client.signerDocuments.downloadLogo(accessCode)` | Covered |
|
|
198
|
+
| `POST` | `/v1/sign/certified-copy` | `client.signerDocuments.resendCertifiedCopy(accessCode, documentId?)` | Covered |
|
|
199
|
+
| `GET` | `/v1/signers/downloads/{token}` | `client.signerDocuments.downloadCertifiedCopy(token, artifact?)` | Covered |
|
|
200
|
+
| `POST` | `/v1/signers/downloads/{token}/resend` | `client.signerDocuments.resendCertifiedCopyFromLink(token)` | Covered |
|
|
157
201
|
| `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}` | `client.signerDocuments.sign(documentId, assignmentId, accessCode, entries)` | Covered |
|
|
158
202
|
| `PUT` | `/v1/documents/{documentId}/assignments/{assignmentId}/reject` | `client.signerDocuments.decline(documentId, assignmentId, accessCode, reason)` | Covered |
|
|
159
203
|
| `PUT` | `/v1/signers/documents/sign-multiple` | `client.signerDocuments.signMultiple(documentIds, accessCode)` | Covered |
|
|
@@ -164,8 +208,8 @@ an optional fourth access-code argument only for legacy compatibility.
|
|
|
164
208
|
| `POST` | `/v1/signature` | `client.signerDocuments.uploadSignature(accessCode, image, options?)` | Covered |
|
|
165
209
|
| `GET` | `/v1/signature/{signatureType}` | `client.signerDocuments.downloadSignature(accessCode, signatureType)` | Covered |
|
|
166
210
|
| `GET` | `/v1/signers/{signerId}/documents` | `client.signerDocuments.list(signerId, accessCode, params?)` / `client.signerDocuments.listAsWorkspace(signerId, params?)` | Covered |
|
|
167
|
-
| `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search)` / `client.signerDocuments.searchAsWorkspace(signerId, search?)` | Covered |
|
|
168
|
-
| `GET` | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `client.signerDocuments.download(signerId, documentId,
|
|
211
|
+
| `GET` | `/v1/signers/{signerId}/documents/search` | `client.signerDocuments.search(signerId, accessCode, search?, params?)` / `client.signerDocuments.searchAsWorkspace(signerId, search?, params?)` | Covered |
|
|
212
|
+
| `GET` | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `client.signerDocuments.download(signerId, documentId, 'original', accessCode)` | Covered |
|
|
169
213
|
|
|
170
214
|
## Tags — 4/4
|
|
171
215
|
|
|
@@ -185,7 +229,7 @@ an optional fourth access-code argument only for legacy compatibility.
|
|
|
185
229
|
Five additional routes are documented separately under
|
|
186
230
|
[Template compatibility routes](#template-compatibility-routes).
|
|
187
231
|
|
|
188
|
-
## Users —
|
|
232
|
+
## Users — 11/11
|
|
189
233
|
|
|
190
234
|
| Method | Path | SDK method | Status |
|
|
191
235
|
| --- | --- | --- | --- |
|
|
@@ -193,13 +237,15 @@ Five additional routes are documented separately under
|
|
|
193
237
|
| `GET` | `/v1/users/self/stats` | `client.users.getStats(params?)` | Covered |
|
|
194
238
|
| `GET` | `/v1/users/self/notification-preferences` | `client.users.getNotificationPreferences()` | Covered |
|
|
195
239
|
| `PUT` | `/v1/users/self/notification-preferences` | `client.users.updateNotificationPreferences(preferences)` | Covered |
|
|
240
|
+
| `GET` | `/v1/users/self/push-preferences` | `client.users.getPushPreferences()` | Covered |
|
|
241
|
+
| `PUT` | `/v1/users/self/push-preferences` | `client.users.updatePushPreferences(preferences)` | Covered |
|
|
196
242
|
| `GET` | `/v1/users/self/mfa` | `client.users.getMfa()` | Covered |
|
|
197
243
|
| `POST` | `/v1/users/self/mfa/totp` | `client.users.startTotpEnrollment(label?)` | Covered |
|
|
198
244
|
| `PUT` | `/v1/users/self/mfa/totp/confirm` | `client.users.confirmTotpEnrollment(payload)` | Covered |
|
|
199
245
|
| `POST` | `/v1/users/self/mfa/recovery-codes` | `client.users.regenerateRecoveryCodes(proof)` | Covered |
|
|
200
246
|
| `DELETE` | `/v1/users/self/mfa/{customId}` | `client.users.deleteMfaMethod(methodId, proof)` | Covered |
|
|
201
247
|
|
|
202
|
-
## Webhooks —
|
|
248
|
+
## Webhooks — 15/15
|
|
203
249
|
|
|
204
250
|
| Method | Path | SDK method | Status |
|
|
205
251
|
| --- | --- | --- | --- |
|
|
@@ -216,12 +262,13 @@ Five additional routes are documented separately under
|
|
|
216
262
|
| `PUT` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.updateEndpoint(endpointId, payload, accountId?)` | Covered |
|
|
217
263
|
| `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.deleteEndpoint(endpointId, accountId?)` | Covered |
|
|
218
264
|
| `GET` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret` | `client.webhooks.getEndpointSecret(endpointId, accountId?)` | Covered |
|
|
219
|
-
| `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate` | `client.webhooks.rotateEndpointSecret(endpointId, accountId?)` | Covered |
|
|
265
|
+
| `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate` | `client.webhooks.rotateEndpointSecret(endpointId, accountId?, options?)` | Covered |
|
|
266
|
+
| `POST` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}/test` | `client.webhooks.testEndpoint(endpointId, accountId?)` | Covered |
|
|
220
267
|
|
|
221
268
|
## Template compatibility routes
|
|
222
269
|
|
|
223
270
|
These routes are available to existing integrations but do not appear in the
|
|
224
|
-
current OpenAPI path set. They are excluded from the official
|
|
271
|
+
current OpenAPI path set. They are excluded from the official 147-operation
|
|
225
272
|
coverage count.
|
|
226
273
|
|
|
227
274
|
| Method | Path | SDK method | Status |
|
|
@@ -236,7 +283,7 @@ coverage count.
|
|
|
236
283
|
|
|
237
284
|
Two browser URL helpers used by older deployments are live but absent from the
|
|
238
285
|
current OpenAPI path set, so they are likewise excluded from the official
|
|
239
|
-
|
|
286
|
+
147-operation coverage count.
|
|
240
287
|
|
|
241
288
|
| Method | Path | SDK method | Status |
|
|
242
289
|
| --- | --- | --- | --- |
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -16,8 +16,13 @@ GET, PUT, DELETE /v1/accounts/{accountId}
|
|
|
16
16
|
GET, POST, DELETE /v1/accounts/{accountId}/logo
|
|
17
17
|
GET /v1/accounts/{accountId}/theme
|
|
18
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)
|
|
19
23
|
GET /v1/users/self
|
|
20
24
|
GET, PUT /v1/users/self/notification-preferences
|
|
25
|
+
GET, PUT /v1/users/self/push-preferences
|
|
21
26
|
GET /v1/users/self/stats
|
|
22
27
|
GET /v1/users/self/mfa (and the two-factor management routes)
|
|
23
28
|
POST /v1/authentication/mfa/verify
|
|
@@ -25,8 +30,9 @@ GET, POST /v1/accounts/{accountId}/webhooks/endpoints (and per-endpoint
|
|
|
25
30
|
```
|
|
26
31
|
|
|
27
32
|
Sandbox deployments can return `404` for user statistics, account statistics,
|
|
28
|
-
notification preferences, two-factor routes,
|
|
29
|
-
|
|
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
|
|
30
36
|
sandbox `404` does not cause the client to route a request elsewhere.
|
|
31
37
|
|
|
32
38
|
Two browser URL helpers used by older deployments remain available:
|
|
@@ -38,14 +44,13 @@ GET /v1/login-callback
|
|
|
38
44
|
|
|
39
45
|
They map to `auth.getSocialLoginUrl()` and
|
|
40
46
|
`auth.getSocialLoginCallbackUrl()` and are not part of the official
|
|
41
|
-
|
|
47
|
+
147-operation total.
|
|
42
48
|
|
|
43
49
|
The SDK also includes the production contract additions for:
|
|
44
50
|
|
|
45
51
|
- the `pades` document artifact;
|
|
46
|
-
- `DigitalCertificate` verification on
|
|
47
|
-
estimation (
|
|
48
|
-
the server derives their method);
|
|
52
|
+
- `DigitalCertificate` verification on direct and template assignment creation
|
|
53
|
+
and cost estimation (templates with placed signer fields return `400`);
|
|
49
54
|
- typed `display_settings` for collect fields;
|
|
50
55
|
- signer `government_id` updates;
|
|
51
56
|
- signature-image `reuse`;
|
|
@@ -81,8 +86,9 @@ An amendment's `apply_error` is human-readable text, not a stable code. Do not
|
|
|
81
86
|
parse it to select localized guidance. The published causes are a missing
|
|
82
87
|
contract-tracking plan, a parent that cannot accept the delta, an earlier signed
|
|
83
88
|
instrument still pending, a later signed instrument already applied, and an
|
|
84
|
-
unexpected failure.
|
|
85
|
-
|
|
89
|
+
unexpected failure. Refusals of the contract routes themselves carry a
|
|
90
|
+
machine-readable `ApiError.code` (`ContractChanged`, `NoContractTerms`,
|
|
91
|
+
`PlanRestricted`) and, for a `400`, `ApiError.fieldErrors`.
|
|
86
92
|
|
|
87
93
|
A sandbox may return the generic `404` while these routes are not deployed, or
|
|
88
94
|
`403` while its workspace plan does not include contract tracking. The SDK does
|
|
@@ -175,9 +181,10 @@ loud, so neither surfaces as an error a caller could react to:
|
|
|
175
181
|
and the response falls back to the default of 20 rows. The SDK normalizes
|
|
176
182
|
`per_page` to `per-page` on every list method, and an explicit `per-page`
|
|
177
183
|
wins if both are supplied.
|
|
178
|
-
- `per-page` is
|
|
179
|
-
`200`, so page-size arithmetic based
|
|
180
|
-
That maximum is exported as
|
|
184
|
+
- `per-page` is capped at **50** (default 20) on every paginated list. A
|
|
185
|
+
request for 100 returns 50 rows with a `200`, so page-size arithmetic based
|
|
186
|
+
on the requested value is wrong by half. That maximum is exported as
|
|
187
|
+
`MAX_LIST_PAGE_SIZE`.
|
|
181
188
|
|
|
182
189
|
```ts
|
|
183
190
|
import { MAX_LIST_PAGE_SIZE } from '@assinafy/sdk';
|
|
@@ -192,10 +199,10 @@ const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_S
|
|
|
192
199
|
### Document activities
|
|
193
200
|
|
|
194
201
|
Production `GET /v1/documents/{documentId}/activities` is paginated: 20 entries
|
|
195
|
-
per page by default, with `page`, `per-page` (
|
|
202
|
+
per page by default, with `page`, `per-page` (at most 50, as above), and `sort`
|
|
196
203
|
(`-id` for newest first, the default; `id` for oldest first). A page beyond the
|
|
197
|
-
end returns an empty `data` array.
|
|
198
|
-
|
|
204
|
+
end returns an empty `data` array. `envelopes.listActivities()` reads an
|
|
205
|
+
envelope's trail the same way.
|
|
199
206
|
|
|
200
207
|
`documents.activities(documentId, params?)` continues to return
|
|
201
208
|
`IDocumentActivity[]`, normalizing an absent body to `[]`. It accepts `per_page`
|
|
@@ -211,7 +218,7 @@ import type { IDocumentActivity } from '@assinafy/sdk';
|
|
|
211
218
|
const events: IDocumentActivity[] = [];
|
|
212
219
|
for (let page = 1; ; page++) {
|
|
213
220
|
const { data, meta } = await client.documents.listActivities('document-id', {
|
|
214
|
-
page, 'per-page':
|
|
221
|
+
page, 'per-page': 50, sort: 'id',
|
|
215
222
|
});
|
|
216
223
|
events.push(...data);
|
|
217
224
|
// Unpaged sandbox responses have no meta and must be consumed only once.
|
|
@@ -233,9 +240,10 @@ pagination.
|
|
|
233
240
|
|
|
234
241
|
## Assignment list account context
|
|
235
242
|
|
|
236
|
-
`GET /v1/assignments`
|
|
237
|
-
|
|
238
|
-
|
|
243
|
+
`GET /v1/assignments` takes the workspace in the camel-case `accountId` query
|
|
244
|
+
parameter (required unless an OAuth token names it) even though most
|
|
245
|
+
account-scoped routes place it in the path. The SDK always sends it, from the
|
|
246
|
+
optional method argument or the client default:
|
|
239
247
|
|
|
240
248
|
```ts
|
|
241
249
|
const page = await client.assignments.list(
|
|
@@ -346,9 +354,10 @@ also retains `is_active` on create and `type` or `is_required` on update for
|
|
|
346
354
|
deployments that accept them. New code should prefer the operation-specific
|
|
347
355
|
official fields.
|
|
348
356
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
357
|
+
Field validation authenticates with the workspace credentials or with a signer
|
|
358
|
+
access code. With `signerAccessCode`, `fields.validate()` and
|
|
359
|
+
`validateMultiple()` send the code as the `signer-access-code` query on the
|
|
360
|
+
credential-free transport, so it never travels with the API key or token.
|
|
352
361
|
|
|
353
362
|
## Signer request extensions
|
|
354
363
|
|
|
@@ -365,6 +374,11 @@ inputs remain accepted:
|
|
|
365
374
|
New integrations should use the official fields, including `government_id`. `cpf` is not an alias for the official update field, and signer
|
|
366
375
|
responses do not return it.
|
|
367
376
|
|
|
377
|
+
On update, `null` or `''` clears `email`, `whatsapp_phone_number` (stored as
|
|
378
|
+
`null`) and `government_id`; `full_name` cannot be cleared. Changing the e-mail
|
|
379
|
+
or phone of a signer who has not verified yet issues new codes, and an open
|
|
380
|
+
embed frame then reports `session_expired`.
|
|
381
|
+
|
|
368
382
|
## Digital certificate and collect placement
|
|
369
383
|
|
|
370
384
|
`DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
|
|
@@ -379,11 +393,11 @@ estimation with `ValidationError.errors.code` set to
|
|
|
379
393
|
|
|
380
394
|
Template role IDs do not reveal which entries are signers, editors or copy
|
|
381
395
|
receivers. The SDK validates each entry's channel and positive `step`, then
|
|
382
|
-
lets the API enforce role-aware signing order. The server
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
`
|
|
386
|
-
|
|
396
|
+
lets the API enforce role-aware signing order. The server derives the method:
|
|
397
|
+
a fieldless template supports `DigitalCertificate`, while placed signer fields
|
|
398
|
+
produce `collect` and return `400`. A template signer can identify an existing
|
|
399
|
+
signer by `id`, or use `email` to reuse or create one; `id` wins when both are
|
|
400
|
+
sent.
|
|
387
401
|
|
|
388
402
|
## Identity document and face verification
|
|
389
403
|
|
|
@@ -425,8 +439,9 @@ retaining the other document fields.
|
|
|
425
439
|
belongs to the document creator. Do not infer the absence of a decline merely
|
|
426
440
|
because that field is missing for another authenticated user.
|
|
427
441
|
|
|
428
|
-
Owner
|
|
429
|
-
|
|
442
|
+
Owner downloads accept `original`, `certificated`, `certificate-page`, `pades`,
|
|
443
|
+
and `bundle`; a signer with an access code can download only `original` (the
|
|
444
|
+
certified copy is sent to them instead):
|
|
430
445
|
|
|
431
446
|
- `pades` exists only when the document had an ICP-Brasil certificate signer;
|
|
432
447
|
- `bundle` is a ZIP containing `original`, `certificated`, and
|
|
@@ -436,16 +451,29 @@ Owner and signer downloads accept `original`, `certificated`,
|
|
|
436
451
|
|
|
437
452
|
Document and page download URLs in JSON responses are protected. Prefer the
|
|
438
453
|
typed download methods so credentials are applied and binary data is returned
|
|
439
|
-
as a `Buffer`.
|
|
454
|
+
as a `Buffer`. `thumbnail()` and `downloadPage()` accept `{ artifact:
|
|
455
|
+
'certificated' }` for the signed render (`404` until certified, `503` with
|
|
456
|
+
`Retry-After` while it is produced). `details()` accepts `expand:
|
|
457
|
+
['envelope_id', 'envelope']`; those keys never appear in lists or webhooks.
|
|
440
458
|
|
|
441
459
|
## Signer-side preconditions
|
|
442
460
|
|
|
443
|
-
The signer `confirm-data` body contains `
|
|
444
|
-
`
|
|
445
|
-
|
|
446
|
-
`
|
|
447
|
-
|
|
448
|
-
|
|
461
|
+
The production signer `confirm-data` body contains `email`,
|
|
462
|
+
`whatsapp_phone_number` and `has_accepted_terms`: the signer sends the contact
|
|
463
|
+
their channel needs, saved only when they have none. It answers `data: []`, so
|
|
464
|
+
`confirmData()` resolves to `null`; older deployments read `full_name` and
|
|
465
|
+
`government_id` and return the signer, so the SDK still forwards those fields.
|
|
466
|
+
A certificate signer must confirm data and accept terms before
|
|
467
|
+
`getAssignment()`; either send `has_accepted_terms: true` with `confirmData()`
|
|
468
|
+
or call `acceptTerms()` first. The `has_accepted_terms` query on
|
|
469
|
+
`getAssignment()` is too late to open that gate for a certificate signer.
|
|
470
|
+
|
|
471
|
+
Signer reads return `ISigningDocument`. A code closes 30 minutes after its
|
|
472
|
+
signer is done (with every document of an envelope); reads then return only
|
|
473
|
+
`id`, `name`, `status`, `current_signer`, `certified_copy` and `envelope`, with
|
|
474
|
+
`is_signer_access_closed: true`, and every other signer route answers `410`.
|
|
475
|
+
An envelope code opens another of its documents with `getAssignment(code, {
|
|
476
|
+
documentId })`, and `expand: ['envelope']` names the envelope.
|
|
449
477
|
|
|
450
478
|
`getAssignment()` uses `GET /sign`, but the API records the signer as having
|
|
451
479
|
viewed the assignment. The SDK therefore excludes this request from automatic
|
|
@@ -468,14 +496,16 @@ Document upload accepts a PDF of at most 25 MB and 2,000 pages. The multipart
|
|
|
468
496
|
schema documents the file; the SDK's optional `metadata` JSON part is retained
|
|
469
497
|
for deployments that accept application-owned opaque metadata.
|
|
470
498
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
499
|
+
Assignment expiration accepts an ISO-8601 date (ending at 23:59 UTC), a
|
|
500
|
+
date-time without an offset (UTC), or an offset-aware date-time. The
|
|
501
|
+
reset-expiration schema requires the `expires_at` key itself; send `null` to
|
|
502
|
+
remove the expiration. The SDK always sends that key.
|
|
474
503
|
|
|
475
504
|
## Resend-cost response variants
|
|
476
505
|
|
|
477
|
-
|
|
478
|
-
|
|
506
|
+
Production answers the compact `ResendCostEstimate` (`total`,
|
|
507
|
+
`has_sufficient_credits`, nullable `credit_balance`); older deployments return
|
|
508
|
+
the full `ICostEstimate`, so the SDK exposes `IResendCostEstimate`:
|
|
479
509
|
|
|
480
510
|
```ts
|
|
481
511
|
const estimate = await client.assignments.estimateResendCost(
|
|
@@ -505,37 +535,43 @@ const document = await client.documents.getPublic(documentId);
|
|
|
505
535
|
const pages = document.pages?.length ?? Number(document.page_count ?? 0);
|
|
506
536
|
```
|
|
507
537
|
|
|
508
|
-
Signer artifact download
|
|
509
|
-
|
|
510
|
-
|
|
538
|
+
Signer artifact download requires the access code and offers only `original`;
|
|
539
|
+
without a usable code the API redirects to its expired-link page. The SDK does
|
|
540
|
+
not follow that redirect, so the call throws `ApiError` (`302`) instead of
|
|
541
|
+
returning HTML bytes. The certified-copy link download
|
|
542
|
+
(`downloadCertifiedCopy(token)`) behaves the same way for an expired link; ask
|
|
543
|
+
for a new link with `resendCertifiedCopyFromLink(token)`.
|
|
511
544
|
|
|
512
545
|
## Empty acknowledgements
|
|
513
546
|
|
|
514
547
|
Several write operations return a success envelope without `data`; older
|
|
515
548
|
responses can use an empty array or object. Methods with no meaningful result
|
|
516
549
|
resolve to `Promise<void>` after validating the HTTP and envelope status. This
|
|
517
|
-
applies to
|
|
518
|
-
|
|
550
|
+
applies to signer OTP verification, signature-image upload, bulk signer
|
|
551
|
+
actions, and deletions without a documented result. `acceptTerms()` returns
|
|
552
|
+
the signer's `{ full_name, email, has_accepted_terms }`. Tag deletion and
|
|
519
553
|
document-tag detachment preserve `{ deleted: boolean }` and
|
|
520
554
|
`{ detached: boolean }`.
|
|
521
555
|
|
|
522
556
|
## WhatsApp notification buttons
|
|
523
557
|
|
|
524
|
-
The published notification button schema requires `text`.
|
|
525
|
-
|
|
526
|
-
signer access or verification value; treat it as a
|
|
558
|
+
The published notification button schema requires `text`. Production strips
|
|
559
|
+
button URLs; the sandbox returns `url`, so the SDK types it as optional. A
|
|
560
|
+
button URL can contain a signer access or verification value; treat it as a
|
|
561
|
+
credential and never log it. `sent_at` is an ISO-8601 string.
|
|
527
562
|
|
|
528
563
|
## Webhook delivery
|
|
529
564
|
|
|
530
565
|
Assinafy sends webhook events as HTTP `POST` JSON requests with
|
|
531
566
|
`Connection: close`, `webhook-id` and `webhook-timestamp` headers, and a
|
|
532
567
|
`webhook-signature` header on signing-enabled endpoints. Every active endpoint
|
|
533
|
-
subscribed to an event receives it independently. Any `2xx` is successful.
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
568
|
+
subscribed to an event receives it independently. Any `2xx` is successful.
|
|
569
|
+
Connection failures, timeouts, `408`, `429`, and `5xx` receive up to six
|
|
570
|
+
attempts about ten minutes apart. After ten failed deliveries in a row, the
|
|
571
|
+
endpoint is held and probed after 3, 15, and 60 minutes, then every six hours.
|
|
572
|
+
Success replays missed events oldest first. `webhooks.retryDispatch()` sends
|
|
573
|
+
once immediately, even while held. The first 2,000 response characters and the
|
|
574
|
+
delivery entry are retained for seven days.
|
|
539
575
|
|
|
540
576
|
The common body contains `id`, `event`, nullable `message`, nullable `payload`,
|
|
541
577
|
nullable `origin`, Unix-second `created_at`, polymorphic `subject` and `object`,
|
|
@@ -551,10 +587,19 @@ oldest endpoint; the endpoint routes address each one by ID. Exact registered
|
|
|
551
587
|
URLs can also filter `listEndpoints(accountId?, { url })` and identify the
|
|
552
588
|
target of `deleteEndpointByUrl(url, accountId?)`.
|
|
553
589
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
590
|
+
New or changed endpoint URLs must use HTTPS. Endpoint responses expose
|
|
591
|
+
`is_held` and `held_since`; dispatch entries expose `webhook_id`, `attempt`,
|
|
592
|
+
`kind`, `will_retry`, and `duration_ms`. `testEndpoint()` sends one signed
|
|
593
|
+
`webhook_test` event (not subscribable, `payload` and `origin` `null`), also to a
|
|
594
|
+
held or inactive endpoint, without lifting or counting toward a hold; it is
|
|
595
|
+
limited to 10 per user every 10 minutes. `rotateEndpointSecret(endpointId,
|
|
596
|
+
accountId?, { keep_previous: true })` keeps the old secret signing beside the
|
|
597
|
+
new one for 24 hours (`previous_secret_expires_at`); each delivery then carries
|
|
598
|
+
two `v1,` entries, which `verifySignature()` accepts. `createEndpoint()` returns
|
|
599
|
+
`IWebhookEndpointCreateResponse` with `secret` when signing is enabled.
|
|
600
|
+
`updateEndpoint()` returns the same shape and includes `secret` when that
|
|
601
|
+
request turns signing on. Store the value securely. OAuth applications cannot
|
|
602
|
+
read it afterward, but can rotate it with `webhooks:write`.
|
|
558
603
|
|
|
559
604
|
Signing-enabled endpoints follow Standard Webhooks:
|
|
560
605
|
`webhook-signature` holds space-separated `v1,<base64>` entries, each an
|
|
@@ -562,14 +607,32 @@ HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
|
|
|
562
607
|
base64-decoded part of the `whsec_` secret.
|
|
563
608
|
`webhookVerifier.verifySignature()` implements this, with a 300-second
|
|
564
609
|
timestamp tolerance by default; non-finite or negative windows fail closed.
|
|
565
|
-
The
|
|
566
|
-
|
|
610
|
+
The secret-read route is not available to OAuth applications. The earlier
|
|
611
|
+
`webhookVerifier.verify()` (hex HMAC over the
|
|
567
612
|
body alone) is deprecated; it never matched an Assinafy signature.
|
|
568
613
|
|
|
569
|
-
Older sandbox deployments can omit `secret` from
|
|
570
|
-
return `404` for deletion by URL. API-key integrations can still
|
|
571
|
-
|
|
572
|
-
|
|
614
|
+
Older sandbox deployments can omit `secret` from creation/update responses and
|
|
615
|
+
return `404` for deletion by URL. API-key integrations can still read/rotate
|
|
616
|
+
the secret and delete by ID. OAuth integrations can rotate a lost secret where
|
|
617
|
+
the production route is available.
|
|
618
|
+
|
|
619
|
+
## Refusal codes, idempotency and Bypass
|
|
620
|
+
|
|
621
|
+
- Error bodies carry a string `code` and, for a field `400`, `errors[]`; the SDK
|
|
622
|
+
exposes them as `ApiError.code` and `ApiError.fieldErrors`. The generic `404`
|
|
623
|
+
body's numeric `code: 0` is ignored.
|
|
624
|
+
- Only envelope creation and template document creation deduplicate an
|
|
625
|
+
`Idempotency-Key`; other routes ignore it, so the SDK sends it only from
|
|
626
|
+
`envelopes.create()` and `documents.createFromTemplate()`. Assignment creation
|
|
627
|
+
answers a retry with `400`.
|
|
628
|
+
- `Bypass` verification and notification are enabled per account and absent
|
|
629
|
+
from the published request enums; the SDK accepts them with the pairing the
|
|
630
|
+
API applies (Bypass verification with `Email`, `Whatsapp` or `Bypass`).
|
|
631
|
+
- The embed session exchange route belongs to Assinafy's embed page and is not
|
|
632
|
+
exposed.
|
|
633
|
+
|
|
634
|
+
Usage is documented in the [manual](README.en.md#envelopes) and in each
|
|
635
|
+
method's JSDoc.
|
|
573
636
|
|
|
574
637
|
## Authentication isolation
|
|
575
638
|
|