Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel4
stylecircle

The Story Image Removed

You only want to prepare a document for the time being, but send it or have it signed later? This page explains in detail how you can create a draft via API and how you can then send this draft. The advantage you have by creating a draft compared to creating an envelope:
You can prepare the document completely and send it to your recipients at any time. Therefore, you have already prepared everything at the time of sending the draft.

Use Case Description

Image RemovedUsing Drafts OverviewImage Added


The following steps are necessary to send a draft:

...

Info

All following API calls need an authorization. For information of how to authorize please see the Postman-Guide.

Creating a draft

First step is to create a draft. To create one you have to run the following API call:

https://demo.esignanywhere.net/Api/v5.0/draft/create

Code Block
languagejava
themeEclipse
{
	"SspFileIds": [
		"##SSPFILE-ID##"
	],
	"SendEnvelopeDescription": {
		"Name": "test",
		"EmailSubject": "Please sign the enclosed envelope",
		"EmailBody": "Dear #RecipientFirstName# #RecipientLastName#\n\n#PersonalMessage#\n\nPlease sign the envelope #EnvelopeName#\n\nEnvelope will expire at #ExpirationDate#",
		"DisplayedEmailSender": "",
		"EnableReminders": true,
		"FirstReminderDayAmount": 5,
		"RecurrentReminderDayAmount": 3,
		"BeforeExpirationDayAmount": 3,
		"DaysUntilExpire": 28,
		"CallbackUrl": "",
		"StatusUpdateCallbackUrl": "",
		"LockFormFieldsAtEnvelopeFinish": true,
		"Steps": [
			{
				"OrderIndex": 1,
				"Recipients": [
					{
						"Email": "##EMAIL##",
						"FirstName": "##NAME##",
						"LastName": "##NAME##",
						"LanguageCode": "en",
						"EmailBodyExtra": "",
						"DisableEmail": false,
						"AddAndroidAppLink": false,
						"AddIosAppLink": false,
						"AddWindowsAppLink": false,
						"AllowDelegation": true,
						"AllowAccessFinishedWorkstep": false,
						"SkipExternalDataValidation": false,
						"AuthenticationMethods": []
					}
				],
				"EmailBodyExtra": "",
				"RecipientType": "Signer",
				"DocumentOptions": [
					{
						"DocumentReference": "1",
						"IsHidden": false
					}
				],
				"UseDefaultAgreements": true
			},
			{
				"OrderIndex": 2,
				"Recipients": [
					{
						"Email": "##EMAIL##",
						"FirstName": "##NAME##",
						"LastName": "##NAME##",
						"LanguageCode": "en",
						"EmailBodyExtra": "",
						"DisableEmail": false,
						"AddAndroidAppLink": false,
						"AddIosAppLink": false,
						"AddWindowsAppLink": false,
						"AllowDelegation": false,
						"SkipExternalDataValidation": false,
						"AuthenticationMethods": []
					}
				],
				"EmailBodyExtra": "",
				"RecipientType": "Cc",
				"DocumentOptions": [],
				"UseDefaultAgreements": false
			}
		],
		"AddFormFields": {
			"Forms": {}
		},
		"OverrideFormFieldValues": {
			"Forms": {}
		},
		"AttachSignedDocumentsToEnvelopeLog": false
	},
  "CreateDraftOptions": {
    "AfterSendRedirectUrl": "string",
    "AfterSendCallbackUrl": "string",
    "RedirectPolicy": "None",
    "AllowAgentRedirect": true,
    "IframeWhiteList": "string"
  }
}

After successfully creating an envelope you get the draft id. We will need this id to send the draft as well as we need it for the GET call to receive the data of the draft.

If the create call was successful you can also see this draft in the UI like it is show in the next figure:

Image Removed

Get data of the draft

To get the data of the draft you need to run the following API call:

https://demo.esignanywhere.net/Api/v5.0/draft/{draftid}

Therefore, just replace {draftid} with your draft id and run the call. After a successful API call you should get the data of the draft like the following one:


Info

