@assinafy/sdk 2.1.1 → 2.2.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.
@@ -1,27 +1,113 @@
1
1
  # API compatibility
2
2
 
3
3
  The SDK targets the official Assinafy contract at
4
- [`/v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json) and
5
- keeps compatibility behavior narrow, explicit, and typed. This document records
6
- the differences observed during the 2026-08-06 contract and sandbox audit. It
7
- contains no credentials, account identifiers, signer data, or reusable test
8
- artifacts. The audited OpenAPI response's SHA-256 digest is
9
- `7e5957082002e8e96c5abc2cadf7b4b463eaa5bd61b76e26f64b90a8b922088c`.
4
+ [`/v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json).
5
+ New integrations should send the published request shape. Compatibility paths
6
+ are narrow, typed, and used only when a caller selects one or when a validation
7
+ response unambiguously requests an older shape.
10
8
 
11
- The governing rule is simple: new integrations should send the published
12
- contract. A compatibility path is used only when the caller selects it
13
- explicitly or the server returns a validation error that unambiguously requests
14
- the older shape.
9
+ ## Host availability
15
10
 
16
- ## Template management live extensions
11
+ The production contract includes these account and authenticated-user routes:
17
12
 
18
- The current OpenAPI document contains only:
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/users/self
20
+ GET, PUT /v1/users/self/notification-preferences
21
+ GET /v1/users/self/stats
22
+ ```
23
+
24
+ Sandbox deployments can return `404` for user statistics, account statistics,
25
+ or notification preferences while still accepting the production methods on
26
+ the production host. The SDK keeps the official paths and response types. A
27
+ sandbox `404` does not cause the client to route a request elsewhere.
28
+
29
+ Two browser URL helpers used by older deployments remain available:
30
+
31
+ ```text
32
+ GET /v1/auth/authenticate
33
+ GET /v1/login-callback
34
+ ```
35
+
36
+ They map to `auth.getSocialLoginUrl()` and
37
+ `auth.getSocialLoginCallbackUrl()` and are not part of the official
38
+ 89-operation total.
39
+
40
+ The SDK also includes the production contract additions for:
41
+
42
+ - the `pades` document artifact;
43
+ - `DigitalCertificate` verification on assignment and template-document
44
+ creation and cost estimation;
45
+ - typed `display_settings` for collect fields;
46
+ - signer `government_id` updates;
47
+ - signature-image `reuse`;
48
+ - the documented `400` response from `GET /sign`; and
49
+ - the dedicated `SignerSelf` response fields.
50
+
51
+ Older signer-self responses can omit `has_signature`, `has_initial`, and
52
+ `is_signature_reusable`; assignment signers can omit `notification_history`.
53
+ Those fields are optional in the SDK response types.
54
+
55
+ `DocumentStatsRow` separates notification-channel counters from verification
56
+ method counters. Notification counters are not mutually exclusive.
57
+ `signature_requests_verification_{email,whatsapp,bypass,digital_certificate}`
58
+ are mutually exclusive and sum to `signature_requests`. Older unsuffixed email
59
+ and WhatsApp counters remain optional.
60
+
61
+ ## List pagination
62
+
63
+ Two behaviours of the list endpoints are silent rather than loud, so neither
64
+ surfaces as an error a caller could react to:
65
+
66
+ - Only the hyphenated `per-page` is read. `per_page` is accepted and discarded,
67
+ and the response falls back to the default of 20 rows. The SDK normalizes
68
+ `per_page` to `per-page` on every list method, and an explicit `per-page`
69
+ wins if both are supplied.
70
+ - `per-page` is clamped to **50**. A request for 100 returns 50 rows with a
71
+ `200`, so page-size arithmetic based on the requested value is wrong by half.
72
+ That maximum is exported as `MAX_LIST_PAGE_SIZE`.
73
+
74
+ ```ts
75
+ import { MAX_LIST_PAGE_SIZE } from '@assinafy/sdk';
76
+
77
+ const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_SIZE });
78
+ // meta is read from the X-Pagination-* response headers, so it reports the
79
+ // page size the server actually applied — prefer it over the requested value.
80
+ ```
81
+
82
+ `signers.findByEmail()` pins this maximum for its single lookup request.
83
+
84
+ ## Assignment list account context
85
+
86
+ `GET /v1/assignments` requires the workspace in the camel-case `accountId`
87
+ query parameter even though most account-scoped routes place it in the path.
88
+ The SDK obtains it from the optional method argument or the client default:
89
+
90
+ ```ts
91
+ const page = await client.assignments.list(
92
+ { page: 1, 'per-page': 20 },
93
+ 'account-id',
94
+ );
95
+ // Request query: ?page=1&per-page=20&accountId=account-id
96
+ // Response: { data: IAssignment[], meta?: PaginationMeta }
97
+ ```
98
+
99
+ If neither source supplies an account ID, the SDK throws `ValidationError`
100
+ before making the request.
101
+
102
+ ## Template management extensions
103
+
104
+ The official OpenAPI document contains only:
19
105
 
20
106
  ```text
