### Install pandadoc-signing with npm Source: https://developers.pandadoc.com/docs/signing-session-embed Use this command to add the pandadoc-signing library to your project dependencies using npm. ```text npm install pandadoc-signing ``` -------------------------------- ### Install pandadoc-signing with Yarn Source: https://developers.pandadoc.com/docs/signing-session-embed Use this command to add the pandadoc-signing library to your project dependencies using Yarn. ```text yarn add pandadoc-signing ``` -------------------------------- ### Document Creation Response Example Source: https://developers.pandadoc.com/docs/create-and-send-document-fundamentals This is an example of the JSON response received after successfully creating a document. The `id` field is essential for subsequent API calls. ```json { "id": "BhVzRcxH9Z2LgfPPGXFUqo", "name": "My First Contract", "status": "document.uploaded", "date_created": "2025-08-15T10:30:00.000Z" } ``` -------------------------------- ### Dynamics Custom Sections Example Source: https://developers.pandadoc.com/docs/custom-dynamics-functions Fetches opportunity products and organizes them into sections based on product name for PandaDoc. It separates products starting with 'test' into one section and others into 'Another products'. ```javascript function opportunity_getProducts(entity) { var deferred = $.Deferred(); $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", url: encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/" + "OpportunitySet(guid'" + entity.OpportunityId + "')/product_opportunities?$expand=opportunity_products&$orderby=SequenceNumber"), beforeSend: function (xmlHttpRequest) { xmlHttpRequest.setRequestHeader("Accept", "application/json"); } }).then(function (result) { var items = []; var anotherProducts = []; //custom section items.push({ isSection: true, name: "Products that start with 'test'" }); result.d.results.map(function (op) { var product = { sku: op.OpportunityProductId, name: op.ProductDescription || (op.ProductId ? op.ProductId.Name : ""), price: parseFloat(op.PricePerUnit.Value), qty: parseFloat(op.Quantity), description: (op.opportunity_products && op.opportunity_products.Description) || op.Description || "", currency: op.TransactionCurrencyId.Name || "", custom_fields: {} }; if (product.name.startsWith('test')) { items.push(product); } else { anotherProducts.push(product); } }); if (anotherProducts.length > 0) { items.push({ isSection: true, name: "Another products" }); items = items.concat(anotherProducts); } deferred.resolve(items); }); return deferred.promise(); } ``` -------------------------------- ### Install pandadoc-editor using npm Source: https://developers.pandadoc.com/docs/editor-embed Install the pandadoc-editor library using npm. This is a prerequisite for using the editor in your application. ```text npm install --save pandadoc-editor ``` -------------------------------- ### Create Document with Passcode Verification Source: https://developers.pandadoc.com/docs/enable-verification Example of creating a document with a recipient configured for passcode verification before opening. Replace `template_uuid` and `role` with your specific values. ```json { "name": "One Signer with Recipient Verification", "template_uuid": "Pw3syYYAvTU2h3Tx6vqatG", "recipients": [ { "role": "Client", "first_name": "Signer", "last_name": "One", "email": "signer.one@example.com", "verification_settings": { "verification_place": "before_open", "passcode_verification": { "passcode": "SimpleCode1" } } } ] } ``` -------------------------------- ### Document Creation Failed Payload Example Source: https://developers.pandadoc.com/docs/webhook-events This example illustrates the payload structure when a document creation process fails, including error details. ```APIDOC ## Document Creation Failed Payload ```json [ { "event": "document_creation_failed", "data": { "id": "ptSNky6J4Q8yDh3QKwa7fZ", "error": { "type": "validation_error", "detail": "Role for form field with name='userName' is not provided in payload" } } } ] ``` ``` -------------------------------- ### Handle 'started' Event Payload Source: https://developers.pandadoc.com/docs/javascript-form-embed This payload is received when a user has entered contact details for all recipients and is about to review the document. ```javascript { recipients: [{ first_name: ‘John’, last_name: ‘Doe’, email: ‘johndoe@gmail.com’ }], } ``` -------------------------------- ### Document Event Payload Example Source: https://developers.pandadoc.com/docs/webhook-events This example shows the typical payload structure for document-related events, such as 'document_state_changed'. It includes detailed document information, recipient data, and status. ```json [ { "event": "document_state_changed", "data": { "id": "eHCjisfzWydzJnbqnBbvAj", "name": "My document for webhooks testing", "date_created": "2024-03-18T15:55:03.090372Z", "date_modified": "2024-03-18T16:26:46.286951Z", "expiration_date": "2024-05-17T16:26:45.583270Z", "autonumbering_sequence_name": null, "created_by": { "id": "uHfzrB4Goai39ZkxDRLpMo", "email": "test@pandadoc.com", "first_name": "Test", "last_name": "Test", "avatar": null, "membership_id": "vk5aRcJG4RTd2J83wNGFT5" }, "metadata": {}, "tokens": [], "fields": [], "products": [], "pricing": { "tables": [], "quotes": [], "merge_rules": [] }, "total": "130", "tags": [], "status": "document.completed", "recipients": [ { "id": "8KAZvGRL3W4u44a4fyDoeH", "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "recipient_type": "signer", "has_completed": true, "role": "Client", "roles": ["Client"], "type": "recipient", "shared_link": "https://app.pandadoc.com/document/15d4b481384b652a298530ddc7023bfc07a67d59" } ], "sent_by": { "id": "uHfzrB4Goai39ZkxDRLpMo", "email": "test@pandadoc.com", "first_name": "Test", "last_name": "Test", "avatar": null, "membership_id": "vk5aRcJG4RTd2J83wNGFT5" }, "grand_total": { "amount": "130.00", "currency": "USD" }, "template": { "id": "A9VkDBdjqn3HvRx7zyME3n", "name": "My template for webhooks testing" }, "version": "2", "linked_objects": [] } } ] ``` -------------------------------- ### Dynamics Products Example Source: https://developers.pandadoc.com/docs/custom-dynamics-functions Retrieves product details from an opportunity in Dynamics 365 for PandaDoc. This function fetches product SKU, name, price, quantity, description, and currency. ```javascript function opportunity_getProducts(entity) { var deferred = $.Deferred(); $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", dataType: "json", url: encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/" + "OpportunitySet(guid'" + entity.OpportunityId + "')/product_opportunities?$expand=opportunity_products"), beforeSend: function (xmlHttpRequest) { xmlHttpRequest.setRequestHeader("Accept", "application/json"); } }).then(function (result) { var items = result.d.results.map(function (op) { return { sku: op.OpportunityProductId, name: "Banana Product", price: parseFloat(op.PricePerUnit.Value), qty: parseFloat(op.Quantity), description: (op.opportunity_products && op.opportunity_products.Description ? op.opportunity_products.Description : op.Description) || "", currency: op.TransactionCurrencyId.Name || "", custom_fields: { // here would be your custom fields for pricing table, for example custom_field_1: "This is bananas!!!" } }; }); deferred.resolve(items); }); return deferred.promise(); } ``` -------------------------------- ### Document Event Payload Example Source: https://developers.pandadoc.com/docs/webhook-events This example shows the payload structure for a 'document_state_changed' event, including common document details. ```APIDOC ## Document Event Payload Most document events return data similar to the [Document Details](https://developers.pandadoc.com/reference/document-details) endpoint: ```json [ { "event": "document_state_changed", "data": { "id": "eHCjisfzWydzJnbqnBbvAj", "name": "My document for webhooks testing", "date_created": "2024-03-18T15:55:03.090372Z", "date_modified": "2024-03-18T16:26:46.286951Z", "expiration_date": "2024-05-17T16:26:45.583270Z", "autonumbering_sequence_name": null, "created_by": { "id": "uHfzrB4Goai39ZkxDRLpMo", "email": "test@pandadoc.com", "first_name": "Test", "last_name": "Test", "avatar": null, "membership_id": "vk5aRcJG4RTd2J83wNGFT5" }, "metadata": {}, "tokens": [], "fields": [], "products": [], "pricing": { "tables": [], "quotes": [], "merge_rules": [] }, "total": "130", "tags": [], "status": "document.completed", "recipients": [ { "id": "8KAZvGRL3W4u44a4fyDoeH", "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "recipient_type": "signer", "has_completed": true, "role": "Client", "roles": ["Client"], "type": "recipient", "shared_link": "https://app.pandadoc.com/document/15d4b481384b652a298530ddc7023bfc07a67d59" } ], "sent_by": { "id": "uHfzrB4Goai39ZkxDRLpMo", "email": "test@pandadoc.com", "first_name": "Test", "last_name": "Test", "avatar": null, "membership_id": "vk5aRcJG4RTd2J83wNGFT5" }, "grand_total": { "amount": "130.00", "currency": "USD" }, "template": { "id": "A9VkDBdjqn3HvRx7zyME3n", "name": "My template for webhooks testing" }, "version": "2", "linked_objects": [] } } ] ``` ``` -------------------------------- ### Install PandaDoc Editor Package Source: https://developers.pandadoc.com/docs/embedded-editing-e-token Install the PandaDoc Embedded Editor package using yarn. ```bash yarn add pandadoc-editor ``` -------------------------------- ### Example Feature Request Format Source: https://developers.pandadoc.com/docs/request-new-features Use this format when submitting a new feature request to clearly articulate the desired functionality, business justification, and technical details. ```plaintext Title: Improve Document Recipient Management via API Description: We need the API ability to add multiple CC recipients to existing documents. Business Case: - Reduces manual recipient management overhead - Enables dynamic stakeholder inclusion based on business rules - Streamlines notification workflows for large teams (e.g. when a document is updated) - Improves compliance by ensuring all relevant parties receive copies Current Limitation: Recipients (including CC recipients) can only be added during document creation via API. The current update document endpoint does not allow introducing new recipients after creation - they can only be added via the PandaDoc UI manually. Expected Behavior: Add an endpoint to modify document recipients after creation, allowing API consumers to add recipients to existing documents programmatically without requiring UI interaction. ``` -------------------------------- ### Create Document Request Body Source: https://developers.pandadoc.com/docs/create-with-content-placeholders-from-template Example of a request body for creating a document, including the `content_placeholders` array to specify content library items for specific blocks. ```APIDOC ## POST /public/v1/documents ### Description Creates a new document from a specified template and populates content placeholders. ### Method POST ### Endpoint /public/v1/documents ### Request Body - **name** (string) - Required - The name of the document. - **template_uuid** (string) - Required - The UUID of the template to use. - **recipients** (array) - Optional - A list of recipients for the document. - **email** (string) - Required - Recipient's email address. - **first_name** (string) - Required - Recipient's first name. - **last_name** (string) - Required - Recipient's last name. - **content_placeholders** (array) - Optional - An array of content placeholders to populate. - **block_id** (string) - Required - The ID of the block to populate. - **content_library_items** (array) - Required - An array of content library items to insert. - **id** (string) - Required - The ID of the content library item. - **pricing_tables** (array) - Optional - Pricing tables to include. - **name** (string) - Required - The name of the pricing table. - **options** (object) - Optional - Pricing table options. - **currency** (string) - Optional - The currency for the pricing table. - **discount** (object) - Optional - Discount details. - **is_global** (boolean) - Optional - Whether the discount is global. - **type** (string) - Optional - The type of discount (e.g., 'absolute'). - **name** (string) - Optional - The name of the discount. - **value** (number) - Optional - The value of the discount. - **sections** (array) - Optional - Sections within the pricing table. - **title** (string) - Required - The title of the section. - **default** (boolean) - Optional - Whether this is the default section. - **rows** (array) - Required - Rows within the section. - **options** (object) - Optional - Row options. - **optional** (boolean) - Optional - Whether the row is optional. - **optional_selected** (boolean) - Optional - Whether the optional row is selected. - **qty_editable** (boolean) - Optional - Whether the quantity is editable. - **data** (object) - Required - Data for the row. - **name** (string) - Required - The name of the item. - **price** (number) - Required - The price of the item. - **qty** (number) - Required - The quantity of the item. - **recipients** (array) - Optional - Recipients for this specific content library item. - **email** (string) - Required - Recipient's email address. - **first_name** (string) - Required - Recipient's first name. - **last_name** (string) - Required - Recipient's last name. - **role** (string) - Optional - Recipient's role. - **fields** (object) - Optional - Fields to pre-fill. - **field_name** (string) - Required - The name of the field. - **value** (string) - Required - The value to set for the field. ### Request Example ```json { "name": "API Sample Document for PandaDoc Template", "template_uuid": "{{template_id}}", "recipients": [ { "email": "jane@example.net", "first_name": "Jane", "last_name": "Roe" } ], "content_placeholders": [ { "block_id": "{{block_id}}", "content_library_items": [ { "id": "{{cli_id}}", "pricing_tables": [ { "name": "Pricing Table 1", "options": { "currency": "USD", "discount": { "is_global": true, "type": "absolute", "name": "Discount", "value": 2.26 } }, "sections": [ { "title": "Sample Section", "default": true, "rows": [ { "options": { "optional": true, "optional_selected": true, "qty_editable": true }, "data": { "name": "Placeholder Panda", "price": 10, "qty": 3 } } ] } ] } ] }, { "id": "{{cli_id_2}}", "recipients": [ { "email": "john@example.net", "first_name": "John", "last_name": "Roe", "role": "Signer" } ], "fields": { "Date": { "value": "2019-12-31T00:00:00.000Z" } } } ] } ] } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created document. - **name** (string) - The name of the created document. - **status** (string) - The current status of the document (e.g., `document.uploaded`). - **date_created** (string) - The date and time the document was created. - **date_modified** (string) - The date and time the document was last modified. - **uuid** (string) - The UUID of the document. #### Response Example ```json { "id": "YbyruETM8yzgMMaaLQa2RP", "name": "API Sample Document from PandaDoc Template", "status": "document.uploaded", "date_created": "2021-08-20T07:04:15.654510Z", "date_modified": "2021-08-20T07:04:15.654510Z", "uuid": "YbyruETM8yzgMMaaLQa2RP" } ``` ``` -------------------------------- ### Get Content Placeholder Details from Template Source: https://developers.pandadoc.com/docs/create-with-content-placeholders-from-template Retrieve details about content placeholders within a template, including their UUID, block ID, and description. This is useful for identifying placeholders programmatically. ```json { "content_placeholders": [ { "uuid": "a3293bbf-9109-4478-a875-8271e10a99e9", "block_id": "Content Placeholder 1", "description": "Click here to add content library items" } ] } ``` -------------------------------- ### Handle PandaDoc Signing Events with JavaScript Source: https://developers.pandadoc.com/docs/embedded-signing-legacy This example demonstrates how to listen for and handle events from an embedded PandaDoc signing session using JavaScript. It logs messages to the console for document loaded, completed, and exception events. Replace `{id}` with your session ID. ```html ``` -------------------------------- ### Handle PandaDoc Editor Events Source: https://developers.pandadoc.com/docs/pandadocjs Respond to document events in the browser by registering event handler functions. This example shows alerts for initialization and document sending, redirection on document creation, and console logging when the editor modal is closed. ```jsx events: { onInit: function(){ alert('DocList Loaded!'); }, onDocumentCreate: function() { window.location.pathname="/thank-you"; }, onDocumentSent: function(){ alert('Document Sent!'); }, onClose: function(){ console.log('Editor Modal Closed!'); } } ``` -------------------------------- ### Complete HTML Example for Embedded Signing Source: https://developers.pandadoc.com/docs/handle-post-completion-actions-embedded-signing This snippet shows a full HTML page structure with CSS styling and JavaScript event handling for the PandaDoc embedded signing iframe. It includes functions to manage loading states, display messages, and react to document events like completion or exceptions. ```html Document Signing