Note the following regarding AgentRedirectConfiguration:

  •  Draft/create
    • If Allow flag is set to false, Policy and IFrameAllowList should be null
  • Draft/Update
    • If Allow flag is set to false,
      • Policy and IFrameAllowList should be null
      • If it is valid, then Policy and IFrameAllowList are reset to default
Code Block
languagejava
themeEclipse
"AgentRedirectConfiguration": {
    "Policy": "Workflow",
    "Allow": false,
    "IFrameAllowList": []
  }

RedirectPolicy values:

  • "Workflow" → redirects to the create envelope page
  • "FormEditor" → redirects to the designer page
  • "Summary" → redirects to the envelope summary page

Creating a draft

Info

It is allowed to define placeholders on a template, create a draft still with unresolved placeholders using the POST v6/template/createdraft method and retrieve placeholder information from the draft using GET /v6/draft/{id}. Placeholders need to be replaced before sending the draft.

First step is to create a draft. To create one you have to run the following API call:

https://demo.esignanywhere.net/Api/v6.0/draft/create

Please note: The following configuration includes one recipient who has to sign one ClickToSign:

Code Block
languagejava
themeEclipse
{
    "Documents": [{
            "FileId": "19b7a4b4-1234-1234-1234-daa50efde453",
            "DocumentNumber": 1
        }
    ],
    "Name": "DraftCreate",
    "Activities": [{
            "Action": {
                "Sign": {
                    "RecipientConfiguration": {
                        "ContactInformation": {
                            "Email": "janedoe@sample.com",
                            "GivenName": "Jane",
                            "Surname": "Doe",
                            "LanguageCode": "EN",
                            "PhoneNumber":"+123456789"
                        }
                    },
                    
                    "Elements": {
                        "Signatures": [{
                                "TaskConfiguration": {
                                    "OrderDefinition": {
                                        "OrderIndex": 0
                                    }
                                },
                                "ElementId": "sample sig ClickToSign",
                                "Required": true,
                                "DocumentNumber": 1,
                                "DisplayName": "Sign here",
                                "AllowedSignatureTypes": {
                                    "ClickToSign": {
                                    }
                            
Code Block
languagejava
themeEclipse
{
    "Name": "test",
    "SignEmailOptions": {
        "EmailSubject": "Please sign the enclosed envelope",
        "EmailBody": "Dear #RecipientFirstName# #RecipientLastName#\n\n#PersonalMessage#\n\nPlease sign the envelope #EnvelopeName#\n\nEnvelope will expire at #ExpirationDate#",
        "DisplayedEmailSender": "demo.esignanywhere.net"
    },
    "LockAllFormFieldsOnEnvelopeFinish": true,
    "SendCopyToAllSigners": false,
    "ValidityFromCreationInDays": 0,
    "CreationDate": "2020-12-10T14:31:08.377+00:00",
    "ReminderConfiguration": {
        "Enabled": true,
        "InitialReminderInDays": 5,
        "RecurrentReminderInDays": 3,
        "LastReminderBeforeExpirationInDays": 3
    },
    "CallbackConfiguration": {
          "AfterSendCallbackUrl": "string",
        "EnvelopeFinishCallbackUrl": "",
        "StatusUpdateCallbackUrlFieldDefinition": ""{
    },
     "RedirectConfiguration": {
        "AfterSendRedirectUrl": "string"
    },
    "AgentConfiguration": {
        "LandingPagePosition": "ToRecipients",{
        "Enabled": true,
        "AllowedUrisForIframe": [
            "string"
        ]
    }"PageNumber": 1,
    "AuditLogConfiguration": {
          "EnvelopeLog": false,
        "AttachSignedDocumentsToAuditLog": false
    },
    "Documents": [
        {"X": 100,
            "Id": "##Id##",
               "OrderIndex": 1,
            "FileNameY": "Test.pdf",200
            "DocumentSizes": [
                  {
      },
              "PageNumber": 1,
                      "DocumentSizeInPointsSize": {
                        "Height": 792.0,
               "Width": 100,
        "Width": 612.0
                    }
           "Height": 70
    }
            ],
            "TextFields": [],
       }
     "RadioButtonGroups": [],
            "CheckBoxes": [],
            "ListBoxes": [], }
            "ComboBoxes": [],
               "TypeWriterAnnotations": [], }
            "Attachments": [],
            "SignatureFields": [],
            "ServiceSignatureFields": []
        },
    ],
    "Recipients": [
        {
   "SigningGroup": "firstSigner"
        "Id": "##Id##",
       }
     "OrderIndex": 1,
      }
      "Email": "##EMAIL##",  }
    ]
}

Please note that it is possible to add a default signature type for the draft (only one signature type is allowed to be set to default). See the next configuration (also available for the update craft call):

Code Block
languagejava
themeEclipse
{
        "LanguageCodeDocuments": "en",
[{
            "PlaceholderFileId": false"075f6443-9d96-43d4-9c41-6957fafa44d1",
            "AllowDelegationDocumentNumber": true,1
        }
    "Bulk": false],
        "Name": "DraftCreate",
    "ParallelActivities": false,[{
            "TypeAction": "Signer",{
                "EmailSettingsSign": {
                    "SendEmailRecipientConfiguration": true,{
                "AddAndroidAppLink": false,
        "ContactInformation": {
           "AddIosAppLink": false,
                "AddWindowsAppLinkEmail": false"jane.doe@sample.com",
                "PersonalMessage": ""
            }"GivenName": "Jane",
            "Authentication": {
                "WindowsLiveSurname": false"Doe",
                "OAuthAuthentications": [],
                "SamlAuthenticationsLanguageCode": []"EN",
            },
                "DocumentOptionsPhoneNumber": [
"+123456789"
                        {}
                    "DocumentOrderIndex": 1},
                    "Visible": true
                    "Elements": }{
            ],
            "ServiceTasksSignatures": [{
                "ApplyTimestampOnDocument": false,
                "SigningPluginServiceTasksTaskConfiguration": [],{
                "SwissComServiceRemoteSealingTasks": [],
                    "NamirialServiceRemoteSealingTasksOrderDefinition": []{
            },
            "Agreements": [
               "OrderIndex": {0
                    "Languages": [
               }
         {
                       },
     "LanguageCode": "en",
                            "TextElementId": "Signaturesample Disclosuresig TextClickToSign",
                                "HeaderRequired": "Signaturetrue,
 Disclosure Subject"
                        }
      "DocumentNumber": 1,
             ]
                }
   "DisplayName": "Sign here",
       ]
        },
        {
            "IdAllowedSignatureTypes": "##Id##",{
            "OrderIndex": 2,
            "Email": "##EMAIL##",
            "LanguageCodeClickToSign": "en",{
             "Placeholder": false,
            "AllowDelegation": false,
            "Bulk": false,
              "Parallel": false,
            "Type": "Cc",
        },
    "EmailSettings": {
                "SendEmail": true,
                "AddAndroidAppLinkDrawToSign": false,{
                "AddIosAppLink": false,
                "AddWindowsAppLink": false,
      
          "PersonalMessage": ""
            },
            "Authentication": {}
                "WindowsLive": false,
                "OAuthAuthentications": []},
                "SamlAuthentications": []
            },
            "DocumentOptions"FieldDefinition": [{
                {
                    "DocumentOrderIndexPosition": 1,{
                       "Visible": true
                  }"PageNumber": 1,
            ],
            "ServiceTasks": {
                "ApplyTimestampOnDocumentX": false100,
                "SigningPluginServiceTasks": [],
                  "SwissComServiceRemoteSealingTasks      "Y": [],
200
                   "NamirialServiceRemoteSealingTasks": []
                 },
            "Agreements": [
                        "Size": {
                    "Languages": [
                    "Width": 100,
     {
                                   "LanguageCodeHeight": "en",
70
                                    }
                                }
                            }
                               
                        ]
                    },
                     
                    "SigningGroup": "firstSigner"
                }
               
            }
        }
        
    ],
    "DefaultSignatureTypeConfiguration": {
    "ClickToSign": {
      "IsDefault": false
    },
    "DrawToSign": {
      "IsDefault": true
    },
    "TypeToSign": {
      "IsDefault": false
    },
    "LocalCertificate": {
      "IsDefault": false
    },
    "DisposableCertificate": {
      "IsDefault": false
    },
    "Biometric": {
      "IsDefault": false
    },
    "RemoteCertificate": {
      "IsDefault": false
    },
    "OneTimePassword": {
      "IsDefault": false
    }
                     }
}

After successfully creating the draft you get the draft id. We will need this id to send the draft as well as we need it for the GET call to receive the data of the draft.

If the create call was successful you can also see this draft in the UI like it is show in the next figure:

Created DraftImage Added

Get data of the draft

To get the data of the draft you need to run the following API call:

https://demo.esignanywhere.net/Api/v6.0/draft/{draftid}

Therefore, just replace {draftid} with your draft id and run the call. After a successful API call you should get the data of the draft like the following one:

Code Block
languagejava
themeEclipse
{
    "Id": "3a086823-1234-1234-1234-6af6235b528b",
    "Name": "DraftCreate",
    "Activities": [
        {
            "Id": "12f67be4-1234-1234-1234-3907f818b2ec",
            "Action": {
                "Sign": {
                    "SigningGroup": 1,
                    "ContactInformation": {
                        "Email": "janedoe@sample.com",
                        "GivenName": "Jane",
                        "Surname": "Doe",
                        "PhoneNumber": "+123456789",
                        "LanguageCode": "EN"
                    }
                }
            }
        }
    ]
}

Update a draft

Info

Even if only an empty string for e.g. "Name" is entered, the value of the draft will be adjusted. Therefore, after the update call the draft name would be "". If you do not want certain data from the draft to be changed by the update call, then do not include the value in the json structure. This keeps the value of the draft before updating it and only those declared in the json are changed.

You can change the already created draft with the update API call. For this call you have to run the following URI:

https://demo.esignanywhere.net/Api/v6.0/draft/update

The POST body contains the data of the draft to update (i.e.: the updated draft configuration). A complete configuration contains:

Code Block
languagejava
themeEclipse
{
  "DraftId": "string",
  "TextName": "Signature Disclosure Textstring",
                            "HeaderMetaData": "Signature Disclosure Subjectstring",
  "AddDocumentTimestamp": true,
                     }
   "ShareWithTeam": true,
  "LockFormFieldsOnFinish": true,
  "SendFinishedDocumentsToAllSignersAndMustView": true,
  "EmailConfiguration": {
    "Subject": "string",
    "Message": "string",
    "SenderDisplayName": "string"
  ]},
  "ReminderConfiguration": {
    "Enabled": true,
    "FirstReminderInDays": 0,
   }
    "ReminderResendIntervalInDays": 0,
    "BeforeExpirationInDays": 0
    ]},
  "ExpirationConfiguration": {
     }"ExpirationInSecondsAfterSending": 0,
    ]
}

