Download multiple attachments as ZIP file

I want to download the multiple attachments as zip files.

I have successfully implemented a method using the fetch API to download multiple attachments as zip files. However, when attempting to replicate the same functionality using the client method, I encountered a 403 error.

Below, I am providing the code snippets.

working code with the fetch method:

var myHeaders = new Headers();
        myHeaders.append("X-Requested-With", "application/xml");
        // myHeaders.append("Access-Control-Allow-Origin", "*");

        var requestOptions = {
          method: 'GET',
          headers: myHeaders,
        const data = await fetch(`${each.attachment_url}`, requestOptions);

client code:

const data = await client.request.invokeTemplate(
          { context: { attachment_url: each.attachment_url } }


"AllDownAtt": {
        "schema": {
            "method": "GET",
            "protocol": "https",
            "host": "",
            "path": "/<%= context.attachment_url %>",
            "headers": {
                "X-Requested-With": "application/xml"

this was the error i am getting:

    "status": 403,
    "headers": {
        "server": "nginx/1.14.0 (Ubuntu)",
        "date": "Fri, 15 Mar 2024 12:03:57 GMT",
        "content-type": "text/xml",
        "content-length": "110",
        "connection": "close",
        "x-request-url": "",
        "x-cache": "Error from cloudfront",
        "via": "1.1 (CloudFront)",
        "x-amz-cf-pop": "FRA56-C2",
        "x-amz-cf-id": "eYKI6y4R-ZbAjR4wUtKNv_gjyjMqpXIrD3kVy3BkVmtluIH43d4WYA==",
        "x-final-url": "",
        "access-control-allow-origin": "*",
        "access-control-expose-headers": "server,date,content-type,content-length,connection,x-cache,via,x-amz-cf-pop,x-amz-cf-id,x-final-url,access-control-allow-origin"
    "response": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>",
    "attempts": 1,
    "errorSource": "APP"

Thanks in advance.

Hi @balanagendra,


This happens if the link stays for way too long for pdf (For this I have faced this 403 issue).

On Download, you can check for the pdf type in the download list and if so, re-fetch the link again and download.

Let me know if that works for ya!

Thank you.

is there any update team?