### Initialize and Use SignWell SDK (TypeScript) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Demonstrates how to initialize the SignWell TypeScript SDK with an API key and perform an initial operation, such as deleting an API application. This setup is crucial for interacting with the SignWell API. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ // Defining the base path is optional and defaults to https://www.signwell.com // basePath: "https://www.signwell.com", apiKey: "API_KEY", }); const deleteByIdResponse = await signwell.apiApplication.deleteById({ id: "id_example", }); console.log(deleteByIdResponse); ``` -------------------------------- ### Create New Template (TypeScript) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md This code example shows how to create a new template using the `createNew` method. It requires specifying details such as files, placeholders, and various options like reminders and redirect URLs. The function returns a response object detailing the newly created template. ```typescript const createNewResponse = await signwell.template.createNew({ files: [ { name: "name_example", }, ], placeholders: [ { id: "id_example", name: "name_example", }, ], draft: false, reminders: true, apply_signing_order: false, text_tags: false, allow_decline: true, allow_reassign: true, }); ``` -------------------------------- ### Get Completed Document PDF Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves the completed document as a PDF. You can specify whether to get a URL only or include an audit page. ```APIDOC ## GET /api/v1/documents/{id}/completed_pdf ### Description Gets a completed document PDF. Supply the unique document ID from either a document creation request or document page URL. ### Method GET ### Endpoint /api/v1/documents/{id}/completed_pdf ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the document. #### Query Parameters - **urlOnly** (boolean) - Optional - If true, returns only the URL to the PDF. Defaults to false. - **auditPage** (boolean) - Optional - If true, includes an audit page in the PDF. Defaults to false. ### Response #### Success Response (200) - **DocumentGetCompletedPdfResponse** (object) - The response object containing the completed document PDF or its URL. ``` -------------------------------- ### GET /api/v1/bulk_sends/csv_template (Get CSV Template) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Fetches a CSV template corresponding to the provided document template IDs. This template can be used to structure data for bulk sending. ```APIDOC ## GET /api/v1/bulk_sends/csv_template ### Description Fetches a CSV template that corresponds to the provided document template IDs. CSV templates are blank CSV files that have columns containing required and optional data that can be sent when creating a bulk send. Fields can be referenced by the field label. Example: [placeholder name]_[field label] could be something like customer_address or signer_company_name (if "Customer" and "Signer" were placeholder names for templates set up in SignWell). ### Method GET ### Endpoint /api/v1/bulk_sends/csv_template ### Parameters #### Query Parameters - **templateIds** (string[]) - Required - Unique identifiers for a list of templates. - **base64** (string) - Optional - If set to `true`, the CSV content will be returned as a base64 encoded string. ### Request Example ```json { "templateIds": ["templateIds_example"] } ``` ### Response #### Success Response (200) - **Response Body** (object) - The CSV template content or a base64 encoded string of the CSV template. #### Response Example ```json { "data": "template_id,signer_name,signer_email\n" } ``` ``` -------------------------------- ### Get API Application Details with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Fetches details for a specific API application using its ID. The output includes the application's name, owner's information (name and email), creation date, and preferences. Useful for managing integrations. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const appId = "app_123xyz"; const application = await signwell.apiApplication.getDetails({ id: appId }); console.log(`Application: ${application.data.name}`); console.log(`Owner: ${application.data.owner.name} (${application.data.owner.email})`); console.log(`Created: ${application.data.created_at}`); console.log(`Preferences:`, application.data.preferences); } catch (error) { console.error("Error fetching API application:", error.response?.data || error.message); } ``` -------------------------------- ### Get All Webhooks TypeScript Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves a list of all registered webhooks in the account. This operation does not require any parameters and interacts with the `/api/v1/hooks` endpoint using the GET HTTP method. ```typescript const getAllResponse = await signwell.webhooks.getAll(); ``` -------------------------------- ### SignWell API Application Get Details Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Gets the details of a specific API Application within an account. Supply the unique Application ID from either the Create API Application response or the API Application edit page. ```APIDOC ## GET /api/v1/api_applications/{id} ### Description Gets the details of a specific API Application within an account. Supply the unique Application ID from either the Create API Application response or the API Application edit page. ### Method GET ### Endpoint /api/v1/api_applications/{id} #### Path Parameters - **id** (string) - Required - The unique ID of the API Application to retrieve details for. ### Response #### Success Response (200) - **id** (string) - The unique ID of the API Application. - **name** (string) - The name of the API Application. - **created_at** (string) - The timestamp when the API Application was created. - **updated_at** (string) - The timestamp when the API Application was last updated. #### Response Example ```json { "id": "app_12345", "name": "My Application", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### GET /api/v1/me Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves the account information associated with the API key being used. ```APIDOC ## GET /api/v1/me ### Description Retrieves the account information associated with the API key being used. ### Method GET ### Endpoint /api/v1/me ### Parameters (No parameters are required for this endpoint.) ### Request Example ```typescript const getAccountInfoResponse = await signwell.me.getAccountInfo(); ``` ### Response #### Success Response (200) (Response details for `MeGetAccountInfoResponse` are not fully described in the input text.) #### Response Example (Response example not provided in the input text.) ``` -------------------------------- ### GET /api/v1/bulk_sends/{id} (Get Bulk Send Information) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves detailed information about a specific Bulk Send. This includes its status, creation date, and other relevant metadata. ```APIDOC ## GET /api/v1/bulk_sends/{id} ### Description Returns information about the Bulk Send. ### Method GET ### Endpoint /api/v1/bulk_sends/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the Bulk Send. ### Request Example ```json { "id": "id_example" } ``` ### Response #### Success Response (200) - **Response Body** (object) - Detailed information about the specified Bulk Send. #### Response Example ```json { "data": { "bulk_send_id": "bks_abcdef1234567890", "name": "Q1 2024 Sales", "status": "completed", "created_at": "2024-01-15T10:30:00Z" } } ``` ``` -------------------------------- ### Get Account Information with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Retrieves detailed information about the authenticated SignWell account. This includes the account name, email, subscription plan, remaining documents, and team member count. Essential for understanding account status and limits. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const account = await signwell.me.getAccountInfo(); console.log(`Account: ${account.data.name}`); console.log(`Email: ${account.data.email}`); console.log(`Plan: ${account.data.plan}`); console.log(`Documents remaining: ${account.data.documents_remaining}`); console.log(`Team members: ${account.data.team_members_count}`); } catch (error) { console.error("Error fetching account info:", error.response?.data || error.message); } ``` -------------------------------- ### GET /api/v1/bulk_sends/{id}/documents (Get Bulk Send Documents) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves information about the documents associated with a specific Bulk Send. Allows for paginated results and limiting the number of documents returned. ```APIDOC ## GET /api/v1/bulk_sends/{id}/documents ### Description Returns information about the Bulk Send documents. ### Method GET ### Endpoint /api/v1/bulk_sends/{id}/documents ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the Bulk Send. #### Query Parameters - **limit** (number) - Optional - The maximum number of documents to return per page. Defaults to 10. - **page** (number) - Optional - The page number of the results to retrieve. Defaults to 1. ### Request Example ```json { "id": "id_example", "limit": 10, "page": 1 } ``` ### Response #### Success Response (200) - **Response Body** (object) - A paginated list of documents associated with the Bulk Send. #### Response Example ```json { "data": [ { "document_id": "doc_abcdef1234567890", "status": "completed" } ], "meta": { "total": 50, "limit": 10, "page": 1, "totalPages": 5 } } ``` ``` -------------------------------- ### GET /api/v1/hooks Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves a list of all registered webhooks associated with the account. This endpoint allows users to view all active callback URLs. ```APIDOC ## GET /api/v1/hooks ### Description Retrieves a list of all webhooks currently registered for your account. This allows you to view all active callback URLs that are receiving document events. ### Method GET ### Endpoint /api/v1/hooks ### Parameters None ### Response #### Success Response (200) - **WebhooksGetAllResponseInner** - An array of webhook objects, each containing details of a registered callback URL. ### Response Example ```json [ { "id": "hook_abc123", "callback_url": "https://example.com/webhook", "api_application_id": "app_xyz789" } ] ``` ``` -------------------------------- ### GET /api/v1/document_templates/{id} Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Returns a template and all associated template data. Supply the unique template ID from either a Create Template request or template page URL. ```APIDOC ## GET /api/v1/document_templates/{id} ### Description Returns a template and all associated template data. Supply the unique template ID from either a Create Template request or template page URL. ### Method GET ### Endpoint /api/v1/document_templates/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique ID of the template to retrieve. ### Request Example ```typescript const getTemplateDataResponse = await signwell.template.getTemplateData({ id: "id_example", }); ``` ### Response #### Success Response (200) - **TemplateGetTemplateDataResponse** - The response object containing the template data. ### Response Example { "example": "TemplateGetTemplateDataResponse object" } ``` -------------------------------- ### Get Bulk Send Documents with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Retrieves a list of documents associated with a specific bulk send using the SignWell TypeScript SDK. It allows for pagination and returns details for each document, including its name, ID, status, and recipient information. Requires the 'sign-well-typescript-sdk' package. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const bulkSendId = "bulk_abc123xyz"; const documents = await signwell.bulkSend.getDocuments({ id: bulkSendId, limit: 50, page: 1, }); console.log(`Total documents: ${documents.data.total}`); documents.data.documents.forEach(doc => { console.log(` ${doc.name} (${doc.id})`); console.log(` Status: ${doc.status}`); console.log(` Recipients: ${doc.recipients.map(r => r.name).join(", ")}`); }); } catch (error) { console.error("Error fetching bulk send documents:", error.response?.data || error.message); } ``` -------------------------------- ### Get Document Details using SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Fetches detailed information about a specific document, including its status, creation date, test mode status, and recipient details. It requires a valid API key and document ID. Outputs document name, status, creation timestamp, test mode status, and individual recipient statuses. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const documentId = "8f3c4e12-a9b7-4d5e-9c8f-1234567890ab"; const document = await signwell.document.getDocumentData({ id: documentId }); console.log(`Document: ${document.data.name}`); console.log(`Status: ${document.data.status}`); // pending, awaiting_signature, completed, cancelled console.log(`Created: ${document.data.created}`); console.log(`Test Mode: ${document.data.test_mode}`); // Check recipient status document.data.recipients.forEach(recipient => { console.log(`${recipient.name} (${recipient.email}): ${recipient.status}`); if (recipient.signed_on) { console.log(` Signed on: ${recipient.signed_on}`); } }); // Access custom metadata if (document.data.metadata) { console.log("Metadata:", document.data.metadata); } } catch (error) { console.error("Error fetching document:", error.response?.data || error.message); } ``` -------------------------------- ### Get Template Data - TypeScript Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves a template and its associated data using the template's unique ID. This function takes the template ID as a string parameter and performs a GET request. It returns a TemplateGetTemplateDataResponse object containing the template details. ```typescript const getTemplateDataResponse = await signwell.template.getTemplateData({ id: "id_example", }); ``` -------------------------------- ### Get Completed Document PDF using SignWell SDK Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md This function retrieves the completed PDF of a document. You need to provide the document's unique ID. Optional parameters include `urlOnly` to get a URL instead of the PDF data, and `auditPage` to include an audit trail page. The function returns a response object containing the PDF data or URL. ```typescript const getCompletedPdfResponse = await signwell.document.getCompletedPdf({ id: "id_example", urlOnly: false, auditPage: true, }); ``` -------------------------------- ### Get API Application Details by ID (TypeScript) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves the details of a specific API Application by providing its unique ID. This function is essential for inspecting existing API applications. Ensure the SDK is properly initialized with valid credentials. ```typescript const getDetailsResponse = await signwell.apiApplication.getDetails({ id: "id_example", }); ``` -------------------------------- ### GET /api/v1/bulk_sends/{id} Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves information about a specific Bulk Send using its ID. ```APIDOC ## GET /api/v1/bulk_sends/{id} ### Description Retrieves information about a specific Bulk Send using its ID. ### Method GET ### Endpoint `/api/v1/bulk_sends/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Bulk Send to retrieve. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **BulkSendListBulkSendingsResponse** - Detailed response object for a list of bulk sends. #### Response Example ```json { "example": "" } ``` ``` -------------------------------- ### Get Bulk Send Details with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Fetches detailed information about a specific bulk send using its ID with the SignWell TypeScript SDK. The retrieved details include the bulk send's name, status, progress, creation date, and associated templates. Requires the 'sign-well-typescript-sdk' package. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const bulkSendId = "bulk_abc123xyz"; const bulkSend = await signwell.bulkSend.getInformation({ id: bulkSendId }); console.log(`Bulk Send: ${bulkSend.data.name}`); console.log(`Status: ${bulkSend.data.status}`); console.log(`Progress: ${bulkSend.data.completed_count}/${bulkSend.data.document_count}`); console.log(`Created: ${bulkSend.data.created_at}`); bulkSend.data.templates.forEach(template => { console.log(` Template: ${template.name} (${template.id})`); }); } catch (error) { console.error("Error fetching bulk send:", error.response?.data || error.message); } ``` -------------------------------- ### Get Bulk Send Information - TypeScript Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Fetches general information about a specific Bulk Send. This function requires the Bulk Send ID and returns details pertaining to the overall bulk send operation. ```typescript const getInformationResponse = await signwell.bulkSend.getInformation({ id: "id_example", }); ``` -------------------------------- ### Get Bulk Send Documents - TypeScript Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves information about documents associated with a specific Bulk Send. This function requires the Bulk Send ID and allows for pagination using 'limit' and 'page' parameters to manage the returned list of documents. ```typescript const getDocumentsResponse = await signwell.bulkSend.getDocuments({ id: "id_example", limit: 10, page: 1, }); ``` -------------------------------- ### Generate SignWell Bulk Send CSV Template using TypeScript Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Generates a CSV template for bulk sending documents using multiple SignWell templates. This function takes an array of template IDs and returns a base64 encoded CSV file. The CSV can then be populated with recipient and document-specific data for mass distribution. The code decodes the CSV and saves it to a local file, logging example headers. ```typescript import { SignWell } from "sign-well-typescript-sdk"; import * as fs from "fs"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const templateIds = [ "5a67dbd7-928a-4ea0-a7e2-e476a0eb045f", "d7315111-c671-4b15-8354-c9a19bbaefa0" ]; const csvTemplate = await signwell.bulkSend.getCsvTemplate({ templateIds: templateIds, base64: "true", // Get base64 encoded CSV }); // Decode and save CSV template const csvContent = Buffer.from(csvTemplate.data.csv, 'base64').toString('utf-8'); fs.writeFileSync('bulk_send_template.csv', csvContent); console.log("CSV template downloaded"); console.log("Column headers:", csvContent.split('\n')[0]); // Example headers: client_name,client_email,client_company_name,signer_name,signer_email } catch (error) { console.error("Error fetching CSV template:", error.response?.data || error.message); } ``` -------------------------------- ### Get Document Data using SignWell SDK Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md This function retrieves a document along with all its associated data. It requires the document's unique ID. The returned data includes information about the document, its fields, recipients, and other relevant details. The function returns a response object containing the document data. ```typescript const getDocumentDataResponse = await signwell.document.getDocumentData({ id: "id_example", }); ``` -------------------------------- ### Initialize SignWell SDK Client (TypeScript) Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Initializes the SignWell SDK client with an API key and optional base path. This client provides access to various SignWell API groups for managing documents, templates, and more. Dependencies include the 'sign-well-typescript-sdk' package. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY", basePath: "https://www.signwell.com" // Optional, defaults to production }); // The client provides access to six main API groups: // - signwell.document: Document creation and management // - signwell.template: Template operations // - signwell.bulkSend: Bulk sending operations // - signwell.webhooks: Webhook management // - signwell.apiApplication: API application settings // - signwell.me: Account information ``` -------------------------------- ### Create New Document from Scratch (TypeScript) Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Creates a new document from scratch using the SignWell SDK. This method requires document details, file content (base64 encoded), and recipient information. It supports test mode, draft saving, field placement, reminders, and expiration settings. Error handling for API requests is included. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const document = await signwell.document.createNewDocument({ test_mode: true, // Set to false for production name: "Service Agreement", subject: "Please sign this service agreement", message: "Review and sign the attached agreement at your convenience.", draft: false, // Set to true to save as draft without sending files: [ { name: "agreement.pdf", file_base64: "JVBERi0xLjQKJeLjz9MKMSAwIG9iag...", // Base64 encoded PDF } ], recipients: [ { id: "1", name: "John Doe", email: "john@example.com", send_email: true, send_email_delay: 0, // Send immediately }, { id: "2", name: "Jane Smith", email: "jane@example.com", send_email: true, send_email_delay: 0, } ], fields: [ [ // Fields for first file { type: "signature", page: 1, x: 100, y: 500, width: 200, height: 50, recipient_id: "1", required: true, }, { type: "text", page: 1, x: 100, y: 400, width: 200, height: 30, recipient_id: "1", required: true, label: "Company Name", } ] ], reminders: true, // Send reminders on day 3, 6, and 10 expires_in: 30, // Expires in 30 days allow_decline: true, allow_reassign: true, }); console.log(`Document created with ID: ${document.data.id}`); console.log(`Status: ${document.data.status}`); console.log(`Signing URL: ${document.data.recipients[0].signing_url}`); } catch (error) { console.error("Error creating document:", error.response?.data || error.message); } ``` -------------------------------- ### signwell.template.createNew Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Creates a new template with specified files, placeholders, and settings. Supports various configurations for document flow, reminders, and expiration. ```APIDOC ## POST /api/v1/templates ### Description Creates a new template with specified files, placeholders, and settings. Supports various configurations for document flow, reminders, and expiration. ### Method POST ### Endpoint /api/v1/templates ### Parameters #### Request Body - **files** (array of FilesMapInner) - Required - The files to be used in the template. - **placeholders** (array of PlaceholdersMapInner) - Required - Placeholders are generally job roles that must complete and/or sign the document. For example, a placeholder might be “Client” or “Legal Department”. When a document is created from the template, you assign a person to each placeholder. - **name** (string) - Required - The name of the template. - **subject** (string) - Optional - Email subject for the signature request that recipients will see. Defaults to the default system subject or a template subject (if the document is created from a template). - **message** (string) - Optional - Email message for the signature request that recipients will see. Defaults to the default system message or a template message (if the document is created from a template). - **copied_placeholders** (array of CopiedPlaceholdersMapInner) - Optional - Copied placeholders are emailed the final document once it has been completed by all recipients. - **draft** (boolean) - Optional - Whether the template can still be updated before it is ready for usage. If set to `false` the template is marked as `Available` and it will be ready for use. Defaults to `false`. - **expires_in** (number) - Optional - Number of days before the signature request expires. Defaults to the account expiration setting or template expiration (if the document is created from a template). - **reminders** (boolean) - Optional - Whether to send signing reminders to recipients. Reminders are sent on day 3, day 6, and day 10 if set to `true`. Defaults to `true`. - **apply_signing_order** (boolean) - Optional - When set to `true` recipients will sign one at a time in the order of the `recipients` collection of this request. - **api_application_id** (string) - Optional - Unique identifier for API Application settings to use. API Applications are optional and mainly used when isolating OAuth apps or for more control over embedded API settings - **text_tags** (boolean) - Optional - An alternative way (if you can’t use the recommended way) of placing fields in specific locations of your document by using special text tags. Useful when changing the content of your files changes the location of fields. See API documentation for “Text Tags” for details. Defaults to false. - **redirect_url** (string) - Optional - A URL that recipients are redirected to after successfully signing a document. - **allow_decline** (boolean) - Optional - Whether to allow recipients the option to decline signing a document. If multiple signers are involved in a document, any single recipient can cancel the entire document signing process by declining to sign. - **allow_reassign** (boolean) - Optional - Whether to allow recipients the option to reassign the signing task to another person. ### Request Example ```json { "files": [ { "name": "name_example" } ], "placeholders": [ { "id": "id_example", "name": "name_example" } ], "name": "Template Name", "subject": "Please Sign", "message": "Please review and sign this document.", "copied_placeholders": [], "draft": false, "expires_in": 10, "reminders": true, "apply_signing_order": false, "api_application_id": "app_id_example", "text_tags": false, "redirect_url": "https://example.com/signed", "allow_decline": true, "allow_reassign": true } ``` ### Response #### Success Response (200) (Response details not provided in the input text.) #### Response Example (Response example not provided in the input text.) ``` -------------------------------- ### Retrieve Account Information (TypeScript) Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md This snippet demonstrates how to fetch account details using the `getAccountInfo` method. It requires an initialized SignWell SDK instance and an active API key. The response contains information about the authenticated account. ```typescript const getAccountInfoResponse = await signwell.me.getAccountInfo(); ``` -------------------------------- ### Document Creation Options Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Configure the behavior and appearance of a document during the signing process. ```APIDOC ## Document Creation Options This section details the optional parameters that can be provided when creating or sending a document using the SignWell TypeScript SDK to customize the signing experience. ### Parameters #### Request Body Parameters - **with_signature_page** (boolean) - Optional - When set to `true` the document will have a signature page added to the end, and all signers will be required to add their signature on that page. - **expires_in** (number) - Optional - Number of days before the signature request expires. Defaults to the account expiration setting or template expiration (if the document is created from a template). - **reminders** (boolean) - Optional - Whether to send signing reminders to recipients. Reminders are sent on day 3, day 6, and day 10 if set to `true`. Defaults to `true`. - **apply_signing_order** (boolean) - Optional - When set to `true` recipients will sign one at a time in the order of the `recipients` collection of this request. - **api_application_id** (string) - Optional - Unique identifier for API Application settings to use. API Applications are optional and mainly used when isolating OAuth apps or for more control over embedded API settings. - **embedded_signing** (boolean) - Optional - When set to `true` it enables embedded signing in your website/web application. Embedded functionality works with an iFrame and email authentication is disabled. Defaults to `false`. - **embedded_signing_notifications** (boolean) - Optional - On embedding signing, document owners (and CC'd contacts) do not get a notification email when documents have been completed. Setting this param to `true` will send out those final completed notifications. Default is `false`. - **text_tags** (boolean) - Optional - An alternative way of placing fields in specific locations of your document by using special text tags. Useful when changing the content of your files changes the location of fields. Defaults to `false`. - **custom_requester_name** (string) - Optional - Sets the custom requester name for the document. When set, this is the name used for all email communications, signing notifications, and in the audit file. - **custom_requester_email** (string) - Optional - Sets the custom requester email for the document. When set, this is the email used for all email communications, signing notifications, and in the audit file. - **redirect_url** (string) - Optional - A URL that recipients are redirected to after successfully signing a document. - **allow_decline** (boolean) - Optional - Whether to allow recipients the option to decline signing a document. If multiple signers are involved in a document, any single recipient can cancel the entire document signing process by declining to sign. - **allow_reassign** (boolean) - Optional - Allows a signer to reassign their signing responsibilities to another person. - **decline_redirect_url** (string) - Optional - A URL that recipients are redirected to if the document is declined. - **metadata** (object) - Optional - Optional key-value data that can be associated with the document. If set, will be available every time the document data is returned. - **template_fields** (Array of TemplateFieldsMapInner) - Optional - Fields of your template(s) that you can prepopulate with values. Signature and Initials fields cannot be signed through the API. - **files** (Array of AdditionalFilesMapInner) - Optional - Files to be uploaded for the document. - **fields** (Array of Array of AdditionalFieldsMapInnerInner) - Optional - Fields to be added to any appended files (not existing files). Document fields placed on a document for collecting data or signatures from recipients. Field data should be sent as a 2-dimensional JSON array. One array of fields is needed for each file in the files array. An array of fields can be empty if you have a file that does not contain any fields. - **attachment_requests** (Array of AttachmentRequestsMapInner) - Optional - Attachments that a recipient must upload to complete the signing process. Attachment requests are shown after all document fields have been completed. ### Example Usage (Illustrative Request Body) ```json { "with_signature_page": true, "expires_in": 7, "reminders": false, "apply_signing_order": true, "api_application_id": "app_12345", "embedded_signing": true, "embedded_signing_notifications": true, "text_tags": false, "custom_requester_name": "John Doe", "custom_requester_email": "john.doe@example.com", "redirect_url": "https://example.com/signed", "allow_decline": true, "allow_reassign": true, "decline_redirect_url": "https://example.com/declined", "metadata": { "order_id": "ORD-98765" }, "template_fields": [ { "template_id": "tmpl_abcde", "field_id": "field_123", "value": "Pre-filled Value" } ], "files": [ { "file_url": "https://example.com/document.pdf", "file_name": "document.pdf" } ], "fields": [ [ { "type": "SIGNER", "x": 100, "y": 200, "width": 100, "height": 50, "signer": 0 } ] ], "attachment_requests": [ { "name": "Proof of Identity", "required": true, "allow_upload_by_recipient": true } ] } ``` ``` -------------------------------- ### List Webhooks with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Fetches a list of all registered webhooks associated with the account. It iterates through the results and logs the ID, callback URL, and creation timestamp for each webhook. Handles potential errors during the fetch operation. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const webhooks = await signwell.webhooks.getAll(); console.log(`Total webhooks: ${webhooks.data.length}`); webhooks.data.forEach(webhook => { console.log(`\nWebhook ID: ${webhook.id}`); console.log(` URL: ${webhook.callback_url}`); console.log(` Created: ${webhook.created_at}`); }); } catch (error) { console.error("Error fetching webhooks:", error.response?.data || error.message); } ``` -------------------------------- ### Create New Document with SignWell SDK Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md This TypeScript code snippet demonstrates how to create and send a new document for signing using the `createNewDocument` function. It includes configuration for files, recipients, test mode, and various signing options. The function returns a `DocumentCreateFromTemplateResponse`. ```typescript const createNewDocumentResponse = await signwell.document.createNewDocument({ test_mode: false, files: [ { name: "name_example", }, ], recipients: [ { id: "id_example", email: "email_example", send_email: false, send_email_delay: 0, }, ], draft: false, with_signature_page: false, reminders: true, apply_signing_order: false, embedded_signing: false, embedded_signing_notifications: false, text_tags: false, allow_decline: true, allow_reassign: true, }); ``` -------------------------------- ### Create Document Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Creates a new document with specified properties and fields. This endpoint allows for detailed configuration of the document, including custom requester emails, redirect URLs, signing options, metadata, fields, attachment requests, and copied contacts. ```APIDOC ## POST /api/v1/documents ### Description Creates a new document with specified properties and fields. This endpoint allows for detailed configuration of the document, including custom requester emails, redirect URLs, signing options, metadata, fields, attachment requests, and copied contacts. ### Method POST ### Endpoint /api/v1/documents ### Parameters #### Request Body - **custom_requester_email** (string) - Optional - Sets the custom requester email for the document. When set, this is the email used for all email communications, signing notifications, and in the audit file. - **redirect_url** (string) - Optional - A URL that recipients are redirected to after successfully signing a document. - **allow_decline** (boolean) - Optional - Whether to allow recipients the option to decline signing a document. If multiple signers are involved in a document, any single recipient can cancel the entire document signing process by declining to sign. - **allow_reassign** (boolean) - Optional - In some cases a signer is not the right person to sign and may need to reassign their signing responsibilities to another person. This feature allows them to reassign the document to someone else. - **decline_redirect_url** (string) - Optional - A URL that recipients are redirected to if the document is declined. - **metadata** (object) - Optional - Optional key-value data that can be associated with the document. If set, will be available every time the document data is returned. - **fields** (object[][]) - Optional - Document fields placed on a document for collecting data or signatures from recipients. At least one field must be present in the Create Document request if `draft` is `false` (unless adding a signature page by using `with_signature_page`). Field data should be sent as a 2-dimensional JSON array. One array of fields is needed for each file in the files array. An array of fields can be empty if you have a file that does not contain any fields. - **attachment_requests** (object[]) - Optional - Attachments that a recipient must upload to complete the signing process. Attachment requests are shown after all document fields have been completed. - **copied_contacts** (object[]) - Optional - Copied contacts are emailed the final document once it has been completed by all recipients. ### Response #### Success Response (200) - **DocumentCreateNewDocumentResponse** (object) - The response object containing details of the newly created document. ``` -------------------------------- ### Create SignWell Template using TypeScript Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Creates a new document template in SignWell. This involves defining template name, subject, message, associated files with base64 content, placeholder roles, and field placements. The SDK handles the API call, returning the created template's ID and status upon success. Error handling for API communication is included. ```typescript import { SignWell } from "sign-well-typescript-sdk"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const template = await signwell.template.createNew({ name: "Standard NDA Template", subject: "Please sign our NDA", message: "Review and sign the attached Non-Disclosure Agreement.", files: [ { name: "nda.pdf", file_base64: "JVBERi0xLjQKJeLjz9MKMSAwIG9iag...", } ], placeholders: [ { id: "client", name: "Client", role: "signer", }, { id: "company_rep", name: "Company Representative", role: "signer", } ], fields: [ [ { type: "signature", page: 1, x: 100, y: 500, width: 200, height: 50, placeholder_id: "client", required: true, }, { type: "text", page: 1, x: 100, y: 400, width: 200, height: 30, placeholder_id: "client", required: true, label: "Company Name", api_id: "company_name_field", // For programmatic access }, { type: "signature", page: 2, x: 100, y: 500, width: 200, height: 50, placeholder_id: "company_rep", required: true, } ] ], draft: false, // Mark as available for use reminders: true, expires_in: 30, allow_decline: true, }); console.log(`Template created with ID: ${template.data.id}`); console.log(`Template status: ${template.data.status}`); } catch (error) { console.error("Error creating template:", error.response?.data || error.message); } ``` -------------------------------- ### Get Document Data Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Retrieves a document along with all its associated data. Requires the unique document ID. ```APIDOC ## GET /api/v1/documents/{id} ### Description Returns a document and all associated document data. Supply the unique document ID from either a document creation request or Document page URL. ### Method GET ### Endpoint /api/v1/documents/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the document. ### Response #### Success Response (200) - **DocumentGetDocumentDataResponse** (object) - The response object containing the document and its data. ``` -------------------------------- ### Create Bulk Send with SignWell TypeScript SDK Source: https://context7.com/konfig-sdks/sign-well-typescript-sdk/llms.txt Creates a bulk send job using the SignWell TypeScript SDK. This function takes a CSV file (encoded in base64), template IDs, and other optional parameters like subject, message, and error handling preferences. It returns the ID and status of the newly created bulk send. Requires the 'sign-well-typescript-sdk' package and the 'fs' module. ```typescript import { SignWell } from "sign-well-typescript-sdk"; import * as fs from "fs"; const signwell = new SignWell({ apiKey: "YOUR_API_KEY" }); try { const csvContent = fs.readFileSync('bulk_send_data.csv'); const csvBase64 = csvContent.toString('base64'); const bulkSend = await signwell.bulkSend.createValidationCsv({ name: "Q1 2025 Client Agreements", template_ids: ["5a67dbd7-928a-4ea0-a7e2-e476a0eb045f"], bulk_send_csv: csvBase64, subject: "Please sign your agreement", message: "Review and sign the attached agreement.", skip_row_errors: false, // Fail if any row has errors apply_signing_order: false, test_mode: false, }); console.log(`Bulk send created with ID: ${bulkSend.data.id}`); console.log(`Status: ${bulkSend.data.status}`); console.log(`Documents to be created: ${bulkSend.data.document_count}`); } catch (error) { if (error.response?.status === 422) { console.error("CSV validation errors:", error.response.data.errors); } else { console.error("Error:", error.response?.data || error.message); } } ``` -------------------------------- ### signwell.bulkSend.listBulkSendings Source: https://github.com/konfig-sdks/sign-well-typescript-sdk/blob/main/README.md Fetches a list of bulk sendings with optional pagination and filtering. ```APIDOC ## GET /api/v1/bulk_sends ### Description Fetches a list of bulk sendings with optional pagination and filtering. ### Method GET ### Endpoint `/api/v1/bulk_sends` ### Parameters #### Query Parameters - **userEmail** (string) - Optional - The email of the user to filter by. - **limit** (number) - Optional - The maximum number of results to return. - **page** (number) - Optional - The page number for pagination. - **apiApplicationId** (string) - Optional - The ID of the API application to filter by. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **BulkSendListBulkSendingsResponse** - Detailed response object for a list of bulk sends. #### Response Example ```json { "example": "" } ``` ```