> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GenerateFileDownloadInfo

# Package: wixPaymentsProvider

# Namespace: TaxDocumentsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/payments/wix-payments-provider/tax-documents/generate-file-download-info.md

## Permission Scopes:
Managing tax tax documents: SCOPE.PAYMENTS.MANAGE-TAX-DOCUMENTS

## Introduction

Generates temporary information for downloading a tax document's file.

The returned `downloadInfo.url` is a temporary link to a PDF. It expires 10 seconds after it's generated, so follow it immediately, and don't store it as a static link. Call this method again to get a fresh URL.

The tax document must have a file available, meaning its `downloadable` field is `true`.

---

## REST API

### Schema

```
 Method: generateFileDownloadInfo
 Description: Generates temporary information for downloading a tax document's file.  The returned `downloadInfo.url` is a temporary link to a PDF. It expires 10 seconds after it's generated, so follow it immediately, and don't store it as a static link. Call this method again to get a fresh URL.  The tax document must have a file available, meaning its `downloadable` field is `true`.
 URL: https://www.wixapis.com/payments/platform/v1/tax-documents/{taxDocumentId}/generate-file-download-info
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  taxDocumentId
 Method parameters: 
   param name: taxDocumentId | type:   none | required: true 
 Return type: GenerateFileDownloadInfoResponse
  - name: downloadInfo | type: Document | description: Information for downloading the tax document's file.  
     - name: id | type: string | description: Not used. Always empty for tax documents.  | validation: maxLength 0
     - name: url | type: string | description: Temporary URL for downloading the tax document's PDF file. Expires 10 seconds after it's generated.  | validation: format WEB_URL
     - name: urlExpirationDate | type: string | description: Date and time the download URL expires, 10 seconds after it's generated.  | validation: format date-time
     - name: sizeInBytes | type: string | description: File size in bytes.  | validation: decimalValue {"gt":"0","maxScale":0}
     - name: filename | type: string | description: File name.  | validation: maxLength 255


```

### Examples

### Generate download information for a tax document's file
Generates a temporary URL for downloading the specified tax document's PDF file. The URL expires 10 seconds after it's generated.

```curl
curl -X GET \
'https://www.wixapis.com/payments/platform/v1/tax-documents/3f2b9c7a-1e6d-4b8a-9c2f-7a1e6d4b8a9c/generate-file-download-info' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.payments.taxDocuments.generateFileDownloadInfo(taxDocumentId)
 Description: Generates temporary information for downloading a tax document's file.  The returned `downloadInfo.url` is a temporary link to a PDF. It expires 10 seconds after it's generated, so follow it immediately, and don't store it as a static link. Call this method again to get a fresh URL.  The tax document must have a file available, meaning its `downloadable` field is `true`.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  taxDocumentId
 Method parameters: 
   param name: taxDocumentId | type: string | description: GUID of the tax document to download a file for. | required: true | validation: format GUID
 Return type: PROMISE<GenerateFileDownloadInfoResponse>
  - name: downloadInfo | type: string | description: Information for downloading the tax document's file.  


```

### Examples

### generateFileDownloadInfo
```javascript
import { taxDocuments } from '@wix/payments';

async function generateFileDownloadInfo(taxDocumentId) {
  const response = await taxDocuments.generateFileDownloadInfo(taxDocumentId);
};
```

### generateFileDownloadInfo (with elevated permissions)
```javascript
import { taxDocuments } from '@wix/payments';
import { auth } from '@wix/essentials';

async function myGenerateFileDownloadInfoMethod(taxDocumentId) {
  const elevatedGenerateFileDownloadInfo = auth.elevate(taxDocuments.generateFileDownloadInfo);
  const response = await elevatedGenerateFileDownloadInfo(taxDocumentId);
}
```

### generateFileDownloadInfo (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { taxDocuments } from '@wix/payments';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { taxDocuments },
  // Include the auth strategy and host as relevant
});


async function generateFileDownloadInfo(taxDocumentId) {
  const response = await myWixClient.taxDocuments.generateFileDownloadInfo(taxDocumentId);
};
```

---