Update a draft

You can change the already created draft with the update API call. For this call you have to run the following URI:

https://demo.esignanywhere.net/Api/v5.0/draft/update/{draftid}

Info

Please note: All available event types can be found here: Api Reference - Introduction REST

You will also need the configuration to determine which data should be changed. You can find a complete configuration below:

Code Block
languagejava
themeEclipse
{
  "MetaData"ExpirationDate": "2023-04-18T08:26:00.440Z"
  },
  "CallbackConfiguration": {
    "CallbackUrl": "string",
    "StatusUpdateCallbackUrl": "string",
    "AfterSendCallbackUrl": "string",
    "ActivityActionCallbackConfiguration": {
      "NameUrl": "string",
   "SendCopyToAllSigners   "ActionCallbackSelection": {
        "ConfirmTransactionCode": true,
  "PreventTeamSharing      "AgreementAccepted": true,
   "ReminderConfiguration": {
    "EnabledAgreementRejected": true,
        "InitialReminderInDaysPrepareAuthenticationSuccess": 0true,
        "RecurrentReminderInDaysAuthenticationFailed": 0true,
    "LastReminderBeforeExpirationInDays": 0
  },
  "RedirectConfigurationAuthenticationSuccess": {true,
    "AfterSendRedirectUrl": "string",
    "BeforeSendRedirectUrlAuditTrailRequested": "string"true,
  },
  "AuditLogConfiguration": {
    "EnvelopeLogAuditTrailXmlRequested": true,
    "AttachSignedDocumentsToAuditLog": true
  },
  "ApplyTimestampForAllRecipientsCalledPage": true,
        "LockAllFormFieldsOnEnvelopeFinishDocumentDownloaded": true,
  "CallbackConfiguration": {
      "AfterSendCallbackUrlFlattenedDocumentDownloaded": "string"true,
        "EnvelopeFinishCallbackUrlAddedAnnotation": "string"true,
        "StatusUpdateCallbackUrlAddedAttachment": "string"true,
        "WorkStepEventsAppendedDocument": {true,
        "CallbackUrlFormsFilled": "string"true,
        "ConfigurationConfirmReading": {true,
        "ConfirmTransactionCodeSendTransactionCode": true,
        "DefaultEventTypePrepareSignWorkstepDocument": true,
        "AgreementAcceptedSignWorkstepDocument": true,
        "AgreementRejectedUndoAction": true,
        "RequestPrepareAuthenticationInformationSuccessWorkstepCreated": true,
        "PrepareAuthenticationSuccessWorkstepFinished": true,
        "AuthenticationFailedWorkstepRejected": true,
        "AuthenticationRejectedDisablePolicyAndValidityChecks": true,
        "AuthenticationSuccessEnablePolicyAndValidityChecks": true,
        "ReAuthenticationFailedAppendFileToWorkstep": true,
        "AuditTrailRequestedAppendTasksToWorkstep": true,
        "AuditTrailXmlRequestedSetOptionalDocumentState": true,
        "CalledPagePreparePayloadForBatch": true,
      }
    }
  },
  "WhoIsInformationAgentRedirectConfiguration": true,{
    "Policy": "Workflow",
    "DocumentDownloadedAllow": true,
    "IFrameAllowList": [
      "FlattenedDocumentDownloadedstring": true,
    ]
  },
  "AddedAnnotationAgreementConfiguration": true,{
    "Translations": [
     "AddedAttachment": true, {
        "AppendedDocumentLanguageCode": true"AF",
        "FormsFilledText": true"string",
        "ConfirmReadingHeader": true"string",
        "PageViewChangedIsDefault": true,
        "SendTransactionCode": true,}
    ]
  },
  "PrepareSignWorkstepDocumentRedirectConfiguration": true,
    {
    "SignWorkstepDocumentAfterSendRedirectUrl": true"string",
        "UndoAction": true"BeforeSendRedirectUrl": "string"
  },
  "DefaultSignatureTypeConfiguration": {
     "WorkstepCreatedClickToSign": true,{
        "WorkstepFinishedIsDefault": true,
    },
    "WorkstepRejectedDrawToSign": true,{
        "DisablePolicyAndValidityChecksIsDefault": true,false
    },
    "EnablePolicyAndValidityChecksTypeToSign": true,{
        "AppendFileToWorkstepIsDefault": true,false
    },
    "AppendTasksToWorkstepLocalCertificate": true,{
        "SetOptionalDocumentStateIsDefault": true,false
    },
    "StartBatchDisposableCertificate": true,{
        "EndBatchIsDefault": true,false
    },
    "PreparePayloadForBatchBiometric": true{
      "IsDefault": }false
    },
  },
  "AgentConfigurationRemoteCertificate": {
      "LandingPageIsDefault": "None",false
    "Enabled": true},
    "AllowedUrisForIframeOneTimePassword": [{
      "stringIsDefault": false
    ]}
  }
}

Sending a draft

To send the draft you need to run the following API call:

https://demo.esignanywhere.net/Api/v5v6.0/draft/send/{draftidsend

Add the draftId and send the envelope:

Code Block
languagejava
themeEclipse
{
  "DraftId": "string"
}

After a successful sending of the draft, the recipients will get the envelope.