How can I merge templates and send them for signature?

You can merge multiple templates and send them out for signature as a single envelope. 

The API gets split into two:

  • Merge View
  • Merge Send
     

Merge View will retrieve a list of all the templates you want to merge and inform you whether the templates can be merged as a single envelope. You will receive the success response with all prefilled values along with the recipient's information if there is a possibility to merge the templates. This information will be used to send the document using the merge send API.

 

Sample request

Copiedcurl --location 'https://sign.zoho.com/api/v1/templates/mergeview' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Zoho-oauthtoken <oauthtoken> \
--data-urlencode 'template_ids=["<template_id_1>","<template_id_2>"]'

Sample response

Copied{
    "code": 0,
    "templates": {
        "owner_email": "john***@***.com",
        "created_time": 1702025844874,
        "document_ids": [
            {
                "document_id": "24036000000362044",
                "document_order": "0",
                "document_name": "sample"
            },
            {
                "document_id": "24036000000370001",
                "document_order": "0",
                "document_name": "sample"
            }
        ],
        "email_reminders": true,
        "notes": "",
        "reminder_period": 5,
        "document_fields": [
            {
                "document_id": "24036000000362044",
                "fields": [
                    {
                        "field_id": "24036000000363008",
                        "x_coord": 238,
                        "field_type_id": "24036000000000063",
                        "abs_height": 13,
                        "text_property": {
                            "is_italic": false,
                            "max_field_length": 255,
                            "is_underline": false,
                            "font_color": "000000",
                            "is_fixed_width": false,
                            "font_size": 11,
                            "is_fixed_height": true,
                            "is_read_only": false,
                            "is_bold": false,
                            "font": "Roboto"
                        },
                        "field_category": "textfield",
                        "field_label": "Job title",
                        "is_mandatory": true,
                        "default_value": "",
                        "page_no": 0,
                        "document_id": "24036000000362044",
                        "field_name": "Job title",
                        "y_value": 38.753468,
                        "abs_width": 98,
                        "width": 16.045444,
                        "y_coord": 307,
                        "field_type_name": "Jobtitle",
                        "description_tooltip": "",
                        "x_value": 38.87782,
                        "height": 1.617375
                    }
                ]
            },
            {
                "document_id": "24036000000370001",
                "fields": [
                    {
                        "field_id": "24036000000370020",
                        "x_coord": 426,
                        "field_type_id": "24036000000000053",
                        "abs_height": 13,
                        "text_property": {
                            "is_italic": false,
                            "max_field_length": 2048,
                            "is_underline": false,
                            "font_color": "000000",
                            "is_fixed_width": false,
                            "font_size": 11,
                            "is_fixed_height": true,
                            "is_read_only": false,
                            "is_bold": false,
                            "font": "Roboto"
                        },
                        "field_category": "textfield",
                        "field_label": "name",
                        "is_mandatory": true,
                        "default_value": "",
                        "page_no": 0,
                        "document_id": "24036000000370001",
                        "field_name": "",
                        "y_value": 9.858287,
                        "abs_width": 98,
                        "width": 16.045444,
                        "y_coord": 78,
                        "field_type_name": "Textfield",
                        "description_tooltip": "",
                        "x_value": 69.66315,
                        "height": 1.617375
                    },
                    {
                        "field_id": "24036000000370021",
                        "x_coord": 426,
                        "field_type_id": "24036000000000053",
                        "abs_height": 13,
                        "text_property": {
                            "is_italic": false,
                            "max_field_length": 2048,
                            "is_underline": false,
                            "font_color": "000000",
                            "is_fixed_width": false,
                            "font_size": 11,
                            "is_fixed_height": true,
                            "is_read_only": false,
                            "is_bold": false,
                            "font": "Roboto"
                        },
                        "field_category": "textfield",
                        "field_label": "age",
                        "is_mandatory": true,
                        "default_value": "",
                        "page_no": 0,
                        "document_id": "24036000000370001",
                        "field_name": "",
                        "y_value": 13.754543,
                        "abs_width": 98,
                        "width": 16.035856,
                        "y_coord": 109,
                        "field_type_name": "Textfield",
                        "description_tooltip": "",
                        "x_value": 69.64019,
                        "height": 1.616628
                    }
                ]
            }
        ],
        "owner_id": "24036000000026003",
        "description": "",
        "template_name": "Test forms",
        "is_deleted": false,
        "modified_time": 1702458726158,
        "expiration_days": 15,
        "is_sequential": true,
        "template_id": "24036000000362043,24036000000370015",
        "owner_first_name": "John",
        "request_type_name": "Others",
        "validity": -1,
        "actions": [
            {
                "ishost": false,
                "verify_recipient": false,
                "role": "",
                "recipient_countrycode_iso": "",
                "action_type": "SIGN",
                "private_notes": "",
                "recipient_email": "john***@***.com",
                "language": "en",
                "recipient_phonenumber": "",
                "action_id": "24036000000363002",
                "signing_order": 1,
                "fields": [
                    {
                        "field_id": "24036000000363007",
                        "x_coord": 307,
                        "field_type_id": "24036000000000047",
                        "abs_height": 65,
                        "field_category": "image",
                        "field_label": "Signature",
                        "is_mandatory": true,
                        "page_no": 0,
                        "document_id": "24036000000362044",
                        "is_draggable": false,
                        "field_name": "Signature",
                        "y_value": 9.165126,
                        "abs_width": 187,
                        "action_id": "24036000000363002",
                        "width": 30.595974,
                        "y_coord": 73,
                        "field_type_name": "Signature",
                        "description_tooltip": "",
                        "is_resizable": true,
                        "x_value": 50.22922,
                        "height": 8.240912
                    },
                    {
                        "field_id": "24036000000370019",
                        "x_coord": 435,
                        "field_type_id": "24036000000000047",
                        "abs_height": 20,
                        "field_category": "image",
                        "field_label": "Signature",
                        "is_mandatory": true,
                        "page_no": 0,
                        "document_id": "24036000000370001",
                        "is_draggable": false,
                        "field_name": "Signature",
                        "y_value": 23.952557,
                        "abs_width": 135,
                        "action_id": "24036000000370018",
                        "width": 22.025114,
                        "y_coord": 190,
                        "field_type_name": "Signature",
                        "description_tooltip": "",
                        "is_resizable": true,
                        "x_value": 71.158066,
                        "height": 2.464572
                    }
                ],
                "recipient_name": "John",
                "delivery_mode": "EMAIL",
                "recipient_countrycode": ""
            }
        ],
        "owner_last_name": "Smith",
        "request_type_id": "24036000000000187"
    },
    "message": "Template has been retrieved",
    "status": "success"
} 