21
107
  GET /v1/accounts/{accountId}/templates
22
108
  ```
23
109
 
24
- The live API additionally exposes five routes used by existing integrations:
110
+ Existing integrations can also use these routes:
25
111
 
26
112
  ```text
27
113
  POST /v1/accounts/{accountId}/templates
@@ -31,16 +117,9 @@ DELETE /v1/accounts/{accountId}/templates/{templateId}
31
117
  GET /v1/accounts/{accountId}/templates/{templateId}/pages/{pageId}/download
32
118
  ```
33
119
 
34
- They map to `client.templates.create`, `get`, `update`, `delete`, and
35
- `downloadPage`. They are documented and tested as **live compatibility
36
- extensions**, not counted as official OpenAPI operations. Their absence from a
37
- future schema is not by itself grounds for removal; removal requires a live
38
- regression test, a deprecation period, and a major-version decision.
39
-
40
- Template status examples have also differed in casing (`Uploaded`/`Ready` in
41
- live extension responses versus `uploaded`/`ready` in the published schema).
42
- The exported type intentionally remains `string`. Applications should normalize
43
- before comparing:
120
+ They map to `templates.create`, `get`, `update`, `delete`, and `downloadPage`
121
+ and are excluded from the official operation count. Template status casing can
122
+ vary, so normalize before branching:
44
123
 
45
124
  ```ts
