> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# InitiateBulkDownload

# Package: getPaid

# Namespace: BulkDownloads

# Method link: https://dev.wix.com/docs/api-reference/business-management/get-paid/bulk-downloads/initiate-bulk-download.md

## Permission Scopes:
Manage Receipts: SCOPE.RECEIPTS.MANAGE

## Introduction

Initiates a bulk download process.

The process creates a .zip file containing the requested files. The .zip file is available for download using the `downloadUrl` in the `bulkDownload` response.
The `downloadUrl` is available for 24 hours after the process begins.
Downloads creation is limited per user up to 10 at once.

---

## REST API

### Schema

```
 Method: initiateBulkDownload
 Description: Initiates a bulk download process.  The process creates a .zip file containing the requested files. The .zip file is available for download using the `downloadUrl` in the `bulkDownload` response. The `downloadUrl` is available for 24 hours after the process begins. Downloads creation is limited per user up to 10 at once.
 URL: https://www.wixapis.com/get-paid/v1/bulk-downloads
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  bulkDownload, bulkDownload.entityIds, bulkDownload.namespace
 Method parameters: 
   param name: bulkDownload | type: BulkDownload | description: A bulk download contains the download information to retrieve items in the Get Paid APIs. | required: true 
        - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`. | required: true | validation: immutable
             - enum:
             -     UNKNOWN_NAMESPACE: Unknown namespace.
             -     RECEIPTS: Receipts ([SDK](https://dev.wix.com/docs/sdk/backend-modules/get-paid/receipts/about-the-receipts-apis.md) | [REST](https://dev.wix.com/docs/rest/business-management/get-paid/receipts/about-the-receipts-apis.md)).
        - name: entityIds | type: array<string> | description: List of GUIDs of the entities to include in the bulk download. | required: true | validation: minItems 2, maxItems 100, format GUID, immutable
 Return type: InitiateBulkDownloadResponse
  - name: bulkDownload | type: BulkDownload | description: The initiated bulk download.  
     - name: id | type: string | description: Bulk download GUID.  | read-only: true | validation: format GUID, immutable
     - name: revision | type: string | description: Revision number, which increments by 1 each time the bulk download is updated. To prevent conflicting changes, the current `revision` must be passed when updating the bulk download.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the bulk download was created.  | read-only: true | validation: format date-time, immutable
     - name: updatedDate | type: string | description: Date and time the bulk download was last updated.  | read-only: true | validation: format date-time
     - name: expirationDate | type: string | description: Date and time the bulk download expires.  The .zip file is available for download with the `downloadUrl` until this time.  Default expiration date is 24 hours after creation.  | read-only: true | validation: format date-time, immutable
     - name: downloadGenerationStatus | type: DownloadGenerationStatus | description: Status of the bulk download generation.  | read-only: true 
         - enum:
         -     UNKNOWN_DOWNLOAD_STATUS: Unknown download status.
         -     PROCESSING: Generation is in progress.
         -     PARTIAL_SUCCESS: Generation was successful for some, but not all, entities. Check `skippedEntityIds` for entities not included. The `downloadUrl` is available to download the .zip file containing the successfully generated entities.
         -     SUCCESS: Generation was successful. The .zip file is ready for download using the `downloadUrl`.
         -     FAILED: Generation has failed.
     - name: downloadUrl | type: string | description: URL to download the generated .zip file. Open this URL in a browser to download the file.  Only available when the `downloadGenerationStatus` is `"PARTIAL_SUCCESS"` or `"SUCCESS"`.  | read-only: true | validation: format WEB_URL
     - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`.  | validation: immutable
         - enum:
         -     UNKNOWN_NAMESPACE: Unknown namespace.
         -     RECEIPTS: Receipts ([SDK](https://dev.wix.com/docs/sdk/backend-modules/get-paid/receipts/about-the-receipts-apis.md) | [REST](https://dev.wix.com/docs/rest/business-management/get-paid/receipts/about-the-receipts-apis.md)).
     - name: entityIds | type: array<string> | description: List of GUIDs of the entities to include in the bulk download.  | validation: minItems 2, maxItems 100, format GUID, immutable
     - name: skippedEntityIds | type: array<string> | description: IDs of the entities that aren't included in the .zip file.  If `downloadGenerationStatus` is `"PARTIAL_SUCCESS"` then these entities may still be included once the initiated download is complete. If the value of `downloadGenerationDetails.processed` matches `downloadGenerationDetails.total` then all of the entities have been processed and the skipped entities aren't included in the bulk download.  | read-only: true | validation: maxItems 100, format GUID
     - name: downloadGenerationDetails | type: DownloadGenerationDetails | description: Details about the number of files processed.  | read-only: true 
        - name: processed | type: integer | description: Number of files that have been processed.  
        - name: total | type: integer | description: Total number of files to process.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NAMESPACE_NOT_SUPPORTED | Description: Calling this method with this namespace isn't supported.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PERMISSION_DENIED | Description: Caller doesn't have permissions.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: USER_ID_NOT_FOUND | Description: User identification GUID is missing.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BULK_DOWNLOAD_LIMIT_REACHED | Description: User has reached the limit of maximum bulk downloads.


```

### Examples

### Initiate Bulk Download
Initiates a bulk download process for specified entities

```curl
curl -X POST \
'https://www.wixapis.com/get-paid/v1/bulk-downloads' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
--data-binary '{
  "bulkDownload": {
    "namespace": "RECEIPTS",
    "entityIds": [
      "a1b2c3d4-e5f6-4a5b-9c8d-7e6f5a4b3c2d",
      "f1e2d3c4-b5a6-4c5d-8e7f-9a8b7c6d5e4f"
    ]
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.getPaid.bulkDownloads.initiateBulkDownload(bulkDownload)
 Description: Initiates a bulk download process.  The process creates a .zip file containing the requested files. The .zip file is available for download using the `downloadUrl` in the `bulkDownload` response. The `downloadUrl` is available for 24 hours after the process begins. Downloads creation is limited per user up to 10 at once.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  bulkDownload, bulkDownload.entityIds, bulkDownload.namespace
 Method parameters: 
   param name: bulkDownload | type: BulkDownload | description: A bulk download contains the download information to retrieve items in the Get Paid APIs. | required: true 
        - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`. | required: true | validation: immutable
             - enum:
             -     UNKNOWN_NAMESPACE: Unknown namespace.
             -     RECEIPTS: Receipts ([SDK](https://dev.wix.com/docs/sdk/backend-modules/get-paid/receipts/about-the-receipts-apis.md) | [REST](https://dev.wix.com/docs/rest/business-management/get-paid/receipts/about-the-receipts-apis.md)).
        - name: entityIds | type: array<string> | description: List of GUIDs of the entities to include in the bulk download. | required: true | validation: minItems 2, maxItems 100, format GUID, immutable
 Return type: PROMISE<BulkDownload>
  - name: _id | type: string | description: Bulk download GUID.  | read-only: true | validation: format GUID, immutable
  - name: revision | type: string | description: Revision number, which increments by 1 each time the bulk download is updated. To prevent conflicting changes, the current `revision` must be passed when updating the bulk download.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the bulk download was created.  | read-only: true | validation: immutable
  - name: _updatedDate | type: Date | description: Date and time the bulk download was last updated.  | read-only: true 
  - name: expirationDate | type: Date | description: Date and time the bulk download expires.  The .zip file is available for download with the `downloadUrl` until this time.  Default expiration date is 24 hours after creation.  | read-only: true | validation: immutable
  - name: downloadGenerationStatus | type: DownloadGenerationStatus | description: Status of the bulk download generation.  | read-only: true 
     - enum:
     -     UNKNOWN_DOWNLOAD_STATUS: Unknown download status.
     -     PROCESSING: Generation is in progress.
     -     PARTIAL_SUCCESS: Generation was successful for some, but not all, entities. Check `skippedEntityIds` for entities not included. The `downloadUrl` is available to download the .zip file containing the successfully generated entities.
     -     SUCCESS: Generation was successful. The .zip file is ready for download using the `downloadUrl`.
     -     FAILED: Generation has failed.
  - name: downloadUrl | type: string | description: URL to download the generated .zip file. Open this URL in a browser to download the file.  Only available when the `downloadGenerationStatus` is `"PARTIAL_SUCCESS"` or `"SUCCESS"`.  | read-only: true | validation: format WEB_URL
  - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`.  | validation: immutable
     - enum:
     -     UNKNOWN_NAMESPACE: Unknown namespace.
     -     RECEIPTS: Receipts ([SDK](https://dev.wix.com/docs/sdk/backend-modules/get-paid/receipts/about-the-receipts-apis.md) | [REST](https://dev.wix.com/docs/rest/business-management/get-paid/receipts/about-the-receipts-apis.md)).
  - name: entityIds | type: array<string> | description: List of GUIDs of the entities to include in the bulk download.  | validation: minItems 2, maxItems 100, format GUID, immutable
  - name: skippedEntityIds | type: array<string> | description: IDs of the entities that aren't included in the .zip file.  If `downloadGenerationStatus` is `"PARTIAL_SUCCESS"` then these entities may still be included once the initiated download is complete. If the value of `downloadGenerationDetails.processed` matches `downloadGenerationDetails.total` then all of the entities have been processed and the skipped entities aren't included in the bulk download.  | read-only: true | validation: maxItems 100, format GUID
  - name: downloadGenerationDetails | type: DownloadGenerationDetails | description: Details about the number of files processed.  | read-only: true 
     - name: processed | type: integer | description: Number of files that have been processed.  
     - name: total | type: integer | description: Total number of files to process.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NAMESPACE_NOT_SUPPORTED | Description: Calling this method with this namespace isn't supported.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PERMISSION_DENIED | Description: Caller doesn't have permissions.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: USER_ID_NOT_FOUND | Description: User identification GUID is missing.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BULK_DOWNLOAD_LIMIT_REACHED | Description: User has reached the limit of maximum bulk downloads.


```

### Examples

### initiateBulkDownload
```javascript
import { bulkDownloads } from '@wix/get-paid';

async function initiateBulkDownload(bulkDownload) {
  const response = await bulkDownloads.initiateBulkDownload(bulkDownload);
};
```

### initiateBulkDownload (with elevated permissions)
```javascript
import { bulkDownloads } from '@wix/get-paid';
import { auth } from '@wix/essentials';

async function myInitiateBulkDownloadMethod(bulkDownload) {
  const elevatedInitiateBulkDownload = auth.elevate(bulkDownloads.initiateBulkDownload);
  const response = await elevatedInitiateBulkDownload(bulkDownload);
}
```

### initiateBulkDownload (self-managed)
Self-managed 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 { bulkDownloads } from '@wix/get-paid';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function initiateBulkDownload(bulkDownload) {
  const response = await myWixClient.bulkDownloads.initiateBulkDownload(bulkDownload);
};
```

---