Integrations · Frameworks and SDKs
Validate emails of PandaDoc recipients
Check a PandaDoc document's recipients before you create it. One module with no dependencies, called by your own server right before it creates a document through PandaDoc's API: it checks the address of every recipient and tells you which ones cannot receive mail and where they sit in the request, so a mistyped address is fixed before the document goes out. It never changes the request and never calls PandaDoc.
Download it: email-validation-pandadoc.zip holds email-validation-pandadoc.mjs (one JavaScript module) and the MIT licence.
What you need
- An API key of ours from the API keys page with Validate addresses (on by default). Keep it on your server, never in a page.
- Your server's code that creates documents, in anything with
fetch(Node 22 or later, Bun, Deno, Cloudflare Workers). Copyemail-validation-pandadoc.mjsnext to it. - No PandaDoc key: the module reads the request you are about to send and nothing else.
Before you create a document
PandaDoc takes the recipients when you create the document; its Send document call has none. So check the body of Create document (POST https://api.pandadoc.com/public/v1/documents). Make the check once per process, not per document: it remembers answers between documents.
import { createPandaDocCheck } from './email-validation-pandadoc.mjs';
const ev = createPandaDocCheck({ apiKey: process.env.EV_API_KEY });
const body = {
name: 'Proposal for Acme',
template_uuid: templateId,
recipients: [
{ email: customer.email, first_name: customer.firstName, last_name: customer.lastName, role: 'Client' },
{ email: 'sales@acme.example', first_name: 'Sales' },
],
};
const report = await ev.checkDocument(body);
if (!report.ok) {
// report.blocked: e.g. [{ where: 'recipients[0].email', status: 'invalid', reason: 'no_mailbox', … }]
// ask for the address again instead of creating the document
} else {
// create the document with PandaDoc as you do today, then send it
}Each entry of report.results holds a recipient's email, where, status, reason, action, did_you_mean, blocked and, when it got no answer, error.
What it checks
- The
emailof each entry inrecipients. - For a recipient group (
"type": "recipient_group"), theemailof each of itsmembers. - A recipient with only a
phonehas no address and is not checked.
The same address listed twice is checked once.
Try it free first
Check one of our free test addresses (on a domain that receives no mail) without creating anything:
const report = await ev.checkDocument({
recipients: [{ email: 'no_mailbox@sandbox.email-validation.org', first_name: 'Test', role: 'Client' }],
});
console.log(report.ok, report.blocked); // false [ { where: 'recipients[0].email', status: 'invalid', … } ]Checks of our test addresses are free. Never send a real document to them, or to any address you made up: the email would bounce.
How it decides
- What is blocked.
invalidby default.block: ['invalid', 'disposable']also blocks disposable addresses, andcatch_allcan be added too.validandunknownare never blocked: act on theactionof avalidresult if you want to (spam traps and known complainers arevalidwith the actionremove). - It fails open. A timeout (6 seconds per check by default,
timeoutMs), a network error, a rate limit, no credits or any error answer leaves that recipient unchecked (errorsays why) and never blocks it. Nothing is retried; after a rate limit the module sends nothing until our API'sRetry-Afterhas passed. A missingapiKeythrows when you make the check, so a setup mistake does not pass every document unchecked. - Answers are remembered. A verdict is kept for the process's life (10,000 addresses by default,
memoMaxEntries), so the next document to the same person costs nothing; anunknownor a failed check is asked again. - Credits. Each check uses one credit (
unknownresults, malformed and sandbox addresses are free).region: 'eu'checks in the EU, athttps://api-eu.email-validation.org. - Our key goes only to our API, redirects are never followed, and the module logs nothing.
Test it first
The module reads the request's fields by the names of PandaDoc's API reference and has not run against a real PandaDoc account. A request built in another shape is not understood, and its recipients are then not checked. Run it with the test address above before you rely on it.