This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Envelopes


Overview

The following operations allow you to work with envelopes. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with envelopes, see Sample configuration.

OperationDescription

getEnvelope

Gets the status of an envelope

createEnvelopeFromDocument

Creates and sends an envelope from a list of documents and recipients
createEnvelopeFromTemplate Creates and sends an envelope from a template
createEnvelopeCreate and send an envelope from a combination of documents and templates.
createEnvelopeWithMultiformDataCreate and send an envelope from a combination of documents and templates using multipart/form-data
sendDraftEnvelope Send draft envelope.

Operation details

This section provides details on each of the operations.

Getting the status of an envelope

The getEnvelope operation allows you to retrieve the overall status for the specified envelope.

getEnvelope
<docusign.getEnvelope>
    <accountId>{$ctx:accountId}</accountId>
    <envelopeId>{$ctx:envelopeId}</envelopeId>
</docusign.getEnvelope>
Properties
  • accountId :  The account ID. This information is returned in the login response.

  • envelopeId: The ID of the envelope whose status you want to retrieve.

Sample request

Following is a sample REST request that can be handled by the getEnvelope operation.

getEnvelope
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739",   
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",	
    "accountId":"1910007",
	"envelopeId":"7210606e-3d8b-46fd-ab44-b3036989fa74"
}
Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/get/

Creating an envelope from documents and recipients

The createEnvelopeFromDocument operation allows you to create and send an envelope from a list of documents and recipients.

getDocumentFromAnEnvelope
<docusign.createEnvelopeFromDocument>
    <accountId>{$ctx:accountId}</accountId>
    <documents>{$ctx:documents}</documents>
    <recipients>{$ctx:recipients}</recipients>
    <emailSubject>{$ctx:emailSubject}</emailSubject>
    <status>{$ctx:status}</status>
</docusign.createEnvelopeFromDocument>
Properties
  • accountId: The account ID. This information is returned in the login response.

  • documents: The documents to add to this envelope. In this property, the documentBase64 field contains the contents of the base64-converted version of the PDF file. For details on adding documents to the envelope, see the "Sending Envelopes" section in the Envelopes: create page of the DocuSign API documentation. 
  • recipents: The recipients of the envelope. For more details, see the "Recipient Types" section under "Sending Envelopes" in the Envelopes: create page of the DocuSign API documentation.
  • emailSubject: The subject of the email used to send the envelope.
  • status: The status of the envelope. Set this property to created to save a draft of the envelope, or set it to sent to send it immediately to the recipients.

If the recipients property includes signer or inPersonSigner objects, you can use the tabs field in those objects to specify the tabs that you want to add to the envelope. 

Sample request

Following is a sample REST request that can be handled by the createEnvelopeFromDocument operation.

createEnvelopeFromDocument
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739",  
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",	
    "accountId":"1910007",
	"documents":[{"documentBase64":"V2UgYW5hbHl6ZWQgdGhlIGVycm9yIGxvZyBhbmQgdGhlIHJvb3RjYXVzZSBmb3IgdGhhdCBlcnJvciBpcyBpZiBudWxsIG9yIGVtcHR5IHN0cmluZ3Mg","documentId":"1","fileExtension":"pdf","name":"myFile.pdf"}],
	"recipients":{ "signers":[{"clientUserId":"8b72cfa9-3c49-441e-9511-	d583eb9372dc","email":"vthulasi2000@gmail.com","name":"vthulasi2000@gmail.com","recipientId":"1","roleName":"signer","routingOrder":"1"}]},
	"emailSubject":"Hi, Please sign the document",
	"status":"sent"
}

 

Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/

Creating an envelope from a template

The createEnvelopeFromTemplate operation allows you to create and send an envelope from a template.

