> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# C# SDK setup and configuration

> Learn how to set up and configure the C# eSignature SDK.

## Adding the SDK to your project

The C# eSignature SDK is provided as a NuGet package named [DocuSign.eSign.dll](https://www.nuget.org/packages/DocuSign.eSign.dll/). By default, you will always get the latest stable version of the SDK. Prerelease versions (either release candidate (rc) or beta) can also be downloaded as shown below.

There are two ways to add the package to your project: via the Visual Studio UI or the command line.

### Adding the C# SDK to your project using the Visual Studio UI

1. Open Visual Studio and load the solution you wish to use.

2. Open the **Solution Explorer** window and right-click the desired project in the solution.

3. Select **Manage NuGet Packages…** (shown below).

![](/_fern-files/docusign.docs.buildwithfern.com/51f1e67b157e4d42b5f28deb135679f5b404469fbfd612243e1b8a6e2cbed2e2/assets/img/CSharpSDK_fig1.png)

4. In the **NuGet Package Manager** window, select the **Browse** tab on the left.

![](/_fern-files/docusign.docs.buildwithfern.com/02f813ecfcdf909cad57854b7874f82d90ab9e981bfaffdb0279f8be8ed444d8/assets/img/CSharpSDK_fig2.png)

5. In the **Search** textbox, enter "Docusign" to find all Docusign-related packages.
   **DocuSign.eSign.dll** "by Docusign" (publisher) should be displayed first in the search results. Select it.

![](/_fern-files/_img/49023619ea54c5632d1226b8b1d9e68ea27f7043c42903c47469cc5af4c76bcc.webp)

6. Select **Install** to install the latest version of the package.

**Note:** You can install earlier versions by expanding the drop-down menu to the right of **Version**. You can also install release candidate (rc) and beta versions by selecting the **Include prerelease** checkbox to the right of the **Search** textbox.

7. Acknowledge the license agreement by selecting **I Accept** on the **License Acceptance** screen.

You have now successfully downloaded, configured, and installed the Docusign eSignature SDK for your project. To confirm the package is available in your project, you can go back to the **Solution Explorer** window and expand the **Dependencies > Packages** section of the project. You should see **DocuSign.eSign.dll** (version number) listed.

![](/_fern-files/_img/45e6f9f6c467d131611f1108c1dca07a8f23c9b30705f42fbc77b2c9eefb441e.webp)

**Note:** If you expand the DocuSign.eSign.dll package, you will see the additional dependencies that are automatically installed by the NuGet package manager.

### Adding the C# SDK to your project using the command line

1. Open the NuGet Package Manager command line from the Visual Studio menu bar by selecting **Tools > NuGet Package Manager > Package Manager Console**.

2.

From the **Package Manager Console**, run the following command:

```text
    Install-Package DocuSign.eSign.dll
```

![](/_fern-files/docusign.docs.buildwithfern.com/48727a5142448bf515e7e3d47a6c7793385b255139db69eedf98798ed5ea9027/assets/img/CSharpSDK_fig4.png)

The command above will automatically install the latest stable version. If desired, you can specify a specific version by using the `-Version` switch. For example, this command installs version 5.2.0 of the Docusign C# eSignature package:

```text
    Install-Package DocuSign.eSign.dll -Version 5.2.0
```

## Including the SDK library

After you have installed the DocuSign.eSign.dll package, you will need to find the public classes that are required to complete various eSignature tasks. To do that, add the main namespaces as `using` statements in your C# code.

Here are the three main `using` statements for the commonly required namespaces:

```text
using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client;
```

### [DocuSign.eSign.Api namespace](https://github.com/docusign/docusign-esign-csharp-client/tree/master/sdk/src/DocuSign.eSign/Api)

This namespace is used for endpoint categories. Each class under this namespace corresponds to one of the categories listed in the left menu of the [Docusign eSignature REST API Reference](/docs/esign-rest-api/reference). You will need to use this namespace to make calls to the public methods that initiate REST API calls to the Docusign eSignature REST API.

**Note:** Hereafter in the SDK documentation, the term “API object” will refer to [eSignature REST API Reference](/docs/esign-rest-api/reference) objects.

