REST API Recipe: Request a signature via email using a template


This recipe uses a template to send a signing request. A specific signer will be substituted for the role name that was used in the template.

Getting ready

You’ll need a DocuSign account email and password. The signing request will be sent by the account holder. You’ll also need an integration key. See Generate Your Integrator Key. This recipe uses a template that you have already created in your account. You’ll need the template’s ID and the name of the recipient role in the template. How to find your template’s ID.

How to do it

Step 1: use the login_information API end point to obtain the base url for use in subsequent API calls, and the user’s account ID. See the recipe Request a Signature via Email for an example of this step.

Step 2: Send the signing request via the Envelopes::create method. The request includes the template ID and a Template Role object. The template role object substitutes a name/email for a named role used by the template.

After the request is created, send it to the DocuSign platform. The call should return a 201 HTTP code with the newly created envelope id in the response body. Your signing request has been sent! Check your email to see the incoming signing request.


Source files

The recipe source files are available on Github: Java, C#, Objective-C, Python, PHP, and Node-JS

How it works

Because the role name in the Role object matches the role name set in the template, the Role object’s signer name and email will be substituted for the role in the template’s recipient list.

The signer will inherit all of the settings from the role, as set in the template. This includes signer authentication and tab settings.

There’s more

Templates enable you set, and then easily reuse, sending information including document(s), document tabs, recipient information and more. Any of these items from the template can be over-ridden at signing time. Recipients can be recorded in a template as roles (eg, salesperson) with the actual salesperson’s information set when the template is sent. You can also substitute different document(s) for the template’s document(s).

Templates can be created from the DocuSign web interface or can be programmatically created via the API. It’s often easier to create and test a template by using the web interface. Then invoke the template programmatically by using the API.