Loading document...

Document Signed Successfully!

Thank you for completing the document. You will be redirected shortly.

``` -------------------------------- ### Initialize and Open PandaDoc Signing Session Source: https://developers.pandadoc.com/docs/signing-session-embed Import the Signing library, create an instance with container ID, session details, and optional region, then open the signing session. Ensure you have a valid Session ID obtained from the PandaDoc API. ```typescript import { Signing } from "pandadoc-signing"; const signing = new Signing( "signing-container", // ID of the container element { width: 800, height: 600, sessionId: "Session ID from API", }, { region: "com", // Optional: 'com' or 'eu' } ); await signing.open(); ``` -------------------------------- ### Create Sales Proposal with Pricing Table Source: https://developers.pandadoc.com/docs/what-you-can-do-with-pandadoc-mcp Create a sales proposal using a specified template, including a detailed pricing table with quantities, unit prices, and discounts. ```text Create a sales proposal for Acme Corp using our Q2 Sales Proposal template with a pricing table: 3 licenses at $500 each and a 10% discount ``` -------------------------------- ### Initialize and open PandaDoc Editor Source: https://developers.pandadoc.com/docs/editor-embed Import the Editor class and create an instance, specifying the container element ID and configuration. The editor is then opened to display the document or template. ```typescript import { Editor } from 'pandadoc-editor'; const editor = new Editor( 'editor-container', // ID of the container element { width: 800, height: 600, token: 'Edit session E-Token', } ); editor.open(); ``` -------------------------------- ### Signing Class Constructor Source: https://developers.pandadoc.com/docs/signing-session-embed Initializes a new Signing instance. This is the entry point for embedding the PandaDoc signing experience. ```APIDOC ## Signing Class Constructor ### Description Initializes a new Signing instance, targeting an HTML element to embed the signing iframe. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method Signature ```typescript constructor(id: string, configuration: SigningConfig, pdConfig: Partial) ``` ### Parameters - **id** (string) - Required - The ID of the HTML element where the signing iframe will be mounted. - **configuration** (SigningConfig) - Required - Configuration object for the signing session. - **pdConfig** (Partial) - Optional - PandaDoc specific configuration object. ### Request Example ```typescript const signing = new Signing('signing-container', { sessionId: 'YOUR_SESSION_ID', width: '100%', height: '600px' }, { region: 'eu' }); ``` ``` -------------------------------- ### Create Webhook Subscription via API Source: https://developers.pandadoc.com/docs/how-to-download-completed-document Use this `curl` command to create a webhook subscription for the `document_completed_pdf_ready` event. Ensure you replace `YOUR_API_TOKEN` and `https://your-domain.com/webhook-handler` with your actual token and endpoint URL. ```bash curl -X POST "https://api.pandadoc.com/public/v1/webhook-subscriptions" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "PDF Download Webhook", "url": "https://your-domain.com/webhook-handler", "triggers": ["document_completed_pdf_ready"], "active": true }' ``` -------------------------------- ### Get Recipient ID Source: https://developers.pandadoc.com/docs/resend-document-via-different-delivery-method Retrieve recipient information, including the recipient ID, by calling the Document Details endpoint. ```APIDOC ## GET /public/v1/documents/{document_id}/details ### Description Retrieves the details of a specific document, including recipient information. ### Method GET ### Endpoint /public/v1/documents/{document_id}/details ### Parameters #### Path Parameters - **document_id** (string) - Required - The ID of the document. ``` -------------------------------- ### Filter Documents by Status Source: https://developers.pandadoc.com/docs/filter-search-documents Retrieve documents that match a specific status code. For example, `status=2` typically represents completed documents. ```bash GET /public/v1/documents?status=2&order_by=date_created&count=50 ``` -------------------------------- ### Document Draft Status Response Example Source: https://developers.pandadoc.com/docs/create-and-send-document-fundamentals This JSON shows the expected response when a document has finished processing and is ready to be sent. The `status` field will be `document.draft`. ```json { "id": "YOUR_DOCUMENT_ID", "name": "My First Contract", "status": "document.draft" } ``` -------------------------------- ### Create Document Source: https://developers.pandadoc.com/docs/create-and-send-document-fundamentals This snippet shows how to create a new document from a sample PDF file. It includes setting the document name, providing a URL to the PDF, defining recipients, and pre-filling fields. ```APIDOC ## POST /public/v1/documents ### Description Creates a new document from a specified URL. ### Method POST ### Endpoint https://api.pandadoc.com/public/v1/documents ### Request Body - **name** (string) - Required - The name of the document. - **url** (string) - Required - The URL of the document source (e.g., a PDF file). - **recipients** (array) - Required - A list of recipients for the document. - **email** (string) - Required - The email address of the recipient. - **first_name** (string) - Required - The first name of the recipient. - **last_name** (string) - Required - The last name of the recipient. - **role** (string) - Required - The role of the recipient (e.g., 'user'). - **fields** (object) - Optional - Key-value pairs to pre-fill document fields. - **field_name** (object) - The name of the field. - **value** (any) - The value to set for the field. - **parse_form_fields** (boolean) - Optional - Whether to parse PDF form fields. Defaults to true. ### Request Example ```json { "name": "My First Contract", "url": "https://cdn2.hubspot.net/hubfs/2127247/public-templates/SamplePandaDocPdf_FieldTags.pdf", "recipients": [ { "email": "your-email@example.com", "first_name": "John", "last_name": "Doe", "role": "user" } ], "fields": { "name": { "value": "Mr. John Doe" }, "like": { "value": true } }, "parse_form_fields": false } ``` ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier of the created document. - **name** (string) - The name of the document. - **status** (string) - The current status of the document (e.g., 'document.uploaded'). - **date_created** (string) - The date and time the document was created. #### Response Example ```json { "id": "BhVzRcxH9Z2LgfPPGXFUqo", "name": "My First Contract", "status": "document.uploaded", "date_created": "2025-08-15T10:30:00.000Z" } ``` ``` -------------------------------- ### Initialize and Open PandaDoc Editor Source: https://developers.pandadoc.com/docs/embedded-editing-e-token Initialize the PandaDoc editor with a container ID and optional configuration, then open it with an E-Token. The E-Token is optional during initialization but required to open the editor. ```typescript import { Editor } from "pandadoc-editor"; const editor = new Editor( "editor-container", { fieldPlacementOnly: false, token: "", // E-Token is optional during initialization } ); await editor.open({ token: "your-e-token" }); ``` -------------------------------- ### Get Document Status Source: https://developers.pandadoc.com/docs/create-and-send-document-fundamentals This snippet demonstrates how to retrieve the status of a document using its ID. This is useful for checking if the document has finished processing and is ready to be sent. ```APIDOC ## GET /public/v1/documents/{document_id} ### Description Retrieves the details and status of a specific document. ### Method GET ### Endpoint https://api.pandadoc.com/public/v1/documents/{document_id} ### Parameters #### Path Parameters - **document_id** (string) - Required - The unique identifier of the document. ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier of the document. - **name** (string) - The name of the document. - **status** (string) - The current status of the document (e.g., 'document.draft'). #### Response Example ```json { "id": "YOUR_DOCUMENT_ID", "name": "My First Contract", "status": "document.draft" } ``` ``` -------------------------------- ### Initialize PandaDoc DocEditor (Simple) Source: https://developers.pandadoc.com/docs/pandadocjs Use this snippet for a basic initialization of the PandaDoc DocEditor. It allows for simple configuration with metadata, a custom CSS class, and event handlers. ```javascript var editor = new PandaDoc.DocEditor(); editor.show({ el: '#ELEMENT_ID', data: { metadata: { YOUR_META_KEY: 'YOUR_META_VALUE' } }, cssClass: 'CUSTOM_CSS_CLASS', events: { onInit: function(){}, onDocumentCreated: function(){}, onDocumentSent: function(){}, onClose: function(){} } }); ``` -------------------------------- ### Shared Links: Rapid Implementation Source: https://developers.pandadoc.com/docs/choose-signing-method Choose shared links for quick implementation with minimal custom code. They work with standard API calls and are ideal for MVP or proof-of-concept projects. ```text Problem: You need to implement signing quickly with minimal custom code Solution: Shared links work with standard API calls Example: MVP or proof-of-concept implementations ``` -------------------------------- ### Dynamics Recipients Example Source: https://developers.pandadoc.com/docs/custom-dynamics-functions Defines a custom function to retrieve recipient information for PandaDoc. Ensure the recipient object includes all necessary fields like email, name, and role. ```javascript function new_customentity_getRecipients(entity) { var deferred = jQuery.Deferred(); var recipient = {}; recipient.email = 'john@appleseed.com'; recipient.first_name = 'John'; recipient.last_name = 'Appleseed'; recipient.phone = '0123456789'; recipient.company = 'PandaDoc'; recipient.roleName = "Signer"; deferred.resolve([recipient]); return deferred.promise(); } ``` -------------------------------- ### Get Full Document Details Source: https://developers.pandadoc.com/docs/what-you-can-do-with-pandadoc-mcp Retrieve all available information for a given document, including recipient details, field values, and metadata. Replace 'doc_abc123' with the actual document ID. ```text Show me all the details for document doc_abc123, including recipients, fields, and metadata ``` -------------------------------- ### Order Documents with Date Range Source: https://developers.pandadoc.com/docs/list-documents-api-parameters Optimize performance by ordering documents by creation date and specifying a date range using `created_from` and `created_to`. Limit the results with `count`. ```bash # Order by creation date with date range GET /public/v1/documents?order_by=date_created&created_from=2023-08-01T00:00:00Z&created_to=2023-09-01T00:00:00Z&count=100 ``` -------------------------------- ### Enable Email Delivery for Recipient Source: https://developers.pandadoc.com/docs/resend-document-via-different-delivery-method Update a recipient's settings to enable email delivery. Provide the recipient's email address. Both email and SMS delivery methods are enabled in this example. ```json { "email": "recipient@example.com", "delivery_methods": { "email": true, "sms": true } } ``` -------------------------------- ### SigningConfig Interface Source: https://developers.pandadoc.com/docs/signing-session-embed Defines the configuration options for the Signing instance. ```APIDOC ## SigningConfig Interface ### Description Configuration object for the PandaDoc Signing embed. ### Fields - **width** (number | string) - Optional - The width of the signing iframe. Can be a number (pixels) or a string (e.g., '100%'). - **height** (number | string) - Optional - The height of the signing iframe. Can be a number (pixels) or a string (e.g., '600px'). - **sessionId** (string) - Optional - The document session ID. If provided, the signing experience may open automatically. - **debugMode** (boolean) - Optional - Enables debug logging for the signing process. Defaults to `false`. ``` -------------------------------- ### Add PandaDoc MCP Server to OpenCode Source: https://developers.pandadoc.com/docs/getting-started-with-mcp Execute this command in your terminal to initiate the addition of a new MCP server in OpenCode. Follow the prompts to enter server details. ```bash opencode mcp add ``` -------------------------------- ### Enable SMS Delivery for Recipient Source: https://developers.pandadoc.com/docs/resend-document-via-different-delivery-method Update a recipient's settings to enable SMS delivery. Ensure the phone number is in the correct format. Both email and SMS delivery methods are enabled in this example. ```json { "phone": "+123456789", "delivery_methods": { "email": true, "sms": true } } ``` -------------------------------- ### Get Recipient ID using Document Details API Source: https://developers.pandadoc.com/docs/resend-document-via-different-delivery-method Retrieve recipient information, including the recipient ID, by calling the Document Details endpoint. This ID is necessary for updating delivery methods. ```bash GET /public/v1/documents/{document_id}/details ``` -------------------------------- ### Signing Class Constructor Source: https://developers.pandadoc.com/docs/signing-session-embed Initialize the Signing class by providing the ID of the HTML element to replace with the signing iframe, along with signing and PandaDoc configuration objects. ```typescript constructor(id: string, configuration: SigningConfig, pdConfig: Partial) ``` -------------------------------- ### Get Document Details to List Text Blocks Source: https://developers.pandadoc.com/docs/working-with-text-blocks Retrieve document details to identify the names of available text blocks in your template. The `texts` array in the response contains the `name` property for each text block. ```APIDOC ## Get Document Details ### Description Retrieves details for a specific document, including information about its text blocks. ### Method GET ### Endpoint /public/v1/documents/{document_id}/details ### Parameters #### Path Parameters - **document_id** (string) - Required - The ID of the document to retrieve details for. ### Response #### Success Response (200) - **texts** (array) - An array of text block objects, each containing a `name` property. - **name** (string) - The name of the text block. ``` -------------------------------- ### Initialize PandaDoc DocEditor (Full) Source: https://developers.pandadoc.com/docs/pandadocjs This comprehensive snippet initializes the PandaDoc DocEditor with extensive data options. It supports pre-populating document names, recipient details, form fields (widgets), tokens, pricing table items, and metadata. Use this for a fully configured document creation experience. ```javascript var editor = new PandaDoc.DocEditor(); editor.show({ el: '#ELEMENT_ID', data: { docName: 'Document Name', recipients: [{ first_name: "John", last_name: "Appleseed", email: "john@appleseed.com", title: "Dr.", phone: "+1 415-012-3456", company: "Sample Company", country: "USA", postal_code: "90210", state: "CA", city: "Anytown", street_address: "123 Main Street", //will be automatically assigned to a specific role in a template roleName: "ROLE_IN_A_TEMPLATE" }], //populate fields in a template widgets: { FIELD_TITLE: 'FIELD_DATA' }, //populate tokens in a template tokens: { TOKEN_NAME: 'TOKEN_VALUE', }, //populate a pricing table in a template items: [{ sku: 'A1234', name: 'Sample Product', price: 100, qty: 1, description: 'Description of a product', currency: 'USD', custom_fields: { location : 'California' } }], metadata: { YOUR_META_KEY: 'YOUR_META_VALUE' } }, cssClass: 'CUSTOM_CSS_CLASS', events: { onInit: function(){}, onDocumentCreated: function(){}, onDocumentSent: function(){}, onClose: function(){} } }); ``` -------------------------------- ### Handle PandaDoc Embed Events Source: https://developers.pandadoc.com/docs/javascript-template-embed Capture and respond to events emitted by the embedded PandaDoc template. This includes 'loaded', 'started', 'completed', and 'exception' events. The 'completed' event provides the document UUID, useful for redirects. ```javascript javascript events: { loaded: function () { alert('Template loaded!'); }, started: function () { console.log('This template has been started on'); }, completed: function (data) { console.log('document id', data.uuid); window.location = 'https://yourdomain.com/success-page'; }, exception: function () { console.log('There was an error.'); } } ``` -------------------------------- ### Get Text Block Names from Document Details Source: https://developers.pandadoc.com/docs/working-with-text-blocks Use the Document Details endpoint to retrieve a list of available text block names within a PandaDoc template. The 'name' field must exactly match a text block in your template. ```json GET /public/v1/documents/{document_id}/details ``` ```json { "texts": [ { "name": "Legal Terms Section" }, { "name": "Product Description" } ] } ``` -------------------------------- ### Authenticate PandaDoc MCP Server in OpenCode Source: https://developers.pandadoc.com/docs/getting-started-with-mcp Run this command in your terminal after adding the PandaDoc MCP server to OpenCode to begin the authentication process. ```bash opencode mcp auth pandadoc ``` -------------------------------- ### Apply Global Fees to Pricing Table Source: https://developers.pandadoc.com/docs/working-with-pricing-tables Fees are applied similarly to taxes. Add a Fee column to your pricing table template and define the fee in the `options` object. Fees must also be specified at the row level for the table-level fee to be effective. ```json "pricing_tables": [ { "name": "Pricing Table 1", "data_merge": true, "options": { "currency": "EUR", "Tax": { "name": "Tax", "type": "percent", "value": 10 }, "Fee": { "name": "Fee", "type": "percent", "value": 20 } }, "sections": [ { "title": "Pricing Section", "default": true, "rows": [ { "options": { "optional": false, "optional_selected": false, "qty_editable": false }, "data": { "Name": "Meta Conversion Advertising", "Price": 6000, "QTY": 6, "Description": "Conversion Kampagnen Management + Performance Design", "Unit": "Monatlich", "Tax": { "type": "percent", "value": 0 }, "Fee": { "type": "percent", "value": 0 } } } ] } ] } ] ``` -------------------------------- ### Send POST Request to Create Document Source: https://developers.pandadoc.com/docs/create-document-from-template Send a POST request to the /public/v1/documents endpoint to initiate document creation. The response will contain the document ID and its initial status. ```http POST /public/v1/documents ```