---
title: "TypeScript E-Signature SDK: Typed & Ready | TurboDocx"
description: "TypeScript e-signature SDK with full type safety: install, configure typed credentials, and send PDFs for signature with TurboDocx in 3 steps."
url: "https://www.turbodocx.com/guides/sign-documents-with-typescript"
---

# How to Sign PDFs with TypeScript

> **3 steps to sign a PDF with TypeScript:** 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 a missing `signingOrder` or an invalid field `type` before the code ever runs.

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

Developer Guide by Yacine Kahlerras. Last updated: September 23, 2026.

- Setup time: 5 min
- Types ship with SDK: 0 @types
- ESM + CJS: NodeNext ready

Links: [GitHub SDK](https://github.com/TurboDocx/SDK/tree/main/packages/js-sdk), [Full API Reference](https://docs.turbodocx.com/docs/SDKs/javascript).

## Agentic Quickstart Skill

Skip the boilerplate: your AI coding agent writes the integration. Install with:

```bash
npx skills add TurboDocx/quickstart
```

[How it works](https://www.turbodocx.com/quickstart.md)

## 1. Installation and 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.

```bash
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`

```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`.

## 2. Obtaining an API Key

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

1. [Sign up for a free account](https://app.turbodocx.com) at TurboDocx
2. Navigate to Settings, then API Keys
3. Copy your API Key and Organization ID

`.env`

```bash
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. Sending a Signing Request

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`

```typescript
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, a missing `signingOrder` or an invalid field `type` fails to compile instead of failing at runtime. The `senderEmail` remains required and is used as the reply-to address.

## 4. Processing Results with Webhooks

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`

```typescript
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);

      // Save to your storage
      await saveToStorage(signedPdf, `signed-${data.document_id}.pdf`);
    }

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

## 5. Conclusion

You now have everything you need to integrate type-safe document signing into your TypeScript application using the TurboDocx [e-signature API](https://www.turbodocx.com/e-signature-api.md). 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

- [Embed E-Signatures in React](https://www.turbodocx.com/guides/embed-esignature-in-react.md): Let signers sign inside your own front end with the @turbodocx/embed component instead of an emailed link.
- [Sign Documents with JavaScript](https://www.turbodocx.com/guides/sign-documents-with-javascript.md): The plain Node.js walkthrough using the same SDK, without TypeScript annotations.
- [Sign Documents with Python](https://www.turbodocx.com/guides/sign-documents-with-python.md): Integrate document signing into Django, FastAPI, or Flask applications.

## Resources

- [Full API Reference](https://docs.turbodocx.com/docs/SDKs/javascript): Complete SDK documentation with all methods and types.
- [GitHub Repository](https://github.com/TurboDocx/SDK/tree/main/packages/js-sdk): View source code, examples, and contribute.
- [Webhook Setup](https://docs.turbodocx.com/docs/TurboSign/Webhooks): Configure real-time notifications for your app.
- [Developer Hub](https://www.turbodocx.com/developers.md): All TurboDocx SDKs, API docs, and quickstarts.

## 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.

- [Learn More About the e-signature API](https://www.turbodocx.com/e-signature-api.md)

[Get API Key Free](https://app.turbodocx.com)
