Skip to content

docusealco/docuseal-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocuSeal .NET

The DocuSeal .NET library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within .NET applications. This library is designed to simplify API interactions and provide tools for efficient implementation.

Documentation

Detailed documentation is available at DocuSeal API Docs.

Installation

To install the library, run:

dotnet add package Docuseal

Supports .NET Framework 4.6.2+, .NET Standard 2.0 and .NET 8/9.

Usage

Configuration

Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:

Global Cloud

API keys for the global cloud can be obtained from your Global DocuSeal Console.

var client = new DocusealClient(Environment.GetEnvironmentVariable("DOCUSEAL_API_KEY"));

EU Cloud

API keys for the EU cloud can be obtained from your EU DocuSeal Console.

var client = new DocusealClient(
    Environment.GetEnvironmentVariable("DOCUSEAL_API_KEY"),
    new ClientOptions { BaseUrl = DocusealClientEnvironment.EU });

On-Premises

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 = new DocusealClient(
    Environment.GetEnvironmentVariable("DOCUSEAL_API_KEY"),
    new ClientOptions { BaseUrl = "https://yourdocusealapp.com/api" });

API Methods

GetSubmissionsAsync(params)

Documentation

Provides the ability to retrieve a list of available submissions.

var submissions = await client.GetSubmissionsAsync(new GetSubmissionsParams { Limit = 10 });

GetSubmissionAsync(id)

Documentation

Provides the functionality to retrieve information about a submission.

var submission = await client.GetSubmissionAsync(1001);

GetSubmissionDocumentsAsync(id)

Documentation

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 = await client.GetSubmissionDocumentsAsync(1001, new GetSubmissionDocumentsParams());

CreateSubmissionAsync(data)

Documentation

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 = await client.CreateSubmissionAsync(new CreateSubmissionParams
{
    TemplateId = 1000001,
    SendEmail = true,
    Submitters = [
        new CreateSubmissionSubmitterParams
        {
            Role = "First Party",
            Email = "john.doe@example.com"
        },
    ]
});

CreateSubmissionFromPdfAsync(data)

Documentation

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 = await client.CreateSubmissionFromPdfAsync(new CreateSubmissionFromPdfParams
{
    Name = "Test Submission Document",
    Documents = [
        new CreateSubmissionFromPdfDocumentParams
        {
            Name = "string",
            File = "base64",
            Fields = [
                new CreateSubmissionDocumentFieldParams
                {
                    Name = "string",
                    Areas = [
                        new CreateSubmissionDocumentFieldAreaParams
                        {
                            X = 0,
                            Y = 0,
                            W = 0,
                            H = 0,
                            Page = 1
                        },
                    ]
                },
            ]
        },
    ],
    Submitters = [
        new CreateSubmissionSubmitterParams
        {
            Role = "First Party",
            Email = "john.doe@example.com"
        },
    ]
});

CreateSubmissionFromDocxAsync(data)

Documentation

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 = await client.CreateSubmissionFromDocxAsync(new CreateSubmissionFromDocxParams
{
    Name = "Test Submission Document",
    Variables = new Dictionary<string, object?> { ["variable_name"] = "value" },
    Documents = [
        new CreateSubmissionFromDocxDocumentParams
        {
            Name = "string",
            File = "base64"
        },
    ],
    Submitters = [
        new CreateSubmissionSubmitterParams
        {
            Role = "First Party",
            Email = "john.doe@example.com"
        },
    ]
});

CreateSubmissionFromHtmlAsync(data)

