This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code example, modify the exampleAPI settings at the end of the appsettings.json file from eSignature to rooms.
Note: To use the Rooms API you must also create your DocuSign developer account for Rooms.
Github repo: code-examples-node
This repo is a Node.js application that demonstrates:
- Use embedded signing. Source. This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, the DocuSign signing is initiated from your website.
- Send an envelope with a remote (email) signer and cc recipient. Source. The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.
- List envelopes in the user's account. Source.
- Get an envelope's basic information. Source. The example lists the 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
This includes current recipient status. - Download an envelope's documents. Source
The example can download individual documents, the documents concatenated together, or a zip file of the documents. - Programmatically create a template. Source
- Send an envelope using a template. Source
- Send an envelope and upload its documents with multpart binary transfer. [Source]
(./lib/eSignature/eg010SendBinaryDocs.js)
Binary transfer is 33% more efficient than using Base64 encoding. - Use embedded sending. Source. Embeds the DocuSign web tool (NDSE) in your web app to finalize or update the envelope and documents before they are sent.
- Embedded DocuSign web tool (NDSE). Source.
- Use embedded signing from a template with an added document. Source. This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.
- Accept payments. Source
Send an order form with online payment by credit card. - Get envelope tab data. Source
Retrieve the tab (field) values for all of the envelope's recipients. - Set envelope tab values. Source
The example 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. The example also stores metadata with the envelope. - Set template tab values. Source
The example creates an envelope using a template and sets the initial values for its tabs (fields). The example also stores metadata with the envelope. - Get the envelope custom field data (metadata). Source
The example retrieves the custom metadata (custom data fields) stored with the envelope. - Requiring an access code for a Recipient Source
This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. - Requiring SMS authentication for a recipient Source
This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. - Requiring phone authentication for a recipient Source
This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. - Requiring knowledge-based authentication (KBA) for a Recipient Source
This example sends and envelope that requires passing a public records check to validate identity for the purpose of multi-factor authentication. - Requiring ID Verification (IDV) for a recipient Source
This example sends and envelope that requires the recipient to upload a government issued id. - Creating a permission profile Source
This example demonstrates how to create a permission profile using the Create Permission Profile method. - Setting a permission profile Source
This example demonstrates how to set a user group's permission profile using the Update Group method. You must have already created permissions profile and group of users. - Updating individual permission settings Source
This example demonstrates how to edit individual permission settings on a permissions profile using the Update Permission Profile method. - Deleting a permission profile Source
This example demonstrates how to delete a permission profile using the Delete Permission Profile method. - Creating a brand Source
This example creates brand profile for an account using the Create Brand method. - Applying a brand to an envelope Source
This example demonstrates how to apply a brand you've created to an envelope using the Create Envelope method. First, the code creates the envelope and then applies the brand to it. Anchor text (AutoPlace) is used to position the signing fields in the documents. - Applying a brand to a template Source
This example demonstrates how to apply a brand you've created to a template using using the Create Envelope method. You must have at least one created template and brand. Anchor text (AutoPlace) is used to position the signing fields in the documents. - Bulk-send envelopes to multiple recipients Source
This example demonstrates how to send envelopes in bulk to multiple recipients using these methods: Create Bulk Send List, Create Bulk Send Request. First, the code creates a bulk-send recipients list, and then creates an envelope. After that, initiates bulk envelope sending.
Note: To use the Rooms API, you must also create your DocuSign developer account for Rooms.
- Create room with Data. Source
This example creates a new room in your DocuSign Rooms account to be used for a transaction. - Create a room from a template. Source
This example creates a new room using a template. - Create room with Data. Source. This example exports all the available data from a specific room in your DocuSign Rooms account.
- Add forms to a room. Source. This example adds a standard real estate related form to a specific room in your DocuSign Rooms account.
- How to search for rooms with filters. Source
This example searches for rooms in your DocuSign Rooms account using a specific filter. - Create an external form fillable session. Source
This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account.
-
Authentication with Docusign via Authorization Code Grant flow . When the token expires, the user is asked to re-authenticate. The refresh token is not used in this example.
-
Authentication with DocuSign via the JSON Web Token (JWT) Grant. When the token expires, it updates automatically.
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.
-
A DocuSign developer account (email and password) on demo.docusign.net. If you don't already have one, create a free account.
-
A DocuSign integration key (client ID). To use Authorization Code Grant, you will need an integration key and its secret key. To use JSON Web Token (JWT), you will need an integration key, an RSA key pair, and an account ID for the user you are impersonating.
If you use this example on your own workstation, the Integration key must include a Redirect URI of
http://localhost:5000/ds/callbackIf 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. The signer and the cc email cannot be the same.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip items 1 and 4 below as they're automatically performed for you.
- Download or clone this repository to your workstation to directory code-examples-node
- Switch to the folder:
cd <Quickstart_folder_name>orcd code-examples-node npm install- Copy the file config/appsettings.example.json into a file config/appsettings.json
Either:- Update the file config/appsettings.json in the project's root directory with the Integration Key and other settings, or
- Create and export environment variables for the settings. See the config/appsettings.json file for the names of the environment variables. Note: Protect your integration key and secret--If you update the config/appsettings.json file, then you should ensure that it will not be stored in your source code repository.
npm start- Open a browser to http://localhost:5000
- Create a developer account on developers.docusign.com if you don't already have one.
- Create a new API key in the Admin panel: https://admindemo.docusign.com/api-integrator-key, take note of the public key.
- Set a redirect URI of
http://localhost:5000/ds/callbackas mentioned in the installation steps above for the integration key you create in Prerequisites item 2. - Generate an RSA key pair in the administrator console on the DocuSign developer account and copy the private key to a secure location.
- Create a new file in your repo source folder named private.key, and paste in that copied RSA private key, then save it.
- Update the file config/appsettings.json and include the newly created API key from item 2 as well as your account user id GUID which is also found on the Admin panel:
https://admindemo.docusign.com/api-integrator-key.
From there you should be able to run the launcher using npm start then selecting JSON Web Token when authenticating your account.
To use the payments example, create a test payments gateway for your DocuSign developer account.
See the PAYMENTS_INSTALLATION.md file for instructions.
Then add the payment gateway account id to the config/appsettings.json file.
-
Before running the unit tests you will need to obtain an Access Token and you will need an API Account ID.
-
Either:
- Update the file test/testHelpers.js in the project's root directory 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.
-
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.