Template Management

This guide shows you how to retrieve, update, and delete your templates.

Templates are a powerful tool that enable a sender to quickly create a new document package by using a previous one as a blueprint. When a package has been saved as a template, it can be used as an archetype for any subsequently created package.

The Code

If you don’t know how to create a template, you can follow this feature guide.

Retrieving templates is done with the OneSpan Sign PackageService() and are returned to you as a Page object.

int i = 1;
ArrayList<String> templateIds = new ArrayList<String>();
		
Page<DocumentPackage> templates = eslClient.getPackageService().getTemplates(new PageRequest(i ,50));
		
for (DocumentPackage template : templates) {
	System.out.println(String.format("Template name: %s with id %s", template.getName(), template.getId()));
	templateIds.add(template.getId().toString());
}

To update a template, you first need to create a new PackageId object using the template id. Then, you can retrieve your template using this PackageId object and change any settings you wish. Once you’ve made the necessary changes, you use the TemplateService() to update your template.

PackageId templateId = new PackageId(templateIds.get(0));
		
DocumentPackage templateToUpdate = eslClient.getPackage(templateId);
		
templateToUpdate.setName("This template has been updated");
		
eslClient.getTemplateService().updateTemplate(templateToUpdate);

Finally, to delete a template, you use the PackageService().

eslClient.getPackageService().deletePackage(templateId);

Get the Code

Templates are a powerful tool that enable a sender to quickly create a new document package by using a previous one as a blueprint. When a package has been saved as a template, it can be used as an archetype for any subsequently created package.

The Code

If you don’t know how to create a template, you can follow this feature guide.

Retrieving templates is done with the OneSpan Sign PackageService() and are returned to you as a Page object.

int i = 1;
ArrayList templateIds = new ArrayList();

Page<DocumentPackage> templates = eslClient.PackageService.GetTemplates(new PageRequest(i, 50));

foreach (DocumentPackage template in templates)
{
      Debug.WriteLine(string.Format("Template name: {0} with id {1}", template.Name, template.Id));
      templateIds.Add(template.Id.ToString());
}

To update a template, you first need to create a new PackageId object using the template id. Then, you can retrieve your template using this PackageId object and change any settings you wish. Once you’ve made the necessary changes, you use the TemplateService() to update your template.

PackageId templateId = new PackageId(templateIds[0].ToString());

DocumentPackage templateToUpdate = eslClient.GetPackage(templateId);

templateToUpdate.Name = "This template has been updated";

eslClient.TemplateService.Update(templateToUpdate);

Finally, to delete a template, you use the PackageService().

eslClient.PackageService.DeletePackage(templateId);

Get the Code

Templates are a powerful tool that enable a sender to quickly create a new document package by using a previous one as a blueprint. When a package has been saved as a template, it can be used as an archetype for any subsequently created package.

The Code

If you don’t know how to create a template, you can follow this feature guide.

You can retrieve your templates like so:

HTTP Request
GET /api/packages?type=TEMPLATE&from=0&to=100

HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key

Response Payload

