@assinafy/sdk 2.9.1 → 2.11.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 +51 -1
- package/README.en.md +57 -23
- package/README.md +57 -22
- package/dist/index.d.mts +173 -76
- package/dist/index.d.ts +173 -76
- package/dist/index.js +200 -82
- package/dist/index.mjs +200 -82
- package/docs/API_COVERAGE.md +1 -1
- package/docs/COMPATIBILITY.md +98 -30
- package/docs/RELEASING.md +13 -6
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -956,7 +956,7 @@ interface IWebhookRegisterPayload {
|
|
|
956
956
|
}
|
|
957
957
|
/**
|
|
958
958
|
* The account's oldest webhook endpoint, as returned by the legacy
|
|
959
|
-
* subscription routes: `{ events, is_active, url, email, updated_at }`
|
|
959
|
+
* subscription routes: `{ events, is_active, is_held, held_since, url, email, updated_at }`
|
|
960
960
|
* (no `id` / `created_at`). Use {@link IWebhookEndpoint} for multi-endpoint
|
|
961
961
|
* accounts.
|
|
962
962
|
*/
|
|
@@ -965,6 +965,10 @@ interface IWebhookSubscription {
|
|
|
965
965
|
email: string | null;
|
|
966
966
|
events: string[];
|
|
967
967
|
is_active: boolean;
|
|
968
|
+
/** Whether delivery is paused after repeated failures. */
|
|
969
|
+
is_held?: boolean;
|
|
970
|
+
/** Unix timestamp when delivery was paused; `null` while it is running. */
|
|
971
|
+
held_since?: number | null;
|
|
968
972
|
updated_at?: string | null;
|
|
969
973
|
}
|
|
970
974
|
/** Body for `webhooks.createEndpoint()`. */
|
|
@@ -981,12 +985,17 @@ type IWebhookEndpointUpdatePayload = Partial<IWebhookEndpointCreatePayload>;
|
|
|
981
985
|
* 3 on paid plans; every active endpoint subscribed to an event receives it.
|
|
982
986
|
*/
|
|
983
987
|
interface IWebhookEndpoint {
|
|
988
|
+
resource?: string;
|
|
984
989
|
id: string;
|
|
985
990
|
name: string | null;
|
|
986
991
|
url: string;
|
|
987
992
|
email: string;
|
|
988
993
|
events: (WebhookEventType | AnyString)[];
|
|
989
994
|
is_active: boolean;
|
|
995
|
+
/** Whether delivery is paused after repeated failures. */
|
|
996
|
+
is_held?: boolean;
|
|
997
|
+
/** Unix timestamp when delivery was paused; `null` while it is running. */
|
|
998
|
+
held_since?: number | null;
|
|
990
999
|
/** Whether deliveries carry a `webhook-signature` header. */
|
|
991
1000
|
signing_enabled: boolean;
|
|
992
1001
|
/** ISO-8601 UTC timestamp. */
|
|
@@ -994,9 +1003,9 @@ interface IWebhookEndpoint {
|
|
|
994
1003
|
/** ISO-8601 UTC timestamp. */
|
|
995
1004
|
updated_at: string;
|
|
996
1005
|
}
|
|
997
|
-
/** Endpoint creation also returns
|
|
1006
|
+
/** Endpoint creation/update also returns a newly generated signing secret. */
|
|
998
1007
|
interface IWebhookEndpointCreateResponse extends IWebhookEndpoint {
|
|
999
|
-
/** Store securely
|
|
1008
|
+
/** Store securely when returned; OAuth applications cannot read it later. */
|
|
1000
1009
|
secret?: string;
|
|
1001
1010
|
}
|
|
1002
1011
|
/** An endpoint's Standard Webhooks signing secret. */
|
|
@@ -1021,6 +1030,14 @@ interface IWebhookDispatch {
|
|
|
1021
1030
|
endpoint: string | null;
|
|
1022
1031
|
payload: IWebhookPayload | Record<string, unknown> | null;
|
|
1023
1032
|
delivered: boolean;
|
|
1033
|
+
/** Stable `webhook-id` header across attempts for this event and endpoint. */
|
|
1034
|
+
webhook_id?: string | null;
|
|
1035
|
+
/** Attempt number for this event and endpoint, counted from 1. */
|
|
1036
|
+
attempt?: number | null;
|
|
1037
|
+
/** Whether the entry was scheduled, a recovery probe, or manually retried. */
|
|
1038
|
+
kind?: 'scheduled' | 'probe' | 'manual' | AnyString;
|
|
1039
|
+
/** Whether another automatic attempt follows this entry. */
|
|
1040
|
+
will_retry?: boolean;
|
|
1024
1041
|
http_status: number | null;
|
|
1025
1042
|
/** Receiving endpoint body, truncated by Assinafy to 2,000 characters. */
|
|
1026
1043
|
response_body: string | null;
|
|
@@ -1166,16 +1183,17 @@ interface ITemplateDetailsResponse {
|
|
|
1166
1183
|
updated_at?: string;
|
|
1167
1184
|
[key: string]: unknown;
|
|
1168
1185
|
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Signer assignment for creating a document from a template.
|
|
1171
|
-
*
|
|
1172
|
-
* The SDK temporarily rejects `DigitalCertificate` because the server derives
|
|
1173
|
-
* the method from template fields and can create an unusable `collect`
|
|
1174
|
-
* assignment. Use a direct `virtual` assignment for certificate signers.
|
|
1175
|
-
*/
|
|
1186
|
+
/** Signer assignment for creating a document from a template. */
|
|
1176
1187
|
interface ITemplateSigner {
|
|
1177
1188
|
role_id: string;
|
|
1178
|
-
|
|
1189
|
+
/** Existing signer ID. Takes precedence over the email fields when present. */
|
|
1190
|
+
id?: string;
|
|
1191
|
+
/** Reuses the matching signer or creates one when `id` is omitted. */
|
|
1192
|
+
email?: string;
|
|
1193
|
+
/** Full name used when the email does not match an existing signer. */
|
|
1194
|
+
name?: string;
|
|
1195
|
+
/** E.164 number used when the email does not match an existing signer. */
|
|
1196
|
+
whatsapp_phone_number?: string;
|
|
1179
1197
|
verification_method?: AssignmentVerificationMethod;
|
|
1180
1198
|
notification_methods?: AssignmentNotificationMethod[];
|
|
1181
1199
|
/** Positive integer controlling signing order (see {@link SignerReference}). */
|
|
@@ -1183,9 +1201,7 @@ interface ITemplateSigner {
|
|
|
1183
1201
|
}
|
|
1184
1202
|
/**
|
|
1185
1203
|
* Role/channel descriptor used only for template cost estimation. The official
|
|
1186
|
-
* schema intentionally omits signer
|
|
1187
|
-
* temporarily rejects `DigitalCertificate`; use direct virtual-assignment cost
|
|
1188
|
-
* estimation instead.
|
|
1204
|
+
* schema intentionally omits signer identity and sequential-signing fields.
|
|
1189
1205
|
*/
|
|
1190
1206
|
interface ITemplateCostSigner {
|
|
1191
1207
|
role_id: string;
|
|
@@ -1703,7 +1719,7 @@ declare abstract class BaseResource {
|
|
|
1703
1719
|
missingId: string;
|
|
1704
1720
|
}): Promise<T>;
|
|
1705
1721
|
/** Execute a paginated list call and attach meta from `X-Pagination-*` headers. */
|
|
1706
|
-
protected callList<T>(label: string, request: RequestFn): Promise<PaginatedResult<T>>;
|
|
1722
|
+
protected callList<T>(label: string, request: RequestFn, allowEmptyBody?: boolean): Promise<PaginatedResult<T>>;
|
|
1707
1723
|
}
|
|
1708
1724
|
type RequestFn = () => Promise<AxiosResponse>;
|
|
1709
1725
|
|
|
@@ -1845,7 +1861,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1845
1861
|
* a compact representation with no expanded `assignment` or `pages`, so
|
|
1846
1862
|
* prefer it for name lookups and pickers.
|
|
1847
1863
|
*
|
|
1848
|
-
* @param params - `search`, `status`, `page`, `per-page`.
|
|
1864
|
+
* @param params - `search`, `status`, `page`, `per-page`, and `sort`.
|
|
1849
1865
|
* @param accountId - Override the client's default account ID.
|
|
1850
1866
|
* @returns Matching documents, with pagination in `meta`. Each item:
|
|
1851
1867
|
* ```jsonc
|
|
@@ -2102,14 +2118,22 @@ declare class DocumentResource extends BaseResource {
|
|
|
2102
2118
|
*/
|
|
2103
2119
|
downloadPage(documentId: string, pageId: string): Promise<Buffer>;
|
|
2104
2120
|
/**
|
|
2105
|
-
* Fetch the document activity log
|
|
2121
|
+
* Fetch a page of the document activity log
|
|
2106
2122
|
* (`GET /documents/{documentId}/activities`).
|
|
2107
2123
|
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2124
|
+
* Production returns 20 entries per page by default, newest first. Request
|
|
2125
|
+
* later pages explicitly; a page past the end returns `[]`. Sandbox still
|
|
2126
|
+
* returns the full, unpaged log and may ignore these parameters. This method
|
|
2127
|
+
* preserves its array return type; use {@link DocumentResource.listActivities}
|
|
2128
|
+
* for pagination metadata. Normalises an absent body to `[]`.
|
|
2110
2129
|
*
|
|
2111
2130
|
* @param documentId - The document whose activity log to fetch.
|
|
2112
|
-
* @
|
|
2131
|
+
* @param params - Optional pagination and sorting parameters.
|
|
2132
|
+
* @param params.page - Page number, starting at 1.
|
|
2133
|
+
* @param params.per-page - Entries per page (production default 20, documented max 100).
|
|
2134
|
+
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2135
|
+
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2136
|
+
* @returns The requested page of activity entries, or `[]`:
|
|
2113
2137
|
* ```jsonc
|
|
2114
2138
|
* [
|
|
2115
2139
|
* {
|
|
@@ -2130,16 +2154,56 @@ declare class DocumentResource extends BaseResource {
|
|
|
2130
2154
|
* }
|
|
2131
2155
|
* ]
|
|
2132
2156
|
* ```
|
|
2133
|
-
* @throws {ValidationError} If `documentId` is missing.
|
|
2134
|
-
* @throws {ApiError} If the API rejects the request.
|
|
2157
|
+
* @throws {ValidationError} If `documentId` is missing or invalid, or `params` is not an object.
|
|
2158
|
+
* @throws {ApiError} If the API rejects the request (`401` for invalid credentials, `500` for a server error).
|
|
2135
2159
|
*
|
|
2136
2160
|
* @example
|
|
2137
2161
|
* ```ts
|
|
2138
|
-
* const events = await client.documents.activities('doc-1'
|
|
2162
|
+
* const events = await client.documents.activities('doc-1', {
|
|
2163
|
+
* page: 2, 'per-page': 100, sort: 'id',
|
|
2164
|
+
* });
|
|
2139
2165
|
* console.log(events.map((e) => e.event));
|
|
2140
2166
|
* ```
|
|
2141
2167
|
*/
|
|
2142
|
-
activities(documentId: string): Promise<IDocumentActivity[]>;
|
|
2168
|
+
activities(documentId: string, params?: IListParams): Promise<IDocumentActivity[]>;
|
|
2169
|
+
/**
|
|
2170
|
+
* Fetch document activities with pagination metadata
|
|
2171
|
+
* (`GET /documents/{documentId}/activities`).
|
|
2172
|
+
*
|
|
2173
|
+
* Production defaults to 20 entries, newest first. `meta` comes from the
|
|
2174
|
+
* `X-Pagination-*` headers; use `last_page` to request the remaining pages.
|
|
2175
|
+
* Sandbox returns the full unpaged log without `meta`: process it once.
|
|
2176
|
+
* Normalises an absent body to an empty list. Makes exactly one request.
|
|
2177
|
+
*
|
|
2178
|
+
* @param documentId - The document whose activity log to fetch.
|
|
2179
|
+
* @param params - Optional pagination and sorting parameters.
|
|
2180
|
+
* @param params.page - Page number, starting at 1.
|
|
2181
|
+
* @param params.per-page - Entries per page (production default 20, documented max 100).
|
|
2182
|
+
* @param params.per_page - Alias for `per-page`; explicit `per-page` wins.
|
|
2183
|
+
* @param params.sort - `-id` (default, newest first) or `id` (oldest first).
|
|
2184
|
+
* @returns Activity entries and pagination metadata when the server supplies it:
|
|
2185
|
+
* ```jsonc
|
|
2186
|
+
* {
|
|
2187
|
+
* "data": [{
|
|
2188
|
+
* "id": 15271,
|
|
2189
|
+
* "event": "document_uploaded",
|
|
2190
|
+
* "message": "Documento criado.",
|
|
2191
|
+
* "payload": [],
|
|
2192
|
+
* "origin": null,
|
|
2193
|
+
* "created_at": "2026-07-19T14:56:55Z"
|
|
2194
|
+
* }],
|
|
2195
|
+
* "meta": { "current_page": 2, "per_page": 20, "total": 21, "last_page": 2 }
|
|
2196
|
+
* }
|
|
2197
|
+
* ```
|
|
2198
|
+
* @throws {ValidationError} If `documentId` is missing or invalid, or `params` is not an object.
|
|
2199
|
+
* @throws {ApiError} If the API rejects the request (`401` for invalid credentials, `500` for a server error).
|
|
2200
|
+
* @example
|
|
2201
|
+
* ```ts
|
|
2202
|
+
* const { data, meta } = await client.documents.listActivities('doc-1', { page: 2 });
|
|
2203
|
+
* console.log(data, meta?.total);
|
|
2204
|
+
* ```
|
|
2205
|
+
*/
|
|
2206
|
+
listActivities(documentId: string, params?: IListParams): Promise<PaginatedResult<IDocumentActivity>>;
|
|
2143
2207
|
/**
|
|
2144
2208
|
* Delete a document (`DELETE /documents/{documentId}`).
|
|
2145
2209
|
*
|
|
@@ -2298,9 +2362,11 @@ declare class DocumentResource extends BaseResource {
|
|
|
2298
2362
|
*
|
|
2299
2363
|
* Instantiates the template, binding each role to a signer, and returns the
|
|
2300
2364
|
* new document. The request body is `{ signers, ...options }` — `signers`
|
|
2301
|
-
* maps every template `role_id` to an existing
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2365
|
+
* maps every template `role_id` to an existing signer `id` or an `email`.
|
|
2366
|
+
* An email reuses the matching account signer or creates one with `name`;
|
|
2367
|
+
* `id` wins when both are present. Options may add `name`, `message`,
|
|
2368
|
+
* `expires_at`, `editor_fields`, and tag names in `tags` (unknown names are
|
|
2369
|
+
* created automatically).
|
|
2304
2370
|
*
|
|
2305
2371
|
* Request body (`application/json`):
|
|
2306
2372
|
* ```jsonc
|
|
@@ -2308,7 +2374,9 @@ declare class DocumentResource extends BaseResource {
|
|
|
2308
2374
|
* "signers": [
|
|
2309
2375
|
* {
|
|
2310
2376
|
* "role_id": "signing_role_example",
|
|
2311
|
-
* "
|
|
2377
|
+
* "email": "signer@example.com",
|
|
2378
|
+
* "name": "Example Signer",
|
|
2379
|
+
* "whatsapp_phone_number": "+15555550100",
|
|
2312
2380
|
* "verification_method": "Email",
|
|
2313
2381
|
* "notification_methods": [
|
|
2314
2382
|
* "Email"
|
|
@@ -2332,27 +2400,33 @@ declare class DocumentResource extends BaseResource {
|
|
|
2332
2400
|
* ```
|
|
2333
2401
|
*
|
|
2334
2402
|
* @param templateId - The template to instantiate.
|
|
2335
|
-
* @param signers - Role-to-signer bindings (each with `role_id` and
|
|
2336
|
-
*
|
|
2403
|
+
* @param signers - Role-to-signer bindings (each with `role_id` and either
|
|
2404
|
+
* an existing `id` or an `email`; email creation also accepts `name` and
|
|
2405
|
+
* `whatsapp_phone_number`). `verification_method`, `notification_methods`,
|
|
2406
|
+
* and `step` are optional.
|
|
2337
2407
|
* Only one notification method is allowed per signer; when only one of the
|
|
2338
2408
|
* verification/notification fields is supplied, the API infers the other.
|
|
2339
2409
|
* `DigitalCertificate` costs 0.5 credits, requires the feature plus a
|
|
2340
2410
|
* signer `government_id`, and that signer must be alone in its step. The
|
|
2341
|
-
* server derives the assignment method from placed template fields
|
|
2342
|
-
*
|
|
2343
|
-
*
|
|
2411
|
+
* server derives the assignment method from placed template fields and
|
|
2412
|
+
* rejects certificate signers when those fields produce a `collect`
|
|
2413
|
+
* assignment. Use a template without placed signer fields for certificate
|
|
2414
|
+
* signing.
|
|
2344
2415
|
* `IdDocumentFaceMatchBasic` needs the ID Document + Face Match feature
|
|
2345
2416
|
* and a valid CPF in `government_id`; estimate the per-signer fee first.
|
|
2346
2417
|
* @param options - Optional `name`, `message`, `expires_at`,
|
|
2347
2418
|
* `editor_fields`, `tags`.
|
|
2348
2419
|
* @param options.name - Generated document display name.
|
|
2349
2420
|
* @param options.message - Signing invitation message.
|
|
2350
|
-
* @param options.expires_at - ISO-8601
|
|
2421
|
+
* @param options.expires_at - ISO-8601 deadline: date-only (ends at 23:59
|
|
2422
|
+
* UTC), date-time without an offset (treated as UTC), or an offset-aware
|
|
2423
|
+
* date-time.
|
|
2351
2424
|
* @param options.editor_fields - Template editor values as `{ field_id, value }` entries.
|
|
2352
2425
|
* @param options.tags - Tag names attached to the generated document.
|
|
2353
2426
|
* @param accountId - Override the client's default account ID.
|
|
2354
|
-
* @returns The
|
|
2355
|
-
* `
|
|
2427
|
+
* @returns The uploaded document. Assignment creation continues in the
|
|
2428
|
+
* background; follow `GET /documents/{documentId}` or webhooks until the
|
|
2429
|
+
* document becomes `pending_signature` or `failed`:
|
|
2356
2430
|
* ```jsonc
|
|
2357
2431
|
* {
|
|
2358
2432
|
* "resource": "document",
|
|
@@ -2360,22 +2434,21 @@ declare class DocumentResource extends BaseResource {
|
|
|
2360
2434
|
* "account_id": "acc_example",
|
|
2361
2435
|
* "template_id": "103a0991a5cde83518e5672aa9aa",
|
|
2362
2436
|
* "name": "Service agreement from template",
|
|
2363
|
-
* "status": "
|
|
2364
|
-
* "artifacts": { "original": "https://…/download/original"
|
|
2437
|
+
* "status": "uploaded",
|
|
2438
|
+
* "artifacts": { "original": "https://…/download/original" },
|
|
2365
2439
|
* "is_closed": false,
|
|
2366
2440
|
* "signing_url": "https://app.assinafy.com.br/sign/19f675b7…",
|
|
2367
2441
|
* "tags": [{ "id": "103a0992…", "name": "agreements", "color": null }],
|
|
2368
|
-
* "assignment":
|
|
2369
|
-
* "pages": [
|
|
2442
|
+
* "assignment": null,
|
|
2443
|
+
* "pages": [],
|
|
2370
2444
|
* "created_at": "2026-07-15T19:57:55Z",
|
|
2371
2445
|
* "updated_at": "2026-07-15T19:59:33Z"
|
|
2372
2446
|
* }
|
|
2373
2447
|
* ```
|
|
2374
|
-
* @throws {ValidationError} If `templateId
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2378
|
-
* is not ready.
|
|
2448
|
+
* @throws {ValidationError} If `templateId`, an account ID, signer identity,
|
|
2449
|
+
* channel, order, deadline, editor field, or tag is invalid.
|
|
2450
|
+
* @throws {ApiError} `400` if the signers/roles are invalid, the template
|
|
2451
|
+
* is not ready, or placed signer fields conflict with `DigitalCertificate`.
|
|
2379
2452
|
*
|
|
2380
2453
|
* @example
|
|
2381
2454
|
* ```ts
|
|
@@ -2391,10 +2464,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2391
2464
|
*
|
|
2392
2465
|
* A dry run: sends only `{ signers }` and consumes nothing. Use it to check
|
|
2393
2466
|
* balances before calling {@link DocumentResource.createFromTemplate}.
|
|
2394
|
-
* `DigitalCertificate`
|
|
2395
|
-
*
|
|
2396
|
-
* refuses certificate signers instead of returning a price for an
|
|
2397
|
-
* assignment that may charge credits but cannot be completed.
|
|
2467
|
+
* `DigitalCertificate` adds 0.5 credits per signer plus notification cost;
|
|
2468
|
+
* the API returns `400` when the template has placed signer fields.
|
|
2398
2469
|
*
|
|
2399
2470
|
* Request body (`application/json`):
|
|
2400
2471
|
* ```jsonc
|
|
@@ -2436,10 +2507,10 @@ declare class DocumentResource extends BaseResource {
|
|
|
2436
2507
|
* "message": null
|
|
2437
2508
|
* }
|
|
2438
2509
|
* ```
|
|
2439
|
-
* @throws {ValidationError} If `templateId
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2442
|
-
*
|
|
2510
|
+
* @throws {ValidationError} If `templateId`, an account ID, role, or
|
|
2511
|
+
* channel is invalid.
|
|
2512
|
+
* @throws {ApiError} `400` if the role is invalid or placed signer fields
|
|
2513
|
+
* conflict with `DigitalCertificate`; `403` when a feature is unavailable.
|
|
2443
2514
|
*
|
|
2444
2515
|
* @example
|
|
2445
2516
|
* ```ts
|
|
@@ -3251,7 +3322,7 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3251
3322
|
* without it. Note the camelCase spelling: `account_id` and an
|
|
3252
3323
|
* `X-Account-Id` header are both rejected.
|
|
3253
3324
|
*
|
|
3254
|
-
* @param params - `page`, `per-page`.
|
|
3325
|
+
* @param params - `page`, `per-page`, and `sort`.
|
|
3255
3326
|
* @param accountId - Override the client's default account ID.
|
|
3256
3327
|
* @returns Assignments, with pagination in `meta`. Each item is a full
|
|
3257
3328
|
* {@link IAssignment} (same shape as {@link AssignmentResource.create}
|
|
@@ -3376,6 +3447,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3376
3447
|
* @param payload - Signers plus optional `method` (defaults to `virtual`),
|
|
3377
3448
|
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
3378
3449
|
* addresses), and `collect`-mode `entries` with page-image geometry.
|
|
3450
|
+
* `expires_at` accepts a date (ending at 23:59 UTC), a date-time without
|
|
3451
|
+
* an offset (UTC), or an offset-aware date-time.
|
|
3379
3452
|
* @returns The created {@link IAssignment}: `signers` (rich, with `step` /
|
|
3380
3453
|
* `notified` / `verification_method`), `items` (one row per signer × field),
|
|
3381
3454
|
* a `summary` count block, and per-signer `signing_urls`. Response shape:
|
|
@@ -3539,9 +3612,10 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3539
3612
|
* (`PUT /documents/{documentId}/assignments/{assignmentId}/reset-expiration`).
|
|
3540
3613
|
*
|
|
3541
3614
|
* Sends `{ expires_at }` verbatim; the key itself is required by the
|
|
3542
|
-
* contract. Use an ISO-8601 date
|
|
3543
|
-
*
|
|
3544
|
-
*
|
|
3615
|
+
* contract. Use an ISO-8601 date, a date-time with or without an offset,
|
|
3616
|
+
* or `null` to remove the expiration. Date-only values end at 23:59 UTC;
|
|
3617
|
+
* date-times without offsets are UTC. `null` is intentionally not stripped
|
|
3618
|
+
* from the body.
|
|
3545
3619
|
*
|
|
3546
3620
|
* Request body (`application/json`):
|
|
3547
3621
|
* ```jsonc
|
|
@@ -3552,8 +3626,8 @@ declare class AssignmentResource extends BaseResource {
|
|
|
3552
3626
|
*
|
|
3553
3627
|
* @param documentId - The document the assignment belongs to.
|
|
3554
3628
|
* @param assignmentId - The assignment to update.
|
|
3555
|
-
* @param expiresAt - New expiry as an ISO-8601 date
|
|
3556
|
-
* to remove the expiration.
|
|
3629
|
+
* @param expiresAt - New expiry as an ISO-8601 date or date-time string,
|
|
3630
|
+
* or `null` to remove the expiration.
|
|
3557
3631
|
* @returns The updated {@link IAssignment} — the same full shape
|
|
3558
3632
|
* {@link AssignmentResource.create} returns (`signers`, `items`, `summary`,
|
|
3559
3633
|
* `signing_urls`), with `expires_at` reflecting the new value:
|
|
@@ -3861,6 +3935,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
3861
3935
|
* "document_processing_failed"
|
|
3862
3936
|
* ],
|
|
3863
3937
|
* "is_active": true,
|
|
3938
|
+
* "is_held": false,
|
|
3939
|
+
* "held_since": null,
|
|
3864
3940
|
* "updated_at": "2026-07-18T02:36:02Z" // no `id` / `created_at` are returned
|
|
3865
3941
|
* }
|
|
3866
3942
|
* ```
|
|
@@ -3993,11 +4069,12 @@ declare class WebhookResource extends BaseResource {
|
|
|
3993
4069
|
* (`GET /accounts/{accountId}/webhooks`). Pagination info (if any) is
|
|
3994
4070
|
* attached in `meta`.
|
|
3995
4071
|
*
|
|
3996
|
-
* Assinafy treats any `2xx` response as success.
|
|
3997
|
-
*
|
|
3998
|
-
*
|
|
3999
|
-
*
|
|
4000
|
-
*
|
|
4072
|
+
* Assinafy treats any `2xx` response as success. Retriable failures get up
|
|
4073
|
+
* to six attempts about ten minutes apart. After ten failed deliveries in
|
|
4074
|
+
* a row, the endpoint is paused and probed after 3, 15 and 60 minutes, then
|
|
4075
|
+
* every six hours. A successful delivery or probe resumes the endpoint and
|
|
4076
|
+
* replays missed events oldest first. Response bodies are truncated to
|
|
4077
|
+
* 2,000 characters and delivery entries are retained for seven days.
|
|
4001
4078
|
*
|
|
4002
4079
|
* @param params - Optional filters and pagination:
|
|
4003
4080
|
* - `endpoint_id` — only deliveries to this webhook endpoint.
|
|
@@ -4024,6 +4101,10 @@ declare class WebhookResource extends BaseResource {
|
|
|
4024
4101
|
* // subject: <User>, account_id, created_at }
|
|
4025
4102
|
* },
|
|
4026
4103
|
* "delivered": true,
|
|
4104
|
+
* "webhook_id": "9f86d081884c7d659a2feaa0c55ad015",
|
|
4105
|
+
* "attempt": 1,
|
|
4106
|
+
* "kind": "scheduled",
|
|
4107
|
+
* "will_retry": false,
|
|
4027
4108
|
* "http_status": 200,
|
|
4028
4109
|
* "response_body": "{ ... }", // receiving endpoint body, max 2,000 chars
|
|
4029
4110
|
* "error": null,
|
|
@@ -4099,11 +4180,14 @@ declare class WebhookResource extends BaseResource {
|
|
|
4099
4180
|
* [
|
|
4100
4181
|
* {
|
|
4101
4182
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4183
|
+
* "resource": "activity_event_subscription",
|
|
4102
4184
|
* "name": "ERP",
|
|
4103
4185
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4104
4186
|
* "email": "ops@example.com",
|
|
4105
4187
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4106
4188
|
* "is_active": true,
|
|
4189
|
+
* "is_held": false,
|
|
4190
|
+
* "held_since": null,
|
|
4107
4191
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4108
4192
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4109
4193
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
@@ -4129,8 +4213,8 @@ declare class WebhookResource extends BaseResource {
|
|
|
4129
4213
|
* An account can have 1 endpoint, or up to 3 on paid plans. Each endpoint
|
|
4130
4214
|
* of a workspace needs a different `url`. With `signing_enabled: true` the
|
|
4131
4215
|
* API returns a signing `secret` in this creation response. Store it now:
|
|
4132
|
-
* OAuth applications cannot call {@link WebhookResource.getEndpointSecret}
|
|
4133
|
-
*
|
|
4216
|
+
* OAuth applications cannot call {@link WebhookResource.getEndpointSecret},
|
|
4217
|
+
* but they can rotate a lost secret. When `events` is omitted or
|
|
4134
4218
|
* empty, {@link DEFAULT_WEBHOOK_EVENTS} is sent. OAuth tokens need the
|
|
4135
4219
|
* `webhooks:write` scope.
|
|
4136
4220
|
*
|
|
@@ -4146,19 +4230,22 @@ declare class WebhookResource extends BaseResource {
|
|
|
4146
4230
|
* }
|
|
4147
4231
|
* ```
|
|
4148
4232
|
*
|
|
4149
|
-
* @param payload - Endpoint details. `url` (absolute
|
|
4233
|
+
* @param payload - Endpoint details. `url` (absolute HTTPS) and `email`
|
|
4150
4234
|
* are required; `events`, `name`, `is_active` and `signing_enabled` are
|
|
4151
4235
|
* optional.
|
|
4152
4236
|
* @param accountId - Override the client's default account ID.
|
|
4153
4237
|
* @returns The created endpoint:
|
|
4154
4238
|
* ```jsonc
|
|
4155
4239
|
* {
|
|
4240
|
+
* "resource": "activity_event_subscription",
|
|
4156
4241
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4157
4242
|
* "name": "ERP",
|
|
4158
4243
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4159
4244
|
* "email": "ops@example.com",
|
|
4160
4245
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4161
4246
|
* "is_active": true,
|
|
4247
|
+
* "is_held": false,
|
|
4248
|
+
* "held_since": null,
|
|
4162
4249
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4163
4250
|
* "secret": "whsec_c2VjcmV0", // only in this response when signing is enabled
|
|
4164
4251
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
@@ -4194,12 +4281,15 @@ declare class WebhookResource extends BaseResource {
|
|
|
4194
4281
|
* @returns The endpoint:
|
|
4195
4282
|
* ```jsonc
|
|
4196
4283
|
* {
|
|
4284
|
+
* "resource": "activity_event_subscription",
|
|
4197
4285
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4198
4286
|
* "name": "ERP",
|
|
4199
4287
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4200
4288
|
* "email": "ops@example.com",
|
|
4201
4289
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4202
4290
|
* "is_active": true,
|
|
4291
|
+
* "is_held": false,
|
|
4292
|
+
* "held_since": null,
|
|
4203
4293
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4204
4294
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4205
4295
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
@@ -4218,12 +4308,13 @@ declare class WebhookResource extends BaseResource {
|
|
|
4218
4308
|
/**
|
|
4219
4309
|
* Change a webhook endpoint
|
|
4220
4310
|
* (`PUT /accounts/{accountId}/webhooks/endpoints/{endpointId}`). Only the
|
|
4221
|
-
* fields sent are updated; `url`
|
|
4222
|
-
*
|
|
4311
|
+
* fields sent are updated; a changed `url` must be HTTPS, publicly
|
|
4312
|
+
* routable, and different from every other endpoint in the workspace.
|
|
4223
4313
|
*
|
|
4224
4314
|
* `signing_enabled: true` generates a secret if the endpoint has none and
|
|
4225
|
-
* keeps the current one otherwise; `false` discards the secret.
|
|
4226
|
-
*
|
|
4315
|
+
* keeps the current one otherwise; `false` discards the secret. When this
|
|
4316
|
+
* request turns signing on, the response includes the new `secret` once.
|
|
4317
|
+
* OAuth tokens need the `webhooks:write` scope.
|
|
4227
4318
|
*
|
|
4228
4319
|
* Request body (`application/json`, every field optional):
|
|
4229
4320
|
* ```jsonc
|
|
@@ -4243,13 +4334,17 @@ declare class WebhookResource extends BaseResource {
|
|
|
4243
4334
|
* @returns The updated endpoint:
|
|
4244
4335
|
* ```jsonc
|
|
4245
4336
|
* {
|
|
4337
|
+
* "resource": "activity_event_subscription",
|
|
4246
4338
|
* "id": "65f1c2a9b3e4d5f60718293a4b5c6d7e",
|
|
4247
4339
|
* "name": "ERP",
|
|
4248
4340
|
* "url": "https://example.com/webhooks/assinafy",
|
|
4249
4341
|
* "email": "ops@example.com",
|
|
4250
4342
|
* "events": ["document_ready", "signer_signed_document"],
|
|
4251
4343
|
* "is_active": true,
|
|
4344
|
+
* "is_held": false,
|
|
4345
|
+
* "held_since": null,
|
|
4252
4346
|
* "signing_enabled": true, // deliveries carry a `webhook-signature` header
|
|
4347
|
+
* "secret": "whsec_c2VjcmV0", // only when this request turned signing on
|
|
4253
4348
|
* "created_at": "2026-10-01T12:00:00Z",
|
|
4254
4349
|
* "updated_at": "2026-10-01T12:00:00Z"
|
|
4255
4350
|
* }
|
|
@@ -4265,7 +4360,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
4265
4360
|
* await client.webhooks.updateEndpoint(endpoint.id, { is_active: false });
|
|
4266
4361
|
* ```
|
|
4267
4362
|
*/
|
|
4268
|
-
updateEndpoint(endpointId: string, payload: IWebhookEndpointUpdatePayload, accountId?: string): Promise<
|
|
4363
|
+
updateEndpoint(endpointId: string, payload: IWebhookEndpointUpdatePayload, accountId?: string): Promise<IWebhookEndpointCreateResponse>;
|
|
4269
4364
|
/**
|
|
4270
4365
|
* Stop delivering events to an endpoint and free its plan slot
|
|
4271
4366
|
* (`DELETE /accounts/{accountId}/webhooks/endpoints/{endpointId}`). Its
|
|
@@ -4334,7 +4429,7 @@ declare class WebhookResource extends BaseResource {
|
|
|
4334
4429
|
* (`POST /accounts/{accountId}/webhooks/endpoints/{endpointId}/secret/rotate`).
|
|
4335
4430
|
* The old secret stops working immediately: deliveries sent after the
|
|
4336
4431
|
* rotation are signed only with the new secret, so update the receiver at
|
|
4337
|
-
* once.
|
|
4432
|
+
* once. OAuth tokens need the `webhooks:write` scope.
|
|
4338
4433
|
*
|
|
4339
4434
|
* @param endpointId - The endpoint ID.
|
|
4340
4435
|
* @param accountId - Override the client's default account ID.
|
|
@@ -7847,8 +7942,9 @@ declare class AssinafyClient {
|
|
|
7847
7942
|
* the API; only `collect` assignments require pre-rendered pages.
|
|
7848
7943
|
* @param options.waitOptions - Optional `maxWaitMs` / `pollIntervalMs`
|
|
7849
7944
|
* forwarded to {@link DocumentResource.waitUntilReady}.
|
|
7850
|
-
* @param options.expiresAt - Optional ISO-8601 assignment expiry
|
|
7851
|
-
*
|
|
7945
|
+
* @param options.expiresAt - Optional ISO-8601 assignment expiry. A date
|
|
7946
|
+
* ends at 23:59 UTC; a date-time without an offset is interpreted as UTC;
|
|
7947
|
+
* an explicit offset is honored.
|
|
7852
7948
|
* @param options.copyReceivers - Optional existing signer IDs (not email
|
|
7853
7949
|
* addresses) that receive a copy. See the caveat on
|
|
7854
7950
|
* {@link ICreateAssignmentPayload.copy_receivers}; some plans silently drop
|
|
@@ -8208,11 +8304,12 @@ declare class NetworkError extends AssinafyError {
|
|
|
8208
8304
|
}
|
|
8209
8305
|
|
|
8210
8306
|
/**
|
|
8211
|
-
*
|
|
8307
|
+
* Observed page-size cap for document and signer lists on older deployments.
|
|
8212
8308
|
*
|
|
8213
8309
|
* The API silently clamps `per-page` to this value rather than rejecting a
|
|
8214
8310
|
* larger one, so a caller asking for 100 receives 50 and no error. Methods that
|
|
8215
8311
|
* need "as many rows as one request can give" pin this instead of guessing.
|
|
8312
|
+
* Production document activities have a documented maximum of 100 instead.
|
|
8216
8313
|
*/
|
|
8217
8314
|
declare const MAX_LIST_PAGE_SIZE = 50;
|
|
8218
8315
|
|