Developer Guide

TypeScript E-Signature SDK: How to Sign PDFs with TypeScript

To sign a PDF with TypeScript, use the TurboDocx TypeScript e-signature SDK in 3 steps: Install the TurboDocx SDK (npm install @turbodocx/sdk), configure your API key with a typed HttpClientConfig, and call TurboSign.sendSignature() with a typed SendSignatureRequest listing recipients and Field objects. The compiler catches an invalid field type or a misspelled property before the code ever runs. The SDK is a typed client for the TurboDocx e-signature API.

The SDK is TypeScript-first: type definitions ship in the package, so requests and responses are typed end to end with no @types install.

Last updated: November 12, 2026

Step 0: Get a free API key (5 signatures a month)

Create a free TurboDocx account, then copy your API key and organization ID from Settings → Developers → API keys. The Free plan includes 5 e-signatures a month, enough to run this guide end to end. Every method is documented in the TypeScript SDK reference.

Same SDK guide in other languages: JavaScript · Python · PHP · Java · Go. Prefer raw HTTP? See the endpoints on the e-signature API page.

5 min

Setup time

TypeScript

0 @types

Types ship with SDK

Typed CJS

Works with NodeNext

1

How do I install the TypeScript SDK and set up tsconfig?

Install the TurboDocx SDK from npm. The package bundles its own .d.ts type definitions, so there is nothing extra to add for full type checking.

npm / yarn / pnpm
npm install @turbodocx/sdk

For modern ESM projects, use NodeNext module resolution and enable esModuleInterop. This lets you use import syntax in both Node and bundled apps.

tsconfig.json
{
  "compilerOptions": {
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "esModuleInterop": true,
    "strict": true,
    "target": "ES2022"
  }
}

Requirements: Node.js 18+ and TypeScript 4.7+. No @types/turbodocx package is needed; the types ship inside @turbodocx/sdk. The examples use top-level await, so set "type": "module" in your package.json (or name the files .mts).

2

Where do I find my API key and org ID?

Before you begin, you'll need your API credentials from the TurboDocx dashboard.

  1. Sign up for a free account at TurboDocx
  2. Navigate to Settings → Developers → API keys
  3. Copy your API Key and Organization ID
.env
TURBODOCX_API_KEY=your_api_key_here
TURBODOCX_ORG_ID=your_org_id_here
TURBODOCX_SENDER_EMAIL=you@company.com
TURBODOCX_SENDER_NAME=Your Company Name
3

How do I send a PDF for signature with TypeScript?

Import the SDK types alongside TurboSign so your configuration, recipients, and fields are checked at compile time. The recipient receives an email with a link to sign.

send-signature.ts
import { TurboSign, type HttpClientConfig, type Recipient, type Field, type SendSignatureResponse } from '@turbodocx/sdk';
import { readFileSync } from 'fs';

// Typed config. process.env values are string | undefined,
// which HttpClientConfig accepts.
const config: HttpClientConfig = {
  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,    // Recommended
};
TurboSign.configure(config);

// Read PDF file
const pdfBuffer: Buffer = readFileSync('contract.pdf');

// Typed recipients and fields
const recipients: Recipient[] = [
  { name: 'John Doe', email: 'john@example.com', signingOrder: 1 },
];

const fields: Field[] = [
  {
    type: 'signature',
    recipientEmail: 'john@example.com',
    template: {
      anchor: '{signature1}',
      placement: 'replace',
      size: { width: 100, height: 30 },
    },
  },
];

// Send document for signature (fully typed response)
const result: SendSignatureResponse = await TurboSign.sendSignature({
  file: pdfBuffer,
  documentName: 'Partnership Agreement',
  recipients,
  fields,
});

console.log('Document ID:', result.documentId);

Type safety: Because Recipient and Field are imported types, an invalid field type (it must be one of the SDK's SignatureFieldType values) or a misspelled property fails to compile instead of failing at runtime. signingOrder is optional in the type, because template roles can set the order, so set it yourself for an uploaded PDF. The senderEmail remains required and is used as the reply-to address.

4

How do I know when the PDF is signed?

Configure webhooks to receive real-time notifications when documents are signed. Verify the typed X-TurboDocx-Signature header with verifyWebhookSignature(); it needs the raw request body, so mount the route with express.raw() instead of express.json().

webhook-handler.ts
import express, { type Request, type Response } from 'express';
import { TurboSign, verifyWebhookSignature } from '@turbodocx/sdk';

const app = express();

app.post(
  '/webhooks/turbosign',
  express.raw({ type: 'application/json' }),
  async (req: Request, res: Response) => {
    const valid: boolean = verifyWebhookSignature(
      req.body as Buffer,
      req.headers['x-turbodocx-signature'] as string,
      req.headers['x-turbodocx-timestamp'] as string,
      process.env.TURBODOCX_WEBHOOK_SECRET!,
    );
    if (!valid) return res.status(401).json({ error: 'invalid signature' });

    const { event, data } = JSON.parse(req.body.toString());

    if (event === 'signature.document.completed') {
      console.log('Document signed:', data.document_id);

      // Download the signed PDF
      const signedPdf = await TurboSign.download(data.document_id);

      // download() returns a Blob; saveToStorage is your own function
      await saveToStorage(Buffer.from(await signedPdf.arrayBuffer()), `signed-${data.document_id}.pdf`);
    }

    res.status(200).json({ received: true });
  }
);
5

What can I build next?

You now have everything you need to integrate type-safe document signing into your TypeScript application using the TurboDocx e-signature API. It handles authentication, document delivery, signature collection, and legally-binding audit trails, all with types that ship in the package.

What you can do next:

  • Add multiple recipients with sequential signing order
  • Use different field types: initials, dates, text, checkboxes
  • Poll TurboSign.getStatus(), typed as DocumentStatusResponse
  • Get audit trails and compliance certificates

Related Guides

Resources

Frequently Asked Questions

How do I sign a PDF with TypeScript?

To sign a PDF with TypeScript, install the TurboDocx SDK (npm install @turbodocx/sdk), configure it with your typed API credentials, then call TurboSign.sendSignature() with a typed request. The SDK ships its own type definitions, so the request and response are fully typed.

Do I need a separate @types package for the TurboDocx SDK?

No. The TurboDocx SDK ships its own TypeScript definitions, so types for TurboSign.configure(), sendSignature(), Recipient, and Field work out of the box with no extra @types install.

How do I track PDF signature status in a typed TypeScript app?

Call the typed TurboSign.getStatus(documentId) to poll for a DocumentStatusResponse, or verify webhook deliveries with the typed verifyWebhookSignature() helper for a push notification on signature.document.completed.

Does the TurboDocx SDK work with ESM and NodeNext?

Yes. The SDK ships a CommonJS build with bundled type definitions. With "module": "NodeNext" and "esModuleInterop": true in your tsconfig, you can use import { TurboSign } from "@turbodocx/sdk" in both Node and bundled applications.

Ready to Get Started?

Create a free account and get your API key. Start sending documents for signature in minutes.