> 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
# BulkDeleteItems
# Package: benefitPrograms
# Namespace: ItemService
# Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/items/bulk-delete-items.md
## Permission Scopes:
Manage benefit programs: SCOPE.BENEFIT_PROGRAMS.MANAGE
## Introduction
Deletes benefit items.
Caution:
Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
---
## REST API
### Schema
```
Method: bulkDeleteItems
Description: Deletes benefit items. Caution: Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
URL: https://www.wixapis.com/benefit-programs/v1/bulk/items/delete
Method: POST
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: itemIds
Method parameters:
param name: itemIds | type: array | description: List of GUIDs of the items to delete. | required: true
Return type: BulkDeleteItemsResponse
- name: results | type: array | description: List of deleted items and associated metadata.
- name: itemMetadata | type: ItemMetadata | description: Item metadata.
- name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).
- name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.
- name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.
- name: error | type: ApplicationError | description: Details about the error in case of failure.
- name: code | type: string | description: Error code.
- name: description | type: string | description: Description of the error.
- name: data | type: object | description: Data related to the error.
- name: item | type: Item | description: Item.
- name: id | type: string | description: Benefit item GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item.
- name: createdDate | type: string | description: Date and time the item was created.
- name: updatedDate | type: string | description: Date and time the item was updated.
- name: externalId | type: string | description: GUID of the item in the app providing it. For example, if the item is a product provided by Wix Stores, the `externalId` would be the Wix Stores `product Id`.
- name: category | type: string | description: Benefit item category.
- name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of.
- name: displayName | type: string | description: Benefit item display name.
- name: providerAppId | type: string | description: GUID of the [app](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix.md) that defines and provides the item. For example, if the item is a Wix Stores product, this field's value is `215238eb-22a5-4c36-9e7b-e7c08025e04e`.
- name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.
- name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
- name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created.
- name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.
- name: totalSuccesses | type: integer | description: Number of items that were successfully processed.
- name: totalFailures | type: integer | description: Number of items that couldn't be processed.
- name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.
```
### Examples
### BulkDeleteItems
```curl
~~~cURL
curl -X POST \
"https://www.wixapis.com/benefit-programs/v1/bulk/items/delete"
-H 'Content-type: application/json' \
-H 'Authorization: ' \
-d '{
"item_ids":[
"4a9d4547-9146-43f9-b445-10053fb73cb1",
"9fd25ceb-ab85-4263-af90-94bd8c3981a8"
]
}'
~~~
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.benefitPrograms.ItemService.bulkDeleteItems(itemIds)
Description: Deletes benefit items. Caution: Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: itemIds
Method parameters:
param name: itemIds | type: array | description: List of GUIDs of the items to delete. | required: true
Return type: PROMISE
- name: results | type: array | description: List of deleted items and associated metadata.
- name: itemMetadata | type: ItemMetadata | description: Item metadata.
- name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item).
- name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.
- name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated.
- name: error | type: ApplicationError | description: Details about the error in case of failure.
- name: code | type: string | description: Error code.
- name: description | type: string | description: Description of the error.
- name: data | type: object | description: Data related to the error.
- name: item | type: Item | description: Item.
- name: _id | type: string | description: Benefit item GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the benefit item is updated. To prevent conflicting changes, the current revision must be passed when updating the benefit item. Ignored when creating a benefit item.
- name: _createdDate | type: Date | description: Date and time the item was created.
- name: _updatedDate | type: Date | description: Date and time the item was updated.
- name: externalId | type: string | description: GUID of the item in the app providing it. For example, if the item is a product provided by Wix Stores, the `externalId` would be the Wix Stores `product Id`.
- name: category | type: string | description: Benefit item category.
- name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of.
- name: displayName | type: string | description: Benefit item display name.
- name: providerAppId | type: string | description: GUID of the [app](https://dev.wix.com/docs/rest/articles/getting-started/apps-created-by-wix.md) that defines and provides the item. For example, if the item is a Wix Stores product, this field's value is `215238eb-22a5-4c36-9e7b-e7c08025e04e`.
- name: extendedFields | type: ExtendedFields | description: Custom field data for the benefit item object. [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.
- name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).
- name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created.
- name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata.
- name: totalSuccesses | type: integer | description: Number of items that were successfully processed.
- name: totalFailures | type: integer | description: Number of items that couldn't be processed.
- name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.
```
### Examples
### bulkDeleteItems
```javascript
import { items } from '@wix/benefit-programs';
async function bulkDeleteItems(itemIds) {
const response = await items.bulkDeleteItems(itemIds);
};
```
### bulkDeleteItems (with elevated permissions)
```javascript
import { items } from '@wix/benefit-programs';
import { auth } from '@wix/essentials';
async function myBulkDeleteItemsMethod(itemIds) {
const elevatedBulkDeleteItems = auth.elevate(items.bulkDeleteItems);
const response = await elevatedBulkDeleteItems(itemIds);
}
```
### bulkDeleteItems (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 { items } from '@wix/benefit-programs';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { items },
// Include the auth strategy and host as relevant
});
async function bulkDeleteItems(itemIds) {
const response = await myWixClient.items.bulkDeleteItems(itemIds);
};
```
---