How to create a signable HTML document
This topic demonstrates how to send HTML code directly to create a document for responsive signing. The Docusign advanced responsive signing feature enables you to use HTML pages as signing documents in an envelope.
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 the envelope definition
In the JSON request body for a standard Envelopes:create method call, ensure that you have at least one document defined in the request’s documents block.
For each HTML document in the envelope, add an htmlDefinition node.
Within the htmlDefinition node, insert another node called source. Add your page’s HTML to the value of source. The sample shows a documents node of a request to create a new signable HTML document.
If the HTML code contains <img> elements with the src attribute set to a path or URL, those images will not be displayed. Images in HTML must be encoded in Base64 format, as shown in the example below:
See the API Reference for the full list of request parameters and configurable options.
Step 3. Call the eSignature REST API
Finally, use the definition of the envelope that you created in Step 2 to create a new envelope and send it, adding your access token and base path to the request header.
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.
- Learn How to request a signature through your app.
- See Responsive signing for details about the feature.
- Learn How to convert a PDF file into a signable HTML document for responsive signing.
- See the API Reference for the full list of responsive signing request parameters and configurable options.
- See Setting tabs in HTML documents for details about adding tabs to HTML documents, including lists of supported elements and syntax.