> **Source:** https://knowledge.leegality.com/document-execution/api/download-files > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # GET /v4/packs/download — Download files > **Info — Sandbox endpoint** > > `https://sandbox.leegality.com/api/v4/packs/download` Use this API to download a pack's files — a document, its audit trail, an attachment, or a supporting document an invitee uploaded. What you send with the request depends on `downloadType`: - For `DOCUMENT`, `AUDIT_TRAIL`, or `ATTACHMENT`, send the `documentId`. - For `SUPPORTING_DOCUMENT`, send the invitee's `signUrl`. You can request one `downloadType` at a time. For `DOCUMENT`, you get the document as it stands at that moment — if no one has signed yet you get the unsigned copy, and once everyone has signed you get the fully signed copy. For `AUDIT_TRAIL`, the document must be fully signed (completed) first. **Authentication:** `Authorization: Bearer ` header required on every request. ## Request URL ``` GET https://app1.leegality.com/api/v4/packs/download?downloadType={downloadType}&documentId={documentId}&signUrl={signUrl}&index={index}&mode={mode} ``` **Environments:** - Production: `https://app1.leegality.com/api/v4/packs/download` - Sandbox: `https://sandbox.leegality.com/api/v4/packs/download` --- ## Parameters | Name | In | Required | Type | Description | Example | |------|----|----------|------|-------------|---------| | `downloadType` | query | Yes | string | The type of file to download. One of `DOCUMENT`, `AUDIT_TRAIL`, `ATTACHMENT`, `SUPPORTING_DOCUMENT`. Only one per call. | — | | `documentId` | query | No | string | The document's ULID. **Required for `DOCUMENT`, `AUDIT_TRAIL`, and `ATTACHMENT`.** Sending it with `SUPPORTING_DOCUMENT` is a validation error. | — | | `signUrl` | query | No | string | The invitee's sign URL. **Required for `SUPPORTING_DOCUMENT`.** Sending it with a document-family `downloadType` is a validation error. | — | | `index` | query | No | integer | 0-indexed position of the file to fetch. Defaults to `0`. Required for `ATTACHMENT` and `SUPPORTING_DOCUMENT`. | — | | `mode` | query | No | string | Set to `stream` to receive the raw file directly. If omitted, the response format follows your account configuration. | — | --- ## Responses ### 200 — Returns the requested file. Depending on your account setup (or the `mode` parameter), you get one of two things: - A JSON response with a temporary download link (`data.url`) that expires shortly (`data.expiresAt`). - The file itself, sent back directly (for example, a PDF). Check the `Content-Type` response header to tell which one you received. | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `data` | object | No | See **data** below. | — | #### data | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `url` | string | No | Temporary link to download the file. Expires shortly. | `https://sandbox-downloads.leegality.com/export/…?Expires=…&S` | | `expiresAt` | string | No | When the download link expires (ISO 8601). | `2026-08-19T09:23:40.297Z` | ### 400 — The request was rejected. Possible errors: - `LE_ERR_AP_043` — `downloadType` is missing - `LE_ERR_AP_044` — `downloadType` is not a supported value - `LE_ERR_AP_029` — `documentId` is missing (for `DOCUMENT`, `AUDIT_TRAIL`, or `ATTACHMENT`) - `LE_ERR_AP_045` — `signUrl` is missing (for `SUPPORTING_DOCUMENT`) - `LE_ERR_AP_046` — `index` is a negative number - `LE_ERR_AP_062` — `index` is not a whole number - `LE_ERR_AP_024` — the document isn't fully signed yet, so its audit trail can't be downloaded | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code (matches the first entry in `errors`). | `LE_ERR_AP_007` | | `traceId` | string | No | Trace identifier for the request, or `null`. | `null` | | `errors` | array\ | No | One or more errors describing why the request failed. See **errors** below. | — | #### errors | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Human-readable error message. | `max must be >= 1` | | `path` | string | No | Request path that produced the error. | `/api/v4/packs/search` | | `code` | string | No | Error code. | `LE_ERR_AP_007` | ### 401 — Authentication failed. - `LE_ERR_AP_080` — missing or invalid authentication token | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code (matches the first entry in `errors`). | `LE_ERR_AP_007` | | `traceId` | string | No | Trace identifier for the request, or `null`. | `null` | | `errors` | array\ | No | One or more errors describing why the request failed. See **errors** below. | — | #### errors | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Human-readable error message. | `max must be >= 1` | | `path` | string | No | Request path that produced the error. | `/api/v4/packs/search` | | `code` | string | No | Error code. | `LE_ERR_AP_007` | ### 404 — Not found. - `LE_ERR_AP_001` — no document matches the `documentId` - `LE_ERR_AP_047` — the requested file isn't available (for example, there's no attachment at that `index`) | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `code` | string | No | Top-level error code (matches the first entry in `errors`). | `LE_ERR_AP_007` | | `traceId` | string | No | Trace identifier for the request, or `null`. | `null` | | `errors` | array\ | No | One or more errors describing why the request failed. See **errors** below. | — | #### errors | Field | Type | Required | Description | Example | |-------|------|----------|-------------|---------| | `message` | string | No | Human-readable error message. | `max must be >= 1` | | `path` | string | No | Request path that produced the error. | `/api/v4/packs/search` | | `code` | string | No | Error code. | `LE_ERR_AP_007` | ### Sample Response (200) ```json { "data": { "url": "https://sandbox-downloads.leegality.com/export/…?Expires=…&Signature=…&Key-Pair-Id=…", "expiresAt": "2026-08-19T09:23:40.297Z" } } ```