...
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.
Use Case Description
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
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 | ||||
---|---|---|---|---|
| ||||
{ "Documents": [{ |
Info | |||||||||
---|---|---|---|---|---|---|---|---|---|
Note the following regarding AgentRedirectConfiguration:
RedirectPolicy values:
|
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 | ||||
---|---|---|---|---|
| ||||
{ "Documents": [{ "SignFileId": { "19b7a4b4-1234-1234-1234-daa50efde453", "RecipientConfigurationDocumentNumber": {1 } ], "Name": "DraftCreate", "ContactInformationActivities": [{ "Action": { "EmailSign": "janedoe@sample.com",{ "RecipientConfiguration": { "GivenName": "Jane", "ContactInformation": { "SurnameEmail": "Doejanedoe@sample.com", "LanguageCodeGivenName": "ENJane", "PhoneNumberSurname": "+123456789Doe", } "LanguageCode": "EN", }, "PhoneNumber":"+123456789" } "Elements": { }, "Signatures": [{ "Elements": { "Signatures": [{ "TaskConfiguration": { "OrderDefinition": { "OrderIndex": 0 } }, "IdElementId": "sample sig click2signClickToSign", "Required": true, "DocumentNumber": 1, "DisplayName": "Sign here", "AllowedSignatureTypes": { "ClickToSign": { } }, "FieldDefinition": { "Position": { "PageNumber": 1, "X": 100, "Y": 200 }, "Size": { "Width": 100, "Height": 70 } } } ] }, "SigningGroup": "firstSigner" } } } ] } |
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:
...
language | java |
---|---|
theme | Eclipse |
...
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 | ||||
---|---|---|---|---|
| ||||
{ "Documents": [{ "FileId": "075f6443-9d96-43d4-9c41-6957fafa44d1", "DocumentNumber": 1 } ], "Name": "DraftCreate", "Activities": [{ "Action": { "Sign": { "RecipientConfiguration": { "ContactInformation": { "Email": "jane.doe@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": { }, "DrawToSign": { } }, "FieldDefinition": { "Position": { "PageNumber": 1, "X": 100, "Y": 200 }, "Size": { "Width": 100, "Height": 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 } "Action": { "Sign": { "SigningGroup": 1, "ContactInformation": { "Email": "janedoe@sample.com", } } |
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 | ||||
---|---|---|---|---|
| ||||
{ "GivenNameId": "Jane3a086823-1234-1234-1234-6af6235b528b", "Name": "DraftCreate", "SurnameActivities": "Doe",[ { "PhoneNumberId": "+12345678912f67be4-1234-1234-1234-3907f818b2ec", "Action": { "LanguageCode": "EN" "Sign": { } "SigningGroup": 1, } } "ContactInformation": { } ] } |
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
The POST body contains the data of the draft to update (i.e.: the updated draft configuration). A complete configuration contains:
Code Block | ||||
---|---|---|---|---|
| ||||
{ "DraftId": "string", "Name": "string", "MetaData": "string", "AddDocumentTimestamp": true, "ShareWithTeam": true, "LockFormFieldsOnFinish": true, "EmailConfiguration": { "Email": "janedoe@sample.com", "GivenName": "Jane", "Surname": "Doe", "SubjectPhoneNumber": "string+123456789", "Body": "string", "SenderDisplayName": "string" }, "ReminderConfiguration": { "EnabledLanguageCode": true,"EN" "FirstReminderInDays": 0, "ReminderResendIntervalInDays": 0, "BeforeExpirationInDays": 0 }, "ExpirationConfiguration": { "ExpirationInSecondsAfterSending": 0, } "ExpirationDate": "string" }, "CallbackConfiguration": { } "CallbackUrl": "string", "StatusUpdateCallbackUrl": "string",} ] "AfterSendCallbackUrl": "string", "StepActionCallbackConfiguration": { "Url": "string", "ActionCallbackSelectionInternal": { "ConfirmTransactionCode": true, "DefaultEventType": true, "AgreementAccepted": true, "AgreementRejected": true, "RequestPrepareAuthenticationInformationSuccess": true, "PrepareAuthenticationSuccess": true, "AuthenticationFailed": true, "AuthenticationRejected": true, "AuthenticationSuccess": true, "ReAuthenticationFailed} |
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 | ||||
---|---|---|---|---|
| ||||
{ "DraftId": "string", "Name": "string", "MetaData": "string", "AddDocumentTimestamp": true, "ShareWithTeam": true, "AuditTrailRequestedLockFormFieldsOnFinish": true, "AuditTrailXmlRequested"SendFinishedDocumentsToAllSignersAndMustView": true, "EmailConfiguration": { "CalledPageSubject": true"string", "WhoIsInformationMessage": true"string", "SenderDisplayName": "string" "DocumentDownloaded": true}, "ReminderConfiguration": { "FlattenedDocumentDownloadedEnabled": true, "AddedAnnotationFirstReminderInDays": true0, "AddedAttachmentReminderResendIntervalInDays": true0, "BeforeExpirationInDays": 0 "AppendedDocument": true}, "ExpirationConfiguration": { "FormsFilledExpirationInSecondsAfterSending": true0, "ExpirationDate": "2023-04-18T08:26:00.440Z" "ConfirmReading": true}, "CallbackConfiguration": { "PageViewChangedCallbackUrl": true"string", "StatusUpdateCallbackUrl": "string", "SendTransactionCodeAfterSendCallbackUrl": true, "string", "PrepareSignWorkstepDocumentActivityActionCallbackConfiguration": true,{ "SignWorkstepDocumentUrl": true"string", "UndoActionActionCallbackSelection": true,{ "WorkstepCreatedConfirmTransactionCode": true, "WorkstepFinishedAgreementAccepted": true, "WorkstepRejectedAgreementRejected": true, "DisablePolicyAndValidityChecksPrepareAuthenticationSuccess": true, "EnablePolicyAndValidityChecksAuthenticationFailed": true, "AppendFileToWorkstepAuthenticationSuccess": true, "AppendTasksToWorkstepAuditTrailRequested": true, "SetOptionalDocumentStateAuditTrailXmlRequested": true, "PreparePayloadForBatchCalledPage": true, }, "ActionCallbackSelectionDocumentDownloaded": {true, "ConfirmTransactionCodeFlattenedDocumentDownloaded": true, "DefaultEventTypeAddedAnnotation": true, "AgreementAcceptedAddedAttachment": true, "AgreementRejectedAppendedDocument": true, "RequestPrepareAuthenticationInformationSuccessFormsFilled": true, "PrepareAuthenticationSuccessConfirmReading": true, "AuthenticationFailedSendTransactionCode": true, "AuthenticationRejectedPrepareSignWorkstepDocument": true, "AuthenticationSuccessSignWorkstepDocument": true, "ReAuthenticationFailedUndoAction": true, "AuditTrailRequestedWorkstepCreated": true, "AuditTrailXmlRequestedWorkstepFinished": true, "CalledPageWorkstepRejected": true, "WhoIsInformationDisablePolicyAndValidityChecks": true, "DocumentDownloadedEnablePolicyAndValidityChecks": true, "FlattenedDocumentDownloadedAppendFileToWorkstep": true, "AddedAnnotationAppendTasksToWorkstep": true, "AddedAttachmentSetOptionalDocumentState": true, "AppendedDocumentPreparePayloadForBatch": true, } "FormsFilled": true, } }, "ConfirmReadingAgentRedirectConfiguration": { true, "Policy": "Workflow", "PageViewChangedAllow": true, "IFrameAllowList": [ "SendTransactionCodestring": true, ] }, "PrepareSignWorkstepDocumentAgreementConfiguration": true, { "SignWorkstepDocumentTranslations": true,[ { "UndoAction": true, "WorkstepCreatedLanguageCode": true"AF", "WorkstepFinishedText": true"string", "WorkstepRejectedHeader": true"string", "DisablePolicyAndValidityChecksIsDefault": true, } "EnablePolicyAndValidityChecks": true, ] }, "AppendFileToWorkstepRedirectConfiguration": true,{ "AfterSendRedirectUrl": "string", "AppendTasksToWorkstepBeforeSendRedirectUrl": true"string" }, "DefaultSignatureTypeConfiguration": { "SetOptionalDocumentStateClickToSign": true,{ "PreparePayloadForBatchIsDefault": true }, } }, "AgentRedirectConfiguration"DrawToSign": { "PolicyIsDefault": "None",false "Allow": true}, "IframeWhitelistingTypeToSign": [{ "stringIsDefault": false ] }, }, "AgreementConfigurationLocalCertificate": { "UseOrganizationAgreementSettingsIsDefault": true, "Translations": [false }, { "DisposableCertificate": { "LanguageCodeIsDefault": "AF",false }, "TextBiometric": "string", { "HeaderIsDefault": "string",false }, "IsDefaultRemoteCertificate": true{ }"IsDefault": false ] }, }, "RedirectConfigurationOneTimePassword": { "AfterSendRedirectUrlIsDefault": "string",false "BeforeSendRedirectUrl": "string"} } } |
Sending a draft
To send the draft you need to run the following API call:
...