Getting Started

About eSign Genie


eSign Genie is the #1 easiest and most collaborative contract management and esignature software with the most robust functionality amongst its peers. Key features include: Collaborative contracts and agreement building; template contract creation; esignature workflow to obtain esignature(s) from single, or multiple users; advanced bulk esignature solution with dashboard; notification receiving control; API for esignature integration with other software or websites and a lot more... For more information on eSign Genie Software, please contact us at info@esigngenie.com

Create a Developer Account


  1. Activate the developer account with eSign Genie under the API tab in the settings menu.
    (This menu will only be visible after you have purchased the API service from eSign Genie).
  2. Fill in the form to obtain your API Key and API Secret under your API settings.
    This is how your API information will display:
    developer account

Authentication

Generating Access Token


Client Credentials Access your eSign Genie account from your application

Your website/application can generate an access token of grant_type: client_credentials as follows:

  https://www.esigngenie.com/esign/api/oauth2/access_token
  application/x-www-form-URLencoded


REQUEST
Parameter Description
grant_type This value should be client_credentials
client_id Your API Key from the API menu under the Settings Tab
client_secret Your API Secret from the API menu under the Settings Tab
scope Please use read-write, in order to send documents

RESPONSE
{
	"access_token":"ACCESS_TOKEN",
	"token_type":"bearer",
	"expires_in":31536000
}
						

Sample Code
curl https://www.esigngenie.com/esign/api/oauth2/access_token \
> -d "grant_type=client_credentials" \
> -d "client_id=CLIENT_ID" \
> -d "client_secret=CLIENT_SECRET" \
> -d "scope=read-write" \
> -H "Content-Type: application/x-www-form-urlencoded" \
> -X POST

						
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/oauth2/access_token",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&scope=read-write",
  CURLOPT_HTTPHEADER => array(
    "cache-control: no-cache",
    "content-type: application/x-www-form-urlencoded"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
						
var request = (HttpWebRequest)WebRequest.Create("https://www.esigngenie.com/esign/api/oauth2/access_token");
var postData = "grant_type=client_credentials" + "&client_id=" + CLIENT_ID + "&client_secret=" + CLIENT_SECRET + "&scope=read-write";
var data = Encoding.ASCII.GetBytes(postData);

request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;

using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

var response = (HttpWebResponse)request.GetResponse();

using (var streamReader = new StreamReader(response.GetResponseStream()))
            {
                var responseString = streamReader.ReadToEnd();
            }

						
URL url= new URL("https://www.esigngenie.com/esign/api/oauth2/access_token");
HttpURLConnection con= (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
String urlParameters = "grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&scope=read-write";
		
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
	
	   
if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
	throw new RuntimeException("Failed : HTTP error code : "+ con.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader((con.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
	System.out.println(output);
}
        
con.disconnect();
						

Now you can make calls to the eSign Genie API with this ACCESS_TOKEN. Please include ACCESS_TOKEN to request headers with every request as indicated.

Authorization: Bearer ACCESS_TOKEN

CURL
curl https://www.esigngenie.com/esign/api/folders/createfolder \
> -i \
> -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
> -H "Content-Type: application/json"
...
						

Document(s) Folder API

All API requests start with https://www.esigngenie.com/esign/api/.

Create folder of documents from PDF files


With eSign Genie API you can create a folder of documents and send them for signature right from your own application. To create a folder of documents from PDF files you can either provide publicly accessible URLs to PDF documents or pass PDF documents as multipart form data and other parameters about the recipient parties, etc.

While creating the documents from PDF files you can define various fields like text field or signature field within the document using simple Text Tags. You can assign various properties for these fields like party responsible for filling the data etc. These Text Tags will then be converted to eSign Genie document fields.
Or if you don't want to use Text Fields within the document, then you can also request to create an embedded document preparing session where you can manually drag and drop each field on the document itself without leaving your application.

Preparing PDF documents with text tags

To send a PDF document from your application for signature, you need to define the signature and other eSign Genie fields in the documents, and who is allowed to fill in the data. eSign Genie supports simple Text Tags.

A Text Tag is a simple text block within your PDF document which defines the field type, the party who is responsible for it, and other field specific options.
Quick Tip: When you apply Text Tags to the document, eSign Genie does not remove or replace the Text Tags text. You can hide codified Text Tags by using the same font color as the background of the document. So the Text Tags can be used by eSign Genie processes and it will not be visible on the document.

Responsive image

  1. Field Type: One of 'textfield', 'signfield', 'initialfield', 'datefield', 'checkboxfield' or short notations.
  2. Party Number: the sequence number of the recipient party from the parties list which will be responsible for filling this field.
  3. Required/Optional Field: 'y' makes the field mandatory to be filled before signing while 'n' makes it optional.
  4. Field Name: Optional. Assign a name to this field. Assigning names to fields is a good practice for better productivity as named fields are downloaded in the document form data report and all same named fields in a document will automatically take up the value typed once in any one of those fields. Please note not to include any space character for the name of field (or anywhere else in the Text Tag) as it will then not recognize that word as a proper Text Tag syntax, instead you can use underscore which will then be replaced with space character in the final eSign Genie field.
  5. Underscores: Optional. A way to increase the field's width.

The full list of Field Types is:

  • TextField - textfield or t (short notation)
  • TextBox - textboxfield or tb (short notation)
  • Signature - signfield or s
  • Initial - initialfield or i
  • Date - datefield or d
  • Checkbox - checkboxfield or c (recommended)
  • Radio Button - radiobuttonfield or rb (recommended)
  • Secured Field - securedfield or sc

Examples

  • ${textfield:1:y:client_name:________} - A mandatory textfield which is assigned to party number 1 with field name as 'client name'.
  • ${tb:1:n:________________} - An optional textbox assinged to party 1.
  • ${signfield:1:y:____} - A mandatory signature field assigned to party number 1.
  • ${i:2:n} - An optional initial field assigned to party number 2.
  • ${datefield:2:n::____} - An optional date field assigned to party number 2 with empty field name.
  • ${c:2:y:male:gender} - A checkbox assigned to party number 2 with initial value as checked with name 'male' and group 'gender'.
  • ${rb:1:n:yes:grp1} - An un-selected radio button assigned to party 1 with name yes and grp 'grp1'.
  • ${sc:2:n:Credit_Card_Number:4:____} - A secured field assigned to party 2 which is optional with name 'Credit Card Number' and only last 4 characters to remain unmasked.

Here is a PDF file with some other Text Tag samples: Sample Document.

Sending the documents

To create a document from PDF files you need to make a call to /folders/createfolder with the given parameters.

  • You can either store the document as 'Draft' in your eSign Genie account and send it later.
  • Or you can directly send the document via eSign Genie API.
  • Or you can embed the document directly inside your application.

1. When using file URLs

/folders/createfolder
application/json

REQUEST
{
	"folderName":"Sample Documents",
	"fileUrls":[
		"URL_TO_DOCUMENT_1","URL_TO_DOCUMENT_2",...
	],
	"fileNames":[
		"document_1.pdf","document_2.pdf",...
	],
	"processTextTags":true,
	"signInSequence":false,
	"sendNow":false,
	"createEmbeddedSendingSession":false,
	"fixRecipientParties":true,
	"fixDocuments":true,
	"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":false,
	"embeddedSignersEmailIds":["FIRST_EMBEDDED_SIGNER_EMAIL","SECOND_EMBEDDED_SIGNER_EMAIL"],
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION",
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	],
	"senderEmail":"user2@example.com"
	
}
						
Parameter Description
folderName (required) Name of the document(s) folder
fileUrls (required) An array of URLs to PDF documents you are sending. It should be publicly accessible when you are creating the document.
fileNames (required) An array of the file names whose URLs are given in the previous parameter
processTextTags (required) Value can be either true or false
Use this field to determine whether eSign Genie should parse your documents for Text Tags to convert them into eSign Genie fields.
signInSequence
Default false
Value can be either true or false
Use this field to determine whether recipients will sign the folder in a sequence.
If false, then all the recipients receive invitation email simultaneously. When true, then each recipient receives invitation email successively after previous recipient completes the required task, like signing the documents or filling fields, etc.
sendNow
Default false
Value can be either true or false
Use this field to send the folder to the recipient parties. Each party will then receive a unique link in their email to sign the document. The invitation mail and subject in this case will be the same as the default invitation mail setup in your account.
createEmbeddedSendingSession
Default false
Value can be either true or false
If true then an embedded token will be generated in the response, for an embedded sending session, where you can directly open the eSign Genie document preparing view in your application for dragging and dropping various fields on your document. And also give a custom invitation message.
fixRecipientParties (required if createEmbeddedSendingSession is true) Value can be either true or false
If true then in the embedded sending view you won't be able to change the parties for the folder which are already added as a part of this API request.
fixDocuments (required if createEmbeddedSendingSession is true) Value can be either true or false
If true then in the embedded sending view you won't be able to change the documents for the folder which are already added as a part of this API request.
sendSuccessUrl (required if createEmbeddedSendingSession is true) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to after successfully sending the folder in the embedded sending view.
sendErrorUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to if error comes during sending the folder in the embedded sending view.
createEmbeddedSigningSession
Default false
Value can be either true or false
If true then an embedded token will be generated in the response, for an embedded signing session for the recipient whose email will be given in the emailIdOfEmbeddedSigner, and that party will not receive any invitation email.
createEmbeddedSigningSessionForAllParties
(optional, default=false)
Value can be either true or false
If true, then an embedded signing session is created for all the recipients in the folder.
Else if false, then the embedded signing session is only created for those recipients whose email ids are given in embeddedSignersEmailIds.
embeddedSignersEmailIds
(optional)
An array of email ids of recipients for whom an embedded signing session needs to be created. The values must be email ids from the recipient parties added in the parties list.
signSuccessUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to after successfully signing the folder in the embedded signing view.
signDeclineUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to if he declines to sign the folder in the embedded signing view.
signLaterUrl (optional) Enter the absolute URL for the landing page your website/application, which the user will be redirected to if he chooses to sign the folder later in the embedded signing view.
signErrorUrl (optional) Enter the absolute URL for the landing page your website/application, which the user will be redirected to if error comes during signing the folder in the embedded signing view.
parties (required) A list of recipient parties you're sending the folder to. Every entry must contain firstName, lastName, emailId, permission and sequence fields.
permission Use this field to assign folder permissions to a recipient. Can be any one of the following values:
FILL_FIELDS_AND_SIGN, FILL_FIELDS_ONLY, SIGN_ONLY, VIEW_ONLY
sequence Use this field to assign a sequence number to a recipient in the list of recipient parties.
Use unique sequence numbers for each party starting with 1 like 1,2,3,4....
senderEmail (optional) You can enter email of another user in your account which will be used for sending this document(s) folder to the recipient parties.
themeColor (optional) You can enter a css value for a color to match your website's look n feel when you embed esign genie inside. The top blue band of the embedded screen is then replaced with the color provided by you.

RESPONSE
{
	"result":"success",
	"message":"folder of document(s) successfully created",
	"embeddedSigningSessions": [
          {
            "emailIdOfSigner": "mtariq@accountsight.com",
            "embeddedToken": "EMBEDDED_TOKEN",
            "embeddedSessionURL": "UNIQUE_EMBEDDED_SESSION_URL"
          },
          {
            "emailIdOfSigner": "mtariq@esigngenie.com",
            "embeddedToken": "EMBEDDED_TOKEN",
            "embeddedSessionURL": "UNIQUE_EMBEDDED_SESSION_URL"
          }
        ],
	"folder":{
	    "folderId": 179,
	    "folderName": "fw4",
	    "folderAuthorId": 1,
	    "folderCompanyId": 11,
	    "folderCreationDate": 1441268056000,
	    "folderSentDate": 1442470444000,
	    "folderStatus": "SHARED",
	    "folderDocumentIds": [
	      420
	    ],
	    "documentsList": [
	      {
	        "documentId": 420,
	        "companyId": 11,
	        "contractCreatedBy": 1,
	        "contractCreatedOn": 1441268055000,
	        "contractType": "W4",
	        "contractStatus": "WAITING_FOR_SIGNATURE",
	        "editable": false,
	        "contractVersionId": 488,
	        "contractVersionName": "fw4",
	        "contractVersionDesc": "this is a non editable form W4",
	        "versionCreatedby": 1,
	        "versionCreatedOn": 1441268055000,
	        "contractVersionNumber": 1
	      }
	    ],
	    "folderRecipientParties": [
	      {
	        "partyId": 52,
	        "partyDetails": {
	          "partyId": 52,
	          "firstName": "Tariq",
	          "lastName": "Acc",
	          "emailId": "mtariq@accountsight.com",
	          "address": "",
	          "dateCreated": 1413013300000
	        },
	        "contractPermissions": "FILL_FIELDS_AND_SIGN",
	        "partySequence": 1,
	        "workflowSignSequence": 1,
	        "envelopeId": 179,
	        "sharingMode": "email",
	        "folderAccessURL": "https://www.esigngenie.com/esign/viewDocumentDirect?encrDocId=QoS4qeiO870mBXNbcuUWYA%3D%3D&partyId=52"
	      },
	      {
	        "partyId": 1,
	        "partyDetails": {
	          "partyId": 1,
	          "firstName": "Tariq",
	          "lastName": "Gmail",
	          "emailId": "mtariq@esigngenie.com",
	          "address": "New Delhi, India",
	          "dateCreated": 1404792207000
	        },
	        "contractPermissions": "FILL_FIELDS_AND_SIGN",
	        "partySequence": 2,
	        "workflowSignSequence": 2,
	        "envelopeId": 179,
	        "sharingMode": "email",
	        "folderAccessURL": "https://www.esigngenie.com/esign/viewDocumentDirect?encrDocId=QoS4qeiO870mBXNbcuUWYA%3D%3D&partyId=1"
	      }
	    ],
	    "folderAccessURLForAuthor": "https://www.esigngenie.com/esign/viewDocumentDirect?encrDocId=jZvyX4AFC2kv7AU%2BBtM16A%3D%3D&partyId=1",
	    "bulkId": 0,
	    "enforceSignWorkflow": false,
	    "currentWorkflowStep": 1,
	    "transactionSource": "API-1-via_file_upload",
	    "editable": false
	}
}
						

Sample Code (creating documents from file URLs)
echo '{
	"folderName":"Sample Documents",
	"fileUrls":[
		"URL_TO_DOCUMENT_1","URL_TO_DOCUMENT_2",...
	],
	"fileNames":[
		"document_1.pdf","document_2.pdf",...
	],
	"processTextTags":true,
	"signInSequence":false,
	"sendNow":false,
	"createEmbeddedSendingSession":false,
	"fixRecipientParties":true,
	"fixDocuments":true,
	"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":true,
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION",
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	]
	
}' | curl https://www.esigngenie.com/esign/api/folders/createfolder \
-i \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json;charset=UTF-8" \
-d @- \
-X POST
						
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/folders/createfolder",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{
	"folderName":"Sample Documents",
	"fileUrls":[
		"URL_TO_DOCUMENT_1","URL_TO_DOCUMENT_2",...
	],
	"fileNames":[
		"document_1.pdf","document_2.pdf",...
	],
	"processTextTags":true,
	"signInSequence":false,
	"sendNow":false,
	"createEmbeddedSendingSession":false,
	"fixRecipientParties":true,
	"fixDocuments":true,
	"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":true,
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION",
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	]
	
}',
  
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
						