The Merge Send API is used to send the merged templates out for signature. Refer to the sample payload structure, which depends on the response of the Merge View API.

Prefill Field Mapping
Text field , Dropdown fields are 'field_text_data'
checkbox/checkbox group - 'field_boolean_data'
Date field - 'field_date_data'
Radio field - 'field_radio_data'
Recipient mapping - Fill in the name, email, and phone number if authentication/SMS delivery needs to be performed.

Sample request

Copiedcurl --location 'https://sign.zoho.com/api/v1/templates/mergesend' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Zoho-oauthtoken <oauthtoken>' \
--data-urlencode 'template_ids=["<template_id_1>","<template_id_2>"]' \
--data-urlencode 'data={
    "templates": {
        "field_data": {
            "field_text_data": {
                "<field_label>": "<value>",
                "<field_label>": "<value>"
            },
            "field_boolean_data": {},
            "field_date_data": {},
            "field_radio_data": {}
        },
        "actions": [
            {
                "recipient_name": "<recipient_name>",
                "recipient_email": "<recipient_email>",
                "action_id": "<action_id>",
                "signing_order": 1,
                "role": "",
                "verify_recipient": false,
                "private_notes": ""
            }
        ],
        "notes": ""
    }
}' \
--data-urlencode 'is_quicksend=true'

Sample response

CopiedHTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
  "code": 0,
  "requests": {
    "request_status": "inprogress",
    "notes": "Hi\nA note\nMr. Tester\nHow ar eyouuu ?",
    "owner_id": "2000000002002",
    "description": "",
    "request_name": "Leave a note test",
    "modified_time": 1522746018025,
    "action_time": 1522746018310,
    "is_deleted": false,
    "expiration_days": 1,
    "is_sequential": true,
    "sign_submitted_time": 1522746018310,
    "owner_first_name": "V*******",
    "sign_percentage": 33.34,
    "expire_by": 1522866540000,
    "is_expiring": true,
    "owner_email": "v**********@***.com",
    "created_time": 1522746018025,
    "document_ids": [
      {
        "image_string": "<BASE 64 Image String>",
        "document_name": "Employee NDA.pdf",
        "pages": [
          {
            "image_string": "<BASE 64 Image String>",
            "page": 0,
            "is_thumbnail": true
          }
        ],
        "document_size": 26591,
        "document_order": "0",
        "total_pages": 2,
        "document_id": "2000000492171"
      }
    ],
    "self_sign": false,
    "in_process": false,
    "request_type_name": "Others",
    "request_id": "2000000492177",
    "request_type_id": "2000000000135",
    "owner_last_name": "",
    "actions": [
      {
        "verify_recipient": false,
        "action_id": "2000000492180",
        "action_type": "SIGN",
        "private_notes": "",
        "recipient_email": "s***********@***.com",
        "signing_order": 0,
        "fields": [
          {
            "field_id": "2000000492182",
            "field_category": "image",
            "field_label": "Signature",
            "is_mandatory": true,
            "page_no": 0,
            "document_id": "2000000492171",
            "field_name": "Signature",
            "y_coord": 3,
            "action_id": "2000000492180",
            "abs_width": 22,
            "field_type_name": "Signature",
            "description_tooltip": "",
            "x_coord": 42,
            "abs_height": 5
          },
          {
            "field_id": "2000000492183",
            "field_category": "image",
            "field_label": "Initial",
            "is_mandatory": true,
            "page_no": 0,
            "document_id": "2000000492171",
            "field_name": "Initial",
            "y_coord": 3,
            "action_id": "2000000492180",
            "abs_width": 18,
            "field_type_name": "Initial",
            "description_tooltip": "",
            "x_coord": 71,
            "abs_height": 5
          }
        ],
        "recipient_name": "s***********",
        "allow_signing": true,
        "action_status": "UNOPENED",
        "recipient_phonenumber": "",
        "recipient_countrycode": ""
      }
    ]
  },
  "status": "success"
}