TurboDocx JavaScript SDK - Digital signatures, document generation, and AI-powered workflows
npm install @turbodocx/sdk
Official JavaScript/TypeScript SDK for TurboDocx
The most developer-friendly DocuSign & PandaDoc alternative for e-signatures and document generation. Send documents for signature and automate document workflows programmatically.





---
A modern, developer-first alternative to legacy e-signature platforms:
| Looking for... | TurboDocx offers |
|----------------|------------------|
| DocuSign API alternative | Simple REST API, transparent pricing |
| PandaDoc alternative | Document generation + e-signatures in one SDK |
| HelloSign/Dropbox Sign alternative | Full API access, modern DX |
| Adobe Sign alternative | Quick integration, developer-friendly docs |
| SignNow alternative | Predictable costs, responsive support |
| Documint alternative | DOCX/PDF generation from templates |
| WebMerge alternative | Data-driven document automation |
Other platforms we compare to: SignRequest, SignEasy, Zoho Sign, Eversign, SignWell, Formstack Documents
| Package | Description |
|---------|-------------|
| @turbodocx/html-to-docx | Convert HTML to DOCX - fastest JS library |
| @turbodocx/n8n-nodes-turbodocx | n8n community nodes for TurboDocx |
| TurboDocx Writer | Microsoft Word add-in |
---
- 🚀 Production-Ready — Battle-tested, processing thousands of documents daily
- 📝 Full TypeScript Support — Comprehensive type definitions with IntelliSense
- ⚡ Lightweight — Zero dependencies, tree-shakeable
- 🔄 Promise-based — Modern async/await API
- 🛡️ Type-safe — Catch errors at compile time, not runtime
- 🤖 100% n8n Parity — Same operations as our n8n community nodes
---
``bash`
npm install @turbodocx/sdk
Other package managers
`bashYarn
yarn add @turbodocx/sdk
---
Quick Start
`typescript
import { TurboSign } from '@turbodocx/sdk';// 1. Configure with your API key and sender information
TurboSign.configure({
apiKey: process.env.TURBODOCX_API_KEY,
orgId: process.env.TURBODOCX_ORG_ID,
senderEmail: process.env.TURBODOCX_SENDER_EMAIL, // REQUIRED
senderName: process.env.TURBODOCX_SENDER_NAME // OPTIONAL (but strongly recommended)
});
// 2. Send a document for signature
const result = await TurboSign.sendSignature({
file: pdfBuffer,
documentName: 'Partnership Agreement',
recipients: [
{ name: 'John Doe', email: 'john@example.com', signingOrder: 1 }
],
fields: [
{
type: 'signature',
recipientEmail: 'john@example.com',
template: { anchor: '{signature1}', placement: 'replace', size: { width: 100, height: 30 } }
}
]
});
console.log('Document ID:', result.documentId);
`---
Configuration
`typescript
import { TurboSign } from '@turbodocx/sdk';// Basic configuration (REQUIRED)
TurboSign.configure({
apiKey: 'your-api-key', // REQUIRED
orgId: 'your-org-id', // REQUIRED
senderEmail: 'you@company.com', // REQUIRED - reply-to address for signature requests
senderName: 'Your Company' // OPTIONAL but strongly recommended
});
// With custom options
TurboSign.configure({
apiKey: 'your-api-key',
orgId: 'your-org-id',
senderEmail: 'you@company.com',
senderName: 'Your Company',
baseUrl: 'https://custom-api.example.com', // Optional: custom API endpoint
timeout: 30000, // Optional: request timeout (ms)
});
`Important:
senderEmail is REQUIRED. This email will be used as the reply-to address for signature request emails. Without it, emails will default to "API Service User via TurboSign". The senderName is optional but strongly recommended for a professional appearance.$3
We recommend using environment variables for your configuration:
`bash
.env
TURBODOCX_API_KEY=your-api-key
TURBODOCX_ORG_ID=your-org-id
TURBODOCX_SENDER_EMAIL=you@company.com
TURBODOCX_SENDER_NAME=Your Company Name
``typescript
TurboSign.configure({
apiKey: process.env.TURBODOCX_API_KEY,
orgId: process.env.TURBODOCX_ORG_ID,
senderEmail: process.env.TURBODOCX_SENDER_EMAIL,
senderName: process.env.TURBODOCX_SENDER_NAME
});
`---
API Reference
$3
####
createSignatureReviewLink(options)Upload a document for review without sending signature emails. Returns a preview URL.
`typescript
const result = await TurboSign.createSignatureReviewLink({
fileLink: 'https://example.com/contract.pdf',
recipients: [
{ name: 'John Doe', email: 'john@example.com', order: 1 }
],
fields: [
{ type: 'signature', page: 1, x: 100, y: 500, width: 200, height: 50, recipientOrder: 1 }
],
documentName: 'Service Agreement', // Optional
documentDescription: 'Q4 Contract', // Optional
senderName: 'Acme Corp', // Optional
senderEmail: 'contracts@acme.com', // Optional
ccEmails: ['legal@acme.com'] // Optional
});console.log('Preview URL:', result.previewUrl);
console.log('Document ID:', result.documentId);
`####
sendSignature(options)Upload a document and immediately send signature request emails.
`typescript
const result = await TurboSign.sendSignature({
fileLink: 'https://example.com/contract.pdf',
recipients: [
{ name: 'Alice', email: 'alice@example.com', order: 1 },
{ name: 'Bob', email: 'bob@example.com', order: 2 } // Signs after Alice
],
fields: [
{ type: 'signature', page: 1, x: 100, y: 500, width: 200, height: 50, recipientOrder: 1 },
{ type: 'signature', page: 1, x: 100, y: 600, width: 200, height: 50, recipientOrder: 2 }
]
});// Each recipient gets a unique signing URL
result.recipients.forEach(r => {
console.log(
${r.name}: ${r.signUrl});
});
`####
getStatus(documentId)Check the current status of a document.
`typescript
const status = await TurboSign.getStatus('doc-uuid-here');console.log('Document Status:', status.status); // 'pending' | 'completed' | 'voided'
console.log('Recipients:', status.recipients);
// Check individual recipient status
status.recipients.forEach(r => {
console.log(
${r.name}: ${r.status}); // 'pending' | 'signed' | 'declined'
});
`####
download(documentId)Download the signed document as a Buffer/Blob.
`typescript
const signedPdf = await TurboSign.download('doc-uuid-here');// Node.js: Save to file
import { writeFileSync } from 'fs';
writeFileSync('signed-contract.pdf', signedPdf);
// Browser: Trigger download
const blob = new Blob([signedPdf], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
window.open(url);
`####
void(documentId, reason)Cancel a signature request.
`typescript
await TurboSign.void('doc-uuid-here', 'Contract terms changed');
`####
resend(documentId, recipientIds)Resend signature request emails to specific recipients.
`typescript
await TurboSign.resend('doc-uuid-here', ['recipient-uuid-1', 'recipient-uuid-2']);
`####
getAuditTrail(documentId)Get the complete audit trail for a document, including all events and timestamps.
`typescript
const audit = await TurboSign.getAuditTrail('doc-uuid-here');console.log('Document:', audit.document.name);
for (const entry of audit.auditTrail) {
console.log(
${entry.actionType} - ${entry.timestamp});
if (entry.user) {
console.log( By: ${entry.user.name} (${entry.user.email}));
}
if (entry.recipient) {
console.log( Recipient: ${entry.recipient.name});
}
}
`The audit trail includes a cryptographic hash chain for tamper-evidence verification.
---
Field Types
| Type | Description |
|:-----|:------------|
|
signature | Signature field (draw or type) |
| initials | Initials field |
| text | Free-form text input |
| date | Date stamp |
| checkbox | Checkbox / agreement |
| full_name | Full name |
| first_name | First name |
| last_name | Last name |
| email | Email address |
| title | Job title |
| company | Company name |$3
`typescript
{
type: 'signature',
page: 1, // Page number (1-indexed)
x: 100, // X position from left (pixels)
y: 500, // Y position from top (pixels)
width: 200, // Field width (pixels)
height: 50, // Field height (pixels)
recipientOrder: 1, // Which recipient this field belongs to
required: true // Optional: default true for signature/initials
}
`---
Examples
For complete, working examples including template anchors, advanced field types, and various workflows, see the
examples/ directory:turbosign-send-simple.ts - Send document directly with template anchors
- turbosign-basic.ts - Create review link first, then send manually
- turbosign-advanced.ts - Advanced field types (checkbox, readonly, multiline text, etc.)$3
`typescript
const result = await TurboSign.sendSignature({
fileLink: 'https://example.com/contract.pdf',
recipients: [
{ name: 'Employee', email: 'employee@company.com', order: 1 },
{ name: 'Manager', email: 'manager@company.com', order: 2 },
{ name: 'HR', email: 'hr@company.com', order: 3 }
],
fields: [
// Employee signs first
{ type: 'signature', page: 1, x: 100, y: 400, width: 200, height: 50, recipientOrder: 1 },
{ type: 'date', page: 1, x: 320, y: 400, width: 100, height: 30, recipientOrder: 1 },
// Manager signs second
{ type: 'signature', page: 1, x: 100, y: 500, width: 200, height: 50, recipientOrder: 2 },
{ type: 'date', page: 1, x: 320, y: 500, width: 100, height: 30, recipientOrder: 2 },
// HR signs last
{ type: 'signature', page: 1, x: 100, y: 600, width: 200, height: 50, recipientOrder: 3 },
{ type: 'date', page: 1, x: 320, y: 600, width: 100, height: 30, recipientOrder: 3 }
]
});
`$3
`typescript
async function waitForCompletion(documentId: string, maxAttempts = 60) {
for (let i = 0; i < maxAttempts; i++) {
const status = await TurboSign.getStatus(documentId); if (status.status === 'completed') {
return await TurboSign.download(documentId);
}
if (status.status === 'voided') {
throw new Error('Document was voided');
}
// Wait 30 seconds between checks
await new Promise(r => setTimeout(r, 30000));
}
throw new Error('Timeout waiting for signatures');
}
`$3
`typescript
import express from 'express';
import { TurboSign } from '@turbodocx/sdk';const app = express();
TurboSign.configure({ apiKey: process.env.TURBODOCX_API_KEY });
app.post('/api/send-contract', async (req, res) => {
try {
const result = await TurboSign.sendSignature({
fileLink: req.body.pdfUrl,
recipients: req.body.recipients,
fields: req.body.fields
});
res.json({ success: true, documentId: result.documentId });
} catch (error) {
res.status(500).json({ error: error.message });
}
});
`---
Local Testing
The SDK includes a comprehensive manual test script to verify all functionality locally.
$3
`bash
Install dependencies
npm installRun the manual test script
npx tsx manual-test.ts
`$3
The
manual-test.ts file tests all SDK methods:
- ✅ createSignatureReviewLink() - Document upload for review
- ✅ sendSignature() - Send for signature
- ✅ getStatus() - Check document status
- ✅ download() - Download signed document
- ✅ void() - Cancel signature request
- ✅ resend() - Resend signature emails$3
Before running, update the hardcoded values in
manual-test.ts:
- API_KEY - Your TurboDocx API key
- BASE_URL - API endpoint (default: http://localhost:3000)
- ORG_ID - Your organization UUID
- TEST_FILE_PATH - Path to a test PDF/DOCX file
- TEST_EMAIL - Email address for testing$3
The script will:
1. Upload a test document
2. Send it for signature
3. Check the status
4. Test void and resend operations
5. Print results for each operation
---
Error Handling
`typescript
import { TurboSign, TurboDocxError } from '@turbodocx/sdk';try {
await TurboSign.getStatus('invalid-id');
} catch (error) {
if (error instanceof TurboDocxError) {
console.error('Status:', error.statusCode); // HTTP status code
console.error('Message:', error.message); // Error message
console.error('Code:', error.code); // Error code (if available)
} else {
console.error('Unexpected error:', error);
}
}
`$3
| Status | Meaning |
|:-------|:--------|
|
400 | Bad request — check your parameters |
| 401 | Unauthorized — check your API key |
| 404 | Document not found |
| 429 | Rate limited — slow down requests |
| 500 | Server error — retry with backoff |---
TypeScript
Full TypeScript support with exported types:
`typescript
import {
TurboSign,
SendSignatureRequest,
CreateSignatureReviewLinkRequest,
Recipient,
Field,
DocumentStatus,
TurboDocxError
} from '@turbodocx/sdk';// Type-safe options
const options: SendSignatureRequest = {
fileLink: 'https://example.com/contract.pdf',
recipients: [{ name: 'John', email: 'john@example.com', signingOrder: 1 }],
fields: [{ type: 'signature', page: 1, x: 100, y: 500, width: 200, height: 50, recipientEmail: 'john@example.com' }]
};
const result = await TurboSign.sendSignature(options);
``---
- Node.js 16+
- TypeScript 4.7+ (if using TypeScript)
---
| Package | Description |
|:--------|:------------|
| @turbodocx/n8n-nodes-turbodocx | n8n community nodes |
| turbodocx-sdk (Python) | Python SDK |
| turbodocx (Go) | Go SDK |
---
- 📖 Documentation
- 💬 Discord
- 🐛 GitHub Issues
---
MIT — see LICENSE
---