createEnvelopeFromTemplate
<docusign.createEnvelopeFromTemplate>
    <accountId>{$ctx:accountId}</accountId>
    <templateId>{$ctx:templateId}</templateId>
    <templateRoles>{$ctx:templateRoles}</templateRoles>
    <emailSubject>{$ctx:emailSubject}</emailSubject>
    <status>{$ctx:status}</status>
</docusign.createEnvelopeFromTemplate>
Properties
  • accountId: The account ID. This information is returned in the login response.

  • tamplteId: The ID of the template to use.
  • templateRoles: Specifies the template recipients. Each roleName in the template must have a recipient assigned to it. For more information, see the templateRoles description in envelopeDefinition in the DocuSign API documentation.
  • emailSubject: The subject of the email used to send the envelope.
  • status: The status of the envelope. Set this property to created to save a draft of the envelope, or set it to sent to send it immediately to the recipients.
Sample request

Following is a sample REST request that can be handled by the createEnvelopeFromTemplate operation.

createEnvelopeFromTemplate
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739",   
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",	"accountId":"1910007",
	"templateId":"374b471f-8d4b-4fab-89b2-5948776a542d",
	"templateRoles":[{"email":"vthulasi2000@gmail.com","name":"vthulasi2000@gmail.com","roleName":"signer","tabs":{"initialHereTabs":	[{"documentId":"1","pageNumber":"1","tabLabel":"lable1","xPosition":"30","yPosition":"70"}]}}],
	"emailSubject":"Hi, Please sign the document",
	"status":"sent"
}
Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/

Creating an envelope

The createEnvelope operation allows you to create and send an envelope from a combination of documents and templates with basic parameters.

createEnvelope
<docusign.createEnvelope>
    <accountId>{$ctx:accountId}</accountId>
    <documents>{$ctx:documents}</documents>
    <recipients>{$ctx:recipients}</recipients>
    <templateId>{$ctx:templateId}</templateId>
    <templateRoles>{$ctx:templateRoles}</templateRoles>
    <emailSubject>{$ctx:emailSubject}</emailSubject>
    <status>{$ctx:status}</status>
    <brandId>{$ctx:brandId}</brandId>
    <emailBlurb>{$ctx:emailBlurb}</emailBlurb>
    <compositeTemplates>{$ctx:compositeTemplates}</compositeTemplates>
    <accessibility>{$ctx:accessibility}</accessibility>
    <documentsUri>{$ctx:documentsUri}</documentsUri>
    <emailSettings>{$ctx:emailSettings}</emailSettings>
    <enforceSignerVisibility>{$ctx:enforceSignerVisibility}</enforceSignerVisibility>
    <envelopeUri>{$ctx:envelopeUri}</envelopeUri>
    <attachments>{$ctx:attachments}</attachments>
    <mergeRolesOnDraft>{$ctx:mergeRolesOnDraft}</mergeRolesOnDraft>
</docusign.createEnvelope>
Properties
  • accountId: The account ID. This information is returned in the login response.

  • tamplteId: The ID of the template to use.
  • templateRoles: Specifies the template recipients. Each roleName in the template must have a recipient assigned to it. For more information, see the templateRoles description in envelopeDefinition in the DocuSign API documentation.
  • emailSubject: The subject of the email used to send the envelope.
  • status: The status of the envelope. Set this property to created to save a draft of the envelope, or set it to sent to send it immediately to the recipients.
  • documents: The documents to add to this envelope. In this property, the documentBase64 field contains the contents of the base64-converted version of the PDF file. For details on adding documents to the envelope, see the "Sending Envelopes" section in the Envelopes: createpage of the DocuSign API documentation. 
  • recipents: The recipients of the envelope. For more details, see the "Recipient Types" section under "Sending Envelopes" in the Envelopes: create page of the DocuSign API documentation.
  • brandId : This sets the brand profile format used for the envelope. The value in the string is the brandId associated with the profileAccount branding must be enabled for the account to use this option.
  • emailBlurb : This is the same as the email body. If specified it is included in email body for all envelope recipients.
  • compositeTemplates : This is a JSON element. A complex type that can be added to create envelopes from a combination of DocuSign templates and PDF forms.

  • accessibility : Sets the document reading zones for screen reader application. This element can only be used if document accessibility is enabled for the account.

  • documentsUri : Contains a URI for an endpoint that you can use to retrieve the document.

  • emailSettings : This is a JSON element for envelope email setting.

  • enforceSignerVisibility : Boolean value. Document with tabs can only be viewed by signers that have a tab on that document.

  • envelopeUri : Contains a URI for an endpoint that you can use to retrieve the envelope or envelopes.

  • attachments : The is JSON element.

  • mergeRolesOnDraft : Boolean value. When set to true, template roles will be merged, and empty recipients will be removed.

