> For the complete documentation index, see [llms.txt](https://developers.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.docstudio.com/api-reference/download-envelope-archive.md).

# Download Envelope Archive

This document explains how to download a completed envelope archive through DocStudio API.

#### Endpoint

| Method | Endpoint                    |
| ------ | --------------------------- |
| `GET`  | `/api/v1/envelope/{id}/zip` |

#### Headers

<table><thead><tr><th width="155">Header</th><th width="129">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization</code></td><td>Yes</td><td>Bearer authorization token</td></tr><tr><td><code>Mailbox</code></td><td>Yes</td><td>UUID of the mailbox used as the current mailbox context</td></tr></tbody></table>

#### Path parameters

<table><thead><tr><th width="136">Parameter</th><th width="96">Type</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>UUID</td><td>Yes</td><td>UUID of the envelope to download</td></tr></tbody></table>

#### Query parameters

<table><thead><tr><th width="166">Parameter</th><th width="88">Type</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>documentId</code></td><td>string</td><td>No</td><td>ID of one document to include in the archive</td></tr><tr><td><code>excludeFiles</code></td><td>string</td><td>No</td><td>Mask defining which generated files must be excluded</td></tr><tr><td><code>zipStructureName</code></td><td>string</td><td>No</td><td>Name of a ZIP structure previously saved in the envelope template</td></tr><tr><td><code>wait</code></td><td>boolean</td><td>No</td><td>Wait for the archive to become available instead of returning <code>425</code></td></tr></tbody></table>

#### Download the complete envelope archive

```http
GET /api/v1/envelope/89499ba2-287d-404c-87b0-342dc5b01b6a/zip?wait=true
Authorization: Bearer {token}
Mailbox: 9baec31c-e940-4894-b6d1-52033e1af66e
```

#### Download one document

Pass the document ID through the `documentId` query parameter when only one envelope document is required. The document ID must come from the envelope or template structure.

```http
GET /api/v1/envelope/89499ba2-287d-404c-87b0-342dc5b01b6a/zip?documentId={documentId}&wait=true
Authorization: Bearer {token}
Mailbox: 9baec31c-e940-4894-b6d1-52033e1af66e
```

#### Exclude generated files

Use `excludeFiles` to remove generated files that are not required in the downloaded archive. Combine several values in one mask when multiple file types must be excluded.

| Value | Excluded files                       |
| ----- | ------------------------------------ |
| `c`   | Signature or processing certificates |
| `p`   | Printable versions                   |
| `a`   | Audit trail                          |

For example, `excludeFiles=cp` excludes certificates and printable versions:

```http
GET /api/v1/envelope/89499ba2-287d-404c-87b0-342dc5b01b6a/zip?excludeFiles=cp&wait=true
Authorization: Bearer {token}
Mailbox: 9baec31c-e940-4894-b6d1-52033e1af66e
```

#### Response

A successful request returns `200 OK` with the archive as binary content using the `application/octet-stream` media type. Save the response body as a `.zip` file instead of attempting to process it as JSON.

If `wait` is set to `true`, the request waits for the archive to become available. Without this option, the API can return `425` when the requested archive has not been generated yet.

#### Status codes

<table><thead><tr><th width="293">Code</th><th>Description</th></tr></thead><tbody><tr><td><code>200</code></td><td>Archive returned successfully</td></tr><tr><td><code>425</code></td><td>Archive is not ready and the request did not wait for it</td></tr></tbody></table>

#### Related topics

* [Check Envelope Status](/api-reference/check-envelope-status.md)
* [Send Envelope](/api-reference/send-envelope.md)
* [Upload Attachments](/api-reference/upload-attachments.md)