Documentation

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 = await client.CreateSubmissionFromHtmlAsync(new CreateSubmissionFromHtmlParams
{
    Name = "Test Submission Document",
    Documents = [
        new CreateSubmissionFromHtmlDocumentParams
        {
            Name = "Test Document",
            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>
"""
        },
    ],
    Submitters = [
        new CreateSubmissionSubmitterParams
        {
            Role = "First Party",
            Email = "john.doe@example.com"
        },
    ]
});

UpdateSubmissionAsync(id, data)

Documentation

Allows you to update a submission: change its name, expiration date, and archive or unarchive it.

var submission = await client.UpdateSubmissionAsync(1001, new UpdateSubmissionParams
{
    Name = "New Submission Name",
    ExpireAt = "2024-09-01 12:00:00 UTC",
    Archived = true
});

ArchiveSubmissionAsync(id)

Documentation

Allows you to archive a submission.

await client.ArchiveSubmissionAsync(1001);

GetSubmittersAsync(params)

Documentation

Provides the ability to retrieve a list of submitters.

var submitters = await client.GetSubmittersAsync(new GetSubmittersParams { Limit = 10 });

GetSubmitterAsync(id)

Documentation

Provides functionality to retrieve information about a submitter, along with the submitter documents and field values.

var submitter = await client.GetSubmitterAsync(500001);

UpdateSubmitterAsync(id, data)

Documentation

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 = await client.UpdateSubmitterAsync(500001, new UpdateSubmitterParams
{
    Email = "john.doe@example.com",
    Fields = [
        new UpdateSubmitterFieldParams
        {
            Name = "First Name",
            Value = "Acme"
        },
    ]
});

GetTemplatesAsync(params)

Documentation

Provides the ability to retrieve a list of available document templates.

var templates = await client.GetTemplatesAsync(new GetTemplatesParams { Limit = 10 });

GetTemplateAsync(id)

Documentation

Provides the functionality to retrieve information about a document template.

var template = await client.GetTemplateAsync(1000001);

CreateTemplateFromPdfAsync(data)

Documentation

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 = await client.CreateTemplateFromPdfAsync(new CreateTemplateFromPdfParams
{
    Name = "Test PDF",
    Documents = [
        new CreateTemplateFromPdfDocumentParams
        {
            Name = "string",
            File = "base64",
            Fields = [
                new CreateTemplateDocumentFieldParams
                {
                    Name = "string",
                    Areas = [
                        new CreateTemplateDocumentFieldAreaParams
                        {
                            X = 0,
                            Y = 0,
                            W = 0,
                            H = 0,
                            Page = 1
                        },
                    ]
                },
            ]
        },
    ]
});

CreateTemplateFromDocxAsync(data)

Documentation

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 = await client.CreateTemplateFromDocxAsync(new CreateTemplateFromDocxParams
{
    Name = "Test DOCX",
    Documents = [
        new CreateTemplateFromDocxDocumentParams
        {
            Name = "string",
            File = "base64"
        },
    ]
});

CreateTemplateFromHtmlAsync(data)

Documentation

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 = await client.CreateTemplateFromHtmlAsync(new CreateTemplateFromHtmlParams
{
    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"
});

CloneTemplateAsync(id, data)

Documentation

Allows you to clone an existing template into a new template.

var template = await client.CloneTemplateAsync(1000001, new CloneTemplateParams
{
    Name = "Cloned Template"
});

MergeTemplateAsync(data)

Documentation

Allows you to merge multiple templates with documents and fields into a new combined template.

var template = await client.MergeTemplateAsync(new MergeTemplateParams
{
    TemplateIds = [321, 432],
    Name = "Merged Template"
});

UpdateTemplateAsync(id, data)

Documentation

Provides the functionality to move a document template to a different folder and update the name of the template.

var template = await client.UpdateTemplateAsync(1000001, new UpdateTemplateParams
{
    Name = "New Document Name",
    FolderName = "New Folder"
});

UpdateTemplateDocumentsAsync(id, data)

Documentation

Allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content.

var template = await client.UpdateTemplateDocumentsAsync(1000001, new UpdateTemplateDocumentsParams
{
    Documents = [
        new UpdateTemplateDocumentsDocumentParams
        {
            File = "string"
        },
    ]
});

ArchiveTemplateAsync(id)

Documentation

Allows you to archive a document template.

await client.ArchiveTemplateAsync(1000001);

Configuring Timeouts

Set timeouts to avoid hanging requests:

var client = new DocusealClient(
    Environment.GetEnvironmentVariable("DOCUSEAL_API_KEY"),
    new ClientOptions { Timeout = TimeSpan.FromSeconds(30) });

Support

For feature requests or bug reports, visit our GitHub Issues page.

License

The library is available as open source under the terms of the MIT License.

About

DocuSeal Document Signing API for .NET

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors