Getting started overview

Integrating with the PandaDoc API enables programmatic control over document creation, sending, and management workflows. This guide outlines the essential steps to get an initial integration operational, covering account setup, API key generation, and executing a foundational API request. The PandaDoc API documentation provides comprehensive details for advanced configurations and specific endpoint usage.

Before making API calls, ensure you have an active PandaDoc account and have generated the necessary API keys. The API supports various operations, including creating documents from templates, sending them for signature, and tracking their status. Developers can utilize official SDKs or make direct HTTP requests to interact with the platform.

Quick Reference Steps

Step What to Do Where
1. Sign Up Create a PandaDoc account (Free eSignatures or trial of a paid plan). PandaDoc Pricing page
2. Get API Key Generate an API key from your workspace settings. PandaDoc web application: Settings > Integrations > API Keys
3. Choose SDK/Method Select a preferred SDK (Python, Node.js, etc.) or prepare for direct HTTP requests. PandaDoc Developer documentation
4. Install SDK Install the chosen SDK in your development environment. Your project's package manager (e.g., pip install pandadoc-python)
5. Make First Call Execute a simple API request, such as listing templates. Your development environment, using the API key and SDK/HTTP client.

Create an account and get keys

To begin using the PandaDoc API, you must first establish a PandaDoc account. PandaDoc offers a Free eSignatures plan, which can serve as a starting point for basic API interactions, or you can opt for a trial of one of their paid plans, such as Essentials, to access broader features like document creation from templates and CRM integrations. After creating an account, log into the PandaDoc web application.

API keys are essential for authenticating your requests to the PandaDoc API. These keys link your application to your PandaDoc account and ensure that only authorized requests are processed. To generate an API key:

  1. Navigate to your PandaDoc workspace settings. Typically, this is found by clicking on your profile icon or name in the top right corner and selecting Settings.
  2. Within the settings menu, look for Integrations or a similar section.
  3. Locate API Keys. You may need to enable the API integration if it's not already active.
  4. Click on Create API Key. PandaDoc will generate a unique key. This key should be treated as sensitive information, similar to a password.
  5. Copy the generated API key immediately. PandaDoc generally only displays the full key once upon creation. If you lose it, you may need to generate a new one.

For security, it is recommended to store your API key securely, for example, using environment variables, rather than hardcoding it directly into your application's source code. This practice helps prevent unauthorized access to your PandaDoc account if your code repository is compromised. The PandaDoc developer documentation provides further guidance on managing API keys and security best practices.

Your first request

Once you have your PandaDoc API key, you can make your first API request. This example demonstrates listing existing templates, a common initial step to understand how to interact with the API and retrieve available resources. PandaDoc provides SDKs for several programming languages, including Python and Node.js, which simplify API interactions by handling authentication and request formatting.

Using the Python SDK

First, install the PandaDoc Python SDK:

pip install pandadoc-python

Then, use the following Python code to list templates:

import pandadoc_client
from pandadoc_client.exceptions import ApiException
from pandadoc_client.model.template_list_response import TemplateListResponse

# Configure API key authorization
configuration = pandadoc_client.Configuration(
    host = "https://api.pandadoc.com"
)
configuration.api_key['API-Key'] = 'YOUR_PANDADOC_API_KEY'

# Enter a context of an API client where you can
# execute an API call without managing the client's lifecycle
with pandadoc_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = pandadoc_client.TemplatesApi(api_client)
    
    try:
        # List Templates
        api_response = api_instance.list_templates()
        print("Templates listed successfully:")
        for template in api_response.results:
            print(f"  ID: {template.id}, Name: {template.name}")
    except ApiException as e:
        print(f"Exception when calling TemplatesApi->list_templates: {e}")

Replace 'YOUR_PANDADOC_API_KEY' with your actual API key.

Using the Node.js SDK

First, install the PandaDoc Node.js SDK:

npm install pandadoc-node-client

Then, use the following Node.js code to list templates:

const PandaDocAPI = require('pandadoc-node-client').default;

const client = new PandaDocAPI({
  apiKey: 'YOUR_PANDADOC_API_KEY',
});

async function listTemplates() {
  try {
    const templates = await client.templates.listTemplates();
    console.log('Templates listed successfully:');
    templates.results.forEach(template => {
      console.log(`  ID: ${template.id}, Name: ${template.name}`);
    });
  } catch (error) {
    console.error('Error listing templates:', error);
  }
}

