@assinafy/sdk 2.4.0 → 2.4.2

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 CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.4.2] - 2026-09-23
11
+
12
+ ### Changed
13
+
14
+ - The manual live suite requires `--confirm-production` for `--all` on every configured host.
15
+ - Public examples use production URLs while retaining sandbox setup guidance.
16
+
17
+ ## [2.4.1] - 2026-09-23
18
+
19
+ ### Added
20
+
21
+ - OAuth's `webhooks:write` scope is available in `OAuthScope` and documented for
22
+ webhook subscription updates and inactivation.
23
+
10
24
  ## [2.4.0] - 2026-09-21
11
25
 
12
26
  ### Fixed
package/README.en.md CHANGED
@@ -126,7 +126,7 @@ operations, so an API key or Bearer token is never attached accidentally:
126
126
 
127
127
  ```ts
128
128
  const publicClient = new AssinafyClient({
129
- baseUrl: 'https://sandbox.assinafy.com.br/v1',
129
+ baseUrl: 'https://api.assinafy.com.br/v1',
130
130
  });
131
131
 
132
132
  await publicClient.auth.login('me@example.com', 'password');
@@ -228,6 +228,7 @@ await client.oauth.getUserInfo(tokens.access_token); // OIDC claims; needs `open
228
228
  | `templates:read` | Read templates |
229
229
  | `templates:write` | Create and change templates |
230
230
  | `account:read` | Read the workspace's profile, theme and logo |
231
+ | `webhooks:write` | Update or inactivate the workspace's webhook subscription |
231
232
  | `openid` | Receive an `id_token` identifying the user |
232
233
  | `profile` | Read the user's name |
233
234
  | `email` | Read the user's email and whether it is verified |