An [API category](/docs/esign-rest-api/reference) contains all methods for each API resource in that category. For example, the C# SDK [EnvelopesApi](https://github.com/docusign/docusign-esign-csharp-client/blob/master/sdk/src/DocuSign.eSign/Api/EnvelopesApi.cs) class includes the `CreateEnvelope` method. This method corresponds to the [create](/docs/esign-rest-api/reference/envelopes/envelopes/create) method of the API [Envelopes](/docs/esign-rest-api/reference/envelopes/envelopes) resource.

The C# SDK method names roughly correspond to the API Resource:method names.

The API Resource:method page for each endpoint lists the API SDK Method in the **SDK Method** box. The C# method name will be the PascalCase version of the API SDK Method name. For example, the API SDK Method `Envelopes::createEnvelope`, listed toward the bottom of the [Envelopes:create](/docs/esign-rest-api/reference/envelopes/envelopes/create) page, is the C# method `CreateEnvelope`.

Some API endpoints also use HTTP query parameters. Within the API, such query parameters use snake_case. For example, the [Envelopes:create](/docs/esign-rest-api/reference/envelopes/envelopes/create) API method includes an optional query parameter, `change_routing_order`. Within the SDK, the API’s query parameters are added as an elective `options` parameter after the request object.

**Example:** The `CreateEnvelope` method signature is:

```text
    public EnvelopeSummary CreateEnvelope (string accountId, EnvelopeDefinition envelopeDefinition = null, EnvelopesApi.CreateEnvelopeOptions options = null);
```

The `CreateEnvelopeOptions` class is used to set the API method’s query parameters. The class is defined as:

```text
    public class CreateEnvelopeOptions
    {
        public string cdseMode {get; set;}
        public string changeRoutingOrder {get; set;}
        public string completedDocumentsOnly {get; set;}
        public string mergeRolesOnDraft {get; set;}
        public string tabLabelExactMatches {get; set;}
    }
```

The class attributes in camelCase correspond to the API endpoint’s query parameters.

### [DocuSign.eSign.Model namespace](https://github.com/docusign/docusign-esign-csharp-client/tree/master/sdk/src/DocuSign.eSign/Model)

This namespace includes the data structures used for sending and receiving data from the eSignature API endpoints. By using these classes instead of generic JSON objects, C# developers can develop with the Docusign eSignature API more easily and quickly than by using JSON directly.

There’s a one-to-one correspondence between the objects described in the [API Reference](/docs/esign-rest-api/reference) and the classes in the DocuSign.eSign.Model namespace. The API object names use flatcase (all lowercase without spaces) while the corresponding SDK models use PascalCase. For example, the API object [paymentgatewayaccount](/docs/esign-rest-api/reference/payments/paymentgatewayaccounts/list#response200_paymentgatewayaccount) corresponds to the C# model [PaymentGatewayAccount](https://github.com/docusign/docusign-esign-csharp-client/blob/master/sdk/src/DocuSign.eSign/Model/PaymentGatewayAccount.cs).

**Note:** The API object name is often not the same as the corresponding model in the C# SDK.

Object attribute names in the API use camelCase. The corresponding properties of the C# SDK are in PascalCase.

### [DocuSign.eSign.Client namespace](https://github.com/docusign/docusign-esign-csharp-client/tree/master/sdk/src/DocuSign.eSign/Client)

This namespace contains the classes needed to manage the overall API experience. These classes handle instantiating a client element to make API calls, authentication, and exception handling. You will need to include this namespace to be able to use the Docusign eSignature API correctly.

### Using the SDK

To make eSignature REST API calls with the SDK, you need:

* A current `accessToken`.
* The `basePath` for the API call.
* For most API calls, you’ll also need the relevant `accountId`. Note that it is common for a user to be a member of multiple accounts.

### Modifying the default HTTP Request timeout

By default, ASP.NET applications have a 90-second timeout for HTTP requests. In rare cases API calls may take longer, and you may need to increase the timeout to accommodate these calls. Follow instructions provided by Microsoft at [Request timed out error when you use the DataAdapter method in an ASP.NET application](https://docs.microsoft.com/en-us/troubleshoot/developer/webapps/aspnet/site-behavior-performance/request-timed-out-dataadapter) to increase the timeout period for HTTP requests made from your application when using the Docusign C# SDK.