var webAddr = "https://www.esigngenie.com/esign/api/folders/createfolder";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
httpWebRequest.Headers.Add("Authorization", "Bearer " + ACCESS_TOKEN);

using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string json = @"{
	""folderName"":""test"",
	""fileUrls"":[""URL_TO_DOCUMENT_1""],
	""fileNames"":[""eSignGenieSampleUpload.pdf""],	
	""processTextTags"":true,
	""signInSequence"":false,
	""sendNow"":false,
	""createEmbeddedSendingSession"":false,
	""fixRecipientParties"":true,
	""fixDocuments"":true,
	""sendSuccessUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""sendErrorUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""createEmbeddedSigningSession"":true,
	""createEmbeddedSigningSessionForAllParties"":true,
	""signSuccessUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signDeclineUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signLaterUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signErrorUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""themeColor"":""ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION"",
	""parties"":[
		{
			""firstName"":""FIRST_NAME_OF_RECIPIENT_PARTY"",
			""lastName"":""LAST_NAME_OF_RECIPIENT_PARTY"",
			""emailId"":""EMAIL_ID_OF_RECIPIENT_PARTY"",
			""permission"":""FILL_FIELDS_AND_SIGN"",
			""sequence"":1
        }
		]	
}";
                streamWriter.Write(json);
                streamWriter.Flush();
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
            }

						
		URL url= new URL("https://www.esigngenie.com/esign/api/folders/createfolder");
		HttpURLConnection con= (HttpURLConnection) url.openConnection();
		con.setDoOutput(true);
		try {
			con.setRequestMethod("POST");
			
		} catch (ProtocolException e) {
			e.printStackTrace();
		}
		con.setRequestProperty("Authorization", "Bearer ACCESS_TOKEN");
		con.setRequestProperty("Content-Type", "application/json");
		String input="{"
				+ "\"folderName\":\"Creating Folder From Uploading File\","
				+ "\"processTextTags\":true,"
				+ "\"sendNow\":false,"
				+ "\"fileUrls\":[\"https://developers.esigngenie.com/uploads/eSignGenieAPISampleDoc.pdf\"]"
				
				+ "\"parties\":["
					+ "{"
						+ "\"firstName\":\"Tariq\","
						+ "\"lastName\":\"Painuli\","
						+ "\"emailId\":\"mtariq@accountsight.com\","
						+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
						+ "\"sequence\":1"
					+ "},"
					+ "{"
						+ "\"firstName\":\"Tariqesign\","
						+ "\"lastName\":\"Painuli2\","
						+ "\"emailId\":\"mtariq@esigngenie.com\","
						+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
						+ "\"sequence\":2"
					+ "}"
				+ "],"
				+ "\"createEmbeddedSigningSession\":true,"
				+ "\"createEmbeddedSigningSessionForAllParties\":true," 
		        + "\"senderEmail\":\"mtariq@accountsight.com\""
				+ "}";	

		OutputStream os = con.getOutputStream();
		os.write(input.getBytes());
		os.flush();
		if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
			throw new RuntimeException("Failed : HTTP error code : "+ con.getResponseCode());
		}
		BufferedReader br = new BufferedReader(new InputStreamReader((con.getInputStream())));
        String output;
        System.out.println("Output from Server .... \n");
        while ((output = br.readLine()) != null) {
            System.out.println(output);
        }
        
        con.disconnect();
						