@@ -1095,6 +1096,8 @@ await client.users.updateNotificationPreferences({
1095
1096
 
1096
1097
  ### Webhooks
1097
1098
 
1099
+ OAuth tokens need `webhooks:write` for `register()` and `inactivate()`.
1100
+
1098
1101
  ```ts
1099
1102
  await client.webhooks.register({
1100
1103
  url: 'https://example.com/webhooks/assinafy',
package/README.md CHANGED
@@ -123,7 +123,7 @@ uma chave de API ou token Bearer nunca é anexada por acidente:
123
123
 
124
124
  ```ts
125
125
  const clientePublico = new AssinafyClient({
126
- baseUrl: 'https://sandbox.assinafy.com.br/v1',
126
+ baseUrl: 'https://api.assinafy.com.br/v1',
127
127
  });
128
128
 
129
129
  await clientePublico.auth.login('eu@exemplo.com.br', 'senha');
@@ -222,6 +222,7 @@ await client.oauth.getUserInfo(tokens.access_token); // claims OIDC; exige `ope
222
222
  | `templates:read` | Ler templates |
223
223
  | `templates:write` | Criar e alterar templates |
224
224
  | `account:read` | Ler perfil, tema e logotipo do workspace |
225
+ | `webhooks:write` | Atualizar ou inativar a assinatura de webhooks do workspace |
225
226
  | `openid` | Receber um `id_token` identificando o usuário |
226
227
  | `profile` | Ler o nome do usuário |
227
228
  | `email` | Ler o e-mail do usuário e se está verificado |
@@ -1093,6 +1094,8 @@ await client.users.updateNotificationPreferences({
1093
1094
 
1094
1095
  ### Webhooks
1095
1096
 
1097
+ Tokens OAuth exigem `webhooks:write` para `register()` e `inactivate()`.
1098
+
1096
1099
  ```ts
1097
1100
  await client.webhooks.register({
1098
1101
  url: 'https://exemplo.com.br/webhooks/assinafy',
@@ -1362,13 +1365,9 @@ try {
1362
1365
  | Produção | `https://api.assinafy.com.br/v1` |
1363
1366
  | Sandbox | `https://sandbox.assinafy.com.br/v1` |
1364
1367
 
1365
- O sandbox é gratuito e espelha a produção para testar a integração de ponta a ponta, com a exceção
1366
- das rotas de certificado digital, que existem apenas em produção.
1367
-
1368
1368
  O sandbox tem servidor de autorização próprio em `https://auth-sandbox.assinafy.com.br`, com a tela
1369
- de consentimento em `/oauth/authorize`. Os documentos de descoberta dele, porém, não são
1370
- alcançáveis: o nginx do sandbox recusa qualquer caminho iniciado por ponto, então `/.well-known/…`
1371
- nunca chega à aplicação. Informe os endpoints explicitamente para pular a descoberta:
1369
+ de consentimento em `/oauth/authorize`. Os documentos de descoberta dele não são alcançáveis:
1370
+ o nginx recusa caminhos iniciados por ponto, então informe os endpoints explicitamente:
1372
1371
 
1373
1372
  ```ts
1374
1373
  const client = new AssinafyClient({ baseUrl: 'https://sandbox.assinafy.com.br/v1' });
@@ -1382,8 +1381,8 @@ const requisicao = await client.oauth.createAuthorizationUrl({
1382
1381
  });
1383
1382
  ```
1384
1383
 
1385
- Os endpoints de token, revogação e userinfo seguem o `baseUrl` configurado. Confirme que o deploy de
1386
- sandbox os expõe antes de rodar a etapa de troca por lá — veja
1384
+ Os endpoints de token, revogação e userinfo seguem o `baseUrl` configurado. Confirme que o sandbox
1385
+ os expõe antes de rodar a etapa de troca por lá — veja
1387
1386
  [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
1388
1387
 
1389
1388
  ## Desenvolvimento
package/dist/index.d.mts CHANGED
@@ -1154,7 +1154,7 @@ interface IUpdateTagPayload {
1154
1154
  * `scopes_supported` in
1155
1155
  * {@link IOAuthAuthorizationServerMetadata}.
1156
1156
  */
1157
- type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
1157
+ type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'webhooks:write' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
1158
1158
  /**
1159
1159
  * RFC 9728 protected-resource metadata served at
1160
1160
  * `https://api.assinafy.com.br/.well-known/oauth-protected-resource`.
@@ -1383,7 +1383,7 @@ declare class DocumentResource extends BaseResource {
1383
1383
  * "status": "uploaded", // NOT metadata_processing yet
1384
1384
  * "artifacts": { "original": "https://…/documents/103ad216…/download/original" },
1385
1385
  * "is_closed": false,
1386
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1386
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1387
1387
  * "decline_reason": null,
1388
1388
  * "declined_by": null,
1389
1389
  * "tags": [],
@@ -1436,7 +1436,7 @@ declare class DocumentResource extends BaseResource {
1436
1436
  * "thumbnail": "https://…/documents/103acccd…/thumbnail"
1437
1437
  * },
1438
1438
  * "is_closed": false,
1439
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd…",
1439
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd…",
1440
1440
  * "decline_reason": null,
1441
1441
  * "declined_by": null,
1442
1442
  * "tags": [],
@@ -1581,7 +1581,7 @@ declare class DocumentResource extends BaseResource {
1581
1581
  * "thumbnail": "https://…/documents/103ad216…/thumbnail"
1582
1582
  * },
1583
1583
  * "is_closed": false,
1584
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1584
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1585
1585
  * "decline_reason": null,
1586
1586
  * "declined_by": null,
1587
1587
  * "tags": [],
@@ -1923,7 +1923,7 @@ declare class DocumentResource extends BaseResource {
1923
1923
  * "status": "pending_signature",
1924
1924
  * "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
1925
1925
  * "is_closed": false,
1926
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
1926
+ * "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
1927
1927
  * "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
1928
1928
  * "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
1929
1929
  * "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
@@ -2783,7 +2783,7 @@ declare class AssignmentResource extends BaseResource {
2783
2783
  * "signing_urls": [
2784
2784
  * {
2785
2785
  * "signer_id": "19e6b92e7895332ed9708535d8c",
2786
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2786
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2787
2787
  * }
2788
2788
  * ]
2789
2789
  * }
@@ -2878,7 +2878,7 @@ declare class AssignmentResource extends BaseResource {
2878
2878
  * "signing_urls": [
2879
2879
  * {
2880
2880
  * "signer_id": "19e6b92e7895332ed9708535d8c",
2881
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2881
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2882
2882
  * }
2883
2883
  * ]
2884
2884
  * }
@@ -2988,7 +2988,7 @@ declare class AssignmentResource extends BaseResource {
2988
2988
  * ],
2989
2989
  * "summary": { "signer_count": 1, "completed_count": 0 },
2990
2990
  * "signing_urls": [
2991
- * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
2991
+ * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
2992
2992
  * ]
2993
2993
  * }
2994
2994
  * ```
@@ -3094,7 +3094,7 @@ declare class AssignmentResource extends BaseResource {
3094
3094
  * "header": "Assinafy",
3095
3095
  * "body": "Você tem um documento para assinar.",
3096
3096
  * "buttons": [
3097
- * { "text": "Assinar documento", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
3097
+ * { "text": "Assinar documento", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
3098
3098
  * ],
3099
3099
  * "phone_number": "+5511999998888",
3100
3100
  * "signer_id": "19e6b92e7895332ed9708535d8c"
@@ -3127,6 +3127,7 @@ declare class WebhookResource extends BaseResource {
3127
3127
  * When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
3128
3128
  * (`document_ready`, `document_prepared`, `signer_signed_document`,
3129
3129
  * `signer_rejected_document`, `document_processing_failed`).
3130
+ * OAuth tokens need the `webhooks:write` scope.
3130
3131
  *
3131
3132
  * @param payload - Subscription details. `url` and `email` are required;
3132
3133
  * `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
@@ -3150,7 +3151,8 @@ declare class WebhookResource extends BaseResource {
3150
3151
  * ```
3151
3152
  * @throws {ValidationError} If `url` / `email` is invalid, `events` /
3152
3153
  * `is_active` has the wrong type, or no account ID is available.
3153
- * @throws {ApiError} If the API rejects the subscription.
3154
+ * @throws {ApiError} If the API rejects the subscription, including `403`
3155
+ * when an OAuth token lacks `webhooks:write`.
3154
3156
  *
3155
3157
  * @example
3156
3158
  * ```ts
@@ -3209,6 +3211,7 @@ declare class WebhookResource extends BaseResource {
3209
3211
  * subscription-delete route. The subscription is retained (with its `url`
3210
3212
  * and `events`) and simply stops firing; re-enable it by calling
3211
3213
  * {@link WebhookResource.register} again with `is_active: true`.
3214
+ * OAuth tokens need the `webhooks:write` scope.
3212
3215
  *
3213
3216
  * @param accountId - Override the client's default account ID.
3214
3217
  * @returns The subscription with `is_active` flipped to `false`. Response
@@ -3229,7 +3232,8 @@ declare class WebhookResource extends BaseResource {
3229
3232
  * }
3230
3233
  * ```
3231
3234
  * @throws {ValidationError} If no account ID is available.
3232
- * @throws {ApiError} If the API rejects the request.
3235
+ * @throws {ApiError} If the API rejects the request, including `403` when
3236
+ * an OAuth token lacks `webhooks:write`.
3233
3237
  *
3234
3238
  * @example
3235
3239
  * ```ts
@@ -4243,7 +4247,7 @@ declare class OAuthResource extends BaseResource {
4243
4247
  * "scopes_supported": [
4244
4248
  * "documents:read", "documents:write",
4245
4249
  * "templates:read", "templates:write",
4246
- * "account:read", "openid", "profile", "email"
4250
+ * "account:read", "webhooks:write", "openid", "profile", "email"
4247
4251
  * ],
4248
4252
  * "bearer_methods_supported": ["header"]
4249
4253
  * }
@@ -4280,16 +4284,19 @@ declare class OAuthResource extends BaseResource {
4280
4284
  * "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
4281
4285
  * "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
4282
4286
  * "scopes_supported": ["documents:read", "documents:write", "templates:read",
4283
- * "templates:write", "account:read", "openid",
4287
+ * "templates:write", "account:read", "webhooks:write", "openid",
4284
4288
  * "profile", "email", "offline_access"],
4285
4289
  * "response_types_supported": ["code"],
4286
- * "grant_types_supported": ["authorization_code", "refresh_token"],
4290
+ * "grant_types_supported": ["authorization_code", "refresh_token",
4291
+ * "urn:ietf:params:oauth:grant-type:token-exchange"],
4287
4292
  * "code_challenge_methods_supported": ["S256"],
4288
4293
  * "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
4289
4294
  * "authorization_response_iss_parameter_supported": true,
4290
4295
  * "client_id_metadata_document_supported": true
4291
4296
  * }
4292
4297
  * ```
4298
+ * The token-exchange grant is reserved for Assinafy's internal service
4299
+ * clients; integrations use `authorization_code` and `refresh_token`.
4293
4300
  * @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
4294
4301
  * or the document's own `issuer` disagrees with where it was fetched from
4295
4302
  * (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
@@ -4323,6 +4330,7 @@ declare class OAuthResource extends BaseResource {
4323
4330
  * `['documents:read', 'documents:write', 'offline_access']`. Ask for the
4324
4331
  * minimum: the user approves all of them or none. Add `offline_access` to
4325
4332
  * receive a refresh token and `openid` to receive an `id_token`.
4333
+ * `webhooks:write` permits subscription updates and inactivation.
4326
4334
  * @param options.authorizationEndpoint - Skip discovery by supplying the
4327
4335
  * endpoint yourself. Defaults to the discovered
4328
4336
  * `authorization_endpoint`.
@@ -4949,18 +4957,18 @@ declare class SignerDocumentsResource extends BaseResource {
4949
4957
  * "name": "Service agreement.pdf",
4950
4958
  * "status": "pending_signature",
4951
4959
  * "artifacts": {
4952
- * "original": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../download/original",
4953
- * "thumbnail": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../thumbnail"
4960
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
4961
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
4954
4962
  * },
4955
4963
  * "is_closed": false,
4956
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
4964
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
4957
4965
  * "decline_reason": null,
4958
4966
  * "declined_by": null,
4959
4967
  * "tags": [],
4960
4968
  * "assignment": null, // an IAssignment once signing has started
4961
4969
  * "pages": [
4962
4970
  * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
4963
- * "download_url": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
4971
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
4964
4972
  * ],
4965
4973
  * "created_at": "2026-07-19T14:56:54Z",
4966
4974
  * "updated_at": "2026-07-19T14:56:56Z"
@@ -5002,7 +5010,7 @@ declare class SignerDocumentsResource extends BaseResource {
5002
5010
  * "status": "pending_signature",
5003
5011
  * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
5004
5012
  * "is_closed": false,
5005
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
5013
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
5006
5014
  * "decline_reason": null,
5007
5015
  * "declined_by": null,
5008
5016
  * "tags": [],
@@ -5843,7 +5851,7 @@ declare class AssinafyClient {
5843
5851
  * { "id": "1032becb82a279550bc3e5df9bbb", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
5844
5852
  * ],
5845
5853
  * "signing_urls": [
5846
- * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app-sandbox.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
5854
+ * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
5847
5855
  * ]
5848
5856
  * },
5849
5857
  * "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
package/dist/index.d.ts CHANGED
@@ -1154,7 +1154,7 @@ interface IUpdateTagPayload {
1154
1154
  * `scopes_supported` in
1155
1155
  * {@link IOAuthAuthorizationServerMetadata}.
1156
1156
  */
1157
- type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
1157
+ type OAuthScope = 'documents:read' | 'documents:write' | 'templates:read' | 'templates:write' | 'account:read' | 'webhooks:write' | 'openid' | 'profile' | 'email' | 'offline_access' | AnyString;
1158
1158
  /**
1159
1159
  * RFC 9728 protected-resource metadata served at
1160
1160
  * `https://api.assinafy.com.br/.well-known/oauth-protected-resource`.
@@ -1383,7 +1383,7 @@ declare class DocumentResource extends BaseResource {
1383
1383
  * "status": "uploaded", // NOT metadata_processing yet
1384
1384
  * "artifacts": { "original": "https://…/documents/103ad216…/download/original" },
1385
1385
  * "is_closed": false,
1386
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1386
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1387
1387
  * "decline_reason": null,
1388
1388
  * "declined_by": null,
1389
1389
  * "tags": [],
@@ -1436,7 +1436,7 @@ declare class DocumentResource extends BaseResource {
1436
1436
  * "thumbnail": "https://…/documents/103acccd…/thumbnail"
1437
1437
  * },
1438
1438
  * "is_closed": false,
1439
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd…",
1439
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd…",
1440
1440
  * "decline_reason": null,
1441
1441
  * "declined_by": null,
1442
1442
  * "tags": [],
@@ -1581,7 +1581,7 @@ declare class DocumentResource extends BaseResource {
1581
1581
  * "thumbnail": "https://…/documents/103ad216…/thumbnail"
1582
1582
  * },
1583
1583
  * "is_closed": false,
1584
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1584
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1585
1585
  * "decline_reason": null,
1586
1586
  * "declined_by": null,
1587
1587
  * "tags": [],
@@ -1923,7 +1923,7 @@ declare class DocumentResource extends BaseResource {
1923
1923
  * "status": "pending_signature",
1924
1924
  * "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
1925
1925
  * "is_closed": false,
1926
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
1926
+ * "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
1927
1927
  * "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
1928
1928
  * "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
1929
1929
  * "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
@@ -2783,7 +2783,7 @@ declare class AssignmentResource extends BaseResource {
2783
2783
  * "signing_urls": [
2784
2784
  * {
2785
2785
  * "signer_id": "19e6b92e7895332ed9708535d8c",
2786
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2786
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2787
2787
  * }
2788
2788
  * ]
2789
2789
  * }
@@ -2878,7 +2878,7 @@ declare class AssignmentResource extends BaseResource {
2878
2878
  * "signing_urls": [
2879
2879
  * {
2880
2880
  * "signer_id": "19e6b92e7895332ed9708535d8c",
2881
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2881
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
2882
2882
  * }
2883
2883
  * ]
2884
2884
  * }
@@ -2988,7 +2988,7 @@ declare class AssignmentResource extends BaseResource {
2988
2988
  * ],
2989
2989
  * "summary": { "signer_count": 1, "completed_count": 0 },
2990
2990
  * "signing_urls": [
2991
- * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
2991
+ * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
2992
2992
  * ]
2993
2993
  * }
2994
2994
  * ```
@@ -3094,7 +3094,7 @@ declare class AssignmentResource extends BaseResource {
3094
3094
  * "header": "Assinafy",
3095
3095
  * "body": "Você tem um documento para assinar.",
3096
3096
  * "buttons": [
3097
- * { "text": "Assinar documento", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
3097
+ * { "text": "Assinar documento", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
3098
3098
  * ],
3099
3099
  * "phone_number": "+5511999998888",
3100
3100
  * "signer_id": "19e6b92e7895332ed9708535d8c"
@@ -3127,6 +3127,7 @@ declare class WebhookResource extends BaseResource {
3127
3127
  * When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
3128
3128
  * (`document_ready`, `document_prepared`, `signer_signed_document`,
3129
3129
  * `signer_rejected_document`, `document_processing_failed`).
3130
+ * OAuth tokens need the `webhooks:write` scope.
3130
3131
  *
3131
3132
  * @param payload - Subscription details. `url` and `email` are required;
3132
3133
  * `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
@@ -3150,7 +3151,8 @@ declare class WebhookResource extends BaseResource {
3150
3151
  * ```
3151
3152
  * @throws {ValidationError} If `url` / `email` is invalid, `events` /
3152
3153
  * `is_active` has the wrong type, or no account ID is available.
3153
- * @throws {ApiError} If the API rejects the subscription.
3154
+ * @throws {ApiError} If the API rejects the subscription, including `403`
3155
+ * when an OAuth token lacks `webhooks:write`.
3154
3156
  *
3155
3157
  * @example
3156
3158
  * ```ts
@@ -3209,6 +3211,7 @@ declare class WebhookResource extends BaseResource {
3209
3211
  * subscription-delete route. The subscription is retained (with its `url`
3210
3212
  * and `events`) and simply stops firing; re-enable it by calling
3211
3213
  * {@link WebhookResource.register} again with `is_active: true`.
3214
+ * OAuth tokens need the `webhooks:write` scope.
3212
3215
  *
3213
3216
  * @param accountId - Override the client's default account ID.
3214
3217
  * @returns The subscription with `is_active` flipped to `false`. Response
@@ -3229,7 +3232,8 @@ declare class WebhookResource extends BaseResource {
3229
3232
  * }
3230
3233
  * ```
3231
3234
  * @throws {ValidationError} If no account ID is available.
3232
- * @throws {ApiError} If the API rejects the request.
3235
+ * @throws {ApiError} If the API rejects the request, including `403` when
3236
+ * an OAuth token lacks `webhooks:write`.
3233
3237
  *
3234
3238
  * @example
3235
3239
  * ```ts
@@ -4243,7 +4247,7 @@ declare class OAuthResource extends BaseResource {
4243
4247
  * "scopes_supported": [
4244
4248
  * "documents:read", "documents:write",
4245
4249
  * "templates:read", "templates:write",
4246
- * "account:read", "openid", "profile", "email"
4250
+ * "account:read", "webhooks:write", "openid", "profile", "email"
4247
4251
  * ],
4248
4252
  * "bearer_methods_supported": ["header"]
4249
4253
  * }
@@ -4280,16 +4284,19 @@ declare class OAuthResource extends BaseResource {
4280
4284
  * "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
4281
4285
  * "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
4282
4286
  * "scopes_supported": ["documents:read", "documents:write", "templates:read",
4283
- * "templates:write", "account:read", "openid",
4287
+ * "templates:write", "account:read", "webhooks:write", "openid",
4284
4288
  * "profile", "email", "offline_access"],
4285
4289
  * "response_types_supported": ["code"],
4286
- * "grant_types_supported": ["authorization_code", "refresh_token"],
4290
+ * "grant_types_supported": ["authorization_code", "refresh_token",
4291
+ * "urn:ietf:params:oauth:grant-type:token-exchange"],
4287
4292
  * "code_challenge_methods_supported": ["S256"],
4288
4293
  * "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
4289
4294
  * "authorization_response_iss_parameter_supported": true,
4290
4295
  * "client_id_metadata_document_supported": true
4291
4296
  * }
4292
4297
  * ```
4298
+ * The token-exchange grant is reserved for Assinafy's internal service
4299
+ * clients; integrations use `authorization_code` and `refresh_token`.
4293
4300
  * @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
4294
4301
  * or the document's own `issuer` disagrees with where it was fetched from
4295
4302
  * (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
@@ -4323,6 +4330,7 @@ declare class OAuthResource extends BaseResource {
4323
4330
  * `['documents:read', 'documents:write', 'offline_access']`. Ask for the
4324
4331
  * minimum: the user approves all of them or none. Add `offline_access` to
4325
4332
  * receive a refresh token and `openid` to receive an `id_token`.
4333
+ * `webhooks:write` permits subscription updates and inactivation.
4326
4334
  * @param options.authorizationEndpoint - Skip discovery by supplying the
4327
4335
  * endpoint yourself. Defaults to the discovered
4328
4336
  * `authorization_endpoint`.
@@ -4949,18 +4957,18 @@ declare class SignerDocumentsResource extends BaseResource {
4949
4957
  * "name": "Service agreement.pdf",
4950
4958
  * "status": "pending_signature",
4951
4959
  * "artifacts": {
4952
- * "original": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../download/original",
4953
- * "thumbnail": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../thumbnail"
4960
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
4961
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
4954
4962
  * },
4955
4963
  * "is_closed": false,
4956
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
4964
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
4957
4965
  * "decline_reason": null,
4958
4966
  * "declined_by": null,
4959
4967
  * "tags": [],
4960
4968
  * "assignment": null, // an IAssignment once signing has started
4961
4969
  * "pages": [
4962
4970
  * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
4963
- * "download_url": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
4971
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
4964
4972
  * ],
4965
4973
  * "created_at": "2026-07-19T14:56:54Z",
4966
4974
  * "updated_at": "2026-07-19T14:56:56Z"
@@ -5002,7 +5010,7 @@ declare class SignerDocumentsResource extends BaseResource {
5002
5010
  * "status": "pending_signature",
5003
5011
  * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
5004
5012
  * "is_closed": false,
5005
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
5013
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
5006
5014
  * "decline_reason": null,
5007
5015
  * "declined_by": null,
5008
5016
  * "tags": [],
@@ -5843,7 +5851,7 @@ declare class AssinafyClient {
5843
5851
  * { "id": "1032becb82a279550bc3e5df9bbb", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
5844
5852
  * ],
5845
5853
  * "signing_urls": [
5846
- * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app-sandbox.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
5854
+ * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
5847
5855
  * ]
5848
5856
  * },
5849
5857
  * "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
package/dist/index.js CHANGED
@@ -634,7 +634,7 @@ var import_axios2 = __toESM(require("axios"));
634
634
  // package.json
635
635
  var package_default = {
636
636
  name: "@assinafy/sdk",
637
- version: "2.4.0",
637
+ version: "2.4.2",
638
638
  packageManager: "bun@1.4.0",
639
639
  description: "TypeScript SDK for Assinafy API - Digital signature platform",
640
640
  type: "commonjs",
@@ -1284,7 +1284,7 @@ var AssignmentResource = class extends BaseResource {
1284
1284
  * "signing_urls": [
1285
1285
  * {
1286
1286
  * "signer_id": "19e6b92e7895332ed9708535d8c",
1287
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1287
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1288
1288
  * }
1289
1289
  * ]
1290
1290
  * }
@@ -1387,7 +1387,7 @@ var AssignmentResource = class extends BaseResource {
1387
1387
  * "signing_urls": [
1388
1388
  * {
1389
1389
  * "signer_id": "19e6b92e7895332ed9708535d8c",
1390
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1390
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1391
1391
  * }
1392
1392
  * ]
1393
1393
  * }
@@ -1521,7 +1521,7 @@ var AssignmentResource = class extends BaseResource {
1521
1521
  * ],
1522
1522
  * "summary": { "signer_count": 1, "completed_count": 0 },
1523
1523
  * "signing_urls": [
1524
- * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1524
+ * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1525
1525
  * ]
1526
1526
  * }
1527
1527
  * ```
@@ -1658,7 +1658,7 @@ var AssignmentResource = class extends BaseResource {
1658
1658
  * "header": "Assinafy",
1659
1659
  * "body": "Você tem um documento para assinar.",
1660
1660
  * "buttons": [
1661
- * { "text": "Assinar documento", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1661
+ * { "text": "Assinar documento", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1662
1662
  * ],
1663
1663
  * "phone_number": "+5511999998888",
1664
1664
  * "signer_id": "19e6b92e7895332ed9708535d8c"
@@ -1735,7 +1735,7 @@ var DocumentResource = class extends BaseResource {
1735
1735
  * "status": "uploaded", // NOT metadata_processing yet
1736
1736
  * "artifacts": { "original": "https://…/documents/103ad216…/download/original" },
1737
1737
  * "is_closed": false,
1738
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1738
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1739
1739
  * "decline_reason": null,
1740
1740
  * "declined_by": null,
1741
1741
  * "tags": [],
@@ -1805,7 +1805,7 @@ var DocumentResource = class extends BaseResource {
1805
1805
  * "thumbnail": "https://…/documents/103acccd…/thumbnail"
1806
1806
  * },
1807
1807
  * "is_closed": false,
1808
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd…",
1808
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd…",
1809
1809
  * "decline_reason": null,
1810
1810
  * "declined_by": null,
1811
1811
  * "tags": [],
@@ -1979,7 +1979,7 @@ var DocumentResource = class extends BaseResource {
1979
1979
  * "thumbnail": "https://…/documents/103ad216…/thumbnail"
1980
1980
  * },
1981
1981
  * "is_closed": false,
1982
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1982
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1983
1983
  * "decline_reason": null,
1984
1984
  * "declined_by": null,
1985
1985
  * "tags": [],
@@ -2457,7 +2457,7 @@ var DocumentResource = class extends BaseResource {
2457
2457
  * "status": "pending_signature",
2458
2458
  * "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
2459
2459
  * "is_closed": false,
2460
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
2460
+ * "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
2461
2461
  * "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
2462
2462
  * "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
2463
2463
  * "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
@@ -3668,6 +3668,7 @@ var WebhookResource = class extends BaseResource {
3668
3668
  * When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
3669
3669
  * (`document_ready`, `document_prepared`, `signer_signed_document`,
3670
3670
  * `signer_rejected_document`, `document_processing_failed`).
3671
+ * OAuth tokens need the `webhooks:write` scope.
3671
3672
  *
3672
3673
  * @param payload - Subscription details. `url` and `email` are required;
3673
3674
  * `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
@@ -3691,7 +3692,8 @@ var WebhookResource = class extends BaseResource {
3691
3692
  * ```
3692
3693
  * @throws {ValidationError} If `url` / `email` is invalid, `events` /
3693
3694
  * `is_active` has the wrong type, or no account ID is available.
3694
- * @throws {ApiError} If the API rejects the subscription.
3695
+ * @throws {ApiError} If the API rejects the subscription, including `403`
3696
+ * when an OAuth token lacks `webhooks:write`.
3695
3697
  *
3696
3698
  * @example
3697
3699
  * ```ts
@@ -3789,6 +3791,7 @@ var WebhookResource = class extends BaseResource {
3789
3791
  * subscription-delete route. The subscription is retained (with its `url`
3790
3792
  * and `events`) and simply stops firing; re-enable it by calling
3791
3793
  * {@link WebhookResource.register} again with `is_active: true`.
3794
+ * OAuth tokens need the `webhooks:write` scope.
3792
3795
  *
3793
3796
  * @param accountId - Override the client's default account ID.
3794
3797
  * @returns The subscription with `is_active` flipped to `false`. Response
@@ -3809,7 +3812,8 @@ var WebhookResource = class extends BaseResource {
3809
3812
  * }
3810
3813
  * ```
3811
3814
  * @throws {ValidationError} If no account ID is available.
3812
- * @throws {ApiError} If the API rejects the request.
3815
+ * @throws {ApiError} If the API rejects the request, including `403` when
3816
+ * an OAuth token lacks `webhooks:write`.
3813
3817
  *
3814
3818
  * @example
3815
3819
  * ```ts
@@ -4987,7 +4991,7 @@ var OAuthResource = class extends BaseResource {
4987
4991
  * "scopes_supported": [
4988
4992
  * "documents:read", "documents:write",
4989
4993
  * "templates:read", "templates:write",
4990
- * "account:read", "openid", "profile", "email"
4994
+ * "account:read", "webhooks:write", "openid", "profile", "email"
4991
4995
  * ],
4992
4996
  * "bearer_methods_supported": ["header"]
4993
4997
  * }
@@ -5029,16 +5033,19 @@ var OAuthResource = class extends BaseResource {
5029
5033
  * "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
5030
5034
  * "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
5031
5035
  * "scopes_supported": ["documents:read", "documents:write", "templates:read",
5032
- * "templates:write", "account:read", "openid",
5036
+ * "templates:write", "account:read", "webhooks:write", "openid",
5033
5037
  * "profile", "email", "offline_access"],
5034
5038
  * "response_types_supported": ["code"],
5035
- * "grant_types_supported": ["authorization_code", "refresh_token"],
5039
+ * "grant_types_supported": ["authorization_code", "refresh_token",
5040
+ * "urn:ietf:params:oauth:grant-type:token-exchange"],
5036
5041
  * "code_challenge_methods_supported": ["S256"],
5037
5042
  * "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
5038
5043
  * "authorization_response_iss_parameter_supported": true,
5039
5044
  * "client_id_metadata_document_supported": true
5040
5045
  * }
5041
5046
  * ```
5047
+ * The token-exchange grant is reserved for Assinafy's internal service
5048
+ * clients; integrations use `authorization_code` and `refresh_token`.
5042
5049
  * @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
5043
5050
  * or the document's own `issuer` disagrees with where it was fetched from
5044
5051
  * (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
@@ -5086,6 +5093,7 @@ var OAuthResource = class extends BaseResource {
5086
5093
  * `['documents:read', 'documents:write', 'offline_access']`. Ask for the
5087
5094
  * minimum: the user approves all of them or none. Add `offline_access` to
5088
5095
  * receive a refresh token and `openid` to receive an `id_token`.
5096
+ * `webhooks:write` permits subscription updates and inactivation.
5089
5097
  * @param options.authorizationEndpoint - Skip discovery by supplying the
5090
5098
  * endpoint yourself. Defaults to the discovered
5091
5099
  * `authorization_endpoint`.
@@ -6037,18 +6045,18 @@ var SignerDocumentsResource = class extends BaseResource {
6037
6045
  * "name": "Service agreement.pdf",
6038
6046
  * "status": "pending_signature",
6039
6047
  * "artifacts": {
6040
- * "original": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../download/original",
6041
- * "thumbnail": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../thumbnail"
6048
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
6049
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
6042
6050
  * },
6043
6051
  * "is_closed": false,
6044
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
6052
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
6045
6053
  * "decline_reason": null,
6046
6054
  * "declined_by": null,
6047
6055
  * "tags": [],
6048
6056
  * "assignment": null, // an IAssignment once signing has started
6049
6057
  * "pages": [
6050
6058
  * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
6051
- * "download_url": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
6059
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
6052
6060
  * ],
6053
6061
  * "created_at": "2026-07-19T14:56:54Z",
6054
6062
  * "updated_at": "2026-07-19T14:56:56Z"
@@ -6099,7 +6107,7 @@ var SignerDocumentsResource = class extends BaseResource {
6099
6107
  * "status": "pending_signature",
6100
6108
  * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
6101
6109
  * "is_closed": false,
6102
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
6110
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
6103
6111
  * "decline_reason": null,
6104
6112
  * "declined_by": null,
6105
6113
  * "tags": [],
@@ -7246,7 +7254,7 @@ var AssinafyClient = class _AssinafyClient {
7246
7254
  * { "id": "1032becb82a279550bc3e5df9bbb", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
7247
7255
  * ],
7248
7256
  * "signing_urls": [
7249
- * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app-sandbox.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
7257
+ * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
7250
7258
  * ]
7251
7259
  * },
7252
7260
  * "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
package/dist/index.mjs CHANGED
@@ -574,7 +574,7 @@ import axios2 from "axios";
574
574
  // package.json
575
575
  var package_default = {
576
576
  name: "@assinafy/sdk",
577
- version: "2.4.0",
577
+ version: "2.4.2",
578
578
  packageManager: "bun@1.4.0",
579
579
  description: "TypeScript SDK for Assinafy API - Digital signature platform",
580
580
  type: "commonjs",
@@ -1224,7 +1224,7 @@ var AssignmentResource = class extends BaseResource {
1224
1224
  * "signing_urls": [
1225
1225
  * {
1226
1226
  * "signer_id": "19e6b92e7895332ed9708535d8c",
1227
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1227
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1228
1228
  * }
1229
1229
  * ]
1230
1230
  * }
@@ -1327,7 +1327,7 @@ var AssignmentResource = class extends BaseResource {
1327
1327
  * "signing_urls": [
1328
1328
  * {
1329
1329
  * "signer_id": "19e6b92e7895332ed9708535d8c",
1330
- * "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1330
+ * "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c?email=signer%40example.com"
1331
1331
  * }
1332
1332
  * ]
1333
1333
  * }
@@ -1461,7 +1461,7 @@ var AssignmentResource = class extends BaseResource {
1461
1461
  * ],
1462
1462
  * "summary": { "signer_count": 1, "completed_count": 0 },
1463
1463
  * "signing_urls": [
1464
- * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1464
+ * { "signer_id": "19e6b92e7895332ed9708535d8c", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1465
1465
  * ]
1466
1466
  * }
1467
1467
  * ```
@@ -1598,7 +1598,7 @@ var AssignmentResource = class extends BaseResource {
1598
1598
  * "header": "Assinafy",
1599
1599
  * "body": "Você tem um documento para assinar.",
1600
1600
  * "buttons": [
1601
- * { "text": "Assinar documento", "url": "https://app-sandbox.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1601
+ * { "text": "Assinar documento", "url": "https://app.assinafy.com.br/sign/103033c950d865a248a11c5cf96c" }
1602
1602
  * ],
1603
1603
  * "phone_number": "+5511999998888",
1604
1604
  * "signer_id": "19e6b92e7895332ed9708535d8c"
@@ -1675,7 +1675,7 @@ var DocumentResource = class extends BaseResource {
1675
1675
  * "status": "uploaded", // NOT metadata_processing yet
1676
1676
  * "artifacts": { "original": "https://…/documents/103ad216…/download/original" },
1677
1677
  * "is_closed": false,
1678
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1678
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1679
1679
  * "decline_reason": null,
1680
1680
  * "declined_by": null,
1681
1681
  * "tags": [],
@@ -1745,7 +1745,7 @@ var DocumentResource = class extends BaseResource {
1745
1745
  * "thumbnail": "https://…/documents/103acccd…/thumbnail"
1746
1746
  * },
1747
1747
  * "is_closed": false,
1748
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd…",
1748
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd…",
1749
1749
  * "decline_reason": null,
1750
1750
  * "declined_by": null,
1751
1751
  * "tags": [],
@@ -1919,7 +1919,7 @@ var DocumentResource = class extends BaseResource {
1919
1919
  * "thumbnail": "https://…/documents/103ad216…/thumbnail"
1920
1920
  * },
1921
1921
  * "is_closed": false,
1922
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103ad216…",
1922
+ * "signing_url": "https://app.assinafy.com.br/sign/103ad216…",
1923
1923
  * "decline_reason": null,
1924
1924
  * "declined_by": null,
1925
1925
  * "tags": [],
@@ -2397,7 +2397,7 @@ var DocumentResource = class extends BaseResource {
2397
2397
  * "status": "pending_signature",
2398
2398
  * "artifacts": { "original": "https://…/download/original", "thumbnail": "https://…/thumbnail" },
2399
2399
  * "is_closed": false,
2400
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/19f675b7…",
2400
+ * "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
2401
2401
  * "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
2402
2402
  * "assignment": { "id": "103a09a1…", "method": "virtual", "summary": { "signer_count": 1, "completed_count": 0 } },
2403
2403
  * "pages": [{ "id": "103a0992…", "number": 1, "height": 1651, "width": 1275, "download_url": "https://…/download" }],
@@ -3608,6 +3608,7 @@ var WebhookResource = class extends BaseResource {
3608
3608
  * When `events` is omitted or empty, {@link DEFAULT_WEBHOOK_EVENTS} is used
3609
3609
  * (`document_ready`, `document_prepared`, `signer_signed_document`,
3610
3610
  * `signer_rejected_document`, `document_processing_failed`).
3611
+ * OAuth tokens need the `webhooks:write` scope.
3611
3612
  *
3612
3613
  * @param payload - Subscription details. `url` and `email` are required;
3613
3614
  * `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
@@ -3631,7 +3632,8 @@ var WebhookResource = class extends BaseResource {
3631
3632
  * ```
3632
3633
  * @throws {ValidationError} If `url` / `email` is invalid, `events` /
3633
3634
  * `is_active` has the wrong type, or no account ID is available.
3634
- * @throws {ApiError} If the API rejects the subscription.
3635
+ * @throws {ApiError} If the API rejects the subscription, including `403`
3636
+ * when an OAuth token lacks `webhooks:write`.
3635
3637
  *
3636
3638
  * @example
3637
3639
  * ```ts
@@ -3729,6 +3731,7 @@ var WebhookResource = class extends BaseResource {
3729
3731
  * subscription-delete route. The subscription is retained (with its `url`
3730
3732
  * and `events`) and simply stops firing; re-enable it by calling
3731
3733
  * {@link WebhookResource.register} again with `is_active: true`.
3734
+ * OAuth tokens need the `webhooks:write` scope.
3732
3735
  *
3733
3736
  * @param accountId - Override the client's default account ID.
3734
3737
  * @returns The subscription with `is_active` flipped to `false`. Response
@@ -3749,7 +3752,8 @@ var WebhookResource = class extends BaseResource {
3749
3752
  * }
3750
3753
  * ```
3751
3754
  * @throws {ValidationError} If no account ID is available.
3752
- * @throws {ApiError} If the API rejects the request.
3755
+ * @throws {ApiError} If the API rejects the request, including `403` when
3756
+ * an OAuth token lacks `webhooks:write`.
3753
3757
  *
3754
3758
  * @example
3755
3759
  * ```ts
@@ -4927,7 +4931,7 @@ var OAuthResource = class extends BaseResource {
4927
4931
  * "scopes_supported": [
4928
4932
  * "documents:read", "documents:write",
4929
4933
  * "templates:read", "templates:write",
4930
- * "account:read", "openid", "profile", "email"
4934
+ * "account:read", "webhooks:write", "openid", "profile", "email"
4931
4935
  * ],
4932
4936
  * "bearer_methods_supported": ["header"]
4933
4937
  * }
@@ -4969,16 +4973,19 @@ var OAuthResource = class extends BaseResource {
4969
4973
  * "userinfo_endpoint": "https://api.assinafy.com.br/v1/oauth/userinfo",
4970
4974
  * "jwks_uri": "https://auth.assinafy.com.br/.well-known/jwks.json",
4971
4975
  * "scopes_supported": ["documents:read", "documents:write", "templates:read",
4972
- * "templates:write", "account:read", "openid",
4976
+ * "templates:write", "account:read", "webhooks:write", "openid",
4973
4977
  * "profile", "email", "offline_access"],
4974
4978
  * "response_types_supported": ["code"],
4975
- * "grant_types_supported": ["authorization_code", "refresh_token"],
4979
+ * "grant_types_supported": ["authorization_code", "refresh_token",
4980
+ * "urn:ietf:params:oauth:grant-type:token-exchange"],
4976
4981
  * "code_challenge_methods_supported": ["S256"],
4977
4982
  * "token_endpoint_auth_methods_supported": ["client_secret_post", "none"],
4978
4983
  * "authorization_response_iss_parameter_supported": true,
4979
4984
  * "client_id_metadata_document_supported": true
4980
4985
  * }
4981
4986
  * ```
4987
+ * The token-exchange grant is reserved for Assinafy's internal service
4988
+ * clients; integrations use `authorization_code` and `refresh_token`.
4982
4989
  * @throws {ValidationError} If `issuer` is not an absolute `https://` URL,
4983
4990
  * or the document's own `issuer` disagrees with where it was fetched from
4984
4991
  * (RFC 8414 §3.3 — a mismatch means the document is not authoritative).
@@ -5026,6 +5033,7 @@ var OAuthResource = class extends BaseResource {
5026
5033
  * `['documents:read', 'documents:write', 'offline_access']`. Ask for the
5027
5034
  * minimum: the user approves all of them or none. Add `offline_access` to
5028
5035
  * receive a refresh token and `openid` to receive an `id_token`.
5036
+ * `webhooks:write` permits subscription updates and inactivation.
5029
5037
  * @param options.authorizationEndpoint - Skip discovery by supplying the
5030
5038
  * endpoint yourself. Defaults to the discovered
5031
5039
  * `authorization_endpoint`.
@@ -5977,18 +5985,18 @@ var SignerDocumentsResource = class extends BaseResource {
5977
5985
  * "name": "Service agreement.pdf",
5978
5986
  * "status": "pending_signature",
5979
5987
  * "artifacts": {
5980
- * "original": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../download/original",
5981
- * "thumbnail": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../thumbnail"
5988
+ * "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
5989
+ * "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
5982
5990
  * },
5983
5991
  * "is_closed": false,
5984
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
5992
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
5985
5993
  * "decline_reason": null,
5986
5994
  * "declined_by": null,
5987
5995
  * "tags": [],
5988
5996
  * "assignment": null, // an IAssignment once signing has started
5989
5997
  * "pages": [
5990
5998
  * { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
5991
- * "download_url": "https://sandbox.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
5999
+ * "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
5992
6000
  * ],
5993
6001
  * "created_at": "2026-07-19T14:56:54Z",
5994
6002
  * "updated_at": "2026-07-19T14:56:56Z"
@@ -6039,7 +6047,7 @@ var SignerDocumentsResource = class extends BaseResource {
6039
6047
  * "status": "pending_signature",
6040
6048
  * "artifacts": { "original": "https://...", "thumbnail": "https://..." },
6041
6049
  * "is_closed": false,
6042
- * "signing_url": "https://app-sandbox.assinafy.com.br/sign/103acccd...",
6050
+ * "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
6043
6051
  * "decline_reason": null,
6044
6052
  * "declined_by": null,
6045
6053
  * "tags": [],
@@ -7186,7 +7194,7 @@ var AssinafyClient = class _AssinafyClient {
7186
7194
  * { "id": "1032becb82a279550bc3e5df9bbb", "step": 1, "email": "ana@example.com", "full_name": "Ana Souza", "notified": true, "completed": false }
7187
7195
  * ],
7188
7196
  * "signing_urls": [
7189
- * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app-sandbox.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
7197
+ * { "signer_id": "1032becb82a279550bc3e5df9bbb", "url": "https://app.assinafy.com.br/sign/103ad216846e6b90710cb9acef59?email=ana%40example.com" }
7190
7198
  * ]
7191
7199
  * },
7192
7200
  * "signer_ids": ["1032becb82a279550bc3e5df9bbb"]
@@ -101,6 +101,8 @@ operations answer with flat RFC 6749 / OIDC bodies rather than the
101
101
  `{ status, message, data }` envelope used everywhere else, and the SDK returns
102
102
  them unwrapped. The browser-facing `/oauth/authorize` page belongs to the
103
103
  authorization server (`https://auth.assinafy.com.br`), not to this API.
104
+ The token endpoint also advertises an internal-service token-exchange grant;
105
+ ordinary OAuth applications use the two SDK methods listed below.
104
106
 
105
107
  | Method | Path | SDK method | Status |
106
108
  | --- | --- | --- | --- |
package/docs/RELEASING.md CHANGED
@@ -47,25 +47,6 @@ The `publish-gh` job uses the workflow-scoped `GITHUB_TOKEN` with
47
47
  the `@assinafy` scope and that the package remains linked to this repository.
48
48
  No separate personal access token should be stored.
49
49
 
50
- ### Sandbox integration environment
51
-
52
- Create a protected GitHub environment named `sandbox`. Restrict deployments to
53
- the mirrored `main` branch, require reviewer approval, and store these required
54
- environment secrets:
55
-
56
- - `ASSINAFY_API_KEY`
57
- - `ASSINAFY_ACCOUNT_ID`
58
-
59
- The `disposable-full` mode also requires `ASSINAFY_TEST_EMAIL_PRIMARY` and
60
- `ASSINAFY_TEST_EMAIL_SECONDARY`. Optional coverage uses
61
- `ASSINAFY_TEST_WEBHOOK_URL`, `ASSINAFY_TEST_LOGIN_EMAIL`,
62
- `ASSINAFY_TEST_LOGIN_PASSWORD`, `ASSINAFY_SIGNER_ACCESS_CODE`,
63
- `ASSINAFY_SIGNER_OTP`, and `ASSINAFY_PUBLIC_DOCUMENT_ID`.
64
-
65
- Keep secret values out of repository variables, files, and logs. Run the manual
66
- **Sandbox integration** workflow from mirrored `main`; use `read-only` first
67
- and select `disposable-full` only for a deliberate reversible test run.
68
-
69
50
  ### Mirror and tag protection
70
51
 
71
52
  The GitLab push mirror must include tags and be able to update the GitHub
@@ -110,7 +91,7 @@ deleting the same pattern to the mirror/release maintainers. Protect the GitHub
110
91
  ASSINAFY_BASE_URL='https://sandbox.assinafy.com.br/v1' \
111
92
  ASSINAFY_TEST_EMAIL_PRIMARY='first@example.com' \
112
93
  ASSINAFY_TEST_EMAIL_SECONDARY='second@example.com' \
113
- bun scripts/live-smoke.ts --all
94
+ bun scripts/live-smoke.ts --all --confirm-production
114
95
  ```
115
96
 
116
97
  The suite creates and force-deletes a disposable workspace, but an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "packageManager": "bun@1.4.0",
5
5
  "description": "TypeScript SDK for Assinafy API - Digital signature platform",
6
6
  "type": "commonjs",