SignNow Java SDK
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


SignNow REST Service Wrapper


12/3/2015 - The eval server has been changed to You will need to create a new account for

About SignNow

SignNow is a powerful web-based e-signature solution that streamlines the signing process and overall document flow for businesses of any size. SignNow offers SaaS as well as public and private cloud deployment options using the same underlying API. With SignNow you can easily sign, share and manage documents in compliance with international data laws and industry-specific regulations. SignNow enables you to collect signatures from partners, employees and customers from any device within minutes.

API Contact Information

If you have questions about the SignNow API, please visit or email

See additional contact information at the bottom.


add SignNowSDK.jar file to your classpath. Download SignNowSDK.jar from


To run the you will need an API key. You can get one here For a full list of accepted parameters, refer to the SignNow REST Endpoints API guide:

set the below to the correct values.

		 String accountUser = "accountEmailAddress";
         String accountPass = "password";
         String testEmailAddress = "testEmailAddress";
         String clientId= "clientId";
         String clientSecret="clientSecret";

         //Client ID, Client Secret, API URL
         Config.init("[YOUR CLIENT ID]", "[YOUR CLIENT SECRET]", "");

User"================= Create User =================");
        String email ="";
        String password="123456789";
        String firstName="John";
        String lastName= "Carter";
        JSONObject createUserObj = new JSONObject();
        createUserObj.put("email", email);
        createUserObj.put("password", password);
        createUserObj.put("last_name", lastName);
        JSONObject newAccountRes = User.Create(createUserObj,clientId,clientSecret);
    	 if(newAccountRes != null)
    		 String id = (String)newAccountRes.get("id");" id is"+id);    	 
    	 {"User Creation failed. Please check if already verification mail sent for the user...");

Retrieve User Information"================= Retrieve User Info =================");
    	 JSONObject userInfo= User.Get(access_token);"UserInfo is..."+userInfo);

OAuth 2.0

Request Access Token

String grant_type= "password";
         String scope="*";
         JSONObject OAuthRes = OAuth2.requestToken(accountUser,accountPass,grant_type,scope);
         String access_token = "";
    	 String refresh_token = "";
    	 Long expires_in;
         if(OAuthRes != null)
        	 access_token= (String)OAuthRes.get("access_token");
        	 refresh_token= (String)OAuthRes.get("refresh_token");
        	 expires_in= (Long)OAuthRes.get("expires_in");
"access_token ==> "+access_token);
"refresh_token ==> "+refresh_token); 
"expires_in ==> "+expires_in); 

Verify an Access Token"=================Verifying OAuth2 Token=================");
         JSONObject OAuthVRes = OAuth2.Verify(access_token);
    	if(OAuthVRes!= null)
			String verify_access_token = (String) OAuthVRes.get("access_token");			


Retrieve a List of the User’s Documents

         JSONArray getAllDocumentsObj = Document.getAllUserDocuments(access_token);
         if(getAllDocumentsObj != null)
"Get all User Documents Result :" + getAllDocumentsObj); 

Retrieve a Document Resource

         JSONObject getDocumentObj = Document.get(access_token,documentId);
         if(getDocumentObj != null)
"Get Document Result :" + getDocumentObj); 

Download a Collapsed Document
"=================Downloading Document =================");
         InputStream downloadDocRes =, documentId); 
		 // provide the path where the document to be downloaded with a name to it.
         String filePath = "C://TEST//sample.pdf";
         FileOutputStream fos = new FileOutputStream(new File(filePath));
         int inByte;
         while((inByte = != -1)
         fos.close();"Document  downloaded");	

Delete Document"================= Delete Document =================");
         JSONObject deleteDocRes = Document.Delete(access_token, docId);
         if(deleteDocRes != null) {
        	 String status =(String)deleteDocRes.get("status");
"Deleted Document ID :" + docId + "Deletion Status :"+  status);

Upload Document
"================= Creating New Document =================");
         boolean extra_fileds=false;
         String resultFormat= "JSON";

         File file = new File("1-tkt.pdf").getAbsoluteFile();
         String name= "1-tkt.pdf";
         String fileExtn="pdf";
         JSONObject newDocRes = Document.Create(access_token,file,name,extra_fileds,fileExtn);
         String documentId=null;
         if(newDocRes != null) {
			documentId=(String)newDocRes.get("id");"New Document ID : "+ documentId);