You can also pass PDF document(s) as a multipart form data instead of passing a publicly accessible URLs. In this case pass the JSON as 'data' parameter and include file as a multipart form parameter 'file'. Make sure you're using multipart/form-data as a content type for this call.


Sample Code (creating documents from multipart form data)
curl https://www.esigngenie.com/esign/api/folders/createfolder \
-i \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: multipart/form-data;charset=UTF-8" \
-F data='{"folderName":"Sample Documents","processTextTags":true,"signInSequence":false,"sendNow":false,"createEmbeddedSendingSession":false,"fixRecipientParties":true,"fixDocuments":true,"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","createEmbeddedSigningSession":true,"createEmbeddedSigningSessionForAllParties":true,"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION","parties":[{"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY","lastName":"LAST_NAME_OF_RECIPIENT_PARTY","emailId":"EMAIL_ID_OF_RECIPIENT_PARTY","permission":"FILL_FIELDS_AND_SIGN","sequence":1}]}' \
-F file=@FILE_1_TO_UPLOAD \
-X POST						
						
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/folders/createfolder",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array(
    'file' => '@/path/to/file1.pdf',
    'data' => '{"folderName":"Sample Documents","processTextTags":true,"signInSequence":false,"sendNow":false,"createEmbeddedSendingSession":false,"fixRecipientParties":true,"fixDocuments":true,"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","createEmbeddedSigningSession":true,"createEmbeddedSigningSessionForAllParties":true,"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION","themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION","parties":[{"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY","lastName":"LAST_NAME_OF_RECIPIENT_PARTY","emailId":"EMAIL_ID_OF_RECIPIENT_PARTY","permission":"FILL_FIELDS_AND_SIGN","sequence":1}]}'
  ),
	
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache",
    "content-type: multipart/form-data;"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
						
URL url= new URL("https://www.esigngenie.com/esign/api/folders/createfolder");
HttpURLConnection con= (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
String charset="UTF-8";
		
String input="{"
			+ "\"folderName\":\"Creating Folder From Uploading File\","
			+ "\"processTextTags\":true,"
			+ "\"sendNow\":false,"
			+ "\"parties\":["
				+ "{"
					+ "\"firstName\":\"Tariq\","
					+ "\"lastName\":\"Painuli\","
					+ "\"emailId\":\"mtariq@accountsight.com\","
					+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
					+ "\"sequence\":1"
				+ "},"
				+ "{"
					+ "\"firstName\":\"Tariqesign\","
					+ "\"lastName\":\"Painuli2\","
					+ "\"emailId\":\"mtariq@esigngenie.com\","
					+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
					+ "\"sequence\":2"
				+ "}"
			+ "],"
			+ "\"createEmbeddedSigningSession\":true,"
			+ "\"createEmbeddedSigningSessionForAllParties\":true," 
	        + "\"senderEmail\":\"mtariq@accountsight.com\""
			+ "}";	
		
		
File binaryFile = new File("D:\\Sample.pdf");
String boundary = "----"+ Long.toHexString(System.currentTimeMillis()) + "------"; 
String CRLF = "\r\n"; 
con.setRequestProperty("Content-Type","multipart/form-data; boundary=\"" + boundary + "\"");
		
con.setRequestProperty("Authorization", "Bearer ACCESS_TOKEN");
try (
	OutputStream output = con.getOutputStream();
	PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true);
	) {
		   
	writer.append("--" + boundary).append(CRLF);
			    
	writer.append("Content-Disposition:form-data; name=\"data\"").append(CRLF);
			 
	writer.append(CRLF).append(input).append(CRLF).flush();
    writer.append("--" + boundary).append(CRLF);
	writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + binaryFile.getName() + "\"").append(CRLF);
		   
	writer.append("Content-Transfer-Encoding: binary").append(CRLF);
	writer.append(CRLF).flush();
		    
	Files.copy(binaryFile.toPath(), output);
	output.flush();
	writer.append(CRLF).flush(); 
	writer.append("--" + boundary + "--").append(CRLF).flush();
		   
	}
	List<String> response = new ArrayList<String>();
	if (con.getResponseCode()== HttpURLConnection.HTTP_OK) {
	    BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
		String line = null;
		while ((line = reader.readLine()) != null) {
			response.add(line);
		}
	            
		reader.close();
		con.disconnect();
	} else {
		throw new IOException("Server returned non-OK status: " + con.getResponseCode());
	}
		 
 
System.out.println("Finally Reply from server "+con.getResponseCode());
						
String file = @"C:\test\sample.pdf";
String url = "https://www.esigngenie.com/esign/api/folders/createfolder";
String boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.ContentType = "multipart/form-data; boundary=" + boundary;
wr.Method = "POST";
wr.KeepAlive = true;
wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

Stream rs = wr.GetRequestStream();

string json = @"{
	""folderName"":""test"",
	""processTextTags"":true,
	""signInSequence"":false,
	""sendNow"":false,
	""createEmbeddedSendingSession"":false,
	""fixRecipientParties"":true,
	""fixDocuments"":true,
	""sendSuccessUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""sendErrorUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""createEmbeddedSigningSession"":true,
	""createEmbeddedSigningSessionForAllParties"":true,
	""signSuccessUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signDeclineUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signLaterUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signErrorUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""themeColor"":""#0066cb"",
	""parties"":[
		{
			""firstName"":""FIRST_NAME_OF_RECIPIENT_PARTY"",
			""lastName"":""LAST_NAME_OF_RECIPIENT_PARTY"",
			""emailId"":""EMAIL_ID_OF_RECIPIENT_PARTY"",
			""permission"":""FILL_FIELDS_AND_SIGN"",
			""sequence"":1
		}
		]	
}";

rs.Write(boundarybytes, 0, boundarybytes.Length);

string formdataTemplate = "Content-Disposition: form-data; name=\"data\"\r\n\r\n"+json;
byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formdataTemplate);
rs.Write(formitembytes, 0, formitembytes.Length);

rs.Write(boundarybytes, 0, boundarybytes.Length);

string headerTemplate = "Content-Disposition: form-data; name=\"file\"; filename=\"sample.pdf\"\r\nContent-Type: application/pdf\r\n\r\n";
      
byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(headerTemplate);
rs.Write(headerbytes, 0, headerbytes.Length);

FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
byte[] buffer = new byte[4096];
int bytesRead = 0;
while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0) {
          rs.Write(buffer, 0, bytesRead);
}
fileStream.Close();

byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
rs.Write(trailer, 0, trailer.Length);
rs.Close();

WebResponse wresp = null;
try {
     wresp = wr.GetResponse();
     Stream stream2 = wresp.GetResponseStream();
     StreamReader reader2 = new StreamReader(stream2);
     log.Debug(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd()));
} catch(Exception ex) {
     log.Error("Error uploading file", ex);
     if(wresp != null) {
         wresp.Close();
         wresp = null;
     }
} finally {
     wr = null;
}
    
						

Create embedded signing view


When embedded signing view is enabled, you can show a document within your application.

The embedded signing view URL obtained via embeddedSessionURL will look like the following:
https://www.esigngenie.com/esign/embedded/embeddedsign?eetid={URL-ENCODED EMBEDDED-TOKEN}

You can embed eSign Genie in your application using iFrame like
<div style="height: 100%; width: 100%; overflow: auto;" data-role="content">
<iframe src="[EMBED_SESSION_URL]" style="width: 99% !important;height: 99% !important;position: absolute;" frameborder="0"></iframe>
</div>

You can style the outer div element as per your application look and feel.

In the iframe, you will see the document which the User needs to sign. Responsive image

Once the user successfully esigns, he/she will be redirected to application success URL which you submitted in the request.

eSign Genie adds the following two more parameters to the original success url:

Parameter Description
folderId This is the id of the folder that was signed by the party in the embedded session. You can use this id to further query our API to download the document PDF, etc.
event Its value is signing_success, if the user successfully signs the document.
Or signing_declined, if the user declines to sign the document.

Create embedded sending view


When embedded sending view is enabled, you can prepare a document within your application where you can drag and drop various fields on your document.

The embedded sending view URL obtained via embeddedSessionURL will look like the following:
https://www.esigngenie.com/esign/embedded/embeddedsend?eetid={URL-ENCODED EMBEDDED-TOKEN}

You can embed eSign Genie in your application using iFrame like
<div style="height: 100%; width: 100%; overflow: auto;" data-role="content">
<iframe src="[EMBED_SESSION_URL]" style="width: 99% !important;height: 99% !important;position: absolute;" frameborder="0"></iframe>
</div>

You can style the outer div element as per your application look and feel.

In the iframe, you will see the document which the User needs to sign.

Once the user successfully sends the folder, he/she will be redirected to application success URL which you submitted in the request.

eSign Genie adds the following two more parameters to the original success url:

Parameter Description
folderId This is the id of the folder that was sent by the party in the embedded session. You can use this id to further query our API to get the document status, etc.
event Its value is sending_success, if the user successfully sends the document.

Get Folder Data


You can poll our API to get the folder/document data

 /folders/myfolder?folderId={FOLDER_ID}


Request Parameters
folderId Your FOLDER_ID