46
125
  if (template.status.toLowerCase() === 'ready') {
@@ -48,9 +127,13 @@ if (template.status.toLowerCase() === 'ready') {
48
127
  }
49
128
  ```
50
129
 
130
+ A page object's `download_url` is protected by account authentication. Prefer
131
+ `templates.downloadPage(templateId, pageId)` so the SDK attaches credentials
132
+ and returns the JPEG bytes as a `Buffer`.
133
+
51
134
  ## Public send-token request
52
135
 
53
- The official operation is:
136
+ The official operation sends an email body:
54
137
 
55
138
  ```http
56
139
  PUT /v1/public/documents/{documentId}/send-token
@@ -59,13 +142,11 @@ Content-Type: application/json
59
142
  { "email": "signer@example.com" }
60
143
  ```
61
144
 
62
- That is the default SDK call:
63
-
64
145
  ```ts
65
146
  await client.documents.sendToken(documentId, 'signer@example.com');
66
147
  ```
67
148
 
68
- Some older environments require `{ recipient, channel }`. The explicit
149
+ Older environments can require `{ recipient, channel }`. The explicit
69
150
  three-argument overload sends that shape:
70
151
 
71
152
  ```ts
@@ -73,121 +154,142 @@ await client.documents.sendToken(documentId, '+5511999990000', 'whatsapp');
73
154
  ```
74
155
 
75
156
  For a two-argument call, the SDK starts with `{ email }` and retries the older
76
- email shape only when the API's validation body specifically says that
77
- `recipient` or `channel` is required. Unrelated errors are never swallowed or
78
- retried under this compatibility rule.
157
+ email shape only when the validation response names `recipient` or `channel` as
158
+ required. Other errors are returned unchanged.
79
159
 
80
- ## Document tag identifiers
160
+ ## Document tags
81
161
 
82
- The current OpenAPI request schemas for replacing and attaching document tags
83
- define `tags` as an array of existing **tag IDs**. The SDK follows that contract:
162
+ Replace and attach requests require existing tag IDs:
84
163
 
85
164
  ```ts
86
- const tag = await client.tags.create({ name: 'Contracts' });
165
+ const tag = await client.tags.create({ name: 'Contracts', color: '#ff8800' });
87
166
  await client.documents.addTags(documentId, [tag.id]);
88
167
  await client.documents.replaceTags(documentId, [tag.id]);
168
+ const result = await client.documents.detachTag(documentId, tag.id);
169
+ // result → { detached: true }
89
170
  ```
90
171
 
91
- Older environments have accepted tag names and auto-created unknown names. The
92
- wire type remains `string[]` so those deployments are not broken, but name-based
93
- attachment is a legacy extension and is not the documented default. Production
94
- code should create/list tags first and submit IDs.
172
+ The API accepts a tag color with or without a leading `#` and returns the
173
+ stored six-character value without it. Unknown tag names are not the normal
174
+ attachment input; create or list the tag first and send its ID. An empty array
175
+ passed to `replaceTags` detaches every tag.
95
176
 
96
- ## Account branding fields on create and update
177
+ ## Account branding fields
97
178
 
98
- The official `Account` response schema includes `primary_color` and
99
- `secondary_color`, while the current create/update request schemas list only
100
- `name` and `notification_sender_type`. The sandbox also accepts the two color
101
- fields on create/update, and the SDK preserves them for existing integrations.
102
- They must be six hexadecimal characters without a leading `#`.
179
+ The official account create/update request schemas define `name` and
180
+ `notification_sender_type`. The response includes `primary_color` and
181
+ `secondary_color`. Some deployments also accept those two color fields on
182
+ create/update, so the SDK retains them as optional inputs. Account colors must
183
+ be six hexadecimal characters without a leading `#`.
103
184
 
104
- The sandbox audited on 2026-08-06 rejects the official optional
105
- `notification_sender_type` field with `400` on account creation, while accepting
106
- the same field on update. The SDK still exposes and sends it because it is part
107
- of the production OpenAPI contract. The live audit creates its prerequisite
108
- workspace with a name only, then tests the field independently via update so
109
- the create-side deployment lag cannot prevent the rest of the suite.
185
+ Some sandbox plans reject `notification_sender_type` during account creation
186
+ while accepting it on update. If that occurs, create with `{ name }` and apply
187
+ the sender type in a separate update. `getTheme`, `downloadLogo`, `uploadLogo`,
188
+ and `deleteLogo` are official operations.
110
189
 
111
- The branding read and file operations—`getTheme`, `downloadLogo`, `uploadLogo`,
112
- and `deleteLogo`—are official operations and are not extensions.
190
+ `workspaces.delete(accountId, { force: true })` requests cancellation of an
191
+ active paid subscription as part of account deletion. It is not a general
192
+ override for unrelated deletion restrictions.
113
193
 
114
- ## Field-definition request extensions
194
+ ## Field-definition extensions
115
195
 
116
196
  The official field-create body defines `type`, `name`, nullable `regex`, and
117
- `is_required`; the update body defines `name`, nullable `regex`, and
118
- `is_active`. The audited sandbox also accepts `is_active` on create and
119
- `type`/`is_required` on update. Those three properties remain typed as explicit
120
- live extensions so existing integrations keep working. New code should prefer
121
- the operation-specific official fields.
197
+ `is_required`; update defines `name`, nullable `regex`, and `is_active`. The SDK
198
+ also retains `is_active` on create and `type` or `is_required` on update for
199
+ deployments that accept them. New code should prefer the operation-specific
200
+ official fields.
122
201
 
123
- The field-validation schemas also omit the `signer-access-code` query parameter
124
- accepted by signer-portal deployments. `fields.validate` and `validateMultiple`
125
- retain the typed `signerAccessCode` option for those deployments. The 2026-08-06
126
- full audit exercised account-authenticated validation; it did not have the
127
- signer-code fixture needed to re-certify this compatibility query.
202
+ The field-validation schemas omit the `signer-access-code` query parameter used
203
+ by some signer portals. `fields.validate()` and `validateMultiple()` retain the
204
+ typed `signerAccessCode` option for those environments.
128
205
 
129
- ## Retained signer request compatibility
206
+ ## Signer request extensions
130
207
 
131
- The current signer create/update schemas use `full_name`, `email`, and
132
- `whatsapp_phone_number`. The SDK also retains three older integration inputs:
208
+ The official signer-create schema uses `full_name`, `email`, and
209
+ `whatsapp_phone_number`. Signer update adds `government_id`, which the SDK
210
+ normalizes to digits. Three older integration inputs remain accepted:
133
211
 
134
- - `phone` is a client-only alias normalized to `whatsapp_phone_number` before
135
- transmission;
212
+ - `phone` is normalized to `whatsapp_phone_number` before transmission;
136
213
  - `cpf` is normalized to digits and forwarded; and
137
214
  - create-time `metadata` is forwarded unchanged.
138
215
 
139
- These inputs remain source-compatible because removing them without a live
140
- regression would break existing consumers. They were unit/request-contract
141
- tested but were not separately re-probed in the 2026-08-06 disposable signer
142
- matrix, so new integrations should prefer only the published fields.
143
-
144
- The official signer `confirm-data` body contains only `full_name`, `email`, and
145
- `government_id`. Its primary overload exposes exactly those fields. A deprecated
146
- compatibility overload retains `whatsapp_phone_number`, which was not live-
147
- certified in this audit. It also preserves the pre-audit `has_accepted_terms`
148
- pass-through because that behavior could not be live-tested with the supplied
149
- fixtures. This field is outside the current contract and must **not** be treated
150
- as legal consent or as a substitute for the separate official `acceptTerms()`
151
- request. Production signer UIs should call `acceptTerms()` explicitly.
152
-
153
- ## Signature-image media type
154
-
155
- `POST /signature` officially accepts a raw `image/png` body. That is the SDK's
156
- typed/default request and the only media type claimed by the API contract. The
157
- deprecated `contentType` compatibility overload is retained so older consumers
158
- are not silently broken, but non-PNG values were not live-certified because the
159
- provided audit fixtures contained no signer access code or legal-consent flow.
160
- Do not use the override in new integrations without verifying the target
161
- deployment.
162
-
163
- ## Document upload metadata
164
-
165
- The multipart upload schema documents the PDF file but not the SDK's optional
166
- JSON `metadata` part. The audited sandbox accepted and processed a disposable
167
- document carrying metadata on 2026-08-06. The option remains an explicit live
168
- extension; callers should treat metadata keys and values as application-owned,
169
- opaque JSON.
170
-
171
- ## Reset-expiration null and public signer-download compatibility
172
-
173
- The reset-expiration schema declares `expires_at` as a date-time string. The SDK
174
- retains `null` as a compatibility value used by older integrations to clear an
175
- expiration, but the full live audit tested only a future timestamp; `null` is
176
- unit/request-contract tested and remains live-unverified.
177
-
178
- The signer artifact download is the opposite case: OpenAPI explicitly marks it
179
- public and defines no `signer-access-code` query. The official three-argument SDK
180
- call therefore sends no code. An optional fourth code remains available for
181
- older deployments, but it is a compatibility query rather than part of the
182
- published operation.
216
+ New integrations should use the official create fields and `government_id` on
217
+ update. `cpf` is not an alias for the official update field, and signer
218
+ responses do not return it.
219
+
220
+ ## Digital certificate and collect placement
221
+
222
+ `DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
223
+ signer's `government_id`, and exactly one certificate signer in that signing
224
+ step. It costs two credits per signer in addition to the selected notification
225
+ cost. Notification methods remain `Email` and `Whatsapp`.
226
+
227
+ For a `collect` assignment, each field can include `display_settings`.
228
+ `left`, `top`, `width`, `height`, and `fontSize` are required; `fontFamily` and
229
+ `backgroundColor` are optional. Values use Assinafy's 150-DPI page-image pixels
230
+ from the upper-left corner and must stay within the page.
231
+
232
+ ## Document responses and artifacts
233
+
234
+ `documents.rename()` can return a document without `pages` or `assignment`.
235
+ `IRenameDocumentResponse` therefore keeps those two properties optional while
236
+ retaining the other document fields.
237
+
238
+ `documents.details()` returns `decline_reason` only when the access token
239
+ belongs to the document creator. Do not infer the absence of a decline merely
240
+ because that field is missing for another authenticated user.
241
+
242
+ Owner and signer downloads accept `original`, `certificated`,
243
+ `certificate-page`, `pades`, and `bundle`:
244
+
245
+ - `pades` exists only when the document had an ICP-Brasil certificate signer;
246
+ - `bundle` is a ZIP containing `original`, `certificated`, and
247
+ `certificate-page`, plus `pades` when it exists; and
248
+ - a generated artifact can return `404` until processing or certification is
249
+ complete.
250
+
251
+ Document and page download URLs in JSON responses are protected. Prefer the
252
+ typed download methods so credentials are applied and binary data is returned
253
+ as a `Buffer`.
254
+
255
+ ## Signer-side preconditions
256
+
257
+ The signer `confirm-data` body contains `full_name`, `email`,
258
+ `government_id`, and `has_accepted_terms`. A certificate signer must confirm
259
+ data and accept terms before `getAssignment()`; either send
260
+ `has_accepted_terms: true` with `confirmData()` or call `acceptTerms()` first.
261
+ The `has_accepted_terms` query on `getAssignment()` is too late to open that
262
+ gate for a certificate signer.
263
+
264
+ `getAssignment()` uses `GET /sign`, but the API records the signer as having
265
+ viewed the assignment. The SDK therefore excludes this request from automatic
266
+ HTTP 429 replay.
267
+
268
+ `sign()` sends a non-empty array of `{ itemId, fieldId, pageId, value }` and is
269
+ intended for collect assignments. A virtual signer must confirm their data
270
+ before signing and should use `signMultiple()`, which accepts only virtual
271
+ documents. Certificate signers cannot use `sign()`; they complete the
272
+ certificate-start and certificate-complete browser flow.
273
+
274
+ Signature image upload sends raw PNG bytes with `Content-Type: image/png`.
275
+ `reuse: true` persists the image for later documents. A deprecated
276
+ `contentType` option remains for older integrations, but the official contract
277
+ supports PNG only.
278
+
279
+ ## Upload metadata and expiration reset
280
+
281
+ Document upload accepts a PDF of at most 25 MB and 2,000 pages. The multipart
282
+ schema documents the file; the SDK's optional `metadata` JSON part is retained
283
+ for deployments that accept application-owned opaque metadata.
284
+
285
+ The reset-expiration schema requires an ISO-8601 date-time string. The SDK also
286
+ accepts `null` for older integrations that clear an expiration this way. Confirm
287
+ support in the target deployment before sending `null`.
183
288
 
184
289
  ## Resend-cost response variants
185
290
 
186
- The published
187
- `POST /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/estimate-resend-cost`
188
- response references the full `CostEstimate` schema. A smaller resend-specific
189
- shape has also been observed live. The SDK therefore returns the honest union
190
- `IResendCostEstimate`:
291
+ The official resend-cost response is `ICostEstimate`. Older deployments can
292
+ return a compact branch, so the SDK exposes `IResendCostEstimate`:
191
293
 
192
294
  ```ts
193
295
  const estimate = await client.assignments.estimateResendCost(
@@ -203,83 +305,81 @@ if ('total_credits' in estimate) {
203
305
  }
204
306
  ```
205
307
 
206
- The SDK does not synthesize missing fields, so callers never mistake invented
207
- zeroes for server-provided balances.
308
+ The SDK does not add absent balance fields.
208
309
 
209
- ## Public-document response variants
310
+ ## Public document and signer download
210
311
 
211
- The official `GET /public/documents/{documentId}` response references the full
212
- `Document` schema. Older public responses can be compact and expose only fields
213
- such as `id`, `name`, `page_count`, and `created_by`. `IPublicDocumentInfo`
214
- requires the stable `id` and `name`, makes expanded document fields optional,
215
- and retains the compact fields. Check optional fields before using them:
312
+ The official public-document response is the full `Document` schema. Compact
313
+ responses can contain only `id`, `name`, `page_count`, and `created_by`.
314
+ `IPublicDocumentInfo` requires `id` and `name`, keeps expanded fields optional,
315
+ and retains the compact fields:
216
316
 
217
317
  ```ts
218
318
  const document = await client.documents.getPublic(documentId);
219
- if (document.pages) {
220
- console.log(document.pages.length);
221
- } else {
222
- console.log(Number(document.page_count ?? 0));
223
- }
319
+ const pages = document.pages?.length ?? Number(document.page_count ?? 0);
224
320
  ```
225
321
 
322
+ Signer artifact download is public in the OpenAPI document and requires no
323
+ access-code query in the official three-argument call. An optional fourth code
324
+ is available only for older deployments that require it.
325
+
226
326
  ## Empty acknowledgements
227
327
 
228
- Several write operations return a successful status/message envelope with no
229
- `data` field, while a few older responses use an empty array or object. Methods
230
- whose contract has no meaningful result resolve to `Promise<void>` and validate
231
- the HTTP/envelope status. This applies to token dispatch, signer OTP/terms,
232
- signature-image upload, bulk signer actions, and deletion operations. Success is
233
- not represented as a fabricated object.
328
+ Several write operations return a success envelope without `data`; older
329
+ responses can use an empty array or object. Methods with no meaningful result
330
+ resolve to `Promise<void>` after validating the HTTP and envelope status. This
331
+ applies to token dispatch, signer OTP and terms, signature-image upload, bulk
332
+ signer actions, and deletions without a documented result. Tag deletion and
333
+ document-tag detachment preserve `{ deleted: boolean }` and
334
+ `{ detached: boolean }`.
335
+
336
+ ## WhatsApp notification buttons
337
+
338
+ The published notification button schema requires `text`. Some deployments
339
+ also return `url`, so the SDK types it as optional. A button URL can contain a
340
+ signer access or verification value; treat it as a credential and never log it.
341
+
342
+ ## Webhook delivery
343
+
344
+ Assinafy sends webhook events as HTTP `POST` JSON requests with
345
+ `Connection: close`. Any `2xx` is successful. There are at most two automatic
346
+ attempts per event with a three-second wait. After ten consecutive failed
347
+ events, ordinary delivery pauses and about 5% of later events are attempted
348
+ until one succeeds. `webhooks.retryDispatch()` requests immediate redelivery.
349
+ Only the first 2,000 characters of the receiver response body are retained in
350
+ dispatch history.
351
+
352
+ The common body contains `id`, `event`, nullable `message`, nullable `payload`,
353
+ nullable `origin`, Unix-second `created_at`, polymorphic `subject` and `object`,
354
+ and `account_id`. Use `id` for idempotent handling and accept unknown fields.
234
355
 
235
356
  ## Webhook signature verification is not in the OpenAPI contract
236
357
 
237
358
  The official webhook operations define subscription management, event types,
238
- delivery history, and retry. The current OpenAPI document does **not** define a
239
- shared-secret field, signature algorithm, digest encoding, or signature header
240
- for incoming deliveries.
359
+ delivery history, and retry. They do not define a shared-secret field,
360
+ signature algorithm, digest encoding, or signature header for incoming events.
241
361
 
242
- `client.webhookVerifier` is retained as an opt-in HMAC-SHA256 utility for
243
- environments whose separate Assinafy agreement provides a shared secret and a
244
- hex digest. Confirm the header name and signing procedure with Assinafy for the
245
- target environment before enforcing it. Do not assume an
246
- `X-Assinafy-Signature` header solely from this SDK.
362
+ `client.webhookVerifier` is an opt-in HMAC-SHA256 utility for environments whose
363
+ separate Assinafy agreement provides a shared secret and hex digest. Confirm the
364
+ header name and signing procedure for the target environment before enforcing
365
+ it. Do not assume an `X-Assinafy-Signature` header solely from this SDK.
247
366
 
248
367
  ## Authentication isolation
249
368
 
250
- Public documents, login/social login, password-reset, OAuth URL, and
369
+ Public documents, login and social login, password reset, OAuth URLs, and
251
370
  signer-access-code flows use a separate HTTP transport without `X-Api-Key` or
252
- `Authorization` defaults. This is a security boundary rather than a
253
- wire-contract deviation: a credentialless `new AssinafyClient()` can drive
254
- those flows, and credentials configured for protected resources are not leaked
255
- to them.
256
-
257
- Protected methods still use the authenticated transport and receive the API's
258
- normal `401` response if credentials are absent or invalid.
259
-
260
- ## Sandbox user and statistics deployment lag
261
-
262
- The current OpenAPI schema defines `GET /users/self` as a direct `AuthUser`
263
- payload. The sandbox audited on 2026-08-06 still wraps that value as
264
- `{ user, accounts }` and adds `user.is_password_set`. `users.getCurrent()`
265
- normalizes both forms to `IAuthenticatedUser`; `is_password_set` is an optional
266
- live-compatibility field.
267
-
268
- The same sandbox returns `404` for the official `GET /users/self/stats` and
269
- `GET /accounts/{accountId}/stats` routes. The production host recognizes both
270
- routes (an unauthenticated probe receives `401`), so the SDK retains the exact
271
- published paths and types. The live audit reports those sandbox-only `404`s as
272
- explicit `SKIP`s rather than claiming they passed or rewriting calls to an
273
- undocumented route.
274
-
275
- ## Updating this record
276
-
277
- When the upstream API changes:
278
-
279
- 1. Diff the new official OpenAPI paths and schemas against the snapshot date
280
- above.
281
- 2. Add or update typed methods and request/response tests.
282
- 3. Verify live-only behavior in the sandbox without logging secrets or tokens.
283
- 4. Update [API_COVERAGE.md](API_COVERAGE.md) and this file in the same change.
284
- 5. Keep compatibility behavior isolated and feature-detectable; do not silently
285
- broaden retries or coerce malformed success payloads.
371
+ `Authorization` defaults. A credentialless `new AssinafyClient()` can drive
372
+ those flows, and credentials configured for protected resources are not sent.
373
+
374
+ Protected methods use the authenticated transport and receive the API's normal
375
+ `401` response when credentials are absent or invalid. The authenticated
376
+ transport accepts same-origin absolute URLs, rejects cross-origin requests
377
+ before dispatch, and treats credentials as redirect-sensitive. Use a separate
378
+ HTTP client for unrelated origins.
379
+
380
+ ## Authenticated-user response variants
381
+
382
+ `GET /users/self` officially returns `AuthUser` directly. Some sandbox
383
+ deployments return `{ user, accounts }` and add `user.is_password_set`.
384
+ `users.getCurrent()` normalizes both forms to `IAuthenticatedUser`, where
385
+ `is_password_set` is optional.