{
    "results": [
        {
            "roles": [
                {
                    "id": "a32f8b14-2771-4000-9ab6-19b8e9aae4bc",
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "data": null,
                    "index": 2,
                    "type": "SIGNER",
                    "signers": [],
                    "name": "Placeholder2"
                },
                {
                    "id": "fad2c2d5-d75c-4bac-8707-3d9a555b8a07",
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "data": null,
                    "index": 1,
                    "type": "SIGNER",
                    "signers": [],
                    "name": "Placeholder1"
                },
                {
                    "id": "YV68HNuhshUS",
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "data": null,
                    "index": 0,
                    "type": "SENDER",
                    "signers": [
                        {
                            "group": null,
                            "language": "en",
                            "signature": {
                                "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
                                "textual": null
                            },
                            "id": "ZQI8k6faVoM8",
                            "address": null,
                            "created": "2017-11-01T14:54:52Z",
                            "title": null,
                            "external": null,
                            "updated": "2017-11-01T14:54:52Z",
                            "phone": "",
                            "userCustomFields": [],
                            "company": "eSignLive",
                            "email": "haris.haidary@gmail.com",
                            "firstName": "Haris",
                            "lastName": "Haidary",
                            "professionalIdentityFields": [],
                            "data": null,
                            "auth": {
                                "scheme": "NONE",
                                "challenges": []
                            },
                            "knowledgeBasedAuthentication": null,
                            "delivery": {
                                "email": true,
                                "download": true,
                                "provider": false
                            },
                            "name": "",
                            "specialTypes": []
                        }
                    ],
                    "name": "Owner"
                }
            ],
            "status": "DRAFT",
            "description": "",
            "language": "en",
            "id": "9VFZTf0vgi2rGEGHTozxZAXlm28=",
            "created": "2017-11-01T14:54:52Z",
            "autocomplete": true,
            "sender": {
                "status": "ACTIVE",
                "language": "en",
                "signature": {
                    "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
                    "textual": null
                },
                "id": "ZQI8k6faVoM8",
                "address": {
                    "zipcode": "",
                    "address1": "",
                    "address2": "",
                    "city": "",
                    "country": "",
                    "state": ""
                },
                "created": "2016-05-05T19:30:13Z",
                "title": null,
                "external": null,
                "updated": "2016-05-05T19:30:13Z",
                "memberships": [],
                "phone": "+1 201-555-5555",
                "userCustomFields": [
                    {
                        "id": "policy_number_id",
                        "translations": [
                            {
                                "description": "Car Insurance Policy Number.",
                                "language": "en",
                                "id": "",
                                "data": null,
                                "name": "Policy Number"
                            }
                        ],
                        "data": null,
                        "value": "",
                        "name": ""
                    }
                ],
                "locked": null,
                "activated": null,
                "company": "eSignLive",
                "email": "haris.haidary@gmail.com",
                "firstName": "Haris",
                "lastName": "Haidary",
                "professionalIdentityFields": [],
                "account": {
                    "owner": "ZQI8k6faVoM8",
                    "id": "3vD0Dc9Fh7wQ",
                    "created": "2016-05-05T19:30:13Z",
                    "providers": null,
                    "updated": "2016-05-05T19:30:13Z",
                    "company": {
                        "id": "jVWmyg4cyis8",
                        "address": {
                            "zipcode": null,
                            "address1": null,
                            "address2": null,
                            "city": null,
                            "country": null,
                            "state": null
                        },
                        "data": null,
                        "name": "eSignLive"
                    },
                    "customFields": [
                        {
                            "required": false,
                            "id": "policy_number_id",
                            "translations": [
                                {
                                    "description": "Car Insurance Policy Number.",
                                    "language": "en",
                                    "id": "",
                                    "data": null,
                                    "name": "Policy Number"
                                }
                            ],
                            "data": null,
                            "value": "123-456-789-0",
                            "name": ""
                        }
                    ],
                    "licenses": [
                        {
                            "status": "ACTIVE",
                            "created": "2016-05-05T19:30:13Z",
                            "paidUntil": "2020-05-05T00:00:00Z",
                            "transactions": [],
                            "plan": {
                                "group": "",
                                "description": "E-Sign Hundreds of Documents with Unlimited Signers",
                                "id": "sandbox",
                                "features": null,
                                "cycle": "YEAR",
                                "contract": "YEAR",
                                "freeCycles": null,
                                "quotas": [
                                    {
                                        "scope": "ACCOUNT",
                                        "cycle": null,
                                        "limit": 100,
                                        "target": "SENDER"
                                    },
                                    {
                                        "scope": "SENDER",
                                        "cycle": null,
                                        "limit": 500,
                                        "target": "DOCUMENT"
                                    },
                                    {
                                        "scope": "SENDER",
                                        "cycle": null,
                                        "limit": 500,
                                        "target": "STORAGE"
                                    }
                                ],
                                "original": null,
                                "data": null,
                                "price": {
                                    "amount": 0,
                                    "currency": {
                                        "id": "USD",
                                        "data": null,
                                        "name": "US Dollar"
                                    }
                                },
                                "name": "Sandbox"
                            }
                        }
                    ],
                    "logoUrl": "",
                    "data": null,
                    "name": "Haris Haidary"
                },
                "data": {
                    "serviceCredentials": "{}",
                    "showIntro": false
                },
                "type": "MANAGER",
                "name": "",
                "specialTypes": [],
                "hasDelegates": false
            },
            "documents": [
                {
                    "status": "",
                    "description": "",
                    "id": "b1bcf8fb96e7663fcf8d79b3d36ab03a409ffb5ac183ced6",
                    "approvals": [
                        {
                            "role": "a32f8b14-2771-4000-9ab6-19b8e9aae4bc",
                            "id": "f3L60CQtJ4w4",
                            "signed": null,
                            "accepted": null,
                            "data": null,
                            "fields": [
                                {
                                    "binding": null,
                                    "validation": null,
                                    "id": "FT055fW0IMEM",
                                    "page": 0,
                                    "subtype": "FULLNAME",
                                    "height": 52.0252180917263,
                                    "extract": false,
                                    "width": 234.98929138064383,
                                    "extractAnchor": null,
                                    "left": 241.80519113063812,
                                    "top": 605.0225778079033,
                                    "data": null,
                                    "type": "SIGNATURE",
                                    "value": "",
                                    "name": ""
                                }
                            ],
                            "name": ""
                        },
                        {
                            "role": "fad2c2d5-d75c-4bac-8707-3d9a555b8a07",
                            "id": "mEZ3ZWiNBYkE",
                            "signed": null,
                            "accepted": null,
                            "data": null,
                            "fields": [
                                {
                                    "binding": null,
                                    "validation": null,
                                    "id": "MGG8WGRTIEoJ",
                                    "page": 0,
                                    "subtype": "FULLNAME",
                                    "height": 51.99999809265137,
                                    "extract": false,
                                    "width": 234.9996913802624,
                                    "extractAnchor": null,
                                    "left": 221.99969185709955,
                                    "top": 514.000481146574,
                                    "data": null,
                                    "type": "SIGNATURE",
                                    "value": "",
                                    "name": ""
                                }
                            ],
                            "name": ""
                        }
                    ],
                    "pages": [
                        {
                            "id": "53659ae7eb53699b0e6027311a5b9db435984e896e1306cf_0_-1_1.png",
                            "height": 1030,
                            "left": 0,
                            "width": 796,
                            "top": 0,
                            "index": 0,
                            "version": 0
                        }
                    ],
                    "external": null,
                    "extract": false,
                    "data": {},
                    "signedHash": null,
                    "extractionTypes": [],
                    "signerVerificationToken": null,
                    "fields": [],
                    "index": 0,
                    "name": "sample_contract",
                    "size": 97332
                }
            ],
            "consent": null,
            "due": null,
            "emailMessage": "",
            "limits": null,
            "notarized": false,
            "settings": {
                "ceremony": {
                    "layout": {
                        "header": {
                            "feedback": true,
                            "breadcrumbs": true,
                            "globalActions": {
                                "confirm": true,
                                "download": true,
                                "hideEvidenceSummary": true,
                                "saveAsLayout": true
                            },
                            "globalNavigation": true,
                            "titleBar": null,
                            "sessionBar": true
                        },
                        "brandingBar": {
                            "logo": {
                                "link": "",
                                "src": "branding"
                            }
                        },
                        "iframe": false,
                        "footer": null,
                        "navigator": true
                    },
                    "inPerson": false,
                    "declineButton": true,
                    "declineReasons": [],
                    "disableDeclineOther": false,
                    "disableDownloadForUncompletedPackage": false,
                    "disableFirstInPersonAffidavit": false,
                    "disableInPersonAffidavit": false,
                    "disableOptOutOther": false,
                    "disableSecondInPersonAffidavit": false,
                    "documentToolbarOptions": null,
                    "events": {
                        "complete": {
                            "dialog": true,
                            "redirect": null
                        }
                    },
                    "handOver": null,
                    "hideCaptureText": false,
                    "hideLanguageDropdown": false,
                    "hidePackageOwnerInPerson": false,
                    "hideWatermark": false,
                    "maxAuthFailsAllowed": 3,
                    "optOutButton": true,
                    "optOutReasons": [],
                    "extractAcroFields": false,
                    "extractTextTags": false,
                    "style": null,
                    "enforceCaptureSignature": false
                }
            },
            "signedDocumentDelivery": null,
            "updated": "2017-11-01T14:55:35Z",
            "visibility": "SENDER",
            "data": {
                "senderVisible": false
            },
            "messages": [],
            "type": "TEMPLATE",
            "name": "Signing Order Sender",
            "notaryRoleId": null,
            "bulkSendable": true
        }
    ],
    "count": 11
}