RESPONSE
{
  "result": "success",
  "folder": {
    "folderId": 86377,
    "folderName": "eSignGenie Sample",
    "folderAuthorId": 1,
    "folderCompanyId": 12,
    "folderCreationDate": 1473332678000,
    "folderSentDate": null,
    "folderStatus": "EXECUTED",
    "folderDocumentIds": [
      101857
    ],
    "documentsList": [
      {
        "documentId": 101857,
        "contractId": 101857,
        "companyId": 12,
        "contractCreatedBy": 1,
        "contractCreatedOn": 1473332676000,
        "contractType": "Sample",
        "contractStatus": "OPEN",
        "editable": false,
        "contractVersionId": 101715,
        "contractVersionName": "eSignGenie Sample",
        "contractVersionDesc": "eSign Genie Sample Document",
        "versionCreatedby": 1,
        "versionCreatedOn": 1473332676000,
        "contractVersionNumber": 1
      }
    ],
    "folderRecipientParties": [
      {
        "partyId": 1,
        "partyDetails": {
          "partyId": 1,
          "firstName": "Tariq",
          "lastName": "G'mail",
          "emailId": "game.tariq@gmail.com",
          "address": "Delhi",
          "dateCreated": 1404837207000
        },
        "contractPermissions": "FILL_FIELDS_AND_SIGN",
        "partySequence": 1,
        "workflowSignSequence": 1,
        "envelopeId": 86377,
        "sharingMode": "email",
        "folderAccessURL": null,
        "securityMode": "none",
        "extraComments": null
      },
      {
        "partyId": 28,
        "partyDetails": {
          "partyId": 28,
          "firstName": "Mohammad",
          "lastName": "Tariq",
          "emailId": "mtariq@accountsight.com",
          "address": "",
          "dateCreated": 1404837216000
        },
        "contractPermissions": "FILL_FIELDS_AND_SIGN",
        "partySequence": 2,
        "workflowSignSequence": 2,
        "envelopeId": 86377,
        "sharingMode": "email",
        "folderAccessURL": null,
        "securityMode": "none",
        "extraComments": null
      }
    ],
    "folderAccessURLForAuthor": null,
    "bulkId": 0,
    "enforceSignWorkflow": false,
    "currentWorkflowStep": 0,
    "transactionSource": "eSignGenie WebApp",
    "editable": false,
    "inPersonSignable": false,
    "overrideAccountReminders": false,
    "envelopeId": 86377,
    "envelopeName": "eSignGenie Sample",
    "envelopeOriginatorId": 1,
    "envelopeCompanyId": 12,
    "envelopeDate": 1473332678000,
    "envelopeSharedDate": null,
    "envelopeStatus": "DRAFT",
    "envelopeContractIds": [
      101857
    ],
    "envelopePartyPermissions": [
      {
        "partyId": 1,
        "partyDetails": {
          "partyId": 1,
          "firstName": "Tariq",
          "lastName": "G'mail",
          "emailId": "game.tariq@gmail.com",
          "address": "Delhi",
          "dateCreated": 1404837207000
        },
        "contractPermissions": "FILL_FIELDS_AND_SIGN",
        "partySequence": 1,
        "workflowSignSequence": 1,
        "envelopeId": 86377,
        "sharingMode": "email",
        "folderAccessURL": null,
        "securityMode": "none",
        "extraComments": null
      },
      {
        "partyId": 28,
        "partyDetails": {
          "partyId": 28,
          "firstName": "Mohammad",
          "lastName": "Tariq",
          "emailId": "mtariq@accountsight.com",
          "address": "",
          "dateCreated": 1404837216000
        },
        "contractPermissions": "FILL_FIELDS_AND_SIGN",
        "partySequence": 2,
        "workflowSignSequence": 2,
        "envelopeId": 86377,
        "sharingMode": "email",
        "folderAccessURL": null,
        "securityMode": "none",
        "extraComments": null
      }
    ]
  },
  "allFields": [
    {
      "fieldTagId": 898441,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "textfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.14267,
      "coordinateYRatio": 0.421053,
      "elementWidthRatio": 0.212766,
      "elementHeightRatio": 0.0205592,
      "docFieldId": "898441",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "textfieldName": "Name of party",
      "value": "",
      "description": "",
      "partyResponsible": 1,
      "required": false,
      "multiLine": false,
      "fontSize": 8,
      "fontFamily": "default",
      "fontColor": "#000000",
      "readOnly": false,
      "systemField": false
    },
    {
      "fieldTagId": 898443,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "signfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.505436,
      "coordinateYRatio": 0.73602,
      "elementWidthRatio": 0.212766,
      "elementHeightRatio": 0.0246711,
      "docFieldId": "898443",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "partyResponsible": 1,
      "signatureId": null
    },
    {
      "fieldTagId": 898445,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "signfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.505436,
      "coordinateYRatio": 0.797697,
      "elementWidthRatio": 0.212766,
      "elementHeightRatio": 0.0246711,
      "docFieldId": "898445",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "partyResponsible": 28,
      "signatureId": null
    },
    {
      "fieldTagId": 898447,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "datefield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.518202,
      "coordinateYRatio": 0.422697,
      "elementWidthRatio": 0.212766,
      "elementHeightRatio": 0.0205592,
      "docFieldId": "898447",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "datefieldName": "date of contract",
      "value": "",
      "description": "",
      "partyResponsible": 28,
      "required": false,
      "dateFormat": "DD-MMM-YYYY",
      "readOnly": false,
      "systemField": false
    },
    {
      "fieldTagId": 898449,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "checkboxfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.453309,
      "coordinateYRatio": 0.578125,
      "elementWidthRatio": 0.0212766,
      "elementHeightRatio": 0.0164474,
      "docFieldId": "898449",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "cbname": "",
      "description": "",
      "partyResponsible": 28,
      "cbgroup": "",
      "checked": false,
      "oneCbMandatoryInGroup": false,
      "multiCheckGroup": false,
      "displayAsRadioButton": false
    },
    {
      "fieldTagId": 898451,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "checkboxfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.580851,
      "coordinateYRatio": 0.578947,
      "elementWidthRatio": 0.0212766,
      "elementHeightRatio": 0.0164474,
      "docFieldId": "898451",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "cbname": "",
      "description": "",
      "partyResponsible": 28,
      "cbgroup": "",
      "checked": false,
      "oneCbMandatoryInGroup": false,
      "multiCheckGroup": false,
      "displayAsRadioButton": false
    },
    {
      "fieldTagId": 1724179,
      "contractId": 101857,
      "versionId": 101715,
      "templateId": 0,
      "companyId": 12,
      "fieldType": "dropdownfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.509028,
      "coordinateYRatio": 0.354372,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0206677,
      "docFieldId": "1486624780052513",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "dropdownFieldName": "Month",
      "description": "",
      "value": "January",
      "dropdownOptions": "df~||~as~||~aasd sa~||~dsd~||~Option 1~||~~||~January",
      "dropdownNoOfOptions": 0,
      "partyResponsible": 0
    }
  ],
  "allFieldsNameValue": [
    {
      "fieldId": 898441,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "textfield",
      "name": "Name of party",
      "value": ""
    },
    {
      "fieldId": 898443,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "signfield"
    },
    {
      "fieldId": 898445,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "signfield"
    },
    {
      "fieldId": 898447,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "datefield",
      "name": "date of contract",
      "value": ""
    },
    {
      "fieldId": 898449,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "checkboxfield",
      "name": "",
      "value": "No"
    },
    {
      "fieldId": 898451,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "checkboxfield",
      "name": "",
      "value": "No"
    },
    {
      "fieldId": 1724179,
      "documentId": 101857,
      "documentVersionId": 101715,
      "fieldType": "dropdownfield",
      "name": "Month",
      "value": "January"
    }
  ]
}
						

Sample Code
curl -X GET -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Cache-Control: no-cache" "https://www.esigngenie.com/esign/api/folders/myfolder?folderId=179"
								
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/folders/myfolder?folderId=179",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
								
var webAddr = "https://www.esigngenie.com/esign/api/folders/myfolder?folderId=" + FOLDERID;

            var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
            httpWebRequest.Method = "GET";
            httpWebRequest.Headers.Add("Authorization", "Bearer " + ACCESS_TOKEN);

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                
            }
									
								
		int fid= ENTER_YOUR_FOLDER_ID;
		
		URL url= new URL("https://www.esignenie.com/esign/api/folders/myfolder?folderId="+fid);
		HttpURLConnection con= (HttpURLConnection) url.openConnection();
		con.setDoOutput(true);
		con.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
            throw new RuntimeException("Failed : HTTP error code : "+ con.getResponseCode());
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(
                (con.getInputStream())));
        String output;
        System.out.println("Output from Server .... \n");
        while ((output = br.readLine()) != null) {
            System.out.println(output);
        }
        
        con.disconnect();
								

Download All Documents in Folder


You can download executed folder document(s) as well as signature certificate all at once in a zip file.

 /folders/download?folderId={FOLDER_ID}


Request Parameters
folderId Your FOLDER_ID

Response

Returns ZIP file binary stream of all the documents in the folder with the signature certificate


