---
title: "3 Steps: Java Digital Signature SDK for PDFs | TurboDocx"
description: "3 steps to sign PDFs with the TurboDocx Java digital signature SDK: add it from Maven Central, build a client with your API key, call sendSignature()."
url: "https://www.turbodocx.com/guides/sign-documents-with-java"
---

# How to Sign PDFs with the Java Digital Signature SDK

> 3 steps to sign a PDF with the TurboDocx Java digital signature SDK: add the TurboDocx SDK to `pom.xml` or `build.gradle`, build a `TurboDocxClient` with the Builder pattern using your API key, org ID, and sender email, then call `client.turboSign().sendSignature()` with a request built from recipients and signature fields. TurboDocx emails each recipient a signing link and returns the new document ID.

This guide shows you how to integrate e-signatures into your Spring Boot or Maven project in under 5 minutes. Last updated: October 16, 2026.

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

## At a glance

- **5 min**: setup time
- **Java 11+**: LTS support
- **Builder**: pattern API

## 1. Installation

Add the TurboDocx SDK to your project using Maven or Gradle.

Maven (`pom.xml`):

```xml
<dependency>
    <groupId>com.turbodocx</groupId>
    <artifactId>turbodocx-sdk</artifactId>
    <version>0.7.0</version>
</dependency>
```

Gradle (`build.gradle`):

```groovy
implementation 'com.turbodocx:turbodocx-sdk:0.7.0'
```

Requirements: Java 11+. Compatible with Spring Boot and other Java 11+ frameworks.

## 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, API Keys
3. Copy your API Key and Organization ID

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

Spring Boot: The Builder below reads these with `System.getenv()`. To source them from `application.properties` instead, bind them with `@Value` and pass the resolved strings to the Builder.

## 3. Sending a Signing Request

Use the SDK to send a document for signature. The recipient will receive an email with a link to sign.

```java
import com.turbodocx.TurboDocxClient;
import com.turbodocx.models.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        // Create client with sender configuration
        TurboDocxClient client = new TurboDocxClient.Builder()
            .apiKey(System.getenv("TURBODOCX_API_KEY"))       // REQUIRED
            .orgId(System.getenv("TURBODOCX_ORG_ID"))         // REQUIRED
            .senderEmail(System.getenv("TURBODOCX_SENDER_EMAIL"))  // REQUIRED
            .senderName(System.getenv("TURBODOCX_SENDER_NAME"))    // Recommended
            .build();

        // Read PDF file
        byte[] pdfFile = Files.readAllBytes(Paths.get("contract.pdf"));

        // Send document for signature
        SendSignatureResponse result = client.turboSign().sendSignature(
            new SendSignatureRequest.Builder()
                .file(pdfFile)
                .fileName("contract.pdf")
                .documentName("Partnership Agreement")
                .recipients(Arrays.asList(
                    new Recipient("John Doe", "john@example.com", 1)
                )))
                .fields(Arrays.asList(
                    new Field.Builder()
                        .type("signature")
                        .recipientEmail("john@example.com")
                        .template(new Field.TemplateAnchor.Builder()
                            .anchor("{signature1}")
                            .placement("replace")
                            .size(new Field.Size(100, 30))
                            .build())
                        .build()
                )))
                .build()
        );

        System.out.println("Document ID: " + result.getDocumentId());
    }
}
```

Builder Pattern: The SDK uses fluent builders like `new Field.Builder()...build()` for type-safe request construction.

## Next: Processing Results with Webhooks

Configure webhooks to receive real-time notifications when documents are signed. Verify the `X-TurboDocx-Signature` header with `WebhookSignatureVerifier.verify()` against the raw request bytes before trusting a payload.

```java
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.turbodocx.WebhookSignatureVerifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;

@RestController
@RequestMapping("/webhooks")
public class WebhookController {

    private final TurboDocxClient client;
    private final ObjectMapper mapper = new ObjectMapper();

    @PostMapping("/turbosign")
    public ResponseEntity<Map<String, Boolean>> handleWebhook(
            @RequestBody byte[] rawBody,
            @RequestHeader("X-TurboDocx-Signature") String signature,
            @RequestHeader("X-TurboDocx-Timestamp") String timestamp
    ) throws Exception {
        if (!WebhookSignatureVerifier.verify(rawBody, signature, timestamp, System.getenv("TURBODOCX_WEBHOOK_SECRET"))) {
            return ResponseEntity.status(401).body(Map.of("error", true));
        }

        Map<String, Object> payload = mapper.readValue(rawBody, Map.class);
        String event = (String) payload.get("event");
        Map<String, Object> data = (Map<String, Object>) payload.get("data");

        if ("signature.document.completed".equals(event)) {
            String documentId = (String) data.get("document_id");

            // Download the signed PDF
            byte[] signedPdf = client.turboSign().download(documentId);

            // Save to file
            Files.write(
                Paths.get("signed-" + documentId + ".pdf"),
                signedPdf
            );
        }

        return ResponseEntity.ok(Map.of("received", true));
    }
}
```

## Conclusion

You now have everything you need to integrate document signing into your Java application using the TurboDocx [e-signature API](https://www.turbodocx.com/e-signature-api.md). The Builder-style SDK handles authentication, document delivery, signature collection, and legally-binding audit trails behind a typed client.

What you can do next:

- Add multiple recipients with sequential signing order
- Use different field types: initials, dates, text, checkboxes
- Integrate with Spring Security for authentication
- Get audit trails and compliance certificates

## Related Guides

- [Sign Documents with TypeScript](https://www.turbodocx.com/guides/sign-documents-with-typescript.md): Fully typed e-signature integration with imported SDK types and tsconfig setup.
- [Sign Documents with JavaScript](https://www.turbodocx.com/guides/sign-documents-with-javascript.md): Integrate document signing into Node.js or TypeScript applications.
- [Sign Documents with Go](https://www.turbodocx.com/guides/sign-documents-with-go.md): Add document signing to Go applications with idiomatic patterns.

## Resources

- [Full API Reference](https://docs.turbodocx.com/docs/SDKs/java): Complete SDK documentation with all methods.
- [GitHub Repository](https://github.com/TurboDocx/SDK/tree/main/packages/java-sdk): View source code, examples, and contribute.
- [Maven Central](https://central.sonatype.com/artifact/com.turbodocx/turbodocx-sdk): View package info and version history.
- [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 Java?

Add the TurboDocx SDK to your Maven/Gradle project, create a client with your API key using the Builder pattern, then use client.turboSign().sendSignature() to send the document for e-signature.

### Is there a Java digital signature SDK on Maven Central?

Yes. com.turbodocx:turbodocx-sdk is published on Maven Central and built with fluent Builders, so Spring Boot services get type-safe recipients and signature fields instead of writing raw HTTP or multipart upload code.

### Does the Java SDK work with Spring Boot?

Yes, the TurboDocx Java SDK works with Spring Boot and any Java 11+ application. It uses a fluent Builder pattern for type-safe request construction.

### Is the Java digital signature SDK free?

Yes. com.turbodocx:turbodocx-sdk is open source under the MIT license, and API access is included on every TurboDocx plan, including the Free plan with 5 e-signatures per month.

### What Java version is required?

The TurboDocx Java SDK requires Java 11 or higher (LTS versions recommended).

## Ready to Get Started?

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

[Get API Key Free](https://app.turbodocx.com) or [learn more about the e-signature API](https://www.turbodocx.com/e-signature-api.md).
