eSignature eSignAnywhere - Use Case Example: Draft

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

The Story

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

The following steps are necessary to send a draft:

  • Prepare a draft
  • Send the draft

This case guides you through the process of creating and sending a draft via API and UI.

Integration

Please note: 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

{
	"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:

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:

{
    "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": "",
        "StatusUpdateCallbackUrl": ""
    },
    "RedirectConfiguration": {
        "AfterSendRedirectUrl": "string"
    },
    "AgentConfiguration": {
        "LandingPage": "ToRecipients",
        "Enabled": true,
        "AllowedUrisForIframe": [
            "string"
        ]
    },
    "AuditLogConfiguration": {
        "EnvelopeLog": false,
        "AttachSignedDocumentsToAuditLog": false
    },
    "Documents": [
        {
            "Id": "##Id##",
            "OrderIndex": 1,
            "FileName": "Test.pdf",
            "DocumentSizes": [
                {
                    "PageNumber": 1,
                    "DocumentSizeInPoints": {
                        "Height": 792.0,
                        "Width": 612.0
                    }
                }
            ],
            "TextFields": [],
            "RadioButtonGroups": [],
            "CheckBoxes": [],
            "ListBoxes": [],
            "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,
            "Email": "##EMAIL##",
            "LanguageCode": "en",
            "Placeholder": false,
            "AllowDelegation": false,
            "Bulk": false,
            "Parallel": false,
            "Type": "Cc",
            "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"
                        }
                    ]
                }
            ]
        }
    ]
}

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}

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

{
  "MetaData": "string",
  "Name": "string",
  "SendCopyToAllSigners": true,
  "PreventTeamSharing": true,
  "ReminderConfiguration": {
    "Enabled": true,
    "InitialReminderInDays": 0,
    "RecurrentReminderInDays": 0,
    "LastReminderBeforeExpirationInDays": 0
  },
  "RedirectConfiguration": {
    "AfterSendRedirectUrl": "string",
    "BeforeSendRedirectUrl": "string"
  },
  "AuditLogConfiguration": {
    "EnvelopeLog": true,
    "AttachSignedDocumentsToAuditLog": true
  },
  "ApplyTimestampForAllRecipients": true,
  "LockAllFormFieldsOnEnvelopeFinish": true,
  "CallbackConfiguration": {
    "AfterSendCallbackUrl": "string",
    "EnvelopeFinishCallbackUrl": "string",
    "StatusUpdateCallbackUrl": "string",
    "WorkStepEvents": {
      "CallbackUrl": "string",
      "Configuration": {
        "ConfirmTransactionCode": true,
        "DefaultEventType": true,
        "AgreementAccepted": true,
        "AgreementRejected": true,
        "RequestPrepareAuthenticationInformationSuccess": true,
        "PrepareAuthenticationSuccess": true,
        "AuthenticationFailed": true,
        "AuthenticationRejected": true,
        "AuthenticationSuccess": true,
        "ReAuthenticationFailed": true,
        "AuditTrailRequested": true,
        "AuditTrailXmlRequested": true,
        "CalledPage": true,
        "WhoIsInformation": true,
        "DocumentDownloaded": true,
        "FlattenedDocumentDownloaded": true,
        "AddedAnnotation": true,
        "AddedAttachment": true,
        "AppendedDocument": true,
        "FormsFilled": true,
        "ConfirmReading": true,
        "PageViewChanged": true,
        "SendTransactionCode": true,
        "PrepareSignWorkstepDocument": true,
        "SignWorkstepDocument": true,
        "UndoAction": true,
        "WorkstepCreated": true,
        "WorkstepFinished": true,
        "WorkstepRejected": true,
        "DisablePolicyAndValidityChecks": true,
        "EnablePolicyAndValidityChecks": true,
        "AppendFileToWorkstep": true,
        "AppendTasksToWorkstep": true,
        "SetOptionalDocumentState": true,
        "StartBatch": true,
        "EndBatch": true,
        "PreparePayloadForBatch": true
      }
    }
  },
  "AgentConfiguration": {
    "LandingPage": "None",
    "Enabled": true,
    "AllowedUrisForIframe": [
      "string"
    ]
  }
}

Sending a draft

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

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

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