Sample Code
var webAddr = "https://www.esigngenie.com/esign/api/folders/download?folderId=" + FOLDER_ID +"&access_token="+ ACCESS_TOKEN;
           
            using (var client = new WebClient())
            {
                client.DownloadFile(webAddr, "FILE_PATH");
            }
							
		int fid= ENTER_FOLDER_ID;
	    String fileURL = "https://www.esigngenie.com/esign/api/folders/download?folderId="+fid;
	    String saveDir = "D:\\";
	            
	    URL url= new URL(fileURL);
		HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();

        List<String> response = new ArrayList<String>();
        
		httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		
        int responseCode = httpConn.getResponseCode();
       
        if (responseCode == HttpURLConnection.HTTP_OK) {
        	String contentType = httpConn.getContentType();
        	if(contentType.equals("application/json")) {
        		 BufferedReader reader = new BufferedReader(new InputStreamReader(
              		   httpConn.getInputStream()));
                 String line = null;
                 while ((line = reader.readLine()) != null) {
                     response.add(line);
                 }
                 
                 reader.close();
                 httpConn.disconnect();
        	} 
        	
        	else {
				String fileName = "";
                String disposition = httpConn.getHeaderField("Content-Disposition");
                
				int contentLength = httpConn.getContentLength();
     
                if (disposition != null) {
                    // extracts file name from header field
                    int index = disposition.indexOf("filename=");
                    if (index > 0) {
                        fileName = disposition.substring(index + 10,
                                disposition.length() - 1);
                    }
                } else {
                   
                    fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
                            fileURL.length());
                }
     
               System.out.println("Content-Type = " + contentType);
                InputStream inputStream = httpConn.getInputStream();
                String saveFilePath = saveDir + File.separator + "abc.zip";
                FileOutputStream outputStream = new FileOutputStream(saveFilePath);
     
                int bytesRead = -1;
                byte[] buffer = new byte[BUFFER_SIZE];
                while ((bytesRead = inputStream.read(buffer)) != -1) {
                    outputStream.write(buffer, 0, bytesRead);
                }
                
                outputStream.close();
                inputStream.close();
                System.out.println("File downloaded");
        	}
     }
        else {
            System.out.println("No file to download. Server replied HTTP code: " + responseCode);
            BufferedReader reader = new BufferedReader(new InputStreamReader(
           		   httpConn.getErrorStream()));
              String line1 = null;
              while ((line1 = reader.readLine()) != null) {
                  response.add(line1);
              }
              
              reader.close();
              httpConn.disconnect();
              
        }
							

Download a Document


You can download individual document as a pdf file.

 /folders/downloaddocument?documentId={DOCUMENT_ID}


Request Parameters
documentId Individual document id

Response

Returns PDF file binary stream of the document which you can save as PDF file.


Sample Code
var webAddr = "https://www.esigngenie.com/esign/api/folders/downloaddocument?documentId=" + DOCUMENT_ID + "&access_token=" + ACCESS_TOKEN;

            using (var client = new WebClient())
            {
                client.DownloadFile(webAddr,"FILE_PATH");
            }
							
							
		int fid= ENTER_FOLDER_ID;
	        String fileURL = "https://www.esigngenie.com/esign/api/folders/downloaddocument?documentId="+fid;
	        String saveDir = "D:\\test\\";
	      URL url= new URL(fileURL);
		HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();

        List<String> response = new ArrayList<String>();
        
		httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		
        int responseCode = httpConn.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
        	String contentType = httpConn.getContentType();
        	if(contentType.equals("application/json")) {
        		 BufferedReader reader = new BufferedReader(new InputStreamReader(
              		   httpConn.getInputStream()));
                 String line = null;
                 while ((line = reader.readLine()) != null) {
                     response.add(line);
                 }
                 
                 reader.close();
                 httpConn.disconnect();
        	} 
        	
        	else {
				String fileName = "";
                String disposition = httpConn.getHeaderField("Content-Disposition");
                
				int contentLength = httpConn.getContentLength();
     
                if (disposition != null) {
                    // extracts file name from header field
                    int index = disposition.indexOf("filename=");
                    if (index > 0) {
                        fileName = disposition.substring(index + 10,
                                disposition.length() - 1);
                    }
                } else {
                    // extracts file name from URL
                    fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
                            fileURL.length());
                }
     
               System.out.println("Content-Type = " + contentType);
             
     
                // opens input stream from the HTTP connection
                InputStream inputStream = httpConn.getInputStream();
                String saveFilePath = saveDir + File.separator + "abc1.pdf";//fileName;
                 
                // opens an output stream to save into file
                FileOutputStream outputStream = new FileOutputStream(saveFilePath);
     
                int bytesRead = -1;
                byte[] buffer = new byte[BUFFER_SIZE];
                while ((bytesRead = inputStream.read(buffer)) != -1) {
                    outputStream.write(buffer, 0, bytesRead);
                }
                
                outputStream.close();
                inputStream.close();
                System.out.println("File downloaded");
        	}
            
        }
        
        else {
            System.out.println("No file to download. Server replied HTTP code: " + responseCode);
            BufferedReader reader = new BufferedReader(new InputStreamReader(
           		   httpConn.getErrorStream()));
              String line = null;
              while ((line = reader.readLine()) != null) {
                  response.add(line);
              }
              
              reader.close();
              httpConn.disconnect();
        }
							

Delete your Document(s) from eSign Genie


Using eSign Genie API you can move your document(s) folders to recycle bin. Documents in recycle bin are permanently removed from eSign Genie systems automatically after 14 days.

 /folders/movetorecyclebin
application/json


REQUEST
{
	"folderIds":[219]
}
Parameter Description
folderIds An array of folder IDs that you want to move to recycle bin
RESPONSE
{
	"result":"success"
}
Code Samples
curl -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
    "folderIds":[219]
}' "https://www.esigngenie.com/esign/api/folders/movetorecyclebin"
						
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/folders/movetorecyclebin",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{
  	"folderIds":[219]
}',
  
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
						
var webAddr = "https://www.esigngenie.com/esign/api/folders/movetorecyclebin";

            var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);

            httpWebRequest.ContentType = "application/json; charset=utf-8";
            httpWebRequest.Method = "POST";
           
            httpWebRequest.Headers.Add("Authorization", "Bearer " + ACCESS_TOKEN);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string json = @"{""folderIds"":["+ FOLDERIDSTODELETE+ "]}";
                streamWriter.Write(json);
                streamWriter.Flush();
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                
            }

						
			String apiURL = "https://www.esigngenie.com/esign/api/folders/movetorecyclebin/";
		    URL url= new URL(apiURL);
			HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();
			httpConn.setDoOutput(true);
			httpConn.setRequestProperty("Content-Type", "application/json");
			httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		
			String urlParameters="{\"folderIds\":[FOLDER_ID_1,FOLDER_ID_2]}";
		
			DataOutputStream wr = new DataOutputStream(httpConn.getOutputStream());
			wr.writeBytes(urlParameters);
			
			   if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
		            throw new RuntimeException("Failed : HTTP error code : "+ httpConn.getResponseCode());
		        }
		        BufferedReader br = new BufferedReader(new InputStreamReader(
		                (httpConn.getInputStream())));
		        String output;
		        System.out.println("Output from Server .... \n");
		        while ((output = br.readLine()) != null) {
		            System.out.println(output);
		        }
		        
		        httpConn.disconnect();
						

Templates API

Create a new folder of documents from templates


To create a folder of documents from templates, you need to make a call to /templates/createFolder with the following parameters and use template_id to specify the templates:

 /templates/createFolder
 application/json


REQUEST
{
	"folderName":"Sample Documents",
	"templateIds":[ID_OF_TEMPLATE_A,ID_OF_TEMPLATE_B],
	"fields":
		{
			"FIELD1_NAME":"FIELD1_VALUE",
			"FIELD2_NAME":"FIELD2_VALUE",
			....
		},
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	],
	"senderEmail":"user2@example.com",
	"signInSequence":false,
	"sendNow":false,
	"createEmbeddedSendingSession":false,
	"fixRecipientParties":true,
	"fixDocuments":true,
	"sendSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"sendErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":false,
	"embeddedSignersEmailIds":["FIRST_EMBEDDED_SIGNER_EMAIL","SECOND_EMBEDDED_SIGNER_EMAIL"],
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION"
}						
						
