> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform-resources/skill-library/document-skills/document-to-zip.md).

# Document To Zip

**Document To Zip** combines one or more documents into a single ZIP archive, so downstream steps — and the people at the end of them — deal with one file instead of many.

## How it works

1. **Input resolution** — uses `$input` (the previous skill's output) and `$secret` (vault secrets).
2. **Processing:**
   * Resolves each `documentId` in the `documents` list.
   * Fetches binary content from the declared `source` (`conversation` or `storage`).
   * Streams files into an in-memory ZIP buffer, or a temp file if the bundle exceeds 50 MB.
   * Uploads the archive to the selected `outputStorage` target.
   * Emits a new `zipDocumentId`.
3. **Execution** — hybrid. Small bundles run blocking; large bundles switch to async automatically. There is no threshold control in the configuration.
4. **Response:**
   * **Success** — metadata for the new ZIP.
   * **Failure** — `statusCode >= 400` with a `reason` naming the first failing document.

<figure><img src="/files/eM1qjPCB89Q7HRM4xkEX" alt="" width="563"><figcaption><p>Document To Zip processing flow</p></figcaption></figure>

{% hint style="warning" %}
**Partial bundles are discarded.** If any document fails, you get no archive at all — not an archive missing a file. That is the right behavior when the ZIP is a legal or underwriting package, but it means one bad `documentId` costs the whole bundle.
{% endhint %}

## Worked example: packaging a loan application for an underwriter

A workflow collects everything a loan application needs — the form, the credit report, income statements, ID proofs. Once the agent has extracted the key data and run its initial checks, all of it has to reach a human underwriter.

**The problem.** Sending a dozen separate files is cumbersome and error-prone. Underwriters want one consolidated package, not an inbox to reassemble.

**The approach.** Finish the workflow with a Document To Zip skill. Pass the `documentId` values accumulated along the way, set `outputStorage` to persistent storage, and give `zipFileName` something a person can recognize — the application reference rather than `bundle-1718553600.zip`.

The `zipDocumentId` it returns behaves like any other document, so the next step can attach it to an email or hand it to an API.

<figure><img src="/files/1slQWkTUjQanI7lmQ7YK" alt=""><figcaption><p>Listing the documents to bundle</p></figcaption></figure>

<figure><img src="/files/Gq1qTcUhfgr8lyYBgwwf" alt=""><figcaption><p>Setting the output storage and archive filename</p></figcaption></figure>

## Configuration reference

| Field           | Type                            | Required                       | Description                                                       |
| --------------- | ------------------------------- | ------------------------------ | ----------------------------------------------------------------- |
| `documents`     | array\<object>                  | ✅                              | Input documents. Each item: `{ documentId, source, storageId? }`. |
| `outputStorage` | `'conversation'` \| `'storage'` | ✅                              | Where to save the ZIP.                                            |
| `storagePath`   | string                          | when `outputStorage='storage'` | Destination path.                                                 |
| `zipFileName`   | string                          | —                              | Custom filename; defaults to `bundle-<timestamp>.zip`.            |

## Output

| Field           | Type   | Always | Description                                   |
| --------------- | ------ | ------ | --------------------------------------------- |
| `zipDocumentId` | string | ✅      | Identifier of the generated archive.          |
| `storageType`   | string | ✅      | `conversation` or `storage`.                  |
| `storagePath`   | string | —      | Present when `storageType='storage'`.         |
| `mimeType`      | string | ✅      | Always `application/zip`.                     |
| `statusCode`    | number | ✅      | HTTP-like — `200` success, `400`/`500` error. |

## Errors

| Error                     | Status | Notes                                        |
| ------------------------- | ------ | -------------------------------------------- |
| Missing document          | `404`  | `reason` names the first missing ID.         |
| Source unavailable        | `503`  | Storage service offline or timed out.        |
| Bundle too large          | `413`  | Maximum combined size exceeded — a hard cap. |
| Invalid configuration     | `400`  | Schema validation failed.                    |
| Internal processing error | `500`  | Unexpected exception while zipping.          |

## Testing in isolation

* **Path** — `/skill-runtime/workflows/nodes/DocumentToZip/execute`
* **Method** — `POST`
* **Body:**

```json
{
  "nodeType": "DOCUMENT_TO_ZIP",
  "config": { },
  "input": { }
}
```

***

To add this skill to an agent, see [Adding a Skill to the Agent](/agent-builder/build/adding-a-skill-to-the-agent.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/platform-resources/skill-library/document-skills/document-to-zip.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