listTemplates();

Replace 'YOUR_PANDADOC_API_KEY' with your actual API key.

Direct HTTP Request (cURL example)

If you prefer not to use an SDK, you can make direct HTTP requests. Here's a cURL example for listing templates:

curl -X GET \
  'https://api.pandadoc.com/public/v1/templates' \
  -H 'Authorization: API-Key YOUR_PANDADOC_API_KEY' \
  -H 'Content-Type: application/json'

Again, replace YOUR_PANDADOC_API_KEY with your API key. A successful response will return a JSON object containing an array of template objects.

Common next steps

After successfully making your first API call, consider these common next steps to further integrate PandaDoc into your application:

  1. Explore Document Creation: The core functionality of PandaDoc often involves generating documents. Explore the PandaDoc API documentation for document creation. This typically involves using a template ID and providing data to populate the document fields. You can create documents from existing templates or assemble them from scratch using content blocks.
  2. Manage Recipients and Sending: Once a document is created, you'll need to define recipients and send the document for e-signature or review. The API allows you to specify recipient roles, email addresses, and even send documents programmatically. Refer to the PandaDoc document sending API reference for details on how to manage this process.
  3. Track Document Status: Integrate webhooks or regularly poll the API to monitor the status of sent documents (e.g., sent, viewed, signed, completed). This allows your application to react to document lifecycle events, such as triggering subsequent workflows when a document is fully executed. Webhooks are generally preferred for real-time updates and reducing API call overhead, as discussed in the Cloudflare Webhooks documentation as a general best practice for event-driven systems.
  4. Utilize Content Library and Variables: For dynamic document generation, leverage PandaDoc's content library and variables. The content library allows you to store reusable blocks of content, while variables enable personalized data insertion into documents. Understanding how to manage these programmatically can greatly enhance automation capabilities.
  5. Implement Error Handling and Logging: As you build out your integration, robust error handling and logging are crucial. Implement mechanisms to catch API exceptions, log request and response details, and provide clear messages to users or administrators in case of failures. This aids in debugging and maintaining a reliable integration.
  6. Explore Integrations: PandaDoc offers integrations with various CRMs, payment gateways, and other business tools. While some are pre-built, understanding how to connect your custom application with these services through PandaDoc's API can unlock further automation potential.

Troubleshooting the first call

Encountering issues during your first API call is common. Here's a guide to troubleshoot some frequent problems:

1. Authentication Errors (401 Unauthorized)

  • Incorrect API Key: Double-check that the API key you are using exactly matches the one generated in your PandaDoc settings. Ensure there are no leading or trailing spaces.
  • Missing API Key Header: Verify that your API key is correctly included in the Authorization header as API-Key YOUR_PANDADOC_API_KEY. Refer to the PandaDoc API reference for specific authentication requirements.
  • Expired/Revoked Key: Confirm that your API key is still active. If you suspect it might be compromised or expired, generate a new one from your PandaDoc account settings.

2. Bad Request Errors (400)

  • Incorrect Request Body/Parameters: If you're attempting a POST or PUT request, ensure your JSON request body is correctly formatted and contains all required fields with valid data types. Review the specific endpoint's documentation on the PandaDoc API documentation.
  • Content-Type Header: For requests with a body (e.g., POST, PUT), ensure the Content-Type header is set correctly, typically application/json.

3. Not Found Errors (404)

  • Incorrect Endpoint URL: Verify that the URL you are calling is precisely the one specified in the PandaDoc API documentation. Pay attention to version numbers (e.g., /public/v1/).
  • Resource Not Found: If you are trying to access a specific resource (e.g., a document or template by ID), ensure the ID is correct and the resource actually exists in your PandaDoc account.

4. Server Errors (5xx)

  • Temporary Server Issue: A 5xx error indicates a problem on the PandaDoc server side. These are usually temporary. Wait a few moments and retry your request. If the issue persists, check the PandaDoc Help Center for any service status updates.

5. Network or Connection Issues

  • Firewall/Proxy: Ensure your network environment (firewall, proxy settings) is not blocking outgoing connections to api.pandadoc.com.
  • DNS Resolution: Verify that your system can correctly resolve the PandaDoc API domain name.

When troubleshooting, always consult the official PandaDoc API documentation for the most accurate and up-to-date information regarding endpoints, request formats, and error codes. Additionally, using tools like Postman or Insomnia can help isolate issues by allowing you to construct and test API requests independently of your application code.