Upload File & Extract Fields
"=================Creating New Document & Extracting Fields =================");
         File docFile = new File("Example Fields.docx").getAbsoluteFile();
         String docFileName= "Example Fields.docx";
         JSONObject docRes = Document.Create(access_token,docFile,docFileName,true,fileExtn);
         String docId=null;
         if(docRes!=null) {
			docId=(String)docRes.get("id");"New Document ID using Extract Fields:  "+ docId);

Update Document (add fields)
"================= Adding Fields =================");
         JSONArray fields = new JSONArray();
         JSONObject fieldsObj = new JSONObject();
         fieldsObj.put("x", Integer.valueOf("10"));
         fieldsObj.put("y", Integer.valueOf("10"));
         fieldsObj.put("width", Integer.valueOf("122"));
         fieldsObj.put("height", Integer.valueOf("34"));
         fieldsObj.put("page_number", Integer.valueOf("0"));
         fieldsObj.put("role", "Buyer");
         JSONObject fields1Obj = new JSONObject();
         fields1Obj.put("x", Integer.valueOf("40"));
         fields1Obj.put("y", Integer.valueOf("40"));
         fields1Obj.put("width", Integer.valueOf("122"));
         fields1Obj.put("height", Integer.valueOf("34"));
         fields1Obj.put("page_number", Integer.valueOf("0"));
         fields1Obj.put("role", "Seller");
         JSONObject fobj = new JSONObject();
         fobj.put("fields", fields);"Fields Object is : " + fobj.toJSONString());
         JSONObject fieldsRes = Document.Update(access_token,documentId,fobj);
         String fields_docId=null;
         if(fieldsRes != null) {
        	 fields_docId =(String)fieldsRes.get("id");
"After Adding the fileds, Document ID is :" + fields_docId);

Create Invite to Sign a Document

//Send Free Form Invite. Below are the two steps to perform this.

       //STEP 1: Create a New Document"================= SendInvite =================");

         file = new File("pdf-sample.pdf").getAbsoluteFile();
         name= "pdf-sample.pdf";
         newDocRes = Document.Create(access_token,file,name,extra_fileds,fileExtn);
         String invite_document_Id=null;
         if(newDocRes != null) {
			invite_document_Id=(String)newDocRes.get("id");"Invite Document ID : "+ invite_document_Id);
         //STEP 2:  Get the document id from STEP 1. Construct the invite object and send free form invite 
         "Sending free form Invite");         
         JSONObject inviteDataObj = new JSONObject();
         inviteDataObj.put("from", accountUser);
         inviteDataObj.put("to", testEmailAddress);
         String inviteDataObjStr = inviteDataObj.toString();
         boolean disableEmail= false;
         JSONObject sendFreeFormInviteRes = Document.Invite(access_token, invite_document_Id, inviteDataObjStr,disableEmail);"Invite Status: "+ sendFreeFormInviteRes);   
         // parse the response and show the invite id and status
         String invite_id=null;
         String status;
         if(sendFreeFormInviteRes != null) {
			status=(String)sendFreeFormInviteRes.get("result");"Freeform invite done : invite_id "+ invite_id+ " status :"+ status);

Cancel an Invite to a Document
"================= Canceling Invite =================");
         JSONObject cancelInviteRes = Document.CancelInvite(access_token, invite_id);         
         if(cancelInviteRes != null) {
 			status=(String)cancelInviteRes.get("result");"Cancel Invite Status: "+status);

Create a One-time Use Download URL
"================= Creating Download Link (Share)=================");
         JSONObject downloadLinkRes = Document.Share(access_token, documentId);
         String link;
         if(downloadLinkRes != null) {
  			link=(String)downloadLinkRes.get("link");"Download Link: "+link);