Parameter Description
folderName (optional) Name of the document(s) folder
If this value is not provided, then the document(s) folder name is kept same as the template(s) name(s).
templateIds (required) An array of template IDs you want to use to create the documents for this folder. You can determine the template ID from the template URL.(https://www.esigngenie.com/esign/templates/prepareimmutabletemplate?template.templateId={TEMPLATE_ID}) Responsive image
fields (optional) You may pass of the field values used in the templates to prefill them in the documents created from the template.
FIELD_NAME is the name of the field used in the template. FIELD_VALUE is the document field value.
parties (required) A list of recipient parties you're sending the folder to. Every entry must contain firstName, lastName, emailId, permission and sequence fields.
permission Use this field to assign folder permissions to a recipient. Can be any one of the following values:
FILL_FIELDS_AND_SIGN, FILL_FIELDS_ONLY, SIGN_ONLY, VIEW_ONLY
sequence Use this field to assign a sequence number to a recipient in the list of recipient parties.
Use unique sequence numbers for each party starting with 1 like 1,2,3,4....
senderEmail (optional) You can enter email of another user in your account which will be used for sending this document(s) folder to the recipient parties.
signInSequence
(optional, default=false)
Value can be either true or false
Use this field to determine whether recipients will sign the folder in a sequence.
If false, then all the recipients receive invitation email simultaneously. When true, then each recipient receives invitation email successively after previous recipient completes the required task, like signing the documents or filling fields, etc.
sendNow
Default true
Value can be either true or false
Use this field to send the folder to the recipient parties. Each party will then receive a unique link in their email to sign the document. The invitation mail and subject in this case will be the same as the default invitation mail setup in your account.
createEmbeddedSendingSession
Default false
Value can be either true or false
If true then an embedded token will be generated in the response, for an embedded sending session, where you can directly open the eSign Genie document preparing view in your application for dragging and dropping various fields on your document. And also give a custom invitation message.
fixRecipientParties (required if createEmbeddedSendingSession is true) Value can be either true or false
If true then in the embedded sending view you won't be able to change the parties for the folder which are already added as a part of this API request.
fixDocuments (required if createEmbeddedSendingSession is true) Value can be either true or false
If true then in the embedded sending view you won't be able to change the documents for the folder which are already added as a part of this API request.
sendSuccessUrl (required if createEmbeddedSendingSession is true) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to after successfully sending the folder in the embedded sending view.
sendErrorUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to if error comes during sending the folder in the embedded sending view.
createEmbeddedSigningSession
(optional, default=false)
Value can be either true or false
If false, then all the recipients receive an email invitation to sign the folder.
Else if true then an embedded signing session will be generated in the response, for the recipients whose emails will be given in the embeddedSignersEmailIds, and those recipients will not receive any invitation email.
Also if its value is true then either createEmbeddedSigningSessionForAllParties value should also be true or embeddedSignersEmailIds should be non-empty
createEmbeddedSigningSessionForAllParties
(optional, default=false)
Value can be either true or false
If true, then an embedded signing session is created for all the recipients in the folder.
Else if false, then the embedded signing session is only created for those recipients whose email ids are given in embeddedSignersEmailIds.
embeddedSignersEmailIds
(optional)
An array of email ids of recipients for whom an embedded signing session needs to be created. The values must be email ids from the recipient parties added in the parties list.
signSuccessUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to after successfully signing the folder in the embedded signing view.
signDeclineUrl (optional) Enter the absolute URL for the landing page on your website/application, which the user will be redirected to if he declines to sign the folder in the embedded signing view.
signLaterUrl (optional) Enter the absolute URL for the landing page your website/application, which the user will be redirected to if he chooses to sign the folder later in the embedded signing view.
signErrorUrl (optional) Enter the absolute URL for the landing page your website/application, which the user will be redirected to if error comes during signing the folder in the embedded signing view.
themeColor (optional) You can enter a css value for a color to match your website's look n feel when you embed esign genie inside. The top blue band of the signing screen is then replaced with the color provided by you.

RESPONSE
{
	"result":"success",
	"message":"folder of document(s) successfully created",
	"embeddedSigningSessions": [
          {
            "emailIdOfSigner": "mtariq@accountsight.com",
            "embeddedToken": "EMBEDDED_TOKEN",
            "embeddedSessionURL": "UNIQUE_EMBEDDED_SESSION_URL"
          },
          {
            "emailIdOfSigner": "mtariq@esigngenie.com",
            "embeddedToken": "EMBEDDED_TOKEN",
            "embeddedSessionURL": "UNIQUE_EMBEDDED_SESSION_URL"
          }
        ],
	"folder":{
		"folderId": 179,
	    "folderName": "fw4",
	    "folderAuthorId": 1,
	    "folderCompanyId": 11,
	    "folderCreationDate": 1441268056000,
	    "folderSentDate": 1442470444000,
	    "folderStatus": "SHARED",
	    "folderDocumentIds": [
	      420
	    ],
	    "documentsList": [
	      {
	        "documentId": 420,
	        "companyId": 11,
	        "contractCreatedBy": 1,
	        "contractCreatedOn": 1441268055000,
	        "contractType": "W4",
	        "contractStatus": "WAITING_FOR_SIGNATURE",
	        "editable": false,
	        "contractVersionId": 488,
	        "contractVersionName": "fw4",
	        "contractVersionDesc": "this is a non editable form W4",
	        "versionCreatedby": 1,
	        "versionCreatedOn": 1441268055000,
	        "contractVersionNumber": 1
	      }
	    ],
	    "folderRecipientParties": [
	      {
	        "partyId": 52,
	        "partyDetails": {
	          "partyId": 52,
	          "firstName": "Tariq",
	          "lastName": "Acc",
	          "emailId": "mtariq@accountsight.com",
	          "address": "",
	          "dateCreated": 1413013300000
	        },
	        "contractPermissions": "FILL_FIELDS_AND_SIGN",
	        "partySequence": 1,
	        "workflowSignSequence": 1,
	        "envelopeId": 179,
	        "sharingMode": "email",
	        "folderAccessURL": "https://www.esigngenie.com/esign/viewDocumentDirect?encrDocId=QoS4qeiO870mBXNbcuUWYA%3D%3D&partyId=52"
	      },
	      {
	        "partyId": 1,
	        "partyDetails": {
	          "partyId": 1,
	          "firstName": "Tariq",
	          "lastName": "Gmail",
	          "emailId": "mtariq@esigngenie.com",
	          "address": "New Delhi, India",
	          "dateCreated": 1404792207000
	        },
	        "contractPermissions": "FILL_FIELDS_AND_SIGN",
	        "partySequence": 2,
	        "workflowSignSequence": 2,
	        "envelopeId": 179,
	        "sharingMode": "email",
	        "folderAccessURL": "https://www.esigngenie.com/esign/viewDocumentDirect?encrDocId=QoS4qeiO870mBXNbcuUWYA%3D%3D&partyId=1"
	      }
	    ],
	    "bulkId": 0,
	    "enforceSignWorkflow": false,
	    "currentWorkflowStep": 1,
	    "transactionSource": "API-1-via_templates:[46]",
	    "editable": false
	}
}
						

Code Samples
echo '{
	"folderName":"Sample Documents",
	"templateIds":[ID_OF_TEMPLATE_A,ID_OF_TEMPLATE_B],
	"fields":
		{
			"FIELD1_NAME":"FIELD1_VALUE",
			"FIELD2_NAME":"FIELD2_VALUE",
			....
		},
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	],
	"signInSequence":false,
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":true,
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION"
}' | curl https://www.esigngenie.com/esign/api/templates/createFolder \
-i \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json;charset=UTF-8" \
-d @- \
-X POST

						
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/templates/createFolder",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => '{
  	"folderName":"Sample Documents",
	"templateIds":[ID_OF_TEMPLATE_A,ID_OF_TEMPLATE_B],
	"fields":
		{
			"FIELD1_NAME":"FIELD1_VALUE",
			"FIELD2_NAME":"FIELD2_VALUE",
			....
		},
	"parties":[
		{
			"firstName":"FIRST_NAME_OF_RECIPIENT_PARTY",
			"lastName":"LAST_NAME_OF_RECIPIENT_PARTY",
			"emailId":"EMAIL_ID_OF_RECIPIENT_PARTY",
			"permission":"FILL_FIELDS_AND_SIGN",
			"sequence":1
		},
		....
	],
	"signInSequence":false,
	"createEmbeddedSigningSession":true,
	"createEmbeddedSigningSessionForAllParties":true,
	"signSuccessUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signDeclineUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signLaterUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"signErrorUrl":"YOUR_PAGE_TO_REDIRECT_USER_FROM_EMBEDDED_SESSION",
	"themeColor":"ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION"
}',
  
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
						
var webAddr = "https://www.esigngenie.com/esign/api/templates/createFolder"         
var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
            httpWebRequest.ContentType = "application/json; charset=utf-8";
            httpWebRequest.Method = "POST";
            httpWebRequest.Headers.Add("Authorization","Bearer "+ ACCESS_TOKEN);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string json = @"{
	""folderName"":""Sample Documents"",
    ""templateIds"":[ID_OF_TEMPLATE_A],
	""fields"":
		{
			""Customer Name"":""[CustomerName]"",
			""Start Date"":""[StartDate]"",
""Included"":""[Included]"",
""Comments"":""[Comments]"",
""Signature Date"":""[SignatureDate]""
			
		},
	""parties"":[
		{
			""firstName"":""FIRST_NAME_OF_RECIPIENT_PARTY"",
			""lastName"":""LAST_NAME_OF_RECIPIENT_PARTY"",
			""emailId"":""EMAIL_ID_OF_RECIPIENT_PARTY"",
			""permission"":""FILL_FIELDS_AND_SIGN"",
			""sequence"":1

        }
		],
	""signInSequence"":false,
	""createEmbeddedSigningSession"":true,
	""createEmbeddedSigningSessionForAllParties"":true,
	""signSuccessUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signDeclineUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signLaterUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""signErrorUrl"":""https://www.esigngenie.com/demo-sign-success/"",
	""themeColor"":""ANY_CSS_COLOR_TO_MATCH_YOUR_APPLICATION""
}";

                streamWriter.Write(json);
                streamWriter.Flush();
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
            }

						
			String apiURL = "https://www.esigngenie.com/esign/api/templates/createFolder";
			URL url= new URL(apiURL);
			HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();
			httpConn.setDoOutput(true);
			
			httpConn.setRequestProperty("Content-Type", "application/json");
			httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		
			String input="{"
					+ "\"folderName\":\"Folder of Templates Using Java\","
					+ "\"templateIds\":[template_id_1,template_id_2],"
					+ "\"sendNow\":false,"
					+ "\"parties\":["
						+ "{"
							+ "\"firstName\":\"Tariq\","
							+ "\"lastName\":\"Painuli\","
							+ "\"emailId\":\"mtariq@accountsight.com\","
							+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
							+ "\"sequence\":1"
						+ "},"
						+ "{"
							+ "\"firstName\":\"Tariqesign\","
							+ "\"lastName\":\"Painuli2\","
							+ "\"emailId\":\"mtariq@esigngenie.com\","
							+ "\"permission\":\"FILL_FIELDS_AND_SIGN\","
							+ "\"sequence\":2"
						+ "}"
					+ "],"
					+ "\"createEmbeddedSigningSession\":true,"
					+ "\"createEmbeddedSigningSessionForAllParties\":true," 
			        + "\"senderEmail\":\"mtariq@accountsight.com\""
					+ "}";	
			
			OutputStream os = httpConn.getOutputStream();
	        os.write(input.getBytes());
	        os.flush();
		
	        if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
	            throw new RuntimeException("Failed : HTTP error code : "+ httpConn.getResponseCode());
	        } else {
	        	BufferedReader br = new BufferedReader(new InputStreamReader(
		                (httpConn.getInputStream())));
		        String output;
		        System.out.println("Output from Server .... \n");
		        while ((output = br.readLine()) != null) {
		            System.out.println(output);
		            
		        }
	        }	        
	        
	        httpConn.disconnect();
						

