Versions Compared

Key

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

Before you start with this guide please also have a look at the API-Documentation and the Postman-Guide.

Table of Contents
maxLevel4
stylecircle

The Story Image Modified

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.

...

Info

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

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/v5v6.0/draft/create

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

Code Block
languagejava
Code Block
languagejava
themeEclipse
{
	"SspFileIds    "Documents": [
		"##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:

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#",
{
            "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
                                    }
                                },
                                "Id": "sample sig click2sign",
                                "Required": true,
                                "DocumentNumber": 1,
                                "DisplayName": "Sign here",
                                "AllowedSignatureTypes": {
                                    "ClickToSign": {
                                    }
                                },
                                "DisplayedEmailSenderFieldDefinition": "demo.esignanywhere.net"{
    },
    "LockAllFormFieldsOnEnvelopeFinish": true,
    "SendCopyToAllSigners": false,
    "ValidityFromCreationInDays": 0,
    "CreationDate": "2020-12-10T14:31:08.377+00:00",
    "ReminderConfiguration": {
        "EnabledPosition": true,{
        "InitialReminderInDays": 5,
          "RecurrentReminderInDays": 3,
        "LastReminderBeforeExpirationInDays": 3
         },
    "CallbackConfigurationPageNumber": {1,
        "AfterSendCallbackUrl": "string",
        "EnvelopeFinishCallbackUrl": "",
        "StatusUpdateCallbackUrl": ""
    },
    "RedirectConfiguration": {
        "AfterSendRedirectUrlX": "string"100,
    },
    "AgentConfiguration": {
        "LandingPage": "ToRecipients",
              "Enabled": true,
        "AllowedUrisForIframeY": [200
            "string"
        ]
    },
    "AuditLogConfiguration": {
        "EnvelopeLog": false},
        "AttachSignedDocumentsToAuditLog": false
    },
    "Documents": [
        {
            "IdSize": "##Id##",{
            "OrderIndex": 1,
               "FileName": "Test.pdf",
            "DocumentSizesWidth": [100,
                {
                        "PageNumberHeight": 1,70
                    "DocumentSizeInPoints": {
                }
              "Height": 792.0,
                 }
       "Width": 612.0
                    }
                }
            ],
            "TextFields": [],
            "RadioButtonGroups": []},
            "CheckBoxes": [],
            "ListBoxesSigningGroup": [],"firstSigner"
            "ComboBoxes": [],    }
            "TypeWriterAnnotations": [],}
        }
    "Attachments": [],
            "SignatureFields": [],
            "ServiceSignatureFields": []
        }
    ],
    "Recipients": [
        {
            "Id": "##Id##",
            "OrderIndex": 1,
            "Email": "##EMAIL##",
            "LanguageCode": "en",
            "Placeholder": false,
            "AllowDelegation": true,
            "Bulk": false,
            "Parallel": false,
            "Type": "Signer",
            "EmailSettings": {
                "SendEmail": true,
                "AddAndroidAppLink": false,
                "AddIosAppLink": false,
                "AddWindowsAppLink": false,
                "PersonalMessage": ""
            },
            "Authentication": {
                "WindowsLive": false,
                "OAuthAuthentications": [],
                "SamlAuthentications": []
            },
            "DocumentOptions": [
                {
                    "DocumentOrderIndex": 1,
                    "Visible": true
                }
            ],
            "ServiceTasks": {
                "ApplyTimestampOnDocument": false,
                "SigningPluginServiceTasks": [],
                "SwissComServiceRemoteSealingTasks": [],
                "NamirialServiceRemoteSealingTasks": []
            },
            "Agreements": [
                {
                    "Languages": [
                        {
                            "LanguageCode": "en",
                            "Text": "Signature Disclosure Text",
                            "Header": "Signature Disclosure Subject"
                        }
                    ]
                }
            ]
        },
        {
            "Id": "##Id##",
            "OrderIndex": 2,}

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:

Image 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": [
        {
            "EmailId": "##EMAIL##12f67be4-1234-1234-1234-3907f818b2ec",
            "LanguageCodeAction": "en",
{
                "PlaceholderSign": false,{
            "AllowDelegation": false,
            "BulkSigningGroup": false1,
            "Parallel": false,
            "TypeContactInformation": "Cc",
{
              "EmailSettings": {
          "Email": "janedoe@sample.com",
       "SendEmail": true,
                "AddAndroidAppLinkGivenName": false"Jane",
                "AddIosAppLink": false,
       "Surname": "Doe",
        "AddWindowsAppLink": false,
                "PersonalMessagePhoneNumber": "+123456789",
            },
            "AuthenticationLanguageCode": {"EN"
                "WindowsLive": false,
     }
           "OAuthAuthentications": [],
     }
           "SamlAuthentications": [] }
        }
    ]
}

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/v6.0/draft/update

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

