# DownloadDocument

Returns a copy of the document

`GET /documents/{documentId}/$download`

**API:** Avalara E-Invoicing API
**Tag:** Documents
**API Version:** 1.6
**Base URL:** https://api.sbx.avalara.com/einvoicing
**Authentication:** Bearer token

Source: https://developer.avalara.com/products/e-invoicing/api/v1.6/methods/Documents/DownloadDocument/

## Description

Downloads the document when it is available. Specify the output format in the Accept header. Returns 404 if the file has not been created.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `avalara-version` | string | header | Yes | Header that specifies the API version to use (for example "1.6"). |
| `Accept` | string | header | Yes | Header that specifies the MIME type of the returned document. |
| `X-Avalara-Client` | string | header | No | Optional header for a client identifier string used for diagnostics (for example "Fingerprint"). |
| `documentId` |  | path | Yes | The unique documentId returned in the POST /documents response body. |

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | Returns the document content in the format specified by the Accept header. |  |
| 401 | Unauthorized. |  |
| 403 | Forbidden. | `ForbiddenError` |
| 404 | A document for the specified ID was not found. | `NotFoundError` |
| 406 | Unsupported document format was requested in the Accept header. | `BadDownloadRequest` |

## Example Request

```bash
curl -X GET "https://api.sbx.avalara.com/einvoicing/documents/{documentId}/$download" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json"
```