Skip to product menu
Skip to main content

Download Mail Merge

Purpose

Use the download mail merge API to download the merged document created using your mail merge template.

Request Details

Request URL

{api-domain}/crm/{version}/{module_API_name}/{record_id}/actions/download_mail_merge

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoCRM.settings.mailmerge.CREATE,ZohoWriter.documentEditor.ALL,ZohoWriter.merge.ALL

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v6/Leads/554023000003128089/actions/download_mail_merge"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@input.json"
-X POST

In the request, "@input.json" contains the sample input data. 

Input JSON
  • mail_merge_templateJSON object, mandatory
    • name string, mandatory

      The name of the mail merge template you want to use.

  • output_formatstring, optional

    The format you want for the document. This can be pdf , html or docx. The default format will be pdf.

  • file_namestring, optional

    The file name you want for the document. Default value will be "download". Maximum size for file_name is 255 characters.

  • passwordstring, optional

    The password for the document. This is applicable when the output format is pdf.

Note

  • This api can support merge processing time upto 1 minute.
  • This api consumes 5 credits. Incase of failure, it consumes 1 credit

 

Sample Input

Copied{
  "download_mail_merge": [
    {
      "mail_merge_template": {
        "name": "mailmergename"
      },
      "output_format": "pdf",
      "file_name": "testdocument",
      "password": "tester"
    }
  ]
}

Possible Errors

  • EXPECTED_FIELD_MISSINGHTTP 400

    You have not specified the name in the "mail_merge_template" key.
    Resolution: You must specify the name of the mail merge template in the "mail_merge_template" key.

  • INVALID_DATAHTTP 400
    • You have specified an incorrect name of the mail merge template.
    • You have provided an invalid output format.
    • You have provided a file_name that is more than 255 characters in length.

    Resolution: Refer to the "details" key in the response for the API name of the field that has the error in the input and correct it.

     

  • INVALID_DATAHTTP 400

    You have specified an incorrect record ID in the URL.
    Resolution: Provide the right record ID in the URL. Use the Get Records API to get the record ID.

  • .

    INVALID_MODULEHTTP 400

    The module name is invalid.
    Resolution: Use the Modules API to get the API name of the module.

  • MANDATORY_NOT_FOUNDHTTP 400

    You have not specified one or more mandatory keys in the request.
    Resolution: Refer to the Input JSON section for the list of mandatory keys.

  • INVALID_REQUEST_METHODHTTP 400

    The HTTP request method is invalid.
    Resolution: The HTTP request method for this API is POST.

  • INTERNAL_ERRORHTTP 500

    Unhandled exception in server.
    Resolution: Contact the support team at support@zohocrm.com.

  • DEPENDENT_SERVICE_ERRORHTTP 400

    Document processing time is more than 1 minute.
    Resolution: You can make changes in your template like compressing images which will reduce the file size thus making the processing time shorter.