Code Block
languagejava
themeEclipse
{
  "DraftId": "string",
  "Name": "string",
  "MetaData": "string",
  "AddDocumentTimestamp": true,
  "ShareWithTeam": true,
  "LockFormFieldsOnFinish": true,
  "EmailConfiguration},
            "DocumentOptions": [
                {
                    "DocumentOrderIndex": 1,
                    "Visible": true
                }
            ],
            "ServiceTasks": {
            "Subject": "string",
    "ApplyTimestampOnDocumentBody": false"string",
    "SenderDisplayName": "string"
  },
     "ReminderConfiguration": {
    "SigningPluginServiceTasksEnabled": []true,
    "FirstReminderInDays": 0,
    "ReminderResendIntervalInDays": 0,
      "SwissComServiceRemoteSealingTasksBeforeExpirationInDays": [] 0
  },
  "ExpirationConfiguration": {
    "ExpirationInSecondsAfterSending": 0,
    "ExpirationDate": "string"
  },
  "NamirialServiceRemoteSealingTasksCallbackConfiguration": []{
       "CallbackUrl": "string",
     }"StatusUpdateCallbackUrl": "string",
       "AfterSendCallbackUrl": "string",
     "AgreementsStepActionCallbackConfiguration": [{
      "Url": "string",
      "ActionCallbackSelectionInternal":   {
        "ConfirmTransactionCode": true,
           "LanguagesDefaultEventType": [true,
        "AgreementAccepted": true,
        "AgreementRejected": true,
         {"RequestPrepareAuthenticationInformationSuccess": true,
        "PrepareAuthenticationSuccess": true,
        "AuthenticationFailed": true,
          "LanguageCodeAuthenticationRejected": "en"true,
        "AuthenticationSuccess": true,
           "ReAuthenticationFailed": true,
        "TextAuditTrailRequested": "Signature Disclosure Text"true,
        "AuditTrailXmlRequested": true,
           "CalledPage": true,
        "HeaderWhoIsInformation": "Signature Disclosure Subject"true,
        "DocumentDownloaded": true,
               }"FlattenedDocumentDownloaded": true,
        "AddedAnnotation": true,
        "AddedAttachment": true,
  ]
      "AppendedDocument": true,
         }"FormsFilled": true,
            ]"ConfirmReading": true,
        }
    ]
}

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": "string",
  "Name": "string",
  "SendCopyToAllSigners"PageViewChanged": true,
        "SendTransactionCode": true,
        "PrepareSignWorkstepDocument": true,
        "SignWorkstepDocument": true,
        "UndoAction": true,
        "WorkstepCreated": true,
        "PreventTeamSharingWorkstepFinished": true,
        "ReminderConfigurationWorkstepRejected": {true,
        "EnabledDisablePolicyAndValidityChecks": true,
        "InitialReminderInDaysEnablePolicyAndValidityChecks": 0true,
        "RecurrentReminderInDaysAppendFileToWorkstep": 0true,
        "LastReminderBeforeExpirationInDaysAppendTasksToWorkstep": 0true,
  },
  "RedirectConfiguration": {
    "AfterSendRedirectUrlSetOptionalDocumentState": "string"true,
        "BeforeSendRedirectUrlPreparePayloadForBatch": "string"true
      },
      "AuditLogConfigurationActionCallbackSelection": {
        "EnvelopeLogConfirmTransactionCode": true,
        "AttachSignedDocumentsToAuditLogDefaultEventType": true,
  },
   "ApplyTimestampForAllRecipients": true,
  "LockAllFormFieldsOnEnvelopeFinishAgreementAccepted": true,
  "CallbackConfiguration": {
      "AfterSendCallbackUrlAgreementRejected": "string"true,
        "EnvelopeFinishCallbackUrlRequestPrepareAuthenticationInformationSuccess": "string"true,
        "StatusUpdateCallbackUrlPrepareAuthenticationSuccess": "string"true,
        "WorkStepEventsAuthenticationFailed": {true,
        "CallbackUrlAuthenticationRejected": "string"true,
        "ConfigurationAuthenticationSuccess": {true,
        "ConfirmTransactionCodeReAuthenticationFailed": true,
        "DefaultEventTypeAuditTrailRequested": true,
        "AgreementAcceptedAuditTrailXmlRequested": true,
        "AgreementRejectedCalledPage": true,
        "RequestPrepareAuthenticationInformationSuccessWhoIsInformation": true,
        "PrepareAuthenticationSuccessDocumentDownloaded": true,
        "AuthenticationFailedFlattenedDocumentDownloaded": true,
        "AuthenticationRejectedAddedAnnotation": true,
        "AuthenticationSuccessAddedAttachment": true,
        "ReAuthenticationFailedAppendedDocument": true,
        "AuditTrailRequestedFormsFilled": true,
        "AuditTrailXmlRequestedConfirmReading": true,
        "CalledPagePageViewChanged": true,
        "WhoIsInformationSendTransactionCode": true,
        "DocumentDownloadedPrepareSignWorkstepDocument": true,
        "FlattenedDocumentDownloadedSignWorkstepDocument": true,
        "AddedAnnotationUndoAction": true,
        "AddedAttachmentWorkstepCreated": true,
        "AppendedDocumentWorkstepFinished": true,
        "FormsFilledWorkstepRejected": true,
        "ConfirmReadingDisablePolicyAndValidityChecks": true,
        "PageViewChangedEnablePolicyAndValidityChecks": true,
        "SendTransactionCodeAppendFileToWorkstep": true,
        "PrepareSignWorkstepDocumentAppendTasksToWorkstep": true,
        "SignWorkstepDocumentSetOptionalDocumentState": true,
        "UndoActionPreparePayloadForBatch": true,
      }
    "WorkstepCreated}
  },
  "AgentRedirectConfiguration": true,{
    "Policy": "None",
    "WorkstepFinishedAllow": true,
        "WorkstepRejectedIframeWhitelisting": true,[
        "DisablePolicyAndValidityChecksstring": true,
    ]
  },
  "EnablePolicyAndValidityChecksAgreementConfiguration": true,{
        "AppendFileToWorkstepUseOrganizationAgreementSettings": true,
    "Translations": [
   "AppendTasksToWorkstep": true,   {
        "SetOptionalDocumentStateLanguageCode": true"AF",
        "StartBatchText": true"string",
        "EndBatchHeader": true"string",
        "PreparePayloadForBatchIsDefault": true
      }
    }]
  },
  "AgentConfigurationRedirectConfiguration": {
    "LandingPageAfterSendRedirectUrl": "Nonestring",
    "Enabled": true,
    "AllowedUrisForIframe": [
      BeforeSendRedirectUrl": "string"
    ]
  }
}

Sending a draft

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

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

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.