Merges Existing Documents
"================= Merging Existing Documents =================");
         JSONArray jsonArray = new JSONArray();
         JSONObject mergeDocObj = new JSONObject();
         mergeDocObj.put("name", "My-New-Merged-doc");
         mergeDocObj.put("document_ids", jsonArray);
         String mergeDocObjStr = mergeDocObj.toString();

         InputStream mergeDocsRes = Document.Merge(access_token, mergeDocObjStr);"Merged Docs Result: "+ mergeDocsRes);
         // provide the path where the document to be downloaded with a name to it.
         filePath = "C://TEST//";
         FileOutputStream fos1 = new FileOutputStream(new File(filePath+"merged.pdf"));
         while((inByte = != -1)
         fos1.close();"Merged Document downloaded at : " +filePath+"merged.pdf");		

Get Document History
"================= Retrieving Document History =================");
         JSONArray docHistoryRes = Document.History(access_token, documentId);
         if(docHistoryRes != null)
         {"Document History:   "+ docHistoryRes.toString());


Create a Template
"Create Template");
         JSONObject templObj = new JSONObject();
         templObj.put("document_id", documentId);
         templObj.put("document_name", "My New Template");
         JSONObject newTemplateRes = Template.Create(access_token,templObj);
        if(newTemplateRes != null) {
   			String template_id=(String)newTemplateRes.get("id");"New Template ID:       "+template_id);

Duplicate a Template
"================= Copy Template =================");
         JSONObject copyTemplobj = new JSONObject();
         JSONObject copyTemplateRes = Template.Copy(access_token, invite_document_Id,copyTemplobj);
         if(copyTemplateRes != null) {
    			String doc_id=(String)copyTemplateRes.get("id");
    			String doc_name=(String)copyTemplateRes.get("name");"New Doc ID: "+ doc_id +"  AND DocName:  "+doc_name);


Returns a list of folders"================= List Folder =================");

         //List Folders"List Folders");
         JSONObject listFoldersRes = Folder.List(access_token);"List Folders Results:       "+ listFoldersRes);
         String folderId=null;
         String doc_id=null;
         String doc_name= null;
         if(listFoldersRes != null) {
 			JSONArray folders = (JSONArray) listFoldersRes.get("folders");
 			JSONObject folderObj= (JSONObject)folders.get(0);
 			 doc_id = (String)folderObj.get("id");
 			 doc_name=(String)folderObj.get("name");"New Doc ID: "+ doc_id +"  AND DocName:  "+doc_name);

Returns a list of documents inside a folder
"================= Get Folder =================");
         String params=""; // optional parameters        
         JSONObject getFolderRes = Folder.Get(access_token, doc_id,params);
         if(getFolderRes != null)
" Get Folder Results:       "+ getFolderRes);


Create a Webhook

Events Description
document.create Webhook is triggered when a document is uploaded to users account in SignNow
document.update Webhook is triggered when a document is updated (fields added, text added, signature added, etc.)
document.delete Webhook is triggered when a document is deleted from
invite.create Webhook is triggered when an invitation to a SignNow document is created.
invite.update Webhook is triggered when an invite to SignNow document is updated. Ex. A signer has signed the document."================= Create Webhook =================");
 		JSONObject webHookobj = new JSONObject();
 		webHookobj.put("event", "document.create");
 		webHookobj.put("callback_url", "");
         JSONObject createWebhookRes = Webhook.Create(access_token,webHookobj);"Webhook Created : Results:       "+ createWebhookRes);
         String subscriptionId=null;
         if(createWebhookRes != null) {
 			subscriptionId=(String)createWebhookRes.get("id");"Webhook Created : Subscription Id:       "+ subscriptionId);

List Webhook"================= List Webhooks =================");
        JSONObject listWebhooksRes = Webhook.List(access_token);
        if(listWebhooksRes != null)
        {" List Webhooks Results:       "+ listWebhooksRes);

Delete Webhook
"================= Delete Webhooks =================");
         JSONObject deleteWebhookRes = Webhook.Delete(access_token, subscriptionId);
         if(deleteWebhookRes != null)
         {" Delete Webhooks Results:       "+ deleteWebhookRes);

"=================Link =================");
"Create Signing Link");
 		JSONObject linkObj = new JSONObject();
 		linkObj.put("document_id", documentId);
         JSONObject createLinkRes = Link.Create(access_token,linkObj);
         if(createLinkRes != null)
         {"Results:       "+ createLinkRes);

Document Groups


