@assinafy/sdk 2.5.0 → 2.5.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 +57 -49
- package/README.en.md +77 -25
- package/README.md +29 -29
- package/dist/index.d.mts +580 -40
- package/dist/index.d.ts +580 -40
- package/dist/index.js +527 -55
- package/dist/index.mjs +523 -51
- package/docs/API_COVERAGE.md +12 -1
- package/docs/COMPATIBILITY.md +16 -22
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,7 @@ interface IAssignment {
|
|
|
361
361
|
sender_email?: string;
|
|
362
362
|
method: AssignmentMethod;
|
|
363
363
|
expires_at?: string | null;
|
|
364
|
+
/** Compatibility extension; absent from the OpenAPI Assignment schema. */
|
|
364
365
|
expiration?: string;
|
|
365
366
|
message?: string | null;
|
|
366
367
|
signers: IAssignmentSigner[];
|
|
@@ -1099,6 +1100,7 @@ interface IWhatsAppNotification {
|
|
|
1099
1100
|
sent_at: number;
|
|
1100
1101
|
header: string;
|
|
1101
1102
|
body: string;
|
|
1103
|
+
/** Compatibility extension: the spec documents only `text`; `url` is retained for deployments that send link buttons. */
|
|
1102
1104
|
buttons: Array<{
|
|
1103
1105
|
text: string;
|
|
1104
1106
|
url?: string;
|
|
@@ -1527,6 +1529,13 @@ declare class DocumentResource extends BaseResource {
|
|
|
1527
1529
|
* {@link DocumentResource.upload} — that avoids the extra round-trip and
|
|
1528
1530
|
* the processing race entirely.
|
|
1529
1531
|
*
|
|
1532
|
+
* Request body (`application/json`):
|
|
1533
|
+
* ```jsonc
|
|
1534
|
+
* {
|
|
1535
|
+
* "name": "Service agreement.pdf"
|
|
1536
|
+
* }
|
|
1537
|
+
* ```
|
|
1538
|
+
*
|
|
1530
1539
|
* @param documentId - The document to rename.
|
|
1531
1540
|
* @param name - The new display name (max 255 chars), e.g.
|
|
1532
1541
|
* `'Service agreement.pdf'`. The API removes diacritics and replaces
|
|
@@ -1604,8 +1613,7 @@ declare class DocumentResource extends BaseResource {
|
|
|
1604
1613
|
* "updated_at": "2026-07-19T17:24:46Z"
|
|
1605
1614
|
* }
|
|
1606
1615
|
* ```
|
|
1607
|
-
* @throws {ValidationError} If `documentId` is missing
|
|
1608
|
-
* not one of the five documented artifact names.
|
|
1616
|
+
* @throws {ValidationError} If `documentId` is missing.
|
|
1609
1617
|
* @throws {ApiError} `404` if the document does not exist.
|
|
1610
1618
|
*
|
|
1611
1619
|
* @example
|
|
@@ -1825,6 +1833,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
1825
1833
|
* overwrites the existing set — use
|
|
1826
1834
|
* {@link DocumentResource.addTags} to append.
|
|
1827
1835
|
*
|
|
1836
|
+
* Request body (`application/json`):
|
|
1837
|
+
* ```jsonc
|
|
1838
|
+
* {
|
|
1839
|
+
* "tags": [
|
|
1840
|
+
* "tag_example"
|
|
1841
|
+
* ]
|
|
1842
|
+
* }
|
|
1843
|
+
* ```
|
|
1844
|
+
*
|
|
1828
1845
|
* @param documentId - The document to retag.
|
|
1829
1846
|
* @param tags - The complete desired set of tag IDs (`[]` clears all).
|
|
1830
1847
|
* @param accountId - Override the client's default account ID.
|
|
@@ -1854,6 +1871,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
1854
1871
|
* present is a no-op. To replace the whole set instead, use
|
|
1855
1872
|
* {@link DocumentResource.replaceTags}.
|
|
1856
1873
|
*
|
|
1874
|
+
* Request body (`application/json`):
|
|
1875
|
+
* ```jsonc
|
|
1876
|
+
* {
|
|
1877
|
+
* "tags": [
|
|
1878
|
+
* "tag_example"
|
|
1879
|
+
* ]
|
|
1880
|
+
* }
|
|
1881
|
+
* ```
|
|
1882
|
+
*
|
|
1857
1883
|
* @param documentId - The document to tag.
|
|
1858
1884
|
* @param tags - Tag IDs to attach (must be non-empty).
|
|
1859
1885
|
* @param accountId - Override the client's default account ID.
|
|
@@ -1906,6 +1932,35 @@ declare class DocumentResource extends BaseResource {
|
|
|
1906
1932
|
* `options` may add `name`, `message`, `expires_at`, `editor_fields`, and
|
|
1907
1933
|
* tag names in `tags` (unknown names are created automatically).
|
|
1908
1934
|
*
|
|
1935
|
+
* Request body (`application/json`):
|
|
1936
|
+
* ```jsonc
|
|
1937
|
+
* {
|
|
1938
|
+
* "signers": [
|
|
1939
|
+
* {
|
|
1940
|
+
* "role_id": "signing_role_example",
|
|
1941
|
+
* "id": "signer_example",
|
|
1942
|
+
* "verification_method": "Email",
|
|
1943
|
+
* "notification_methods": [
|
|
1944
|
+
* "Email"
|
|
1945
|
+
* ],
|
|
1946
|
+
* "step": 1
|
|
1947
|
+
* }
|
|
1948
|
+
* ],
|
|
1949
|
+
* "name": "Service agreement.pdf",
|
|
1950
|
+
* "message": "Please sign this document.",
|
|
1951
|
+
* "expires_at": "2027-12-31T23:59:59Z",
|
|
1952
|
+
* "editor_fields": [
|
|
1953
|
+
* {
|
|
1954
|
+
* "field_id": "editor_field_example",
|
|
1955
|
+
* "value": "Example Company"
|
|
1956
|
+
* }
|
|
1957
|
+
* ],
|
|
1958
|
+
* "tags": [
|
|
1959
|
+
* "Contracts"
|
|
1960
|
+
* ]
|
|
1961
|
+
* }
|
|
1962
|
+
* ```
|
|
1963
|
+
*
|
|
1909
1964
|
* @param templateId - The template to instantiate.
|
|
1910
1965
|
* @param signers - Role-to-signer bindings (each with `role_id` and `id`,
|
|
1911
1966
|
* plus optional `verification_method`, `notification_methods`, `step`).
|
|
@@ -1958,6 +2013,21 @@ declare class DocumentResource extends BaseResource {
|
|
|
1958
2013
|
* `DigitalCertificate` adds two credits per signer and has the same feature,
|
|
1959
2014
|
* `government_id`, and signing-step prerequisites as document creation.
|
|
1960
2015
|
*
|
|
2016
|
+
* Request body (`application/json`):
|
|
2017
|
+
* ```jsonc
|
|
2018
|
+
* {
|
|
2019
|
+
* "signers": [
|
|
2020
|
+
* {
|
|
2021
|
+
* "role_id": "signing_role_example",
|
|
2022
|
+
* "verification_method": "Email",
|
|
2023
|
+
* "notification_methods": [
|
|
2024
|
+
* "Email"
|
|
2025
|
+
* ]
|
|
2026
|
+
* }
|
|
2027
|
+
* ]
|
|
2028
|
+
* }
|
|
2029
|
+
* ```
|
|
2030
|
+
*
|
|
1961
2031
|
* @param templateId - The template that would be instantiated.
|
|
1962
2032
|
* @param signers - One channel descriptor per template role. Cost requests
|
|
1963
2033
|
* use only `role_id`, `verification_method`, and `notification_methods`;
|
|
@@ -2114,6 +2184,15 @@ declare class DocumentResource extends BaseResource {
|
|
|
2114
2184
|
* that legacy shape only when the server explicitly reports that
|
|
2115
2185
|
* `channel`/`recipient` is required.
|
|
2116
2186
|
*
|
|
2187
|
+
* Request body (`application/json`):
|
|
2188
|
+
* ```jsonc
|
|
2189
|
+
* { "email": "signer@example.com" }
|
|
2190
|
+
* ```
|
|
2191
|
+
* Compatibility fallback or explicit-channel body:
|
|
2192
|
+
* ```jsonc
|
|
2193
|
+
* { "recipient": "signer@example.com", "channel": "email" }
|
|
2194
|
+
* ```
|
|
2195
|
+
*
|
|
2117
2196
|
* @param documentId - The document to send the token for.
|
|
2118
2197
|
* @param recipient - The signer's email address (or WhatsApp number when an
|
|
2119
2198
|
* explicit channel is supplied).
|
|
@@ -2131,9 +2210,25 @@ declare class DocumentResource extends BaseResource {
|
|
|
2131
2210
|
* ```
|
|
2132
2211
|
*/
|
|
2133
2212
|
sendToken(documentId: string, email: string): Promise<void>;
|
|
2213
|
+
/**
|
|
2214
|
+
* Send a signing token through an explicit channel
|
|
2215
|
+
* (`PUT /public/documents/{documentId}/send-token`).
|
|
2216
|
+
* Sends JSON `{ "recipient": "+5511999998888", "channel": "whatsapp" }`.
|
|
2217
|
+
* @param documentId - Document identifier.
|
|
2218
|
+
* @param recipient - Controlled email address or WhatsApp number.
|
|
2219
|
+
* @param channel - Delivery channel, `email` or `whatsapp`.
|
|
2220
|
+
* @returns Nothing; the acknowledgement body is discarded.
|
|
2221
|
+
* @throws {ValidationError} If an argument is empty.
|
|
2222
|
+
* @throws {ApiError} If delivery is rejected.
|
|
2223
|
+
* @example
|
|
2224
|
+
* ```ts
|
|
2225
|
+
* await client.documents.sendToken('doc-1', 'signer@example.com', 'email');
|
|
2226
|
+
* ```
|
|
2227
|
+
*/
|
|
2134
2228
|
sendToken(documentId: string, recipient: string, channel: SendTokenChannel): Promise<void>;
|
|
2135
2229
|
/**
|
|
2136
|
-
* Quick boolean check: has every signer
|
|
2230
|
+
* Quick boolean check (`GET /documents/{documentId}`): has every signer
|
|
2231
|
+
* completed their assignment?
|
|
2137
2232
|
*
|
|
2138
2233
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2139
2234
|
* /documents/{documentId}`). Returns `true` when the document status is
|
|
@@ -2155,7 +2250,8 @@ declare class DocumentResource extends BaseResource {
|
|
|
2155
2250
|
*/
|
|
2156
2251
|
isFullySigned(documentId: string): Promise<boolean>;
|
|
2157
2252
|
/**
|
|
2158
|
-
* Summarise signing progress for UI display
|
|
2253
|
+
* Summarise signing progress for UI display
|
|
2254
|
+
* (`GET /documents/{documentId}`).
|
|
2159
2255
|
*
|
|
2160
2256
|
* A computed convenience over {@link DocumentResource.details} (one `GET
|
|
2161
2257
|
* /documents/{documentId}`). `total` and `signed` come from the assignment
|
|
@@ -2194,6 +2290,19 @@ declare class SignerResource extends BaseResource {
|
|
|
2194
2290
|
* A reused signer is returned unchanged; this method does not overwrite its
|
|
2195
2291
|
* existing name, phone, CPF, or metadata with the create payload.
|
|
2196
2292
|
*
|
|
2293
|
+
* Request body (`application/json`):
|
|
2294
|
+
* ```jsonc
|
|
2295
|
+
* {
|
|
2296
|
+
* "full_name": "Example Signer",
|
|
2297
|
+
* "email": "signer@example.com",
|
|
2298
|
+
* "whatsapp_phone_number": "+5548999990000",
|
|
2299
|
+
* "cpf": "39053344705",
|
|
2300
|
+
* "metadata": {
|
|
2301
|
+
* "reference": "customer_example"
|
|
2302
|
+
* }
|
|
2303
|
+
* }
|
|
2304
|
+
* ```
|
|
2305
|
+
*
|
|
2197
2306
|
* @param payload - The signer to create. The official fields are required
|
|
2198
2307
|
* `full_name` plus optional `email` and E.164 `whatsapp_phone_number`.
|
|
2199
2308
|
* `phone`, `cpf`, and `metadata` are compatibility extensions; the SDK
|
|
@@ -2296,6 +2405,16 @@ declare class SignerResource extends BaseResource {
|
|
|
2296
2405
|
* while it belongs to an in-flight document; changing an unverified channel
|
|
2297
2406
|
* rotates its access/verification codes, so resend the notification.
|
|
2298
2407
|
*
|
|
2408
|
+
* Request body (`application/json`):
|
|
2409
|
+
* ```jsonc
|
|
2410
|
+
* {
|
|
2411
|
+
* "full_name": "Example Signer",
|
|
2412
|
+
* "email": "signer@example.com",
|
|
2413
|
+
* "whatsapp_phone_number": "+5548999990000",
|
|
2414
|
+
* "government_id": "39053344705"
|
|
2415
|
+
* }
|
|
2416
|
+
* ```
|
|
2417
|
+
*
|
|
2299
2418
|
* @param signerId - The signer to update.
|
|
2300
2419
|
* @param payload - Fields to change. The official `government_id` field and
|
|
2301
2420
|
* legacy `cpf` extension are stripped to digits before sending.
|
|
@@ -2411,6 +2530,16 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2411
2530
|
/**
|
|
2412
2531
|
* Create a new workspace (`POST /accounts`).
|
|
2413
2532
|
*
|
|
2533
|
+
* Request body (`application/json`):
|
|
2534
|
+
* ```jsonc
|
|
2535
|
+
* {
|
|
2536
|
+
* "name": "Example Workspace",
|
|
2537
|
+
* "notification_sender_type": "Account",
|
|
2538
|
+
* "primary_color": "336699",
|
|
2539
|
+
* "secondary_color": "ffffff"
|
|
2540
|
+
* }
|
|
2541
|
+
* ```
|
|
2542
|
+
*
|
|
2414
2543
|
* @param payload - Official fields are workspace `name` (required) and
|
|
2415
2544
|
* optional `notification_sender_type` (`User` or `Account`). Optional brand
|
|
2416
2545
|
* colours use six hex characters without
|
|
@@ -2627,6 +2756,16 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2627
2756
|
/**
|
|
2628
2757
|
* Update a workspace (`PUT /accounts/{accountId}`).
|
|
2629
2758
|
*
|
|
2759
|
+
* Request body (`application/json`):
|
|
2760
|
+
* ```jsonc
|
|
2761
|
+
* {
|
|
2762
|
+
* "name": "Example Workspace",
|
|
2763
|
+
* "notification_sender_type": "Account",
|
|
2764
|
+
* "primary_color": "336699",
|
|
2765
|
+
* "secondary_color": null
|
|
2766
|
+
* }
|
|
2767
|
+
* ```
|
|
2768
|
+
*
|
|
2630
2769
|
* @param accountId - The workspace to update.
|
|
2631
2770
|
* @param payload - Official fields are `name` and
|
|
2632
2771
|
* `notification_sender_type` (`User` or `Account`). Brand colours use six
|
|
@@ -2669,6 +2808,13 @@ declare class WorkspaceResource extends BaseResource {
|
|
|
2669
2808
|
* proceeds with deletion; it is not documented as a blanket override for
|
|
2670
2809
|
* unrelated restrictions. The flag is sent in the request body.
|
|
2671
2810
|
*
|
|
2811
|
+
* Request body (`application/json`):
|
|
2812
|
+
* ```jsonc
|
|
2813
|
+
* {
|
|
2814
|
+
* "force": true
|
|
2815
|
+
* }
|
|
2816
|
+
* ```
|
|
2817
|
+
*
|
|
2672
2818
|
* @param accountId - The workspace to delete.
|
|
2673
2819
|
* @param options - Set `force: true` to cancel an active paid subscription
|
|
2674
2820
|
* and proceed with deletion.
|
|
@@ -2816,6 +2962,28 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2816
2962
|
* `DigitalCertificate` costs two credits, requires the feature plus a
|
|
2817
2963
|
* signer `government_id`, and that signer must be alone in its step.
|
|
2818
2964
|
*
|
|
2965
|
+
* Request body (`application/json`):
|
|
2966
|
+
* ```jsonc
|
|
2967
|
+
* {
|
|
2968
|
+
* "method": "virtual",
|
|
2969
|
+
* "signers": [
|
|
2970
|
+
* {
|
|
2971
|
+
* "id": "signer_example",
|
|
2972
|
+
* "verification_method": "Email",
|
|
2973
|
+
* "notification_methods": [
|
|
2974
|
+
* "Email"
|
|
2975
|
+
* ],
|
|
2976
|
+
* "step": 1
|
|
2977
|
+
* }
|
|
2978
|
+
* ],
|
|
2979
|
+
* "message": "Please sign this document.",
|
|
2980
|
+
* "expires_at": "2027-12-31T23:59:59Z",
|
|
2981
|
+
* "copy_receivers": [
|
|
2982
|
+
* "copy_signer_example"
|
|
2983
|
+
* ]
|
|
2984
|
+
* }
|
|
2985
|
+
* ```
|
|
2986
|
+
*
|
|
2819
2987
|
* @param documentId - The document to request signatures on.
|
|
2820
2988
|
* @param payload - Signers plus optional `method` (defaults to `virtual`),
|
|
2821
2989
|
* `message`, `expires_at`, `copy_receivers` (existing signer IDs, not
|
|
@@ -2919,14 +3087,29 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2919
3087
|
* email notification, and 0.45 for WhatsApp notification; a digital
|
|
2920
3088
|
* certificate charge is added on top of its notification cost.
|
|
2921
3089
|
*
|
|
3090
|
+
* Request body (`application/json`):
|
|
3091
|
+
* ```jsonc
|
|
3092
|
+
* {
|
|
3093
|
+
* "method": "virtual",
|
|
3094
|
+
* "signers": [
|
|
3095
|
+
* {
|
|
3096
|
+
* "verification_method": "Email",
|
|
3097
|
+
* "notification_methods": [
|
|
3098
|
+
* "Email"
|
|
3099
|
+
* ]
|
|
3100
|
+
* }
|
|
3101
|
+
* ]
|
|
3102
|
+
* }
|
|
3103
|
+
* ```
|
|
3104
|
+
*
|
|
2922
3105
|
* @param documentId - The document the assignment would be created on.
|
|
2923
3106
|
* @param payload - `method` plus channel-only signer descriptors and/or
|
|
2924
3107
|
* `collect`-mode `entries`. Create-only fields and signer IDs are not part
|
|
2925
|
-
* of this request schema.
|
|
2926
|
-
* `InsufficientDocuments`, or `InsufficientCredits`.
|
|
3108
|
+
* of this request schema.
|
|
2927
3109
|
* @returns an {@link ICostEstimate} with `total_credits`, balances, a
|
|
2928
|
-
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
2929
|
-
*
|
|
3110
|
+
* line-item `breakdown`, and a `has_sufficient_resources` gate.
|
|
3111
|
+
* `blocking_reason` may be `PendingPayment`, `InsufficientDocuments`, or
|
|
3112
|
+
* `InsufficientCredits`. Response shape:
|
|
2930
3113
|
* ```jsonc
|
|
2931
3114
|
* {
|
|
2932
3115
|
* "documents": 1,
|
|
@@ -2965,6 +3148,13 @@ declare class AssignmentResource extends BaseResource {
|
|
|
2965
3148
|
* is retained as a compatibility value and, unlike ordinary nullable
|
|
2966
3149
|
* inputs, is intentionally not stripped from the body.
|
|
2967
3150
|
*
|
|
3151
|
+
* Request body (`application/json`):
|
|
3152
|
+
* ```jsonc
|
|
3153
|
+
* {
|
|
3154
|
+
* "expires_at": "2027-12-31T23:59:59Z"
|
|
3155
|
+
* }
|
|
3156
|
+
* ```
|
|
3157
|
+
*
|
|
2968
3158
|
* @param documentId - The document the assignment belongs to.
|
|
2969
3159
|
* @param assignmentId - The assignment to update.
|
|
2970
3160
|
* @param expiresAt - New expiry as an ISO-8601 date/time string. `null` is
|
|
@@ -3135,6 +3325,19 @@ declare class WebhookResource extends BaseResource {
|
|
|
3135
3325
|
* `signer_rejected_document`, `document_processing_failed`).
|
|
3136
3326
|
* OAuth tokens need the `webhooks:write` scope.
|
|
3137
3327
|
*
|
|
3328
|
+
* Request body (`application/json`):
|
|
3329
|
+
* ```jsonc
|
|
3330
|
+
* {
|
|
3331
|
+
* "events": [
|
|
3332
|
+
* "document_ready",
|
|
3333
|
+
* "document_prepared"
|
|
3334
|
+
* ],
|
|
3335
|
+
* "is_active": true,
|
|
3336
|
+
* "url": "https://myapp.example.com/webhooks/assinafy",
|
|
3337
|
+
* "email": "operations@example.com"
|
|
3338
|
+
* }
|
|
3339
|
+
* ```
|
|
3340
|
+
*
|
|
3138
3341
|
* @param payload - Subscription details. `url` and `email` are required;
|
|
3139
3342
|
* `events` defaults to {@link DEFAULT_WEBHOOK_EVENTS} and `is_active`
|
|
3140
3343
|
* defaults to `true`.
|
|
@@ -3554,6 +3757,14 @@ declare class TemplateResource extends BaseResource {
|
|
|
3554
3757
|
* `undefined` keys before sending. Unlike uploads, `name` here is a plain
|
|
3555
3758
|
* display name and is **not** forced to end in `.pdf`.
|
|
3556
3759
|
*
|
|
3760
|
+
* Request body (`application/json`):
|
|
3761
|
+
* ```jsonc
|
|
3762
|
+
* {
|
|
3763
|
+
* "name": "Service agreement.pdf",
|
|
3764
|
+
* "message": "Please sign this document."
|
|
3765
|
+
* }
|
|
3766
|
+
* ```
|
|
3767
|
+
*
|
|
3557
3768
|
* @param templateId - The template to update.
|
|
3558
3769
|
* @param payload - `name` and/or `message`; both optional.
|
|
3559
3770
|
* @param accountId - Override the client's default account ID.
|
|
@@ -3696,6 +3907,14 @@ declare class TagResource extends BaseResource {
|
|
|
3696
3907
|
* and `'ff8800'` both persist as `'ff8800'`. Omit `color`
|
|
3697
3908
|
* (or pass `null`) for no color.
|
|
3698
3909
|
*
|
|
3910
|
+
* Request body (`application/json`):
|
|
3911
|
+
* ```jsonc
|
|
3912
|
+
* {
|
|
3913
|
+
* "name": "Contracts",
|
|
3914
|
+
* "color": "ff8800"
|
|
3915
|
+
* }
|
|
3916
|
+
* ```
|
|
3917
|
+
*
|
|
3699
3918
|
* @param payload - `name` (required, max 64 characters; trimmed with
|
|
3700
3919
|
* internal whitespace collapsed) and optional `color`.
|
|
3701
3920
|
* @param accountId - Override the client's default account ID.
|
|
@@ -3731,6 +3950,14 @@ declare class TagResource extends BaseResource {
|
|
|
3731
3950
|
* leading `#` on `color` is accepted and stripped by the API
|
|
3732
3951
|
* (`'#112233'` → `'112233'`).
|
|
3733
3952
|
*
|
|
3953
|
+
* Request body (`application/json`):
|
|
3954
|
+
* ```jsonc
|
|
3955
|
+
* {
|
|
3956
|
+
* "name": "Signed contracts",
|
|
3957
|
+
* "color": null
|
|
3958
|
+
* }
|
|
3959
|
+
* ```
|
|
3960
|
+
*
|
|
3734
3961
|
* @param tagId - The tag to update.
|
|
3735
3962
|
* @param payload - `name` and/or `color`. `color: null` clears the color;
|
|
3736
3963
|
* omit a field to leave it unchanged.
|
|
@@ -3851,6 +4078,14 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3851
4078
|
* `X-Api-Key` (see {@link AuthenticationResource.createApiKey}) instead of
|
|
3852
4079
|
* storing a password.
|
|
3853
4080
|
*
|
|
4081
|
+
* Request body (`application/json`):
|
|
4082
|
+
* ```jsonc
|
|
4083
|
+
* {
|
|
4084
|
+
* "email": "user@example.com",
|
|
4085
|
+
* "password": "example-password"
|
|
4086
|
+
* }
|
|
4087
|
+
* ```
|
|
4088
|
+
*
|
|
3854
4089
|
* @param email - The user's email address, e.g. `'user@example.com'`.
|
|
3855
4090
|
* @param password - The user's password.
|
|
3856
4091
|
* @returns An {@link ILoginResponse} with the access token, user, and
|
|
@@ -3860,7 +4095,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3860
4095
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
3861
4096
|
* "user": {
|
|
3862
4097
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3863
|
-
* "name": "
|
|
4098
|
+
* "name": "Empresa Exemplo",
|
|
3864
4099
|
* "email": "user@example.com",
|
|
3865
4100
|
* "telephone": null,
|
|
3866
4101
|
* "government_id": "",
|
|
@@ -3872,7 +4107,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3872
4107
|
* "accounts": [
|
|
3873
4108
|
* {
|
|
3874
4109
|
* "id": "acc_example",
|
|
3875
|
-
* "name": "
|
|
4110
|
+
* "name": "Empresa Exemplo",
|
|
3876
4111
|
* "roles": ["Owner"],
|
|
3877
4112
|
* "is_delete_allowed": true,
|
|
3878
4113
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -3899,6 +4134,15 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3899
4134
|
* Assinafy JWT. Returns the same {@link ILoginResponse} shape as
|
|
3900
4135
|
* {@link AuthenticationResource.login}.
|
|
3901
4136
|
*
|
|
4137
|
+
* Request body (`application/json`):
|
|
4138
|
+
* ```jsonc
|
|
4139
|
+
* {
|
|
4140
|
+
* "provider": "google",
|
|
4141
|
+
* "token": "provider_token_example",
|
|
4142
|
+
* "has_accepted_terms": true
|
|
4143
|
+
* }
|
|
4144
|
+
* ```
|
|
4145
|
+
*
|
|
3902
4146
|
* @param payload - The social-login body.
|
|
3903
4147
|
* @param payload.provider - OAuth provider; currently exactly `'google'`.
|
|
3904
4148
|
* @param payload.token - The provider-issued OAuth/ID token.
|
|
@@ -3911,7 +4155,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3911
4155
|
* "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
|
|
3912
4156
|
* "user": {
|
|
3913
4157
|
* "id": "md3j6p9w8b7y6qvqaoy5er42",
|
|
3914
|
-
* "name": "
|
|
4158
|
+
* "name": "Empresa Exemplo",
|
|
3915
4159
|
* "email": "user@example.com",
|
|
3916
4160
|
* "telephone": null,
|
|
3917
4161
|
* "government_id": "",
|
|
@@ -3923,7 +4167,7 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3923
4167
|
* "accounts": [
|
|
3924
4168
|
* {
|
|
3925
4169
|
* "id": "acc_example",
|
|
3926
|
-
* "name": "
|
|
4170
|
+
* "name": "Empresa Exemplo",
|
|
3927
4171
|
* "roles": ["Owner"],
|
|
3928
4172
|
* "is_delete_allowed": true,
|
|
3929
4173
|
* "created_at": "2026-05-12T13:45:11Z"
|
|
@@ -3961,6 +4205,14 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3961
4205
|
* The response is the standard status/message acknowledgement with no data,
|
|
3962
4206
|
* so this method resolves to `void`.
|
|
3963
4207
|
*
|
|
4208
|
+
* Request body (`application/json`):
|
|
4209
|
+
* ```jsonc
|
|
4210
|
+
* {
|
|
4211
|
+
* "provider": "google",
|
|
4212
|
+
* "token": "provider_token_example"
|
|
4213
|
+
* }
|
|
4214
|
+
* ```
|
|
4215
|
+
*
|
|
3964
4216
|
* @param payload - Social provider and provider-issued access/ID token.
|
|
3965
4217
|
* @returns Resolves when the API acknowledges that the identity was linked.
|
|
3966
4218
|
* @throws {ValidationError} If `provider` is not `google` or `token` is empty.
|
|
@@ -3987,6 +4239,13 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
3987
4239
|
* a masked value. Calling this again rotates the key, invalidating the
|
|
3988
4240
|
* previous one.
|
|
3989
4241
|
*
|
|
4242
|
+
* Request body (`application/json`):
|
|
4243
|
+
* ```jsonc
|
|
4244
|
+
* {
|
|
4245
|
+
* "password": "example-password"
|
|
4246
|
+
* }
|
|
4247
|
+
* ```
|
|
4248
|
+
*
|
|
3990
4249
|
* @param password - The current user's password, required to authorize
|
|
3991
4250
|
* key generation.
|
|
3992
4251
|
* @returns An {@link IApiKeyResponse} containing the new key. Response
|
|
@@ -4057,6 +4316,15 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
4057
4316
|
* Requires the current password as a confirmation. On success the API
|
|
4058
4317
|
* echoes back the affected `email`.
|
|
4059
4318
|
*
|
|
4319
|
+
* Request body (`application/json`):
|
|
4320
|
+
* ```jsonc
|
|
4321
|
+
* {
|
|
4322
|
+
* "email": "user@example.com",
|
|
4323
|
+
* "password": "example-password",
|
|
4324
|
+
* "new_password": "new-example-password"
|
|
4325
|
+
* }
|
|
4326
|
+
* ```
|
|
4327
|
+
*
|
|
4060
4328
|
* @param payload - The change-password body.
|
|
4061
4329
|
* @param payload.email - The user's email address.
|
|
4062
4330
|
* @param payload.password - The current password.
|
|
@@ -4096,6 +4364,13 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
4096
4364
|
* Triggers Assinafy to email a reset link/token to the given address.
|
|
4097
4365
|
* Complete the flow with {@link AuthenticationResource.resetPassword}.
|
|
4098
4366
|
*
|
|
4367
|
+
* Request body (`application/json`):
|
|
4368
|
+
* ```jsonc
|
|
4369
|
+
* {
|
|
4370
|
+
* "email": "user@example.com"
|
|
4371
|
+
* }
|
|
4372
|
+
* ```
|
|
4373
|
+
*
|
|
4099
4374
|
* @param email - The email address to send the reset link to.
|
|
4100
4375
|
* @returns `{ email }` — the address the reset link was sent to. Response
|
|
4101
4376
|
* shape:
|
|
@@ -4123,6 +4398,15 @@ declare class AuthenticationResource extends BaseResource {
|
|
|
4123
4398
|
* {@link AuthenticationResource.requestPasswordReset} and sets the new
|
|
4124
4399
|
* password. On success the API echoes back the affected `email`.
|
|
4125
4400
|
*
|
|
4401
|
+
* Request body (`application/json`):
|
|
4402
|
+
* ```jsonc
|
|
4403
|
+
* {
|
|
4404
|
+
* "email": "user@example.com",
|
|
4405
|
+
* "token": "reset_token_example",
|
|
4406
|
+
* "new_password": "new-example-password"
|
|
4407
|
+
* }
|
|
4408
|
+
* ```
|
|
4409
|
+
*
|
|
4126
4410
|
* @param payload - The reset-password body.
|
|
4127
4411
|
* @param payload.email - The user's email address.
|
|
4128
4412
|
* @param payload.token - The reset token from the emailed link. The current
|
|
@@ -4215,20 +4499,20 @@ type TokenEndpointAuthOptions = {
|
|
|
4215
4499
|
* // Step 1 — before redirecting the user
|
|
4216
4500
|
* const request = await client.oauth.createAuthorizationUrl({
|
|
4217
4501
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4218
|
-
* redirectUri: 'https://myapp.com/oauth/callback',
|
|
4219
|
-
* scopes: ['documents:read', 'documents:write', 'offline_access'],
|
|
4502
|
+
* redirectUri: 'https://myapp.example.com/oauth/callback',
|
|
4503
|
+
* scopes: ['documents:read', 'documents:write', 'account:read', 'offline_access'],
|
|
4220
4504
|
* });
|
|
4221
4505
|
* session.oauth = request; // state + codeVerifier + issuer
|
|
4222
4506
|
* response.redirect(request.url);
|
|
4223
4507
|
*
|
|
4224
|
-
* // Step 3/4 — on https://myapp.com/oauth/callback
|
|
4508
|
+
* // Step 3/4 — on https://myapp.example.com/oauth/callback
|
|
4225
4509
|
* const { code } = client.oauth.readAuthorizationCallback(query, session.oauth);
|
|
4226
4510
|
* const tokens = await client.oauth.exchangeCode({
|
|
4227
4511
|
* code,
|
|
4228
4512
|
* codeVerifier: session.oauth.codeVerifier,
|
|
4229
|
-
* redirectUri: 'https://myapp.com/oauth/callback',
|
|
4513
|
+
* redirectUri: 'https://myapp.example.com/oauth/callback',
|
|
4230
4514
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4231
|
-
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET
|
|
4515
|
+
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
|
|
4232
4516
|
* });
|
|
4233
4517
|
* ```
|
|
4234
4518
|
*/
|
|
@@ -4374,8 +4658,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
4374
4658
|
* ```ts
|
|
4375
4659
|
* const request = await client.oauth.createAuthorizationUrl({
|
|
4376
4660
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4377
|
-
* redirectUri: 'https://myapp.com/oauth/callback',
|
|
4378
|
-
* scopes: ['documents:read', 'documents:write', 'offline_access'],
|
|
4661
|
+
* redirectUri: 'https://myapp.example.com/oauth/callback',
|
|
4662
|
+
* scopes: ['documents:read', 'documents:write', 'account:read', 'offline_access'],
|
|
4379
4663
|
* });
|
|
4380
4664
|
* session.oauth = request;
|
|
4381
4665
|
* response.redirect(request.url);
|
|
@@ -4426,8 +4710,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
4426
4710
|
* ```
|
|
4427
4711
|
* @throws {ValidationError} If `state` is missing or does not match, `iss`
|
|
4428
4712
|
* is absent or disagrees with the expected issuer, or a successful response
|
|
4429
|
-
* carries no `code
|
|
4430
|
-
*
|
|
4713
|
+
* carries no `code`, or a protocol parameter appears more than once.
|
|
4714
|
+
* Reject such responses without exchanging the code.
|
|
4431
4715
|
* @throws {OAuthError} If the server returned `error` (e.g.
|
|
4432
4716
|
* `access_denied`, `invalid_scope`, `invalid_request`,
|
|
4433
4717
|
* `unsupported_response_type`, `invalid_target`).
|
|
@@ -4440,9 +4724,9 @@ declare class OAuthResource extends BaseResource {
|
|
|
4440
4724
|
* const tokens = await client.oauth.exchangeCode({
|
|
4441
4725
|
* code,
|
|
4442
4726
|
* codeVerifier: stored.codeVerifier,
|
|
4443
|
-
* redirectUri: 'https://myapp.com/oauth/callback',
|
|
4727
|
+
* redirectUri: 'https://myapp.example.com/oauth/callback',
|
|
4444
4728
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4445
|
-
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET
|
|
4729
|
+
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
|
|
4446
4730
|
* });
|
|
4447
4731
|
* });
|
|
4448
4732
|
* ```
|
|
@@ -4460,6 +4744,12 @@ declare class OAuthResource extends BaseResource {
|
|
|
4460
4744
|
* a browser. Every value must match the authorization request exactly, or
|
|
4461
4745
|
* the API answers `invalid_grant`.
|
|
4462
4746
|
*
|
|
4747
|
+
* Request body (`application/x-www-form-urlencoded`; omit `client_secret`
|
|
4748
|
+
* for public applications):
|
|
4749
|
+
* ```text
|
|
4750
|
+
* grant_type=authorization_code&code=code_example&redirect_uri=https%3A%2F%2Fmyapp.example.com%2Foauth%2Fcallback&client_id=client_example&client_secret=secret_example&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk&resource=https%3A%2F%2Fapi.assinafy.com.br
|
|
4751
|
+
* ```
|
|
4752
|
+
*
|
|
4463
4753
|
* @param options - Exchange options.
|
|
4464
4754
|
* @param options.code - The code from
|
|
4465
4755
|
* {@link OAuthResource.readAuthorizationCallback}.
|
|
@@ -4495,9 +4785,9 @@ declare class OAuthResource extends BaseResource {
|
|
|
4495
4785
|
* const tokens = await client.oauth.exchangeCode({
|
|
4496
4786
|
* code,
|
|
4497
4787
|
* codeVerifier: session.oauth.codeVerifier,
|
|
4498
|
-
* redirectUri: 'https://myapp.com/oauth/callback',
|
|
4788
|
+
* redirectUri: 'https://myapp.example.com/oauth/callback',
|
|
4499
4789
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4500
|
-
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET
|
|
4790
|
+
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
|
|
4501
4791
|
* });
|
|
4502
4792
|
* ```
|
|
4503
4793
|
*/
|
|
@@ -4525,6 +4815,12 @@ declare class OAuthResource extends BaseResource {
|
|
|
4525
4815
|
* only expires if it goes 30 days without a refresh; after that the user
|
|
4526
4816
|
* has to reconnect.
|
|
4527
4817
|
*
|
|
4818
|
+
* Request body (`application/x-www-form-urlencoded`; omit `client_secret`
|
|
4819
|
+
* for public applications):
|
|
4820
|
+
* ```text
|
|
4821
|
+
* grant_type=refresh_token&refresh_token=refresh_token_example&client_id=client_example&client_secret=secret_example&resource=https%3A%2F%2Fapi.assinafy.com.br
|
|
4822
|
+
* ```
|
|
4823
|
+
*
|
|
4528
4824
|
* @param options - Refresh options.
|
|
4529
4825
|
* @param options.refreshToken - The current refresh token.
|
|
4530
4826
|
* @param options.clientId - The application's `client_id`.
|
|
@@ -4555,7 +4851,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4555
4851
|
* const tokens = await client.oauth.refreshToken({
|
|
4556
4852
|
* refreshToken: connection.refreshToken,
|
|
4557
4853
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4558
|
-
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET
|
|
4854
|
+
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
|
|
4559
4855
|
* });
|
|
4560
4856
|
* await connection.save({ refreshToken: tokens.refresh_token });
|
|
4561
4857
|
* ```
|
|
@@ -4596,7 +4892,7 @@ declare class OAuthResource extends BaseResource {
|
|
|
4596
4892
|
* token: connection.refreshToken,
|
|
4597
4893
|
* tokenTypeHint: 'refresh_token',
|
|
4598
4894
|
* clientId: process.env.ASSINAFY_CLIENT_ID!,
|
|
4599
|
-
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET
|
|
4895
|
+
* clientSecret: process.env.ASSINAFY_CLIENT_SECRET!,
|
|
4600
4896
|
* });
|
|
4601
4897
|
* ```
|
|
4602
4898
|
*/
|
|
@@ -4623,8 +4919,8 @@ declare class OAuthResource extends BaseResource {
|
|
|
4623
4919
|
* "email_verified": true
|
|
4624
4920
|
* }
|
|
4625
4921
|
* ```
|
|
4626
|
-
* `sub` is the stable user identifier;
|
|
4627
|
-
* was not granted.
|
|
4922
|
+
* `sub` is the stable user identifier; other claims may be omitted or
|
|
4923
|
+
* `null` when their scope was not granted.
|
|
4628
4924
|
* @throws {ValidationError} If `accessToken` is supplied but empty.
|
|
4629
4925
|
* @throws {ApiError} `401` when the token is missing, expired or revoked;
|
|
4630
4926
|
* `403` when the `openid` scope was not granted — its `WWW-Authenticate`
|
|
@@ -4684,6 +4980,17 @@ declare class FieldsResource extends BaseResource {
|
|
|
4684
4980
|
/**
|
|
4685
4981
|
* Create a field definition (`POST /accounts/{accountId}/fields`).
|
|
4686
4982
|
*
|
|
4983
|
+
* Request body (`application/json`):
|
|
4984
|
+
* ```jsonc
|
|
4985
|
+
* {
|
|
4986
|
+
* "type": "text",
|
|
4987
|
+
* "name": "Reference",
|
|
4988
|
+
* "regex": null,
|
|
4989
|
+
* "is_required": true,
|
|
4990
|
+
* "is_active": true
|
|
4991
|
+
* }
|
|
4992
|
+
* ```
|
|
4993
|
+
*
|
|
4687
4994
|
* @param payload - The field to create. `type` and `name` are required;
|
|
4688
4995
|
* `type` must be one of the platform field types (see
|
|
4689
4996
|
* {@link FieldsResource.listTypes}); `regex` may be a string or `null`,
|
|
@@ -4791,6 +5098,15 @@ declare class FieldsResource extends BaseResource {
|
|
|
4791
5098
|
* Update a field definition
|
|
4792
5099
|
* (`PUT /accounts/{accountId}/fields/{fieldId}`).
|
|
4793
5100
|
*
|
|
5101
|
+
* Request body (`application/json`):
|
|
5102
|
+
* ```jsonc
|
|
5103
|
+
* {
|
|
5104
|
+
* "name": "Customer reference",
|
|
5105
|
+
* "regex": null,
|
|
5106
|
+
* "is_active": true
|
|
5107
|
+
* }
|
|
5108
|
+
* ```
|
|
5109
|
+
*
|
|
4794
5110
|
* @param fieldId - The field definition to update.
|
|
4795
5111
|
* @param payload - Fields are `name`, nullable `regex`, and `is_active`;
|
|
4796
5112
|
* `type` and `is_required` are compatibility extensions.
|
|
@@ -4850,6 +5166,13 @@ declare class FieldsResource extends BaseResource {
|
|
|
4850
5166
|
* `signerAccessCode` is a compatibility query and is sent as
|
|
4851
5167
|
* `signer-access-code` when supplied.
|
|
4852
5168
|
*
|
|
5169
|
+
* Request body (`application/json`):
|
|
5170
|
+
* ```jsonc
|
|
5171
|
+
* {
|
|
5172
|
+
* "value": "Example value"
|
|
5173
|
+
* }
|
|
5174
|
+
* ```
|
|
5175
|
+
*
|
|
4853
5176
|
* @param fieldId - The field definition to validate against.
|
|
4854
5177
|
* @param value - The value to check (validated against the field's
|
|
4855
5178
|
* type/regex). Sent as `{ value }` in the request body.
|
|
@@ -4888,6 +5211,16 @@ declare class FieldsResource extends BaseResource {
|
|
|
4888
5211
|
* same compatibility extension described on
|
|
4889
5212
|
* {@link FieldsResource.validate}.
|
|
4890
5213
|
*
|
|
5214
|
+
* Request body (`application/json`):
|
|
5215
|
+
* ```jsonc
|
|
5216
|
+
* [
|
|
5217
|
+
* {
|
|
5218
|
+
* "field_id": "field_example",
|
|
5219
|
+
* "value": "Example value"
|
|
5220
|
+
* }
|
|
5221
|
+
* ]
|
|
5222
|
+
* ```
|
|
5223
|
+
*
|
|
4891
5224
|
* @param entries - Non-empty array of `{ field_id, value }` pairs.
|
|
4892
5225
|
* @param options - Account override and optional legacy `signerAccessCode`.
|
|
4893
5226
|
* @returns One validation result per entry. Response shape:
|
|
@@ -4985,8 +5318,7 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
4985
5318
|
* "updated_at": "2026-07-19T14:56:56Z"
|
|
4986
5319
|
* }
|
|
4987
5320
|
* ```
|
|
4988
|
-
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing
|
|
4989
|
-
* or a supplied `search` value is not a string.
|
|
5321
|
+
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
4990
5322
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
4991
5323
|
*
|
|
4992
5324
|
* @example
|
|
@@ -5056,7 +5388,29 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5056
5388
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
5057
5389
|
* @param search - Free-text term matched against the document name.
|
|
5058
5390
|
* @returns Matching documents for that signer, in the compact
|
|
5059
|
-
* {@link IDocumentListItem} shape, with pagination in `meta
|
|
5391
|
+
* {@link IDocumentListItem} shape, with pagination in `meta`:
|
|
5392
|
+
* ```jsonc
|
|
5393
|
+
* {
|
|
5394
|
+
* "data": [
|
|
5395
|
+
* {
|
|
5396
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
5397
|
+
* "account_id": "acc_example",
|
|
5398
|
+
* "template_id": null,
|
|
5399
|
+
* "name": "Service agreement.pdf",
|
|
5400
|
+
* "status": "pending_signature",
|
|
5401
|
+
* "artifacts": { "original": "https://...", "thumbnail": "https://..." },
|
|
5402
|
+
* "is_closed": false,
|
|
5403
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
5404
|
+
* "decline_reason": null,
|
|
5405
|
+
* "declined_by": null,
|
|
5406
|
+
* "tags": [],
|
|
5407
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
5408
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
5409
|
+
* }
|
|
5410
|
+
* ],
|
|
5411
|
+
* "meta": { "current_page": 1, "per_page": 20, "total": 1, "last_page": 1 }
|
|
5412
|
+
* }
|
|
5413
|
+
* ```
|
|
5060
5414
|
* @throws {ValidationError} If `signerId` or `signerAccessCode` is missing.
|
|
5061
5415
|
* @throws {ApiError} If the access code is invalid or expired.
|
|
5062
5416
|
*
|
|
@@ -5118,6 +5472,15 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5118
5472
|
* The `document_ids` array goes in the request body; the access code
|
|
5119
5473
|
* authenticates via the `signer-access-code` query param.
|
|
5120
5474
|
*
|
|
5475
|
+
* Request body (`application/json`):
|
|
5476
|
+
* ```jsonc
|
|
5477
|
+
* {
|
|
5478
|
+
* "document_ids": [
|
|
5479
|
+
* "document_example"
|
|
5480
|
+
* ]
|
|
5481
|
+
* }
|
|
5482
|
+
* ```
|
|
5483
|
+
*
|
|
5121
5484
|
* @param documentIds - Non-empty array of document IDs to sign.
|
|
5122
5485
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
5123
5486
|
* @returns Resolves when the API acknowledges the operation. The documented
|
|
@@ -5146,6 +5509,16 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5146
5509
|
* Both `document_ids` and `decline_reason` go in the request body; the access
|
|
5147
5510
|
* code authenticates via the `signer-access-code` query param.
|
|
5148
5511
|
*
|
|
5512
|
+
* Request body (`application/json`):
|
|
5513
|
+
* ```jsonc
|
|
5514
|
+
* {
|
|
5515
|
+
* "document_ids": [
|
|
5516
|
+
* "document_example"
|
|
5517
|
+
* ],
|
|
5518
|
+
* "decline_reason": "The document needs a correction."
|
|
5519
|
+
* }
|
|
5520
|
+
* ```
|
|
5521
|
+
*
|
|
5149
5522
|
* @param documentIds - Non-empty array of document IDs to decline.
|
|
5150
5523
|
* @param declineReason - Free-text reason shown to the sender (required).
|
|
5151
5524
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
@@ -5235,6 +5608,13 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5235
5608
|
* **body carries only `verification-code`** (putting the access code in the
|
|
5236
5609
|
* body leaves the request unauthenticated → `401`).
|
|
5237
5610
|
*
|
|
5611
|
+
* Request body (`application/json`):
|
|
5612
|
+
* ```jsonc
|
|
5613
|
+
* {
|
|
5614
|
+
* "verification-code": "123456"
|
|
5615
|
+
* }
|
|
5616
|
+
* ```
|
|
5617
|
+
*
|
|
5238
5618
|
* @param payload - `signerAccessCode` (the signing-link code) and
|
|
5239
5619
|
* `verificationCode` (the OTP the signer received).
|
|
5240
5620
|
* @returns Resolves when the API acknowledges the operation. The response
|
|
@@ -5269,12 +5649,32 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5269
5649
|
* `has_accepted_terms: true` here or call
|
|
5270
5650
|
* {@link SignerDocumentsResource.acceptTerms} before fetching the assignment.
|
|
5271
5651
|
*
|
|
5652
|
+
* Request body (`application/json`):
|
|
5653
|
+
* ```jsonc
|
|
5654
|
+
* {
|
|
5655
|
+
* "full_name": "Example Signer",
|
|
5656
|
+
* "email": "signer@example.com",
|
|
5657
|
+
* "government_id": "39053344705",
|
|
5658
|
+
* "has_accepted_terms": true
|
|
5659
|
+
* }
|
|
5660
|
+
* ```
|
|
5661
|
+
*
|
|
5272
5662
|
* @param documentId - The document the signer is confirming data for.
|
|
5273
5663
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
5274
5664
|
* @param payload - Any of the official `full_name`, `email`, or
|
|
5275
5665
|
* `government_id`, or `has_accepted_terms` fields. Fields left out are not
|
|
5276
5666
|
* sent.
|
|
5277
|
-
* @returns The confirmed signer in the full {@link ISigner} response shape
|
|
5667
|
+
* @returns The confirmed signer in the full {@link ISigner} response shape:
|
|
5668
|
+
* ```jsonc
|
|
5669
|
+
* {
|
|
5670
|
+
* "resource": "signer",
|
|
5671
|
+
* "id": "19e6b92e7895332ed9708535d8c",
|
|
5672
|
+
* "full_name": "Example Signer",
|
|
5673
|
+
* "email": "signer@example.com",
|
|
5674
|
+
* "whatsapp_phone_number": null,
|
|
5675
|
+
* "has_accepted_terms": true
|
|
5676
|
+
* }
|
|
5677
|
+
* ```
|
|
5278
5678
|
* @throws {ValidationError} If `documentId` or `signerAccessCode` is missing,
|
|
5279
5679
|
* or a supplied identity value is malformed.
|
|
5280
5680
|
* @throws {ApiError} If the access code is invalid/expired or a value fails
|
|
@@ -5292,8 +5692,23 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5292
5692
|
*/
|
|
5293
5693
|
confirmData(documentId: string, signerAccessCode: string, payload: IConfirmSignerDataPayload): Promise<ISigner>;
|
|
5294
5694
|
/**
|
|
5695
|
+
* Confirm signer data with the compatibility phone field
|
|
5696
|
+
* (`PUT /documents/{documentId}/signers/confirm-data`).
|
|
5295
5697
|
* @deprecated Compatibility overload preserving the previous wire shape.
|
|
5296
5698
|
* `whatsapp_phone_number` is a compatibility pass-through field.
|
|
5699
|
+
* @param documentId - Document identifier.
|
|
5700
|
+
* @param signerAccessCode - Access code sent in the query string.
|
|
5701
|
+
* @param payload - Identity fields, including `whatsapp_phone_number`.
|
|
5702
|
+
* @returns The signer; see the primary overload for its response payload.
|
|
5703
|
+
* @throws {ValidationError} If identity fields or identifiers are invalid.
|
|
5704
|
+
* @throws {ApiError} If the API rejects the confirmation.
|
|
5705
|
+
* @example
|
|
5706
|
+
* ```ts
|
|
5707
|
+
* // JSON body: { "whatsapp_phone_number": "+5511999998888" }
|
|
5708
|
+
* await client.signerDocuments.confirmData(documentId, accessCode, {
|
|
5709
|
+
* whatsapp_phone_number: '+5511999998888',
|
|
5710
|
+
* });
|
|
5711
|
+
* ```
|
|
5297
5712
|
*/
|
|
5298
5713
|
confirmData(documentId: string, signerAccessCode: string, payload: ILegacyConfirmSignerDataPayload): Promise<ISigner>;
|
|
5299
5714
|
/**
|
|
@@ -5328,8 +5743,22 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5328
5743
|
*/
|
|
5329
5744
|
uploadSignature(signerAccessCode: string, image: Buffer, options?: IUploadSignatureOptions): Promise<void>;
|
|
5330
5745
|
/**
|
|
5746
|
+
* Upload a signature image using a compatibility content type
|
|
5747
|
+
* (`POST /signature?signer-access-code=…&type=…`).
|
|
5331
5748
|
* @deprecated Compatibility overload for non-PNG media types. The current
|
|
5332
5749
|
* OpenAPI contract specifies only `image/png`; other values are not certified.
|
|
5750
|
+
* @param signerAccessCode - Access code sent in the query string.
|
|
5751
|
+
* @param image - Non-empty raw image bytes, without a JSON envelope.
|
|
5752
|
+
* @param options - Image type, reuse preference and compatibility content type.
|
|
5753
|
+
* @returns Nothing; the acknowledgement body is discarded.
|
|
5754
|
+
* @throws {ValidationError} If the code, image or options are invalid.
|
|
5755
|
+
* @throws {ApiError} If the API rejects the upload.
|
|
5756
|
+
* @example
|
|
5757
|
+
* ```ts
|
|
5758
|
+
* await client.signerDocuments.uploadSignature(accessCode, image, {
|
|
5759
|
+
* imageType: 'signature', reuse: false, contentType: 'image/jpeg',
|
|
5760
|
+
* });
|
|
5761
|
+
* ```
|
|
5333
5762
|
*/
|
|
5334
5763
|
uploadSignature(signerAccessCode: string, image: Buffer, options: ILegacyUploadSignatureOptions): Promise<void>;
|
|
5335
5764
|
/**
|
|
@@ -5379,7 +5808,48 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5379
5808
|
* @returns The document to sign, including its `assignment` (the
|
|
5380
5809
|
* {@link IAssignment} shape: `signers`, `items`, `summary`, `signing_urls`)
|
|
5381
5810
|
* from which the `itemId` / `fieldId` / `pageId` values for
|
|
5382
|
-
* {@link SignerDocumentsResource.sign} are read
|
|
5811
|
+
* {@link SignerDocumentsResource.sign} are read:
|
|
5812
|
+
* ```jsonc
|
|
5813
|
+
* {
|
|
5814
|
+
* "resource": "document",
|
|
5815
|
+
* "id": "103acccd24234c07858ffddf6d84",
|
|
5816
|
+
* "account_id": "acc_example",
|
|
5817
|
+
* "template_id": null,
|
|
5818
|
+
* "name": "Service agreement.pdf",
|
|
5819
|
+
* "status": "pending_signature",
|
|
5820
|
+
* "artifacts": {
|
|
5821
|
+
* "original": "https://api.assinafy.com.br/v1/documents/103acccd.../download/original",
|
|
5822
|
+
* "thumbnail": "https://api.assinafy.com.br/v1/documents/103acccd.../thumbnail"
|
|
5823
|
+
* },
|
|
5824
|
+
* "is_closed": false,
|
|
5825
|
+
* "signing_url": "https://app.assinafy.com.br/sign/103acccd...",
|
|
5826
|
+
* "decline_reason": null,
|
|
5827
|
+
* "declined_by": null,
|
|
5828
|
+
* "tags": [],
|
|
5829
|
+
* "assignment": {
|
|
5830
|
+
* "id": "1032c55c58bb00a8dc35db916751",
|
|
5831
|
+
* "method": "virtual",
|
|
5832
|
+
* "sender_email": "sender@example.com",
|
|
5833
|
+
* "expires_at": null,
|
|
5834
|
+
* "signers": [
|
|
5835
|
+
* { "id": "19e6b92e7895332ed9708535d8c", "step": 1, "email": "signer@example.com",
|
|
5836
|
+
* "full_name": "Example Signer", "notified": true, "completed": false }
|
|
5837
|
+
* ],
|
|
5838
|
+
* "items": [
|
|
5839
|
+
* { "id": "item-1", "page": { "id": "page-1", "number": 1, "height": 1651, "width": 1275,
|
|
5840
|
+
* "download_url": "https://..." }, "signer": { "id": "19e6b92e..." },
|
|
5841
|
+
* "field": { "id": "field-1", "type": "signature" }, "value": null, "completed": false }
|
|
5842
|
+
* ],
|
|
5843
|
+
* "summary": { "signer_count": 1, "completed_count": 0, "signers": [] }
|
|
5844
|
+
* },
|
|
5845
|
+
* "pages": [
|
|
5846
|
+
* { "id": "103acccd5c73...", "number": 1, "height": 1651, "width": 1275,
|
|
5847
|
+
* "download_url": "https://api.assinafy.com.br/v1/documents/103acccd.../pages/103acccd5c73.../download" }
|
|
5848
|
+
* ],
|
|
5849
|
+
* "created_at": "2026-07-19T14:56:54Z",
|
|
5850
|
+
* "updated_at": "2026-07-19T14:56:56Z"
|
|
5851
|
+
* }
|
|
5852
|
+
* ```
|
|
5383
5853
|
* @throws {ValidationError} If `signerAccessCode` is missing.
|
|
5384
5854
|
* @throws {ApiError} `400` when DigitalCertificate identity/terms are not
|
|
5385
5855
|
* confirmed; `401`/`403` if the access code is invalid or expired; `409`
|
|
@@ -5405,6 +5875,18 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5405
5875
|
* first. Digital Certificate signers cannot use this endpoint; use the
|
|
5406
5876
|
* certificate start/complete API flow instead.
|
|
5407
5877
|
*
|
|
5878
|
+
* Request body (`application/json`):
|
|
5879
|
+
* ```jsonc
|
|
5880
|
+
* [
|
|
5881
|
+
* {
|
|
5882
|
+
* "itemId": "item_example",
|
|
5883
|
+
* "fieldId": "field_example",
|
|
5884
|
+
* "pageId": "page_example",
|
|
5885
|
+
* "value": "Example Signer"
|
|
5886
|
+
* }
|
|
5887
|
+
* ]
|
|
5888
|
+
* ```
|
|
5889
|
+
*
|
|
5408
5890
|
* @param documentId - The document being signed.
|
|
5409
5891
|
* @param assignmentId - The assignment within that document.
|
|
5410
5892
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
@@ -5437,6 +5919,13 @@ declare class SignerDocumentsResource extends BaseResource {
|
|
|
5437
5919
|
* delete the document via `documents.delete`; there is no workspace "cancel"
|
|
5438
5920
|
* endpoint.)
|
|
5439
5921
|
*
|
|
5922
|
+
* Request body (`application/json`):
|
|
5923
|
+
* ```jsonc
|
|
5924
|
+
* {
|
|
5925
|
+
* "decline_reason": "The document needs a correction."
|
|
5926
|
+
* }
|
|
5927
|
+
* ```
|
|
5928
|
+
*
|
|
5440
5929
|
* @param documentId - The document being declined.
|
|
5441
5930
|
* @param assignmentId - The assignment within that document.
|
|
5442
5931
|
* @param signerAccessCode - The signer's access code, from their signing link.
|
|
@@ -5565,13 +6054,40 @@ declare class UserResource extends BaseResource {
|
|
|
5565
6054
|
* (`PUT /users/self/notification-preferences`). Omitted keys retain their
|
|
5566
6055
|
* current values; account/security e-mails are not configurable here.
|
|
5567
6056
|
*
|
|
6057
|
+
* Request body (`application/json`):
|
|
6058
|
+
* ```jsonc
|
|
6059
|
+
* {
|
|
6060
|
+
* "DocumentCompleted": true,
|
|
6061
|
+
* "SignerDeclined": true,
|
|
6062
|
+
* "DocumentCancelled": true,
|
|
6063
|
+
* "DocumentAboutToExpire": true,
|
|
6064
|
+
* "DocumentExpired": true,
|
|
6065
|
+
* "DocumentExpirationReset": true,
|
|
6066
|
+
* "DocumentProcessingFailed": true,
|
|
6067
|
+
* "TemplateProcessingFailed": true,
|
|
6068
|
+
* "SignerWhatsappFailed": true
|
|
6069
|
+
* }
|
|
6070
|
+
* ```
|
|
6071
|
+
*
|
|
5568
6072
|
* @param preferences - One or more of the nine documented keys, each with
|
|
5569
6073
|
* a boolean value. Request example:
|
|
5570
6074
|
* ```json
|
|
5571
6075
|
* { "DocumentCompleted": true, "SignerDeclined": false }
|
|
5572
6076
|
* ```
|
|
5573
|
-
* @returns The complete updated
|
|
5574
|
-
*
|
|
6077
|
+
* @returns The complete updated nine-key preference map:
|
|
6078
|
+
* ```json
|
|
6079
|
+
* {
|
|
6080
|
+
* "DocumentCompleted": true,
|
|
6081
|
+
* "SignerDeclined": false,
|
|
6082
|
+
* "DocumentCancelled": true,
|
|
6083
|
+
* "DocumentAboutToExpire": true,
|
|
6084
|
+
* "DocumentExpired": false,
|
|
6085
|
+
* "DocumentExpirationReset": true,
|
|
6086
|
+
* "DocumentProcessingFailed": true,
|
|
6087
|
+
* "TemplateProcessingFailed": true,
|
|
6088
|
+
* "SignerWhatsappFailed": true
|
|
6089
|
+
* }
|
|
6090
|
+
* ```
|
|
5575
6091
|
* @throws {ValidationError} Before requesting when the map is empty, has an
|
|
5576
6092
|
* unknown key, or contains a non-boolean value.
|
|
5577
6093
|
* @throws {ApiError} `400` if the API rejects the map, `401` for invalid
|
|
@@ -5697,7 +6213,7 @@ interface ClientConfigInput {
|
|
|
5697
6213
|
* const client = new AssinafyClient({
|
|
5698
6214
|
* apiKey: process.env.ASSINAFY_API_KEY!,
|
|
5699
6215
|
* accountId: process.env.ASSINAFY_ACCOUNT_ID!,
|
|
5700
|
-
* webhookSecret: process.env.ASSINAFY_WEBHOOK_SECRET
|
|
6216
|
+
* webhookSecret: process.env.ASSINAFY_WEBHOOK_SECRET!,
|
|
5701
6217
|
* });
|
|
5702
6218
|
*
|
|
5703
6219
|
* const document = await client.documents.upload({ filePath: './contract.pdf' });
|
|
@@ -5878,7 +6394,10 @@ declare class AssinafyClient {
|
|
|
5878
6394
|
* the upload is empty / non-PDF / larger than 25 MB, or `waitForReady` is
|
|
5879
6395
|
* enabled and processing exceeds the {@link DocumentResource.waitUntilReady}
|
|
5880
6396
|
* timeout.
|
|
5881
|
-
* @throws {ApiError} If any underlying API call is rejected
|
|
6397
|
+
* @throws {ApiError} If any underlying API call is rejected — see the
|
|
6398
|
+
* `@throws` of {@link DocumentResource.upload}, {@link SignerResource.create},
|
|
6399
|
+
* {@link AssignmentResource.create}, and
|
|
6400
|
+
* {@link DocumentResource.waitUntilReady} for the per-step statuses.
|
|
5882
6401
|
*
|
|
5883
6402
|
* @example
|
|
5884
6403
|
* ```ts
|
|
@@ -5965,7 +6484,16 @@ interface IAuthenticateChallenge {
|
|
|
5965
6484
|
*
|
|
5966
6485
|
* @param value - Raw header value, or `undefined` when absent.
|
|
5967
6486
|
* @returns The parsed challenge, or `undefined` when there is no header or it
|
|
5968
|
-
* carries no scheme.
|
|
6487
|
+
* carries no scheme. Malformed input never throws; it yields `undefined` or a
|
|
6488
|
+
* scheme-only challenge.
|
|
6489
|
+
*
|
|
6490
|
+
* @example
|
|
6491
|
+
* ```ts
|
|
6492
|
+
* const challenge = parseWwwAuthenticate(
|
|
6493
|
+
* 'Bearer error="insufficient_scope", scope="documents:read"',
|
|
6494
|
+
* );
|
|
6495
|
+
* // → { scheme: 'Bearer', error: 'insufficient_scope', scope: 'documents:read' }
|
|
6496
|
+
* ```
|
|
5969
6497
|
*/
|
|
5970
6498
|
declare function parseWwwAuthenticate(value: string | undefined): IAuthenticateChallenge | undefined;
|
|
5971
6499
|
|
|
@@ -6033,7 +6561,9 @@ declare class ApiError extends AssinafyError {
|
|
|
6033
6561
|
* ones with no structured body to explain them. Anything else falls back to
|
|
6034
6562
|
* the stable message.
|
|
6035
6563
|
* @returns An `ApiError` retaining the original response body in
|
|
6036
|
-
* {@link ApiError.responseData}
|
|
6564
|
+
* {@link ApiError.responseData}. A JSON `message` is used verbatim; only an
|
|
6565
|
+
* unstructured text body is whitespace-collapsed and truncated for
|
|
6566
|
+
* legibility.
|
|
6037
6567
|
*
|
|
6038
6568
|
* @example
|
|
6039
6569
|
* ```ts
|
|
@@ -6093,6 +6623,16 @@ declare class OAuthError extends ApiError {
|
|
|
6093
6623
|
* @param error - Any thrown value.
|
|
6094
6624
|
* @returns An `OAuthError` when the body carries a non-empty string
|
|
6095
6625
|
* `error`, else the original value.
|
|
6626
|
+
*
|
|
6627
|
+
* @example
|
|
6628
|
+
* ```ts
|
|
6629
|
+
* const apiError = ApiError.fromResponse(400, {
|
|
6630
|
+
* error: 'invalid_grant',
|
|
6631
|
+
* error_description: 'The provided authorization grant is invalid.',
|
|
6632
|
+
* });
|
|
6633
|
+
* const upgraded = OAuthError.upgrade(apiError);
|
|
6634
|
+
* // upgraded instanceof OAuthError → true, .error → 'invalid_grant'
|
|
6635
|
+
* ```
|
|
6096
6636
|
*/
|
|
6097
6637
|
static upgrade(error: unknown): unknown;
|
|
6098
6638
|
}
|