PLEASE! Share your feedback in a two-question survey.
GitHub repo: code-examples-powershell
This GitHub repo includes code examples for the Web Forms API, Maestro API, Docusign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API.
This repo includes a PowerShell command-line 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 REST API, see Required scopes.
For a list of code examples that use the eSignature REST API, see the How-to guides overview on the DocuSign Developer Center.
Note: To use the Admin API, you must create an organization in your DocuSign developer account. Also, to run the DocuSign CLM code example, CLM must be enabled for your organization.
For information about the scopes used for obtaining authorization to use the Admin API, see the scopes section.
For a list of code examples that use the Admin API, see the How-to guides overview on the DocuSign Developer Center.
For more information about the scopes used for obtaining authorization to use the Click API, see Required scopes
For a list of code examples that use the Click API, see the How-to guides overview on the DocuSign Developer Center.
Note: To run the ID Evidence code examples, you must first complete the Prerequisites.
For more information about the scopes used for obtaining authorization to use the ID Evidence API, see Required scopes.
For a list of code examples that use the ID Evidence API, see the How-to guides overview on the DocuSign Developer Center.
Note: Maestro API is currently only avaiable for developers that participate in the beta program.
For information about the scopes used for obtaining authorization to use the Maestro API, see the scopes section.
For a list of code examples that use the Maestro API, see the How-to guides overview on the DocuSign Developer Center.
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.
For a list of code examples that use the Monitor API, see the How-to guides overview on the DocuSign Developer Center.
Note: For closed beta participants interested in adding Notary API functionality to your production account, contact your DocuSign representative.
Example 1 requires a Sender DocuSign developer account API account ID that has been provisioned for the Notary API base URI.
Example 2 requires that you create an organization in your Sender DocuSign developer account.
For information about the scopes used for obtaining authorization to use the Notary API, see the scopes section.
For a list of code examples that use the Notary API, see the How-to guides overview on the DocuSign Developer Center.
Note: To use the Rooms API, you must also create your Rooms developer account.
Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account.
For more information about the scopes used for obtaining authorization to use the Rooms API, see Required scopes.
For a list of code examples that use the Rooms API, see the How-to guides overview on the DocuSign Developer Center.
The Web Forms API is available in all developer accounts, but only in certain production account plans. Contact DocuSign Support or your account manager to find out whether the Web Forms API is available for your production account plan.
For more information about the scopes used for obtaining authorization to use the Rooms API, see Required scopes.
For a list of code examples that use the Web Forms API, see the How-to guides overview on the DocuSign Developer Center.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip items 1 and 2 as they were automatically performed for you.
-
A free DocuSign developer account; create one if you don't already have one.
-
A DocuSign app and integration key that is configured for authentication to use either Authorization Code Grant or JWT Grant.
This video demonstrates how to obtain an integration key.
To use Authorization Code Grant, you will need an integration key and a secret key. See Installation steps for details.
To use JWT Grant, you will need an integration key, an RSA key pair, and the User ID GUID of the impersonated user. See Installation steps for JWT Grant authentication for details.
For both authentication flows:
If you use this launcher on your own workstation, the integration key must include a redirect URI of
http://localhost:8080/authorization-code/callback
If you host this launcher on a remote web server, set your redirect URI as
{base_url}/authorization-code/callback
where {base_url} is the URL for the web app.
-
PowerShell 5 or later
-
PowerShell script files (PS1) downloaded from the internet that are not digitally signed are considered a security risk. By default, PowerShell blocks execution of such scripts. To bypass this limitation, you will need to run the following command at the Windows PowerShell command line:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
After executing this command, you can run the downloaded PowerShell script.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip step 3 as it was automatically performed for you.
- Extract the Quickstart ZIP file or download or clone the code-examples-powershell repository.
- In File Explorer, open your Quickstart folder or your code-examples-powershell folder.
- To configure the launcher for Authorization Code Grant authentication, create a copy of the file config/settings.example.json and save the copy as config/settings.json.
- Add your integration key. On the Apps and Keys page, under Apps and Integration Keys, choose the app to use, then select Actions > Edit. Under General Info, copy the Integration Key GUID and save it in settings.json as your
INTEGRATION_KEY_AUTH_CODE
. - Generate a secret key, if you don’t already have one. Under Authentication, select + ADD SECRET KEY. Copy the secret key and save it in settings.json as your
SECRET_KEY
. - Add the launcher’s redirect URI. Under Additional settings, select + ADD URI, and set a redirect URI of http://localhost:8080/authorization-code/callback. Select SAVE.
- Set a name and email address for the signer. In settings.json, save an email address as
SIGNER_EMAIL
and a name asSIGNER_NAME
.
Note: Protect your personal information. Please make sure that settings.json will not be stored in your source code repository.
- Add your integration key. On the Apps and Keys page, under Apps and Integration Keys, choose the app to use, then select Actions > Edit. Under General Info, copy the Integration Key GUID and save it in settings.json as your
Installation steps for Multiple code examples, Authorization Code Grant, and JWT Grant and JWT grant remote signing example
- Run the launcher. In the root folder, right-click the launcher file and select Run with PowerShell > Open.
- Select an API when prompted in Windows PowerShell.
- Select Authorization Code Grant when authenticating your account.
- Select your desired code example.
- In File Explorer, open your Quickstart folder, then open the Quick_ACG folder within it.
- Right-click the launcherACG.ps1 file and select Run with PowerShell > Open.
Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip step 3 as it was automatically performed for you. Also, in order to select JSON Web Token authentication in the launcher, in config/settings.json, change the quickstart
setting to "false"
.
- Extract the Quickstart ZIP file or download or clone the code-examples-powershell repository.
- In File Explorer, open your Quickstart folder or your code-examples-powershell folder.
- To configure the launcher for JWT Grant authentication, create a copy of the file config/settings.example.json and save the copy as config/settings.json.
- Add your User ID. On the Apps and Keys page, under My Account Information, copy the User ID GUID and save it in settings.json as your
IMPERSONATION_USER_GUID
. - Add your integration key. On the Apps and Keys page, under Apps and Integration Keys, choose the app to use, then select Actions > Edit. Under General Info, copy the Integration Key GUID and save it in settings.json as your
INTEGRATION_KEY_JWT
. - Generate an RSA key pair, if you don’t already have one. Under Authentication, select + GENERATE RSA. Copy the private key and save it in a new file named config/private.key.
- Add the launcher’s redirect URI. Under Additional settings, select + ADD URI, and set a redirect URI of http://localhost:8080/authorization-code/callback. Select SAVE.
- Set a name and email address for the signer. In settings.json, save an email address as
SIGNER_EMAIL
and a name asSIGNER_NAME
.
Note: Protect your personal information. Please make sure that your settings.json and private.key files will not be stored in your source code repository.
- Add your User ID. On the Apps and Keys page, under My Account Information, copy the User ID GUID and save it in settings.json as your
- Run the launcher. In the root folder, right-click the launcher file and select Run with PowerShell > Open
- Select an API when prompted in Windows PowerShell.
- Select JSON Web Token when authenticating your account.
- When prompted, log in to your DocuSign developer account. If this is your first time using the app, select ACCEPT at the consent window.
- Select your desired code example.
To use the payments code example, create a test payment gateway on the Payments page in your developer account. See Configure a payment gateway for details.
Once you've created a payment gateway, save the Gateway Account ID GUID to settings.json.
This repository uses the MIT License. See LICENSE for details.
Pull requests are welcomed. Pull requests will only be considered if their content uses the MIT License.