To update a template, you first need to retrieve your template id. Then, you build your JSON payload with the parameters you wish to modify.

HTTP Request
PUT /api/packages/{templateId}

HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key

Request Payload

{
   "name": "Updating template name"
}

Finally, to delete a template, you make a DELETE request to:

HTTP Request
DELETE /api/packages/{templateId}

HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key

Get the Code

JSON Properties

Property Type Editable Required Default Sample Value(s)
status string Yes No DRAFT DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED
autoComplete boolean Yes No true true / false
type string Yes No PACKAGE PACKAGE / TEMPLATE / LAYOUT
name string Yes Yes n/a Document Attributes Example
trashed boolean Yes No false true / false
visibility string Yes No ACCOUNT ACCOUNT / SENDER
documents
name string Yes No n/a sample doc
approvals
fields
subtype string Yes No n/a FULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST
type string Yes No n/a SIGNATURE / INPUT
extract boolean Yes No false true / false
height integer Yes No 50 50 / 100 / 150 …
left integer Yes No 0 50 / 100 / 150 …
page integer Yes No 0 0 / 1 / 2 …
top integer Yes No 0 50 / 100 / 150 …
width integer Yes No 200 50 / 100 / 150 …
role string Yes No n/a Client1
data
Department string Yes No n/a 1806
Employee string Yes No n/a 135526
roles
id string Yes No n/a Client1
name string Yes No n/a Client1
type string Yes No SIGNER SIGNER / SENDER
signers
email string Yes Yes n/a preparer.email@example.com
firstName string Yes Yes n/a John
lastName string Yes Yes n/a Smith
phone string Yes No n/a 514-555-8888
id string Yes No n/a Client1
company string Yes No n/a Acme Inc.
title string Yes No n/a Managing Director