---
title: ZIP
url: https://www.tines.com/docs/formulas/functions/zip/
kind: formula-function
---

*[tines.com](https://www.tines.com/llms.txt) › [Docs](https://www.tines.com/docs/llms.txt) › [Formulas](https://www.tines.com/llm/docs/formulas.md) › [Functions](https://www.tines.com/llm/docs/formulas/functions.md)*

# ZIP

*[View on tines.com](https://www.tines.com/docs/formulas/functions/zip/)*

Creates a ZIP archive containing a given file or files.

If the optional password parameter is present then the archive will be password protected. 

 The function can also accept an array of file objects as its first argument. The file object must contain either contents or base64encoded contents, a file name and optionally can specify the created_at date in ISO8601 format. 

 If the output of the ZIP function is being included in event data, it should be wrapped in the BASE64_ENCODE function to avoid errors - e.g. `BASE64_ENCODE(ZIP(my_action))`.

**Categories:** Data Parsing/Conversion

## Syntax

```
ZIP(fileContentsOrFilesArray, [filename], [password])
```

## Examples

### Example 1

Formula:

```
ZIP(file_contents, "file_name", "optional_password")
```

### Example 2

Formula:

```
ZIP(file_contents_1, "file_name_1", file_contents_2, "file_name_2", "optional_password")
```

### Example 3

Input:

```json
{
  "zip_files": [
    {
      "contents": "file_contents1",
      "created_at": "2023-01-11T15:06:18+00:00",
      "name": "file1.txt"
    },
    {
      "base64encodedcontents": "ZmlsZV9jb250ZW50czI=",
      "created_at": "2023-01-11T16:06:18+00:00",
      "name": "file2.txt"
    }
  ]
}
```

Formula:

```
ZIP(zip_files, "optional_password")
```

## Sample actions

### Sample action 1

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "New Page",
      "description": null,
      "options": {
        "fields": "",
        "mode": "success_page",
        "submissionMessage": "Thank you for your submission",
        "visibility": "tenant",
        "page_logo": {
          "contents": "iVBORw0KGgoAAAANSUhEUgAAAFQAAAAYCAYAAABk8drWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAARCSURBVHgB7VhLctpAEB1k7LVyA/kEgRMEn8BQ5e8qcALjE1icAPsEkJW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hH0jyQK6Tt4kG+7eMtmMIAasLj6ELULqtsfw8oJ1jdA+YGjgLYvvPCcoR84Yc63+UWiIxucf78HiSsuUZFvLTpgF73rzSAI3FMS0MnQJtUCSmD/KdwvdGFfyygnb5NZIBGI8ShzTpwnzUcpaWU2oh1p8ytOVmDIsxIlImOkB0w/9AGFDFhaabJhCmcNlH0zgYoGxXHKxHW451LSF86vXQPdQ6sYqy7BmhYlofs7NPpImaZumR5y3jzVvsFLI0nW6ko9WRG6oaVg0v/nA0JCwjHhx1aktw3jGA+yF8dykr2ZisRVsZLg4XpIcSGWOG+b5ilagQIECBZLxG5sJ41WbSDouAAAAAElFTkSuQmCC\n",
          "display": false,
          "name": "nites.jpeg",
          "type": "image/jpeg"
        },
        "page_width": "small",
        "pages_action_color": "#777FFF",
        "pages_appearance_mode": "light",
        "pages_background_color": "#F9F9F9"
      },
      "position": {
        "x": 1785,
        "y": 5685
      },
      "type": "form",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": {
        "fields": [
          {
            "content": null,
            "defaultValue": null,
            "description": "",
            "maxCharacters": null,
            "multiSelect": false,
            "name": "File upload 1",
            "options": [
              "Option 1",
              "Option 2"
            ],
            "required": false,
            "type": "FILE_UPLOAD",
            "validationPattern": null
          },
          {
            "content": "Submit",
            "defaultValue": null,
            "description": "",
            "maxCharacters": null,
            "multiSelect": false,
            "name": "Button",
            "options": [
              "Option 1",
              "Option 2"
            ],
            "required": false,
            "type": "BUTTON",
            "validationPattern": null
          }
        ]
      }
    },
    {
      "disabled": false,
      "name": "ZIP",
      "description": "",
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "zip": "=BASE64_ENCODE(ZIP(BASE64_DECODE(new_page.body.file_upload_1.contents)))"
        }
      },
      "position": {
        "x": 1785,
        "y": 5985
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```

### Sample action 2

```json
{
  "standardLibVersion": "14",
  "actionRuntimeVersion": "3",
  "agents": [
    {
      "disabled": false,
      "name": "My Action",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": [
          {
            "contents": "file_contents1",
            "name": "file1.txt",
            "created_at": "2023-01-11T15:06:18+00:00"
          },
          {
            "base64encodedcontents": "ZmlsZV9jb250ZW50czI=",
            "name": "file2.txt",
            "created_at": "2023-01-11T16:06:18+00:00"
          }
        ]
      },
      "position": {
        "x": 2100,
        "y": 5880
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    },
    {
      "disabled": false,
      "name": "ZIP",
      "description": null,
      "options": {
        "mode": "message_only",
        "loop": false,
        "payload": {
          "zip": "=BASE64_ENCODE(ZIP(my_action))"
        }
      },
      "position": {
        "x": 2100,
        "y": 5985
      },
      "type": "eventTransformation",
      "timeSavedUnit": "minutes",
      "timeSavedValue": 0,
      "monitorAllEvents": false,
      "monitorFailures": false,
      "monitorNoEventsEmitted": null,
      "form": null
    }
  ],
  "links": [
    {
      "sourceIdentifier": 0,
      "receiverIdentifier": 1
    }
  ],
  "diagramNotes": []
}
```