Sample request

Following is a sample REST request that can be handled by the createEnvelope operation.

createEnvelope
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739", 
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",	"accountId":"1910007",
	"documents":[{"documentBase64":"V2UgYW5hbHl6ZWQgdGhlIGVycm9yIGxvZyBhbmQgdGhlIHJvb3RjYXVzZSBmb3IgdGhhdCBlcnJvciBpcyBpZiBudWxsIG9yIGVtcHR5IHN0cmluZ3Mg","documentId":"1","fileExtension":"txt","name":"myproxy"}],
	"emailSubject":"Hi ,Please sign the documentation",
	"templateId":"374b471f-8d4b-4fab-89b2-5948776a542d",
	"templateRoles":[{"email":"vthulasi2000@gmail.com","name":"vthulasi2000@gmail.com","roleName":"signer","tabs":{"signHereTabs":[{"documentId":"1","pageNumber":"1","tabLabel":"Lable1","xPosition":"100","yPosition":"100"}]}}],
	"status":"sent"
}

Sample REST request for compositeTemplates, this can be handled by the createEnvelopeFromDocument operation.

createEnvelopeFromDocument
{
"apiUrl":"https://demo.docusign.net",
"apiVersion":"v2",
"integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739",
"userName":"thulas@gmail.com",
"password":"xxxxxxxxxxxxxxx",
"accountId":"1910007",
"documents":[],
"recipients":{ "signers":[{"clientUserId":"","email":"vthulas@gmail.com","name":"vthulas@gmail.com","recipientId":"1","roleName":"signer","routingOrder":"1"}]},
"emailSubject": "Please sign the envelope",
"emailBlurb": "Please sign the application from the included link.",
"compositeTemplates": [
    {
      "compositeTemplateId": "820",
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "71f4bb4a-35a9-4315-9bde-bd48d7c1c394"
        }
      ]
    }
    ],
"templateRoles":[],
"status":"sent",
"mergeRolesOnDraft":"true"
}
Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/

Creating an envelope using multipart/form-data

The createEnvelopeWithMultiformData operation allows you to create and send an envelope from a combination of documents and templates with basic parameters using multipart/form-data.

createEnvelopeWithMultiformData
<docusign.createEnvelopeWithMultiformData>
    <accountId>{$url:accountId}</accountId>
</docusign.createEnvelopeWithMultiformData>
Properties
  • accountId: The account ID. This information is returned in the login response.

Sample request

Following is a sample REST request that can be handled by the createEnvelopeWithMultiformData operation.

createEnvelopeWithMultiformData
--AAA
Content-Type: application/json
Content-Disposition: form-data

{
"emailSubject":"Please sign the documentation",
"documents":[{"documentId":"8","name":"contract.txt","order":0}]
}

--AAA
Content-Type: application/json
Content-Disposition: attachment; filename="contract.txt"; documentId="8"

V2UgYW5hbHl6ZWQgdGhlIGVycm9yIGxvZyBhbmQgdGhlIHJvb3RjYXVzZSBmb3IgdGhhdCBlcnJvciBpcyBpZiBudWxsIG9yIGVtcHR5IHN0cmluZ3Mg

