> 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 # 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 - 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 | description: List of GUIDs of the entities to include in the bulk download. | required: true Return type: InitiateBulkDownloadResponse - name: bulkDownload | type: BulkDownload | description: The initiated bulk download. - name: id | type: string | description: Bulk download GUID. - 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. - name: createdDate | type: string | description: Date and time the bulk download was created. - name: updatedDate | type: string | description: Date and time the bulk download was last updated. - 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. - name: downloadGenerationStatus | type: DownloadGenerationStatus | description: Status of the bulk download generation. - 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"`. - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`. - 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 | description: List of GUIDs of the entities to include in the bulk download. - name: skippedEntityIds | type: array | 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. - name: downloadGenerationDetails | type: DownloadGenerationDetails | description: Details about the number of files processed. - 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: ' \ -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 - 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 | description: List of GUIDs of the entities to include in the bulk download. | required: true Return type: PROMISE - name: _id | type: string | description: Bulk download GUID. - 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. - name: _createdDate | type: Date | description: Date and time the bulk download was created. - name: _updatedDate | type: Date | description: Date and time the bulk download was last updated. - 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. - name: downloadGenerationStatus | type: DownloadGenerationStatus | description: Status of the bulk download generation. - 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"`. - name: namespace | type: Namespace | description: App namespace. Currently only supports `"RECEIPTS"`. - 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 | description: List of GUIDs of the entities to include in the bulk download. - name: skippedEntityIds | type: array | 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. - name: downloadGenerationDetails | type: DownloadGenerationDetails | description: Details about the number of files processed. - 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-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 { 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); }; ``` ---