Before you start with this guide please also have a look at the API-Documentation and the Postman-Guide.
Table of Contents | ||||
---|---|---|---|---|
|
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.
...
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 | ||||
---|---|---|---|---|
| ||||
{ "SspFileIdsDocuments": [{ "##SSPFILE-ID##" ], "SendEnvelopeDescription": { "Name": "test", "EmailSubject": "Please sign the enclosed envelope", "EmailBodyFileId": "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:
Code Block | ||||
---|---|---|---|---|
| ||||
{ "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": [ {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": { "IdSignatures": "##Id##",[{ "OrderIndex": 1, "FileName": "Test.pdf", "DocumentSizesTaskConfiguration": [{ { "PageNumberOrderDefinition": 1, { "DocumentSizeInPoints": { "HeightOrderIndex": 792.0, "Width": 612.0 } } } }, ], "TextFields": [], "RadioButtonGroupsId": [],"sample sig click2sign", "CheckBoxes": [], "ListBoxesRequired": []true, "ComboBoxes": [], "TypeWriterAnnotationsDocumentNumber": [],1, "Attachments": [], "SignatureFieldsDisplayName": []"Sign here", "ServiceSignatureFields": [] } ], "RecipientsAllowedSignatureTypes": [{ { "Id": "##Id##", "OrderIndexClickToSign": 1,{ "Email": "##EMAIL##", "LanguageCode": "en", "Placeholder": false, } "AllowDelegation": true, "Bulk": false, }, "Parallel": false, "Type": "Signer", "EmailSettingsFieldDefinition": { "SendEmail": true, "AddAndroidAppLinkPosition": false,{ "AddIosAppLink": false, "AddWindowsAppLinkPageNumber": false1, "PersonalMessage": "" }, "X": 100, "Authentication": { "WindowsLive": false, "OAuthAuthenticationsY": [],200 "SamlAuthentications": [] }, "DocumentOptions": [ { "Size": { "DocumentOrderIndex": 1, "VisibleWidth": true 100, } ], "ServiceTasksHeight": {70 "ApplyTimestampOnDocument": false, "SigningPluginServiceTasks": [], } "SwissComServiceRemoteSealingTasks": [], } "NamirialServiceRemoteSealingTasks": [] }, "Agreements": [} { ] "Languages": [ }, { "SigningGroup": "firstSigner" } "LanguageCode": "en", } } "Text": "Signature Disclosure Text", "Header": "Signature Disclosure Subject" } ] } ] }, { "Id": "##Id##", ] } |
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:
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 | ||||
---|---|---|---|---|
| ||||
{ "Id": "3a086823-1234-1234-1234-6af6235b528b", "Name": "DraftCreate", "Activities": [ "OrderIndex": 2,{ "EmailId": "##EMAIL##12f67be4-1234-1234-1234-3907f818b2ec", "LanguageCodeAction": "en",{ "Placeholder": false, "Sign": { "AllowDelegation": false, "BulkSigningGroup": false1, "Parallel": false, "Type"ContactInformation": "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": [] } }, "DocumentOptions": [ { "DocumentOrderIndex": 1, "Visible": true } ], "ServiceTasks] } |
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 | ||||
---|---|---|---|---|
| ||||
{ "DraftId": "string", "Name": "string", "MetaData": "string", "AddDocumentTimestamp": true, "ShareWithTeam": true, "LockFormFieldsOnFinish": true, "EmailConfiguration": { "Subject": "string", "Body": "string", "SenderDisplayName": "string" }, "ReminderConfiguration": { "Enabled": true, "FirstReminderInDays": 0, "ApplyTimestampOnDocumentReminderResendIntervalInDays": false0, "BeforeExpirationInDays": 0 }, "ExpirationConfiguration": { "SigningPluginServiceTasksExpirationInSecondsAfterSending": []0, "ExpirationDate": "string" }, "CallbackConfiguration": { "SwissComServiceRemoteSealingTasksCallbackUrl": []"string", "StatusUpdateCallbackUrl": "string", "AfterSendCallbackUrl": "string", "NamirialServiceRemoteSealingTasksStepActionCallbackConfiguration": []{ "Url": "string", }, "ActionCallbackSelectionInternal": { "AgreementsConfirmTransactionCode": [true, "DefaultEventType": true, { "AgreementAccepted": true, "AgreementRejected": true, "LanguagesRequestPrepareAuthenticationInformationSuccess": [true, "PrepareAuthenticationSuccess": true, "AuthenticationFailed": true, { "AuthenticationRejected": true, "AuthenticationSuccess": true, "LanguageCodeReAuthenticationFailed": "en"true, "AuditTrailRequested": true, "AuditTrailXmlRequested": true, "TextCalledPage": "Signature Disclosure Text"true, "WhoIsInformation": true, "DocumentDownloaded": true, "HeaderFlattenedDocumentDownloaded": "Signaturetrue, Disclosure Subject" "AddedAnnotation": true, "AddedAttachment": true, } "AppendedDocument": true, "FormsFilled": true, ] "ConfirmReading": true, "PageViewChanged": true, } "SendTransactionCode": true, ] "PrepareSignWorkstepDocument": 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 | ||||
---|---|---|---|---|
| ||||
{ "MetaData": "string", "Name": "string", "SendCopyToAllSigners": true, "PreventTeamSharing "SignWorkstepDocument": true, "UndoAction": true, "WorkstepCreated": true, "WorkstepFinished": true, "WorkstepRejected": true, "DisablePolicyAndValidityChecks": true, "EnablePolicyAndValidityChecks": true, "AppendFileToWorkstep": true, "AppendTasksToWorkstep": true, "ReminderConfiguration": { "EnabledSetOptionalDocumentState": true, "InitialReminderInDays": 0, "RecurrentReminderInDaysPreparePayloadForBatch": 0,true "LastReminderBeforeExpirationInDays": 0}, }, "RedirectConfigurationActionCallbackSelection": { "AfterSendRedirectUrlConfirmTransactionCode": "string"true, "BeforeSendRedirectUrlDefaultEventType": "string" }true, "AuditLogConfiguration": { "EnvelopeLogAgreementAccepted": true, "AttachSignedDocumentsToAuditLogAgreementRejected": true, }, "ApplyTimestampForAllRecipients": true, "LockAllFormFieldsOnEnvelopeFinishRequestPrepareAuthenticationInformationSuccess": true, "CallbackConfiguration": { "AfterSendCallbackUrlPrepareAuthenticationSuccess": "string",true, "EnvelopeFinishCallbackUrlAuthenticationFailed": "string"true, "StatusUpdateCallbackUrl": "string", "WorkStepEventsAuthenticationRejected": {true, "CallbackUrlAuthenticationSuccess": "string"true, "ConfigurationReAuthenticationFailed": {true, "ConfirmTransactionCodeAuditTrailRequested": true, "DefaultEventTypeAuditTrailXmlRequested": true, "AgreementAcceptedCalledPage": true, "AgreementRejectedWhoIsInformation": true, "RequestPrepareAuthenticationInformationSuccessDocumentDownloaded": true, "PrepareAuthenticationSuccessFlattenedDocumentDownloaded": true, "AuthenticationFailedAddedAnnotation": true, "AuthenticationRejectedAddedAttachment": true, "AuthenticationSuccessAppendedDocument": true, "ReAuthenticationFailedFormsFilled": true, "AuditTrailRequestedConfirmReading": true, "AuditTrailXmlRequestedPageViewChanged": true, "CalledPageSendTransactionCode": true, "WhoIsInformationPrepareSignWorkstepDocument": true, "DocumentDownloadedSignWorkstepDocument": true, "FlattenedDocumentDownloadedUndoAction": true, "AddedAnnotationWorkstepCreated": true, "AddedAttachmentWorkstepFinished": true, "AppendedDocumentWorkstepRejected": true, "FormsFilledDisablePolicyAndValidityChecks": true, "ConfirmReadingEnablePolicyAndValidityChecks": true, "PageViewChangedAppendFileToWorkstep": true, "SendTransactionCodeAppendTasksToWorkstep": true, "PrepareSignWorkstepDocumentSetOptionalDocumentState": true, "SignWorkstepDocumentPreparePayloadForBatch": true, } "UndoAction": true } }, "AgentRedirectConfiguration": { "WorkstepCreatedPolicy": true, "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 | ||||
---|---|---|---|---|
| ||||
{ "DraftId": "string" } |
After a successful sending of the draft, the recipients will get the envelope.