--AAA--

Note

createEnvelopeWithMultiformData operation supports to create envelope with the Content-Type multipart/form-data with boundary as a pass-through  scenario.

When invoke the operation using proxy consider the following things as well.

  • Content-Type:multipart/form-data; boundary=AAA
  • Give the apiUrl, apiVersion, integratorKey, accountId, userName, password as URL params with the request.

Send draft envelope

The sendDraftEnvelope operation allows you to send draft envelope.

sendDraftEnvelope
<docusign.sendDraftEnvelope>
    <accountId>{$ctx:accountId}</accountId>
    <envelopeId>{$ctx:envelopeId}</envelopeId>
    <status>{$ctx:status}</status>
</docusign.sendDraftEnvelope>
Properties
  • accountId :  The account ID. This information is returned in the login response.

  • envelopeId: The ID of the envelope whose status you want to retrieve.

  • status: The status of the envelope. Set it to sent to send it immediately to the recipients

Sample request

Following is a sample REST request that can be handled by the sendDraftEnvelope operation.

sendDraftEnvelope
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739",  
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",
	"accountId":"1910007",
	"envelopeId":"657aab5b-b647-4617-b13a-5aec15246632",
	"status":"sent"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to DocuSign with the init operation and use the getEnvelope operation. The sample request for this proxy can be found in getEnvelope sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="createList"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
        <property name="apiUrl" expression="json-eval($.apiUrl)"/>
		<property name="apiVersion" expression="json-eval($.apiVersion)"/>
        <property name="integratorKey" expression="json-eval($.integratorKey)"/> 
        <property name="userName" expression="json-eval($.userName)"/>
        <property name="password" expression="json-eval($.password)"/>	
    	<property name="blocking" expression="json-eval($.blocking)"/>
		<property name="accountId" expression="json-eval($.accountId)"/>
		<property name="envelopeId" expression="json-eval($.envelopeId)"/>
		<property name="documentId" expression="json-eval($.documentId)"/>
      	<docusign.init>
    		<apiUrl>{$ctx:apiUrl}</apiUrl>
    		<apiVersion>{$ctx:apiVersion}</apiVersion>
			<integratorKey>{$ctx:integratorKey}</integratorKey>
            <userName>{$ctx:userName}</userName>
            <password>{$ctx:password}</password>   
			<blocking>{$ctx:blocking}</blocking>
	    </docusign.init>
        <docusign.getEnvelope>
    		<accountId>{$ctx:accountId}</accountId>
    		<envelopeId>{$ctx:envelopeId}</envelopeId>
		</docusign.getEnvelope>
         <respond/>
      </inSequence>
      <outSequence>
         <log/>
         <send/>
      </outSequence>
   </target>
   <parameter name="serviceType">proxy</parameter>
</proxy>

Following is a sample proxy service that illustrates how to connect to DocuSign with the init operation and use the createEnvelopeWithMultiformData operation. The sample request for this proxy can be found in createEnvelopeWithMultiformData sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
  name="createEnvelopeWithMultiformData"
  startOnLoad="true"
  statistics="disable"
  trace="disable"
  transports="http,https">
  <target>
  <inSequence>
  <docusign.init>
  <apiUrl>{$url:apiUrl}</apiUrl>
  <apiVersion>{$url:apiVersion}</apiVersion>
  <integratorKey>{$url:integratorKey}</integratorKey>
  <userName>{$url:userName}</userName>
  <password>{$url:password}</password>
  </docusign.init>
  <docusign.createEnvelopeWithMultiformData>
  <accountId>{$url:accountId}</accountId>
  </docusign.createEnvelopeWithMultiformData>
  <respond/>
  </inSequence>
  <outSequence>
  <log/>
  <send/>
  </outSequence>
  </target>
  <parameter name="serviceType">proxy</parameter>
  <description/>
</proxy>