Github repo: https://github.com/docusign/code-examples-node
This GitHub repo includes code examples for both the DocuSign eSignature REST API and the DocuSign Rooms API.
To use the Rooms API code examples, modify the exampleAPI
setting at the end of the config/appsettings.json file to rooms
.
Note: To use the Rooms API, you must also create your DocuSign developer account for Rooms.
This repo is a Node.js application that supports the following authentication workflows:
-
Authentication with DocuSign via Authorization Code Grant. When the token expires, the user is asked to re-authenticate. The refresh token is not used.
-
Authentication with DocuSign via JSON Web Token (JWT) Grant. When the token expires, it updates automatically.
For more information about the scopes used for obtaining authorization to use the eSignature API, see the Required Scopes section.
- Use embedded signing. Source
Sends an envelope, then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. - Request a signature by email (Remote Signing). Source
The envelope includes a PDF, Word, and HTML document. Anchor text is used to position the signing fields in the documents. - List envelopes in the user's account. Source
The envelopes' current status is included. - Get an envelope's basic information. Source
Lists basic information about an envelope, including its overall status. - List an envelope's recipients Source
Includes current recipient status. - List an envelope's documents. Source
Includes current recipient status. - Download an envelope's documents. Source
Downloads individual documents, the documents concatenated together, or a ZIP file of the documents. - Programmatically create a template. Source
- Request a signature by email using a template. Source
- Send an envelope and upload its documents with multipart binary transfer. Source
Binary transfer is 33% more efficient than using Base64 encoding. - Use embedded sending. Source
Embeds the DocuSign UI in your web app to finalize or update the envelope and documents before they are sent. - Embed the DocuSign UI in your app. Source
- Use embedded signing from a template with an added document. Source
Sends an envelope based on a template. In addition to the template's document(s), this example adds an additional document to the envelope by using the Templates feature. - Accept payments. Source
Sends an order form with online payment by credit card. - Get envelope tab data. Source
Retrieves the tab (field) values for all of the envelope's recipients. - Set envelope tab values. Source
Creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. This example also stores metadata with the envelope. - Set template tab values. Source
Creates an envelope using a template and sets the initial values for its tabs (fields). This example also stores metadata with the envelope. - Get the envelope custom field data (metadata). Source
Retrieves the custom metadata (custom data fields) stored with the envelope. - Require an access code for a recipient. Source
Sends an envelope that requires entering an access code for the purpose of multifactor authentication. - Require SMS authentication for a recipient. Source
Sends an envelope that requires entering a six-digit code from an text message for the purpose of multifactor authentication. - Require phone authentication for a recipient. Source
Sends an envelope that requires entering a voice-based response code for the purpose of multifactor authentication. - Require knowledge-based authentication (KBA) for a recipient. Source
Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication. - Require ID Verification (IDV) for a recipient. Source
Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication. - Create a permission profile. Source
- Set a permission profile. Source
Demonstrates how to set a user group's permission profile. You must have already created a permission profile and a group of users. - Update individual permission settings. Source
Demonstrates how to edit individual permission settings on a permission profile. - Delete a permission profile. Source
- Create a brand. Source
Creates a brand profile for an account. - Apply a brand to an envelope. Source
Demonstrates how to apply a brand you've created to an envelope. First, this example creates the envelope, then applies the brand to it. Anchor text is used to position the signing fields in the documents. - Apply a brand to a template. Source
Demonstrates how to apply a brand you've created to a template. You must have at least one created template and brand. Anchor text is used to position the signing fields in the documents. - Bulk-send envelopes to multiple recipients. Source
Demonstrates how to send envelopes in bulk to multiple recipients. First, this example creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk envelope sending. - Pausing a signature workflow. Source
Demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - Unpausing a signature workflow. Source
Demonstrates how to update an envelope to resume the workflow that has been paused using the Update Envelope method. You must have created at least one envelope with a paused signature workflow to run this example. - Using conditional recipients. Source
Demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction using the Create Envelope method. - Request a signature by SMS delivery Source
Demonstrates how to send a signature request via an SMS message using the Envelopes: create method.
For more information about the scopes used for obtaining authorization to use the Rooms API, see the Required Scopes section.
Note: To use the Rooms API, you must also create your DocuSign Developer Account for Rooms. Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account.
- Create a room with data. Source
Creates a new room in your DocuSign Rooms account to be used for a transaction. - Create a room from a template. Source
Creates a new room using a template. - Export data from a room. Source.
Exports all the available data from a specific room in your DocuSign Rooms account. - Add a form to a room. Source.
Adds a standard real estate-related form to a specific room in your DocuSign Rooms account. - Search for a room with a filter. Source
Searches for a room in your DocuSign Rooms account using a specific filter. - Create an external form fillable session. Source
Creates an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - Creating a form group. Source.
Creates a new form group with the name given in the name property of the request body. - Grant office access to a form group. Source.
Assigns an office to a form group for your DocuSign Rooms. - Assign a form to a form group. Source.
Assigns a form to a form group for your DocuSign Rooms.
For more information about the scopes used for obtaining authorization to use the Click API, see the Required Scopes section.
- Create a clickwrap.
Source
Demonstrates how to create a clickwrap that you can embed in your website or app. - Activate a clickwrap.
Source
Demonstrates how to activate a new clickwrap. By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. - Create a new clickwrap version.
Source
Demonstrates how to use the Click API to create a new version of a clickwrap. - Get a list of clickwraps.
Source
Demonstrates how to get a list of clickwraps associated with a specific DocuSign user. - Get clickwrap responses.
Source
Demonstrates how to get user responses to your clickwrap agreements.
Note: To use the Monitor API, you must also enable DocuSign Monitor for your organization.
For information about the scopes used for obtaining authorization to use the Monitor API, see the scopes section.
- Get monitoring data. Source
Demonstrates how to get and display all of your organization’s monitoring data.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip items 1 and 2 below as they're automatically performed for you.
-
Create a DocuSign developer account if you don't already have one.
-
A DocuSign integration key (client ID) that is configured for authentication to use either Authorization Code Grant or JWT Grant.
To use Authorization Code Grant, you will need an integration key and its secret key.
To use JWT Grant, you will need an integration key, an RSA key pair, and the API Username GUID of the impersonated user. See Configure JWT below for detailed steps.
For both authentication flows:
If you use this launcher on your own workstation, the integration key must include a redirect URI of http://localhost:5000/ds/callback
If you will not be running the example on your own workstation, use the appropriate DNS name and port instead of localhost.
-
A name and email for a signer, and a name and email for a cc recipient.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip step 4 below as it was automatically performed for you.
-
Extract the Quickstart ZIP file or download or clone the code-examples-node repository.
-
Switch to the folder:
cd <Quickstart_folder_name>
orcd code-examples-node
-
Run
npm install
-
Create a new file config/appsettings.json by using config/appsettings.example.json as your template. Update config/appsettings.json with your integration key GUID and other settings.
Note: Protect your integration key and secret and/or RSA private key pair; ensure that config/appsettings.json will not be stored in your source code repository.
-
npm start
-
Open a browser to http://localhost:5000
- Create a new integration key on the Apps and Keys page and save the GUID to a secure location for step 5 below.
- Set a redirect URI of http://localhost:5000/ds/callback
- Generate an RSA key pair. Under Apps and Integration Keys, choose the integration key to use, then select Actions, then Edit. In the Authentication section, select ADD RSA KEYPAIR. Save the private key to a secure location for the next step.
- Create a new file config/private.key, then save your RSA private key in it.
- Update the file config/appsettings.json with your integration key GUID from step 1 as your
dsJWTClientId
and your API Username from the Apps and Keys page as yourimpersonatedUserGuid
. - Run the launcher using
npm start
, then select JSON Web Token when authenticating your account.
To use the payments example, create a test payments gateway for your DocuSign developer account. See PAYMENTS_INSTALLATION.md for instructions.
Then add the Gateway Account ID to the config/appsettings.json file.
- Before running the unit tests you will need to obtain an access token and an API Account ID.
- Either:
- Update the file test/testHelpers.js in the project's root folder with the access token, API Account ID, signer and cc information, or
- Create and export this information as the environment variables named in that file.
- Run
npm test
This repository uses the MIT License. See the LICENSE file for more information.
Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.