The response contains the data for the folder thus created, and it will contain the embedded session URL which you can use to create an embedded signing view in your application if you requested it by passing true in createEmbeddedSigningSession in the request

Get list of all templates for your account


You can get a list of all the templates from your eSign Genie into your application using the following call

 /templates/list


RESPONSE
{
  "result": "success",
  "total_templates": 9,
  "templatesList": [
    {
      "templateId": 1,
      "templateName": "Subcontractor Agreement Template ",
      "templateDesc": "A custom subcontractor agreement Template desc",
      "templateType": "Subcontracting",
      "templateCreationDate": 1413011470000,
      "templateLastUpdateDate": 1427099812000,
      "editable": true,
      "numberOfParties": 0,
      "companyId": 11,
      "templateCreatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "templateLastUpdatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "shareAll": true
    },
    {
      "templateId": 3,
      "templateName": "single party agreement",
      "templateDesc": "sample template  desc 1",
      "templateType": "DEED",
      "templateCreationDate": 1413541233000,
      "templateLastUpdateDate": 1430724568000,
      "editable": true,
      "numberOfParties": 0,
      "companyId": 11,
      "templateCreatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "templateLastUpdatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "shareAll": false
    },
    {
      "templateId": 6,
      "templateName": "NDA Template",
      "templateDesc": "A Non Disclosure Agreement Template",
      "templateType": "NDA",
      "templateCreationDate": 1417083942000,
      "templateLastUpdateDate": 1461753204000,
      "editable": true,
      "numberOfParties": 0,
      "companyId": 11,
      "templateCreatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "templateLastUpdatedBy": {
        "partyId": 1,
        "firstName": "Mohammad",
        "lastName": "Tariq (gmail)",
        "emailId": "game.tariq@gmail.com",
        "address": null,
        "dateCreated": null,
        "companyId": 0,
        "userRole": null,
        "userAddedDate": null,
        "department": null,
        "title": null,
        "active": false,
        "managerId": null
      },
      "shareAll": false
    },
    ...
    ]
   }
						

Sample Code
			String apiURL = "https://www.esigngenie.com/esign/api/templates/list";
			
	        URL url= new URL(apiURL);
			HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();
			httpConn.setDoOutput(true);
		
			httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
		   if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
	            throw new RuntimeException("Failed : HTTP error code : "+ httpConn.getResponseCode());
	        }
	        BufferedReader br = new BufferedReader(new InputStreamReader(
	                (httpConn.getInputStream())));
	        String output;
	        System.out.println("Output from Server .... \n");
	        while ((output = br.readLine()) != null) {
	            System.out.println(output);
	        }
	        
	        httpConn.disconnect();
								

Get Template Data


You can poll our API to get the template data

 /templates/mytemplate?templateId={TEMPLATE_ID}


Request Parameters
templateId Your TEMPLATE_ID

RESPONSE
{
  "result": "success",
  "template": {
    "templateId": 46,
    "templateName": "Copy of eSignGenie Sample",
    "templateDesc": null,
    "templateType": null,
    "templateCreationDate": 1468478204000,
    "templateLastUpdateDate": 1479106113000,
    "editable": false,
    "numberOfParties": 3,
    "companyId": 11,
    "templateCreatedBy": {
      "partyId": 1,
      "firstName": "Mohammad",
      "lastName": "Tariq (gmail)",
      "emailId": "mohammad.tariq147@gmail.com",
      "address": null,
      "dateCreated": null,
      "companyId": 0,
      "userRole": null,
      "userAddedDate": null,
      "department": null,
      "title": null,
      "active": false,
      "managerId": null
    },
    "templateLastUpdatedBy": {
      "partyId": 52,
      "firstName": "Mohammad",
      "lastName": "Tariq",
      "emailId": "mtariq@accountsight.com",
      "address": null,
      "dateCreated": null,
      "companyId": 0,
      "userRole": null,
      "userAddedDate": null,
      "department": null,
      "title": null,
      "active": false,
      "managerId": null
    },
    "shareAll": false
  },
  "allfields": [
    {
      "fieldTagId": 48,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "textfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.142763,
      "coordinateYRatio": 0.415264,
      "elementWidthRatio": 0.197927,
      "elementHeightRatio": 0.0304487,
      "docFieldId": "48",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "textfieldName": "",
      "value": "Tariq",
      "description": "",
      "partyResponsible": 1,
      "required": false,
      "multiLine": false,
      "fontSize": 16,
      "fontFamily": "default",
      "fontColor": "#800080",
      "readOnly": false,
      "systemField": false
    },
    {
      "fieldTagId": 49,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "signfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.322042,
      "coordinateYRatio": 0.688126,
      "elementWidthRatio": 0.166667,
      "elementHeightRatio": 0.0198728,
      "docFieldId": "49",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": 1,
      "partyResponsible": 1,
      "signatureId": null
    },
    {
      "fieldTagId": 51,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "datefield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.53841,
      "coordinateYRatio": 0.424516,
      "elementWidthRatio": 0.166945,
      "elementHeightRatio": 0.016129,
      "docFieldId": "51",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "datefieldName": "DOB",
      "value": "",
      "description": "",
      "partyResponsible": 1,
      "required": false,
      "dateFormat": "MMM/DD/YYYY",
      "readOnly": false,
      "systemField": false
    },
    {
      "fieldTagId": 52,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "signfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.580556,
      "coordinateYRatio": 0.680187,
      "elementWidthRatio": 0.211934,
      "elementHeightRatio": 0.0238474,
      "docFieldId": "52",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "partyResponsible": 2,
      "signatureId": null
    },
    {
      "fieldTagId": 59,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "checkboxfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.445075,
      "coordinateYRatio": 0.569793,
      "elementWidthRatio": 0.0390946,
      "elementHeightRatio": 0.0286169,
      "docFieldId": "14766189127327312",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": 3,
      "cbname": "",
      "description": "",
      "partyResponsible": 2,
      "cbgroup": "",
      "checked": false,
      "oneCbMandatoryInGroup": false
    },
    {
      "fieldTagId": 60,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "checkboxfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.573675,
      "coordinateYRatio": 0.571383,
      "elementWidthRatio": 0.0390946,
      "elementHeightRatio": 0.027027,
      "docFieldId": "14766189209789773",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": 4,
      "cbname": "",
      "description": "",
      "partyResponsible": 2,
      "cbgroup": "",
      "checked": false,
      "oneCbMandatoryInGroup": false
    },
    {
      "fieldTagId": 61,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "signfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.132317,
      "coordinateYRatio": 0.826073,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0238474,
      "docFieldId": "14770354742332322",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "partyResponsible": 3,
      "signatureId": null
    },
    {
      "fieldTagId": 69,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "textfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.328562,
      "coordinateYRatio": 0.722884,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0198728,
      "docFieldId": "14784287893213202",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "textfieldName": "Signer Name",
      "value": "",
      "description": "",
      "partyResponsible": 1,
      "required": false,
      "multiLine": false,
      "fontSize": 8,
      "fontFamily": "default",
      "fontColor": "#000000",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 70,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "textfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.575926,
      "coordinateYRatio": 0.726391,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0206677,
      "docFieldId": "1478438292060593",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "textfieldName": "Signer Name",
      "value": "",
      "description": "",
      "partyResponsible": 2,
      "required": false,
      "multiLine": false,
      "fontSize": 8,
      "fontFamily": "default",
      "fontColor": "#000000",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 71,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "textfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.372222,
      "coordinateYRatio": 0.825755,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0198728,
      "docFieldId": "147843830200324",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "textfieldName": "Signer Name",
      "value": "",
      "description": "",
      "partyResponsible": 3,
      "required": false,
      "multiLine": false,
      "fontSize": 8,
      "fontFamily": "default",
      "fontColor": "#000000",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 72,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "datefield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.325926,
      "coordinateYRatio": 0.758665,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0198728,
      "docFieldId": "14784382692222212",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "datefieldName": "Date Signed",
      "value": "",
      "description": "",
      "partyResponsible": 1,
      "required": false,
      "dateFormat": "DD/MMMM/YYYY",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 73,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "datefield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.569753,
      "coordinateYRatio": 0.762162,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0198728,
      "docFieldId": "14784383126396385",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "datefieldName": "Date Signed",
      "value": "",
      "description": "",
      "partyResponsible": 2,
      "required": false,
      "dateFormat": "DD/MMMM/YYYY",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 74,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "datefield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.625309,
      "coordinateYRatio": 0.82496,
      "elementWidthRatio": 0.205761,
      "elementHeightRatio": 0.0206677,
      "docFieldId": "14784383209099086",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "datefieldName": "Date Signed",
      "value": "",
      "description": "",
      "partyResponsible": 3,
      "required": false,
      "dateFormat": "DD/MMMM/YYYY",
      "readOnly": true,
      "systemField": true
    },
    {
      "fieldTagId": 77,
      "contractId": 0,
      "versionId": 0,
      "templateId": 46,
      "companyId": 11,
      "fieldType": "attachmentfield",
      "documentPageNumber": 1,
      "coordinateXRatio": 0.465856,
      "coordinateYRatio": 0.16725,
      "elementWidthRatio": 0.0925926,
      "elementHeightRatio": 0.0238474,
      "docFieldId": "14791060033633622",
      "dependent": false,
      "parentTagId": "",
      "parentTagValueToCompare": "",
      "conditionResult": null,
      "tabOrder": null,
      "attachmentfieldName": "DL",
      "attachmentfieldDescription": "Please upload scanned copy of DL",
      "partyResponsible": 1,
      "required": true,
      "attachmentFileId": null
    }
  ]
}
						

