The DocuSeal Java library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within Java applications. This library is designed to simplify API interactions and provide tools for efficient implementation.
Detailed documentation is available at DocuSeal API Docs.
To install the Java SDK, add the following dependency to your project:
Gradle
implementation 'com.docuseal:docuseal-java:+'Maven
<dependency>
<groupId>com.docuseal</groupId>
<artifactId>docuseal-java</artifactId>
<version>LATEST</version>
</dependency>Requires Java 17+.
Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:
API keys for the global cloud can be obtained from your Global DocuSeal Console.
var client = DocusealClient.builder()
.apiKey(System.getenv("DOCUSEAL_API_KEY"))
.build();API keys for the EU cloud can be obtained from your EU DocuSeal Console.
import com.docuseal.core.Environment;
var client = DocusealClient.builder()
.apiKey(System.getenv("DOCUSEAL_API_KEY"))
.environment(Environment.EU)
.build();For on-premises installations, API keys can be retrieved from the API settings page of your deployed application, e.g., https://yourdocusealapp.com/settings/api.
var client = DocusealClient.builder()
.apiKey(System.getenv("DOCUSEAL_API_KEY"))
.url("https://yourdocusealapp.com/api")
.build();Provides the ability to retrieve a list of available submissions.
var submissions = client.getSubmissions(GetSubmissionsParams.builder().limit(10).build());Provides the functionality to retrieve information about a submission.
var submission = client.getSubmission(1001);This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned.
var submission = client.getSubmissionDocuments(1001);This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides:
Send documents for signature via API
Pre-fill PDF document form fields with API
var submission = client.createSubmission(CreateSubmissionParams.builder()
.templateId(1000001)
.submitters(List.of(
CreateSubmissionSubmitterParams.builder()
.role("First Party")
.email("[email protected]")
.build()))
.sendEmail(true)
.build());Provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.
Related Guides:
Use embedded text field tags to create a fillable form
var submission = client.createSubmissionFromPdf(CreateSubmissionFromPdfParams.builder()
.documents(List.of(
CreateSubmissionFromPdfDocumentParams.builder()
.name("string")
.file("base64")
.fields(List.of(
CreateSubmissionDocumentFieldParams.builder()
.name("string")
.areas(List.of(
CreateSubmissionDocumentFieldAreaParams.builder()
.x(0)
.y(0)
.w(0)
.h(0)
.page(1)
.build()))
.build()))
.build()))
.submitters(List.of(
CreateSubmissionSubmitterParams.builder()
.role("First Party")
.email("[email protected]")
.build()))
.name("Test Submission Document")
.build());Provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and lists. You can also use the {{signature}} field syntax to define fillable fields, as in a PDF.
Related Guides:
Use dynamic content variables in DOCX to create personalized documents
var submission = client.createSubmissionFromDocx(CreateSubmissionFromDocxParams.builder()
.documents(List.of(
CreateSubmissionFromDocxDocumentParams.builder()
.name("string")
.file("base64")
.build()))
.submitters(List.of(
CreateSubmissionSubmitterParams.builder()
.role("First Party")
.email("[email protected]")
.build()))
.name("Test Submission Document")
.variables(Map.of("variable_name", "value"))
.build());This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides:
Create PDF document fillable form with HTML
var submission = client.createSubmissionFromHtml(CreateSubmissionFromHtmlParams.builder()
.documents(List.of(
CreateSubmissionFromHtmlDocumentParams.builder()
.html("""
<p>Lorem Ipsum is simply dummy text of the
<text-field
name="Industry"
role="First Party"
required="false"
style="width: 80px; height: 16px; display: inline-block; margin-bottom: -4px">
</text-field>
and typesetting industry</p>
""")
.name("Test Document")
.build()))
.submitters(List.of(
CreateSubmissionSubmitterParams.builder()
.role("First Party")
.email("[email protected]")
.build()))
.name("Test Submission Document")
.build());Allows you to update a submission: change its name, expiration date, and archive or unarchive it.
var submission = client.updateSubmission(1001, UpdateSubmissionParams.builder()
.name("New Submission Name")
.expireAt("2024-09-01 12:00:00 UTC")
.archived(true)
.build());Allows you to archive a submission.
client.archiveSubmission(1001);Provides the ability to retrieve a list of submitters.
var submitters = client.getSubmitters(GetSubmittersParams.builder().limit(10).build());Provides functionality to retrieve information about a submitter, along with the submitter documents and field values.
var submitter = client.getSubmitter(500001);Allows you to update submitter details, pre-fill or update field values and re-send emails.
Related Guides:
Automatically sign documents via API
var submitter = client.updateSubmitter(500001, UpdateSubmitterParams.builder()
.email("[email protected]")
.fields(List.of(
UpdateSubmitterFieldParams.builder()
.name("First Name")
.value("Acme")
.build()))
.build());Provides the ability to retrieve a list of available document templates.
var templates = client.getTemplates(GetTemplatesParams.builder().limit(10).build());Provides the functionality to retrieve information about a document template.
var template = client.getTemplate(1000001);Provides the functionality to create a fillable document template for a PDF file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.
Related Guides:
Use embedded text field tags to create a fillable form
var template = client.createTemplateFromPdf(CreateTemplateFromPdfParams.builder()
.documents(List.of(
CreateTemplateFromPdfDocumentParams.builder()
.name("string")
.file("base64")
.fields(List.of(
CreateTemplateDocumentFieldParams.builder()
.name("string")
.areas(List.of(
CreateTemplateDocumentFieldAreaParams.builder()
.x(0)
.y(0)
.w(0)
.h(0)
.page(1)
.build()))
.build()))
.build()))
.name("Test PDF")
.build());Provides the functionality to create a fillable document template for an existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx for more text tag formats. Or specify the exact pixel coordinates of the document fields using fields param.
Related Guides:
Use embedded text field tags to create a fillable form
var template = client.createTemplateFromDocx(CreateTemplateFromDocxParams.builder()
.documents(List.of(
CreateTemplateFromDocxDocumentParams.builder()
.name("string")
.file("base64")
.build()))
.name("Test DOCX")
.build());Provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides:
Create PDF document fillable form with HTML
var template = client.createTemplateFromHtml(CreateTemplateFromHtmlParams.builder()
.html("""
<p>Lorem Ipsum is simply dummy text of the
<text-field
name="Industry"
role="First Party"
required="false"
style="width: 80px; height: 16px; display: inline-block; margin-bottom: -4px">
</text-field>
and typesetting industry</p>
""")
.name("Test Template")
.build());Allows you to clone an existing template into a new template.
var template = client.cloneTemplate(1000001, CloneTemplateParams.builder()
.name("Cloned Template")
.build());Allows you to merge multiple templates with documents and fields into a new combined template.
var template = client.mergeTemplate(MergeTemplateParams.builder()
.templateIds(List.of(321, 432))
.name("Merged Template")
.build());Provides the functionality to move a document template to a different folder and update the name of the template.
var template = client.updateTemplate(1000001, UpdateTemplateParams.builder()
.name("New Document Name")
.folderName("New Folder")
.build());Allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content.
var template = client.updateTemplateDocuments(1000001, UpdateTemplateDocumentsParams.builder()
.documents(List.of(
UpdateTemplateDocumentsDocumentParams.builder()
.file("string")
.build()))
.build());Allows you to archive a document template.
client.archiveTemplate(1000001);Set timeouts (in seconds) to avoid hanging requests:
var client = DocusealClient.builder()
.apiKey(System.getenv("DOCUSEAL_API_KEY"))
.timeout(30)
.build();For feature requests or bug reports, visit our GitHub Issues page.
The library is available as open source under the terms of the MIT License.