Skip to content

Connect PandaDoc to ChatGPT: Automate Document Drafting & Tracking

Learn how to connect PandaDoc to ChatGPT using a managed MCP server. Execute automated document drafting, recipient mapping, and contract tracking via AI.

Uday Gajavalli Uday Gajavalli · · 9 min read
Connect PandaDoc to ChatGPT: Automate Document Drafting & Tracking

If your sales or legal teams spend hours manually assembling contracts, mapping custom fields, and tracking signature statuses, you need to connect PandaDoc to ChatGPT. Providing an AI agent with read and write access to your document infrastructure allows it to draft proposals, track state changes, and fetch audit trails autonomously. (If your team uses Claude, check out our guide on connecting PandaDoc to Claude, or explore our broader architectural overview on connecting PandaDoc to AI Agents).

Giving a Large Language Model (LLM) direct access to a document lifecycle API is an engineering challenge. You must handle complex state machines, manage strict authorization lifecycles, and translate highly nested JSON schemas into tools the LLM can reliably execute. You either spend weeks building, hosting, and maintaining a custom Model Context Protocol (MCP) server, or you use a managed infrastructure layer that generates it for you.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for PandaDoc, connect it natively to ChatGPT, and execute complex document workflows using natural language.

The Engineering Reality of the PandaDoc API

A custom MCP server is a self-hosted integration layer that acts as a JSON-RPC 2.0 translation proxy between an LLM's tool-calling outputs and a vendor's REST API. While Anthropic's open MCP standard provides a predictable way for models to discover tools, implementing it against vendor APIs requires navigating their specific quirks.

If you decide to build a custom MCP server for PandaDoc, you own the entire API lifecycle. Here are the specific integration challenges you must architect around:

The Document State Machine

Unlike a generic CRM record, a PandaDoc document is a stateful entity. You cannot simply "create" a completed document. The API enforces a strict state machine: document.draft -> document.sent -> document.viewed -> document.completed. If your LLM attempts to send a document before all required fields and recipients are fully mapped in the draft state, the API will reject the request. Your MCP server or agentic workflow must explicitly query the document state before executing transition methods.

Field and Recipient Mapping

When generating a document from a template, the API requires you to map specific template roles (e.g., "Signer 1", "Sender") to actual recipient objects. Furthermore, custom fields and tokens within the document must be populated via deeply nested JSON arrays (tokens, fields, pricing_tables). Passing these multi-level nested schemas directly to an LLM often results in hallucinations unless the MCP tool schemas are meticulously constrained and annotated.

Binary Data and File Downloads

The PandaDoc API downloads and attachment_downloads endpoints do not return JSON metadata. They return raw binary data (e.g., PDF bytes). If your MCP tool definition does not account for this, the LLM will attempt to parse binary data as text and crash the context window. Your architecture must have a mechanism to pipe these byte streams to a safe storage location or instruct the LLM to pass the download identifier to a separate execution environment.

Rate Limiting and 429 Pass-Through

PandaDoc enforces rate limits based on your subscription tier and API usage. Factual note on rate limits: Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream PandaDoc API returns an HTTP 429 (Too Many Requests), Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller - your agent framework or custom ChatGPT client - is entirely responsible for reading these headers and implementing retry/backoff logic.

sequenceDiagram
    participant ChatGPT as ChatGPT (Client)
    participant MCP as Truto MCP Server
    participant PandaDoc as PandaDoc API

    ChatGPT->>MCP: Call tool (e.g., list documents)
    MCP->>PandaDoc: Proxy REST API Request
    PandaDoc-->>MCP: HTTP 429 Too Many Requests
    Note over MCP,PandaDoc: Truto normalizes rate limit headers
    MCP-->>ChatGPT: Return JSON-RPC error with 429 status<br>and ratelimit-reset header
    Note over ChatGPT: Agent must pause execution<br>and retry later

Generating the PandaDoc MCP Server

Truto eliminates the need to hand-code tool schemas by dynamically generating them based on the integration's documented resources. When you connect a PandaDoc instance, Truto derives tool definitions from the integration's configuration and documentation records. A tool only appears in the MCP server if it has a corresponding documentation entry - acting as a quality gate to ensure ChatGPT only sees well-defined endpoints.

Each generated MCP server is scoped to a single authenticated PandaDoc tenant. The resulting server URL contains a cryptographic token that securely identifies the account, meaning the URL alone handles authentication for the client.