Sample Code
curl -X GET -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Cache-Control: no-cache" "https://www.esigngenie.com/esign/api/templates/mytemplate?templateId=179"
								
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://www.esigngenie.com/esign/api/templates/mytemplate?templateId=179",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
								
var webAddr = "https://www.esigngenie.com/esign/api/templates/mytemplate?templateId=" + TEMPLATEID;

            var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
            httpWebRequest.Method = "GET";
            httpWebRequest.Headers.Add("Authorization", "Bearer " + ACCESS_TOKEN);

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                
            }
									
								
			int Tid= Your_Template_Id;
		    String apiURL = "https://www.esigngenie.com/esign/api/templates/mytemplate?templateId="+Tid;
	        URL url= new URL(apiURL);
			HttpURLConnection httpConn= (HttpURLConnection) url.openConnection();

	        List<String> response = new ArrayList<String>();
	        
			httpConn.setRequestProperty("Authorization","Bearer ACCESS_TOKEN");
			
	        int responseCode = httpConn.getResponseCode();
	        if (responseCode == HttpURLConnection.HTTP_OK) {
	         BufferedReader reader = new BufferedReader(new InputStreamReader(
	              		   httpConn.getInputStream()));
	                 String line = null;
	                 while ((line = reader.readLine()) != null) {
	                     response.add(line);
	                 }
	                 
	                 reader.close();
	                 httpConn.disconnect();
	        }
								

Webhooks

The webhooks enable you to monitor changes in your document folders without polling the eSign Genie platform.

Webhook is a URL handled by your application which will be called by eSign Genie, based on certain events.
As eSign Genie is calling your application, your application should be publicly accessible on the internet.

You can add your webhook in eSign Genie API Settings page. Also you can define the events that will cause eSign Genie to call your webhook. Eg, you can decide whether the webhook should be called when any party signs your folder, or only when the folder is finally executed.

eSign Genie posts JSON data to your webhook. Every JSON payload posted contains event name (event_name), event date (event_date) and data related to that particular event (data)

Webhook Events

Event Name Description
folder_sent eSign Genie calls your Webhook for this event whenever any document folder is sent out from your account for signature.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was sent.
folder_viewed eSign Genie calls your Webhook for this event whenever any party first time opens your document folder which was sent out to them from your account.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was viewed, and also a viewing_party field which contains the data for the party which viewed the document folder.
folder_signed eSign Genie calls your Webhook for this event whenever any party signs your document folder which was sent out to them from your account.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was signed, and also a signing_party field which contains the data for the party which signed the document folder.
folder_cancelled eSign Genie calls your Webhook for this event whenever any party cancels or declines to sign your document folder which was sent out to them from your account.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was cancelled, and also a cancelling_party field which contains the data for the party which cancelled/declined to sign the document folder, and a reason_for_cancelling field which contains the reason given for cancelling/declining to sign the document.
folder_executed eSign Genie calls your Webhook for this event whenever any document folder which was sent out from your account has been completed with all the required parties signatures.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was completed.
folder_deleted eSign Genie calls your Webhook for this event whenever any document folder from your account is deleted.
The data field in this case consists of the folder (folder) field, which contains the data for the folder which was deleted, and also a deleting_party field which contains the data for the party which deleted the document folder.
Sample Webhook Request Body
{
    "event_name":"folder_signed",
    "event_date":1464237988093,
    "data":{
      "folder":{
        "folderId":649,
        "folderName":"NDA",
        "folderAuthorId":1,
        "folderCompanyId":11,
        "folderCreationDate":1456385855000,
        "folderSentDate":1464237650000,
        "folderStatus":"SHARED",
        "folderDocumentIds":[1239,1240],
        "documentsList":[
          {
            "documentId":1239,
            "companyId":11,
            "contractCreatedBy":1,
            "contractCreatedOn":1456385853000,
            "contractType":"NDA",
            "contractStatus":"WAITING_FOR_SIGNATURE",
            "editable":false,
            "contractVersionId":1307,
            "contractVersionName":"NDA",
            "contractVersionDesc":"NDA",
            "versionCreatedby":1,
            "versionCreatedOn":1456385853000,
            "contractVersionNumber":1
          },
          {
            "documentId":1240,
            "companyId":11,
            "contractCreatedBy":1,
            "contractCreatedOn":1456385871000,
            "contractType":"IRS",
            "contractStatus":"WAITING_FOR_SIGNATURE",
            "editable":false,
            "contractVersionId":1308,
            "contractVersionName":"Form W9 copy",
            "contractVersionDesc":"Pdf sample template",
            "versionCreatedby":1,
            "versionCreatedOn":1456385871000,
            "contractVersionNumber":1
          }
        ],
        "folderRecipientParties":[
		  {
        	"partyId":1,
        	"partyDetails":{
        	  "partyId":1,
        	  "firstName":"Tariq",
        	  "lastName":"Gmail",
        	  "emailId":"mtariq@esigngenie.com",
        	  "address":"New Delhi, India",
        	  "dateCreated":1404837207000
        	},
        	"contractPermissions":"FILL_FIELDS_AND_SIGN",
        	"partySequence":1,
        	"workflowSignSequence":1,
        	"envelopeId":649,
        	"sharingMode":"email",
        	"folderAccessURL":null,
        	"securityMode":"none"
          },
          {
            "partyId":52,
            "partyDetails":{
              "partyId":52,
              "firstName":"Tariq",
              "lastName":"Acc",
              "emailId":"mtariq@accountsight.com",
              "address":"",
              "dateCreated":1413058300000
            },
            "contractPermissions":"FILL_FIELDS_AND_SIGN",
            "partySequence":2,
            "workflowSignSequence":2,
            "envelopeId":649,
            "sharingMode":"email",
            "folderAccessURL":null,
            "securityMode":"none"
            }
          ],
          "bulkId":0,
          "enforceSignWorkflow":false,
          "currentWorkflowStep":1,
          "transactionSource":"API-1-via_templates:[46]",
          "editable":false,
          "inPersonSignable":false
        },
        "signing_party":{
          "partyId":1,
          "firstName":"Tariq",
          "lastName":"Gmail",
          "emailId":"mtariq@esigngenie.com",
          "address":"New Delhi, India",
          "dateCreated":1404837207000
        }
      }
    }
						

Webhook Security

It is recommended to use HTTPS for the webhook urls at your application end to avoid any kind of tampering with your webhook request data.


Signature verification

You can enable extra security around your Webhooks by providing a Webhook Secret (in API settings page, under section of webhooks) which will enable eSign Genie to sign each of the webhook post request with a signature using your Webhook Secret.

The signature is generated using an HMAC-SHA-256 base64 digest of the raw HTTP Body of the Webhook post using this Webhook secret.

Using your Webhook Secret a signature is calculated and sent with each Webhook (as a query string parameter signature). You can thus verify the contents of Webhook as being authentic and un-tampered.

You can generate the signature in php as follows:
$request_body = file_get_contents('php://input');
$s = hash_hmac('sha256', $request_body, 'mySecret', true);
echo base64_encode($s);

This Signature is sent with each Webhook post as a query parameter signature in your URL.
For example, for the following URL you registered as a Webhook:

https://www.test.com/WebhookHandler

eSign Genie will post to the following webhook URL:

https://www.test.com/WebhookHandler?signature=XXXXXXXXXXXXXXXXXXXXX

You can thus verify the contents of the POST by taking the same hash yourself and comparing with a signature you got in request.

IMPORTANT: Keep your Webhook secret safe with you as you would your password, since anyone with your Webhook secret could generate Webhooks that pass the signature validation.

Error Handling

If an error occurs during an API request, eSign Genie will return an error in this response format.

Error Response Samples
{
  "result": "error",
  "error_description": "first name of party cannot be empty"
}
						
{
  "result": "error",
  "error_description": "Cannot add 1 more document(s) to your accounts max document limit of 5"
}
						

Change History

Dec 06, 2016
  • Added new function in the Templates API section.
Oct 06, 2016
  • Added C# examples.
Oct 05, 2016
  • Added new Templates API section.
  • Replaced emailIdOfEmbeddedSigner with two new parameters createEmbeddedSigningSessionForAllParties and embeddedSignersEmailIds in the templates API and folders API which allow generating embedded signing sessions for more than one party. Note: All the older implementations which are using emailIdOfEmbeddedSigner will continue to work the same way without any issue, but we recommend to change to the new parameters to handle broader category of use cases.
June 23, 2016
  • Added delete folder api.
June 06, 2016
  • Added webhooks feature.
Feb 28, 2017
  • Added Java samples.