How to request a signature by email using a template
This topic demonstrates how to use a template to create an envelope and send it by email. When a recipient receives and signs an envelope by email, the process is called remote signing.
Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.
Required data
Running the code in this how-to requires this data:
Step 1. Obtain your OAuth token
To make the API call shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.
See Confidential Authorization Code Grant for guidance on your options to get an Confidential Authorization Code Grant OAuth token.
Step 2. Create an envelope definition from a template
The first step in requesting a signature by email is to create a new envelope definition. Unlike creating an envelope definition without a template, the documents, tabs, and most of the other envelope data will be automatically populated by your chosen template. Instead, you must specify the ID of the template to use and provide the names and emails of the parties acting in each of the roles that the template specifies.
Define a method to create the envelope definition, makeEnvelope, with this code.
Step 3. Create and send the envelope
Next, use the envelope definition you just created in the makeEnvelope method to create a new envelope and send it, adding your access token and base path to the request header. Follow these steps:
- Instantiate the Docusign API client.
- Set the following default request header to add your access token to all API calls.
"Authorization" : "Bearer {ACCESS_TOKEN}" - Initialize the Envelopes API.
- Create an envelope by passing in the generated envelope definition and your account ID to the
CreateEnvelopemethod.
Expected response
If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.
In addition, the signer receives an email containing a signing link that they can use to open and electronically sign a document using the Docusign mobile app or the Docusign website. After signing is complete, the recipient receives a carbon copy (CC) of the email that includes all of the completed and signed documents.
Next steps
- Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.
- Find out more about templates.
- Learn How to request a signature using a composite template.
- Review Working with Templates on Docusign Support.
- See how to Go-Live with a completed app and find the base path for API calls in the production environment.