You can generate this server in two ways.

Method 1: Via the Truto UI

For no-code administration, you can generate the server directly from the dashboard:

  1. Navigate to the Integrated Accounts page for your connected PandaDoc instance.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration (name, allowed methods, tags, and optional expiration).
  5. Copy the generated MCP server URL.

Method 2: Via the API

For dynamic environments - such as generating temporary MCP access for an automated job - you can provision the server via the Truto API. The endpoint validates that the integration is AI-ready, hashes a secure token into Cloudflare KV, and returns the URL.

Request:

curl -X POST https://api.truto.one/integrated-account/<PANDADOC_ACCOUNT_ID>/mcp \
  -H "Authorization: Bearer <TRUTO_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "PandaDoc Contract Agent",
    "config": {
      "methods": ["read", "write"],
      "tags": ["documents", "recipients"]
    }
  }'

Response:

{
  "id": "mcp_abc123",
  "name": "PandaDoc Contract Agent",
  "config": {
    "methods": ["read", "write"],
    "tags": ["documents", "recipients"]
  },
  "expires_at": null,
  "url": "https://api.truto.one/mcp/xyz987securetoken..."
}

Connecting the Server to ChatGPT

Once you have the Truto MCP URL, connecting it to ChatGPT requires zero custom code. The URL itself acts as the JSON-RPC 2.0 endpoint.

Method A: Via the ChatGPT UI

If you are using ChatGPT Enterprise, Pro, or Plus with Developer Mode enabled:

  1. In ChatGPT, navigate to Settings -> Apps -> Advanced settings.
  2. Ensure Developer mode is enabled.
  3. Under MCP servers / Custom connectors, select Add a new server.
  4. Name: Enter a recognizable name (e.g., "PandaDoc Contracts").
  5. Server URL: Paste the Truto MCP URL (https://api.truto.one/mcp/...).
  6. Click Save. ChatGPT will perform an initialization handshake and immediately list the available PandaDoc tools.

Method B: Via Manual Config File

If you are running a local MCP client (such as Claude Desktop, Cursor, or a custom agent framework orchestrating ChatGPT via an API), you can mount the server via a JSON configuration file using the Server-Sent Events (SSE) transport.

{
  "mcpServers": {
    "pandadoc": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/xyz987securetoken..."
      ]
    }
  }
}

Security and Access Control

Exposing an enterprise contract platform to an autonomous model requires strict boundary controls. Truto enforces security at the MCP token level:

  • Method Filtering: Constrain the LLM by passing methods: ["read"]. The server will strip out all create, update, and delete tools at generation time, physically preventing the LLM from mutating data.
  • Tag Filtering: Restrict tools to specific operational domains by configuring tags: ["public_documents"]. Only endpoints tagged accordingly will be exposed.
  • Secondary Authentication (require_api_token_auth): By default, the URL token is sufficient for access. Enabling this flag forces the client to also pass a valid Truto API token in the Authorization header, preventing usage if the URL leaks.
  • Time-to-Live (expires_at): Append an ISO timestamp to automatically revoke the server. Truto uses distributed alarms to permanently drop the token from Edge KV once the time expires, leaving no stale credentials.

Hero Tools for PandaDoc

Truto standardizes resource naming and normalizes complex schemas. When the ChatGPT client calls tools/list, it receives a curated array of endpoints. Here are the core tools to expose for document orchestration.

create_a_panda_doc_public_document

This is the entry point for generating new documents. It accepts parameters to build a document from a raw PDF upload, a markdown string, or an existing PandaDoc template. Because the API operates asynchronously, this returns a document ID in the document.draft state.

"Generate a new document using template ID 'temp_123'. Name it 'Acme Corp MSA' and prepare it for field mapping."

create_a_panda_doc_document_recipient

Before a draft document can be sent, you must attach recipients and assign them roles (e.g., CC, Signer). This tool maps email addresses and names to the corresponding workflow nodes in the document.

"Add Jane Doe (jane.doe@acme.com) as a recipient to document ID 'doc_456' and assign her the role of 'Client Signer'."

panda_doc_public_documents_send

Once a document is fully configured in the draft state, this tool dispatches it to the assigned recipients. It triggers the vendor's internal email engine and transitions the state machine to document.sent.

"The MSA is ready. Send document ID 'doc_456' to all attached recipients and confirm the status change."

