404 - Mail Merge API returns 404 with working template in DriveX (Google Drive)

I’m using Aspose.Words Cloud API with storage = ‘DriveX’.

My template file (SimpleTest.docx) is in the root of the storage.
It contains: {{html#BodyContent}}

When I call:
https://api.aspose.cloud/v4.0/words/SimpleTest.docx/executeMailMerge?destFileName=GeneratedDoc.docx&storage=DriveX&folder=&withRegions=true

I get: 404 Not Found

However, Get Document for SimpleTest.docx returns 200 OK.
Auth is working, token is valid, and BodyContent is passed in the payload.

Please advise if there’s a way to validate merge fields or debug why the 404 is returned.

@StudyGap01

It seems you are encountering a 404 Not Found error when trying to execute a mail merge with your template file located in Google Drive (DriveX). Here are some steps you can take to troubleshoot and potentially resolve this issue:

  1. Check File Path and Name: Ensure that the file name SimpleTest.docx is correctly specified in your API call. The file name is case-sensitive, so make sure it matches exactly, including the file extension.

  2. Storage Parameter: Since you are using DriveX as your storage, confirm that the file is indeed in the root directory of your DriveX storage. If the file is in a subfolder, you need to specify the folder path in the API call.

  3. API Endpoint: The endpoint you are using appears to be correct for executing a mail merge. However, ensure that you are using the correct version of the API and that your request is formatted properly.

  4. Validate Merge Fields: To validate the merge fields in your document, you can use the Get All Field Names API to retrieve the fields defined in your template. This can help confirm that the field {{html#BodyContent}} is correctly recognized.

  5. Debugging: If the above steps do not resolve the issue, consider logging the full request and response details. This can provide more insight into what might be going wrong.

  6. Documentation Reference: For more detailed information on executing mail merges, you can refer to the official documentation on executing mail merges with Aspose.Words Cloud API here.

If you continue to experience issues, please provide additional details about your request, and I would be happy to assist further!

All has been checked multiple times.

Execution log

8:00:22 PM

Notice

Execution started

8:00:22 PM

Info

— convertHtmlReportsToDocx Execution Started at: 2025/06/02, 20:00:22 —

8:00:23 PM

Info

— Iteration 1: Processing “01_Report.html” —

8:00:25 PM

Info

[01_Report.html] Attempting Mail Merge: GeneratedDoc_01_Report_20250602200025.docx

8:00:25 PM

Info

:page_facing_up: Template: SimpleTest.docx

8:00:25 PM

Info

:file_folder: Folder: [root]

8:00:25 PM

Info

:package: Storage: DriveX

8:00:25 PM

Info

:mailbox_with_mail: Data Keys: DocumentName, DocumentID, BodyContent

8:00:26 PM

Info

:test_tube: Payload to Aspose: { “DocumentName”: “01 Report”, “DocumentID”: “01RE-200025”, “BodyContent”: “{\n "BodyContent": "

Executive Summary

This report outlines the findings and recommendations from our latest review.

  • Finding 1
  • Finding 2
"\n}” }

8:00:26 PM

Info

:test_tube: Final Aspose API URL: https://api.aspose.cloud/v4.0/words/SimpleTest.docx/executeMailMerge?destFileName=GeneratedDoc_01_Report_20250602200025.docx&folder=&storage=DriveX&withRegions=true

8:00:27 PM

Info

HTTP 404 - …

8:00:27 PM

Info

[01_Report.html] :x: Mail Merge failed.

8:00:27 PM

Info

:checkered_flag: HTML to DOCX Processing Complete.

8:00:27 PM

Notice

Execution completed

I will investigate this issue with storage, one more question did you try to not set folder parameter, do not leave it empty but just do not set?

Yes, the current script is already set up so that if the template is meant to be in the root of the storage (like when TEMPLATE_PATH_ASPOSE_SEES is just 'Test.docx'), the folder= parameter is not included in the API call to Aspose.

Could you try using our SDKs, which are suitable for your application platform?

"Thank you for the suggestion. I am currently using Google Apps Script, which primarily utilizes UrlFetchApp to make direct REST API calls. While I understand the benefits of SDKs, a dedicated Aspose SDK isn’t directly usable in the Apps Script environment in the same way as other platforms.

The API call my script is making is:
[Paste the exact API URL from your latest log, e.g., https://api.aspose.cloud/v4.0/words/SimpleTest.docx/executeMailMerge?destFileName=...&storage=DriveX&withRegions=true]

This call attempts to access the template 'SimpleTest.docx' from the root of my storage named 'DriveX'. My Aspose.Cloud dashboard file browser shows this file (SimpleTest.docx) existing in the root of my 'DriveX' storage.

Could you please check your server-side logs for my App SID (YOUR_ASPOSE_APP_SID_HERE) for the API call made to the URL above around [Timestamp from your log, e.g., 2025/06/02, 20:00:26]? I am still receiving an HTTP 404 error, and I need to understand why your API cannot find a file that appears to be correctly located in the specified storage via your dashboard."

Please share you client id, I will check the logs

Thank you, Yaroslav. I’ve sent you my Client ID (Aspose App SID) via private message.

Sorry I didn’t read carefully enough the url you paste, it has an error with method name, to check all the available APIs please check our Reference page, here is a link to mail merge operation Aspose.Words Cloud - API References

Thank you for the assistance, Yarosaw, the 404 error has been cleared.