How to Integrate BoldSign into Your ASP.NET Core Application
Tags: webdev, csharp, dotnet, esign
Published: 2022-03-30 03:27:08

---
title: How to Integrate BoldSign into Your ASP.NET Core Application
published: true
date: 2022-03-29 11:42:41 UTC
tags: webdev, csharp, dotnet, esign
canonical_url: https://www.syncfusion.com/blogs/post/integrate-boldsign-into-your-asp-net-core-application.aspx
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lcbysfolhuz8k60j66it.png
---

[BoldSign](https://www.boldsign.com/ "BoldSign") is a web application that enables users to sign documents digitally and allows you to send documents for e-signatures from within your app. It has a set of APIs that gives you complete control over documents and properties. You can send documents for signature, track document status with webhooks, download signed documents and audit trails, remind signers to complete the signing process, and much more.

This blog post will teach you how to integrate BoldSign into an ASP.NET Core application!

## Getting started

**Note:**  Refer to the [Getting Started with BoldSign documentation](https://www.boldsign.com/help/api/general/introduction/ "Documentation: Getting Started with BoldSign") before proceeding.

1. Sign up for a [BoldSign trial](https://account.boldsign.com/signup?planId=101 "Free evaluation of the Syncfusion BoldSign").
2. Create an ASP.NET Core web app using the following command:  

```
dotnet new webapp -o ASPCoreEsignApp
```

3. Install the BoldSign API NuGet package with the following command:  

```
dotnet add package BoldSign.Api
```
4. Acquire the necessary [BoldSign app credentials](https://www.boldsign.com/help/api/general/authentication/#basic-authentication "Documentation: BoldSign basic authentication").

## Add BoldSign services through dependency injection

To communicate with the BoldSign API, you need to add authentication details such as headers and a base path to the **HttpClient**.

Include the following code in the **ConfigureServices** () method in your **startup.cs** file.

```csharp
var apiClient = new ApiClient("https://api.boldsign.com/", " ***API Key***");
services.AddSingleton(apiClient);
services.AddSingleton(new DocumentClient());
services.AddSingleton(new TemplateClient());
```

Now you can start using the BoldSign APIs in your app.

## Send a document for signing

Using the following code in your ASP.NET Core app, you can initiate the signing process. Send a request to sign a document to one or more recipients with the signing workflow, auto-reminders, expiration date, and more.

Refer to the following code example.

```csharp
private readonly IDocumentClient documentClient;
private readonly ITemplateClient templateClient;
 
public IndexModel(IDocumentClient documentClient, ITemplateClient templateClient, ILogger logger)
{
  this.documentClient = documentClient;
  this.templateClient = templateClient;
}
 
public void SignDocument()
{
 
  // Read the document from local path as stream.
  using var fileStream = System.IO.File.OpenRead("doc-2.pdf");
  var documentStream = new DocumentFileStream
  {
    ContentType = "application/pdf",
    FileData = fileStream,
    FileName = "doc-2.pdf",
  };
 
 
  // Creating collection with the loaded document.
  var filesToUpload = new List
  {
    documentStream,
  };
 
  // Creating signature field.
  var signatureField = new FormField(
  id: "Sign",
  type: FieldType.Signature,
  pageNumber: 1,
  isRequired: true,
  bounds: new Rectangle(x: 50, y: 50, width: 200, height: 30));
 
  // Adding the field to the collection.
  List formFeilds = new List();
  formFeilds.Add(signatureField);
 
  // Creating signer field.
  var signer = new DocumentSigner(
    name: "Signer Name 1",
    emailAddress: "signer@boldsign.dev",
    signerOrder: 1,
    authenticationCode: "123",
    signerType: SignerType.Signer,
    privateMessage: "This is private message for signer",
    // Assign the created form fields to the signer.
    formFields: formFeilds);
 
  // Adding the signer to the collection.
  var documentSigners = new List<DocumentSigner>
  {
    signer
  };
 
  // Create send for sign request object.
  var sendForSign = new SendForSign
  {
    Title = "Sent from API SDK",
    Message = "This is document message sent from API SDK",
    EnableSigningOrder = false,
 
  // Assign the signers collection.
  Signers = documentSigners,
 
  // Assign the loaded files collection.
  Files = filesToUpload
  };
 
  // Send the document for signing.
  var createdDocumentResult = this.documentClient.SendDocument(sendForSign);
}
```

**Note:** For more details, refer to the [send document for signing using BoldSign](https://www.boldsign.com/help/api/document/send-document-for-sign/ "Documentation: Send document for signing using BlodSign") documentation.

## Send a document using a template

Also, you can send documents for signing with predefined templates. Templates help users save time when they need to repeatedly send the same contracts for signing to different sets of people. Once we set up a template, sending documents takes less than a minute.

First, [create a template in the BoldSign app](https://www.boldsign.com/help/getting-started/creating-templates/ "Documentation: Creating templates in BlodSign app") and then get the template ID by following these steps:

1. Navigate to the **My Templates** section in the BoldSign app. You can see the created templates in the list.  
 ![Navigate to the My Templates section in the BoldSign app](https://www.syncfusion.com/blogs/wp-content/uploads/2022/03/Navigate-to-the-My-Templates-section-in-the-BoldSign-app.png)
2. Click the more options button at the right end of the template you want to send and choose the **Copy template ID** option to copy the template’s ID.  
 ![Choose the Copy template ID option](https://www.syncfusion.com/blogs/wp-content/uploads/2022/03/Choose-the-Copy-Template-ID-option.png)
3. Use the copied template ID to send your document for signing. You can directly use the template with a predefined set of recipients or add the recipients to the document before sending the signature request. Refer to the following code example.
```csharp
public void SendDocumentUsingTemplate()
{
 
  var templateDetails = new SendForSignFromTemplate(
  templateId: " **templateId**",
  title: "Document from Template",
  message: "This document description");
  var createdDocumentResult = this.templateClient.SendUsingTemplate(templateDetails);
}
```

Refer to the following images.

![Sending a PDF Document for Signing Using BoldSign](https://www.syncfusion.com/blogs/wp-content/uploads/2022/03/Sending-a-PDF-Document-for-Signing-Using-BoldSign.png)
<figcaption>Sending a PDF Document for Signing Using BoldSign</figcaption>

![Signing a PDF Document using BoldSign Web App](https://www.syncfusion.com/blogs/wp-content/uploads/2022/03/Signing-a-PDF-Document-using-BoldSign-Web-App.png)
<figcaption>Signing a PDF Document using BoldSign Web App</figcaption>

**Note:** For more details, refer to the [send document to sign using templates in BoldSign documentation](https://www.boldsign.com/help/api/template/send-document-to-sign-using-template/ "Documentation: Send document to sign using template in BoldSign").

## Conclusion

Thanks for reading about how to integrate BoldSign into your ASP.NET Core web application! Check out our [online demo](https://www.boldsign.com/api-demo/ "Bold Sign online demos") and enjoy a hassle-free signing experience.

The Syncfusion [ASP.NET Core UI controls](https://www.syncfusion.com/aspnet-core-ui-controls "ASP.NET Core UI controls") library, powered by [Essential JS 2](https://www.syncfusion.com/javascript-ui-controls "Essential JS 2 UI components"), is the only control suite you will ever need to build an app. It contains over 70 high-performance, lightweight, modular, and responsive UI controls in a single package. Use them to increase your productivity in your development projects!

You can download the [product setup](https://www.syncfusion.com/account/downloads/studio/ "License and download page of Essential Studio") if you’re already a Syncfusion user. If you’re not one yet, you can download a free [30-day trial ](https://www.syncfusion.com/account/downloads/studio "Free evaluation of the Syncfusion Essential Studio")to evaluate our products.

You can contact us through our [support forum](https://www.syncfusion.com/forums "Syncfusion support forum"), [support portal](https://support.syncfusion.com/ "Syncfusion support portal"), or [feedback portal](https://www.syncfusion.com/feedback/ "Syncfusion Feedback Portal"). As always, we are happy to assist you!

## Related blogs

- [Announcing the Release of E-Signature Platform BoldSign](https://www.syncfusion.com/blogs/post/announcing-the-release-of-e-signature-platform-boldsign.aspx "Announcing the Release of E-Signature Platform BoldSign blog")
- [Simple Steps to Automate UI Testing in ASP.NET Core](https://www.syncfusion.com/blogs/post/simple-steps-to-automate-ui-testing-in-asp-net-core.aspx "Simple Steps to Automate UI Testing in ASP.NET Core blog")
- [Hosting Multiple ASP.NET Core Apps in Ubuntu Linux Server Using Apache](https://www.syncfusion.com/blogs/post/hosting-multiple-asp-net-core-apps-in-ubuntu-linux-server-using-apache.aspx "Hosting Multiple ASP.NET Core Apps in Ubuntu Linux Server Using Apache blog")
- [Easy Steps to Migrate an ASP.NET MVC Project to an ASP.NET Core Project](https://www.syncfusion.com/blogs/post/migrate-asp-net-mvc-project-to-asp-net-core.aspx "Easy Steps to Migrate an ASP.NET MVC Project to an ASP.NET Core Project blog")