> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Zip

> Download a workspace directory as a ZIP archive.

## Overview

Streams a ZIP archive of a workspace directory. Pass `path` to archive a subdirectory, or omit it to archive the entire workspace root. The response is `application/zip` with a `Content-Disposition: attachment` header; point your HTTP client at a file when calling this endpoint from the CLI.

## Path Parameters

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID).
</ParamField>

## Query Parameters

<ParamField query="path" type="string">
  Workspace-relative directory to archive. When empty/omitted, the full workspace is archived as `workspace.zip`.
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL (whole workspace) theme={null}
  curl -G "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/zip" \
    -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
    -o workspace.zip
  ```

  ```bash cURL (subdirectory) theme={null}
  curl -G "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/zip" \
    -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
    --data-urlencode "path=downloads" \
    -o downloads.zip
  ```
</CodeGroup>

## Response

### Success Response (200)

Binary response with `Content-Type: application/zip` and a `Content-Disposition: attachment; filename="<path>.zip"` header. When `path` is omitted the filename is `workspace.zip`; otherwise slashes in the path are replaced with dashes (e.g. `exports/csv` becomes `exports-csv.zip`).

### Error Responses

| Status | Description                                                             |
| ------ | ----------------------------------------------------------------------- |
| `400`  | Invalid path.                                                           |
| `401`  | Unauthorized — invalid or missing API key.                              |
| `404`  | Session or path not found.                                              |
| `413`  | Zip archive would exceed the 500 MiB server-side cap (`MAX_ZIP_BYTES`). |