JSONArray docGroupArray = new JSONArray();
         docGroupArray.add(fields_docId); // having a document with fields is mandatory for DocumentGroup
         JSONObject docGroupObj = new JSONObject();
         docGroupObj.put("document_ids", docGroupArray);
         docGroupObj.put("group_name", "MyDocumentGrpName");
         String docGroupObjStr = docGroupObj.toString();
         JSONObject createDocGroup = DocumentGroup.Create(access_token, docGroupObjStr);
         String docGroupId=null;
         if(createDocGroup != null) {
			docGroupId=(String)createDocGroup.get("id");"Create Document Group Results:       "+ docGroupId);

Get Document Groups"================= Get Document Group =================");
         JSONObject getDocGroup = DocumentGroup.Get(access_token, docGroupId);
         if(getDocGroup != null)
         {"Get Document Group Results:       "+ getDocGroup);

Delete Document Group
"================= Delete Document Group =================");
         JSONObject deleteDocGroup = DocumentGroup.Get(access_token, docGroupId);
         if(deleteDocGroup !=null)
         {"Delete Document Group Results:       "+ deleteDocGroup);

Group Invite
"================= Invite Document Group =================");
         //build the invite model:
         JSONObject model = buildInviteGrpModel(accountUser,testEmailAddress,fields_docId,invite_document_Id);
         JSONObject inviteDocGroup = DocumentGroup.groupInvite(access_token, docGroupId,model);
         String group_invite_id=null;
         String group_id= null;
         String pending_invite_link= null;
         if(inviteDocGroup !=null)
        	 pending_invite_link = (String)inviteDocGroup.get("pending_invite_link");
        	 URL url = new URL(pending_invite_link);
        	 Map map = splitQuery(url);        	 
        	 group_invite_id= (String)map.get("group_invite_id");
        	 group_id= (String)map.get("document_group_id");
"Invite Document Group Results:       Group Invite Id:  "+ group_invite_id +"    AND   Group ID:  "+group_id );

Get Group Invite
"=================Get Invite : Document Group =================");
         JSONObject getInviteGroup = DocumentGroup.getInvite(access_token,group_id,group_invite_id);
         JSONObject inviteObj=null;
         JSONArray inviteStepsArr=null;
         JSONObject stepsObj=null;
         String stepId=null;
         JSONArray actionsArray;
         JSONObject actionsObj;
         String replace_doc_id = null;
         if(getInviteGroup !=null)
        	 inviteObj = (JSONObject)getInviteGroup.get("invite");
        	 actionsArray = (JSONArray)stepsObj.get("actions");
        	 actionsObj= (JSONObject)actionsArray.get(0);
        	 replace_doc_id =(String)actionsObj.get("document_id");
"GET Invite Document Group Results:       "+ inviteObj);
"GET Invite Document Group Results:       "+ stepId);
"GET Invite Document Group Results:       "+ inviteDocGroup);
"GET Invite Document Group Results:       "+ replace_doc_id);

Cancel Group Invite
"================= Cancel Invite : Document Group =================");         
         JSONObject cancelInviteGroup = DocumentGroup.cancelGroupInvite(access_token,group_id,group_invite_id);
         if(cancelInviteGroup !=null)
"CANCEL Invite Document Group Results:       "+ cancelInviteGroup);

Get Pending Invites
"================= Pending Invites : Document Group =================");         
         JSONObject pendingInvites = DocumentGroup.getPendingInvites(access_token,group_id,group_invite_id);
         if(pendingInvites !=null)
"Get Pending Invite Document Group Results:       "+ pendingInvites);

Resend Invites"================= Resend Invite : Document Group =================");         
        JSONObject resendInvite = DocumentGroup.resendInvite(access_token,group_id,group_invite_id);
        if(resendInvite !=null)
        {"Resent Invite Document Group Results:       "+ resendInvite);

Replace Inviters
"=================Replace Inviters : Document Group ================="); 
         JSONObject replaceModelObj = buildReplaceModel(replace_doc_id);
         JSONObject replaceInviters = DocumentGroup.replaceInviters(access_token,group_id,group_invite_id,stepId, replaceModelObj);
         if(replaceInviters !=null)
"ReplaceInviters Document Group Results:       "+ replaceInviters);

Additional Contact Information


To contact SignNow support email


For pricing information please fill form, call (800) 831-2050 or email