get_single_panda_doc_public_document_by_id

Polling this tool is required to track the document lifecycle. It returns the current state (Draft, Sent, Viewed, Completed, Declined) along with expiration dates and version hashes.

"Check the status of the Acme Corp MSA (ID 'doc_456'). Has the client viewed or completed it yet?"

list_all_panda_doc_document_details

This tool retrieves the deep metadata payload for a specific document. It exposes the granular values of custom tokens, pricing tables, assigned fields, and grand totals, which is critical for extracting contract terms back into a CRM or database.

"Fetch the full document details for ID 'doc_456'. Extract the final grand total from the pricing table and list all completed fields."

list_all_panda_doc_document_downloads

Retrieves the finalized, signed PDF of a completed document. Because this tool returns raw binary bytes, the agent must be instructed on how to handle the output (e.g., saving it to disk or passing it to a downstream bucket API).

"Document ID 'doc_456' is completed. Call the download tool and stream the resulting PDF bytes to our internal archive directory."

For the complete inventory of available tools and schema definitions, view the PandaDoc integration page.

Workflows in Action

Connecting tools is only the first step. The true value of MCP is orchestrating multi-step workflows autonomously. Here are concrete examples of how ChatGPT executes logic using the Truto-generated PandaDoc server.

Autonomous Sales Proposal Generation & Sending

User Prompt:

"Draft a new proposal for Initech using template ID 'tm_890'. Name it 'Initech Q3 Proposal'. Add peter@initech.com as the primary signer, map the 'Company Name' token to 'Initech', and send the document."

Agent Execution Sequence:

  1. Calls create_a_panda_doc_public_document passing the template ID, document name, and the 'Company Name' token mapping.
  2. Extracts the resulting document_id from the JSON response.
  3. Calls create_a_panda_doc_document_recipient using the document_id, providing peter@initech.com and tagging the 'signer' kind.
  4. Calls panda_doc_public_documents_send using the document_id to dispatch the proposal.

Result: The agent autonomously navigates the Draft-to-Sent state machine, confirming to the user that the proposal is in the client's inbox.

Post-Signature Archiving & Audit Logging

User Prompt:

"Check the status of document ID 'doc_777'. If it is completed, download the signed PDF and retrieve the full audit trail so we have a record of IP addresses."

Agent Execution Sequence:

  1. Calls get_single_panda_doc_public_document_by_id and parses the status field.
  2. Recognizing the status is document.completed, it proceeds to the next conditional step.
  3. Calls list_all_panda_doc_document_audit_trails using the document_id to retrieve the JSON array of views, signatures, and IP addresses.
  4. Calls list_all_panda_doc_document_downloads to fetch the raw PDF payload.

Result: The user is provided with a summary of the audit trail, and the agent confirms it has fetched the binary file for archival storage.

Strategic Wrap-Up

Building a custom integration for a stateful, highly nested API like PandaDoc is a massive drain on engineering resources. Maintaining JSON schemas, handling cursor pagination, and building backoff logic for rate limits requires continuous investment.

By leveraging Truto's dynamically generated MCP servers, you bypass the integration boilerplate. You can connect ChatGPT to your PandaDoc infrastructure in minutes, relying on a unified proxy layer that maps endpoints securely while leaving the execution logic and rate limit management exactly where it belongs - in the agent framework.

FAQ

Does Truto handle PandaDoc API rate limits automatically for the LLM?
No. Truto passes HTTP 429 rate limit errors directly back to the caller. However, it normalizes upstream rate limit info into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. The AI agent or client framework is responsible for implementing retry and exponential backoff logic.
Can I restrict which PandaDoc endpoints ChatGPT can access?
Yes. When generating the MCP server, you can apply method filtering (e.g., allowing only 'read' operations) and tag filtering to restrict tools to specific operational domains.
How do AI agents handle downloading signed PandaDoc documents?
The download endpoint returns raw file bytes (PDF data). To handle this in an AI context, you typically pipe the resulting binary stream from the tool response directly to a local file system or a cloud storage bucket using your agent framework's runtime capabilities.
Why use an MCP server instead of a standard REST integration for ChatGPT?
An MCP server dynamically exposes API endpoints as LLM-ready tools complete with standardized JSON schemas and descriptions. This eliminates the need to hand-code tool definitions, parse raw API documentation, or manage authentication manually inside the LLM prompt context.

More from our Blog