> 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

# Node.js SDK setup and configuration

> Learn the steps involved in setup and configuration of Node.js SDK.

> **Note**
>
> Learn about [Quickstart](/docs/esign-rest-api/quickstart) and how you can use it to quickly set up and run eSignature REST API code examples.

## Adding the SDK to your project

The Node.js eSignature SDK is provided as a package named [docusign-esign](https://www.npmjs.com/package/docusign-esign/). 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 three ways to add the package to your project: via your preferred console, your project’s package.json file, or by downloading the SDK from GitHub.

### Adding the Node.js SDK to your project using your console

In your console, navigate to your project directory, then run: `npm i -s docusign-esign`

To specify a version using your console, you can use the @ syntax:

`    npm i -s docusign-esign@5.8.1`

### Adding the Node.js SDK to your project using your project’s package.json file

1. In your application's package.json file, add: `"docusign-esign"`
2. Open your console, navigate to your project directory, then run: `"npm install"`

If desired, you can specify a version. For example, adding the following to your project’s package.json file installs version 5.8.1 of the Docusign Node.js eSignature SDK:

`    "docusign-esign": "5.8.1"`

### Downloading the Node.js SDK from the GitHub repository

This open-source SDK is available for download in cases where you would like to make changes to the SDK. You can download the SDK from GitHub using the instructions below:

1. Download or clone the SDK from the [docusign-esign-node-client](https://github.com/docusign/docusign-esign-node-client) repository.
2. In the console, navigate to the docusign-esign-node-client directory, then run: `npm install`

You can also select a different version to download from the [docusign-esign-node-client](https://github.com/docusign/docusign-esign-node-client) repository's [release history](https://github.com/docusign/docusign-esign-node-client/releases/).

## Including the SDK library

Once you have installed the docusign-esign package, you will need to find the public modules that are required to complete various eSignature tasks.

When using the Node.js package, you must add the following `require` statement in your Node.js code:

`    const docusign = require('docusign-esign')`

## Docusign eSignature API modules

These [Node.js SDK modules](https://github.com/docusign/docusign-esign-node-client/tree/master/src/api) contain endpoint categories. Each of these modules corresponds to one of the categories listed in the left menu of the [eSignature REST API](/docs/esign-rest-api) reference. You will need these modules to make calls to the SDK functions 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](/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 Node.js SDK [EnvelopesApi](https://github.com/docusign/docusign-esign-node-client/blob/master/src/api/EnvelopesApi.js) module includes the  [Envelopes:create](https://github.com/docusign/docusign-esign-node-client/blob/master/src/api/EnvelopesApi.js#L1079) function. This function 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 Node.js SDK function 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 Node.js function name will be the camelCase 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 Node.js SDK function [createEnvelope](https://github.com/docusign/docusign-esign-node-client/blob/master/src/api/EnvelopesApi.js#L1079).

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

**Example:** The [getEnvelope](https://github.com/docusign/docusign-esign-node-client/blob/master/src/api/EnvelopesApi.js#L4550) function signature is:

`    this.getEnvelope = function(accountId, envelopeId, optsOrCallback, callback)`

The [queryParams](https://github.com/docusign/docusign-esign-node-client/blob/master/src/api/EnvelopesApi.js#L4581) variable is used to set the API method’s query parameters.

```text
    var queryParams = {
        'advanced_update': optsOrCallback['advancedUpdate'],
        'include': optsOrCallback['include']
    };
```

The Node.js SDK query parameters in snake_case correspond to the API endpoint’s query parameters.

## Docusign eSignature Models

These [models](https://github.com/docusign/docusign-esign-node-client/tree/master/src/model) contain the objects used for sending and receiving data from the eSignature API endpoints. By using these models instead of generic JSON objects, Node.js 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 Node.js Docusign eSignature Models. The API object names use flatcase (all lowercase without spaces) while the corresponding SDK models use PascalCase (the first letter is uppercase). For example, the API object [paymentgatewayaccount](/docs/esign-rest-api/reference/payments/paymentgatewayaccounts/list#response200_paymentgatewayaccount) corresponds to the Node.js model [PaymentGatewayAccount](https://github.com/docusign/docusign-esign-node-client/blob/master/src/model/PaymentGatewayAccount.js).

> **Note**
>
> The API object name is often not the same as the corresponding model in the Node.js SDK.

Object attribute names in the API also use camelCase. The corresponding properties of the Node.js SDK are also in camelCase.

## Docusign eSignature Client, OAuth, and Error functions

These [functions](https://github.com/docusign/docusign-esign-node-client/tree/master/src/) are needed to manage the overall API experience. The Client, OAuth, and Error functions, respectively, handle instantiating a client element to make API calls, authentication, and exception handling. You will need these functions 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.