> 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

# BulkCreateItems

# Package: benefitPrograms

# Namespace: ItemService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/items/bulk-create-items.md

## Permission Scopes:
Manage benefit programs: SCOPE.BENEFIT_PROGRAMS.MANAGE

## Introduction

Creates benefit items.

---

## REST API

### Schema

```
 Method: bulkCreateItems
 Description: Creates benefit items.
 URL: https://www.wixapis.com/benefit-programs/v1/bulk/items/create
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  items, items.itemSetId, items.externalId, items.providerAppId, items.namespace
 Method parameters: 
   param name: items | type: array<items> | description: Items to create. | required: true | validation: minItems 1, maxItems 100
              - 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`. | required: true | read-only: true | validation: format GUID, immutable
              - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of. | required: true | read-only: true | validation: format GUID, immutable
              - name: displayName | type: string | description: Benefit item display name.  | validation: maxLength 400
              - 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`. | required: true | read-only: true | validation: format GUID, immutable
              - 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).  | validation: format map
              - 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. | required: true | read-only: true | validation: minLength 1, maxLength 20, immutable
   param name: returnEntity | type: returnEntity | description: Whether to return the full item entities.  Default: `false`  
 Return type: BulkCreateItemsResponse
  - name: results | type: array<BulkItemResult> | description: List of created items and associated metadata.  | validation: minItems 1, maxItems 100
     - 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).  | validation: format GUID
        - 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.  | read-only: true | validation: format GUID, immutable
        - 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.  | read-only: true | validation: format int64
        - name: createdDate | type: string | description: Date and time the item was created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the item was updated.  | read-only: true | validation: format date-time
        - 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`.  | read-only: true | validation: format GUID, immutable
        - name: category | type: string | description: Benefit item category.  | read-only: true | validation: maxLength 20, immutable
        - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of.  | read-only: true | validation: format GUID, immutable
        - name: displayName | type: string | description: Benefit item display name.  | validation: maxLength 400
        - 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`.  | read-only: true | validation: format GUID, immutable
        - 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).  | validation: format map
        - 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.  | read-only: true | validation: minLength 1, maxLength 20, immutable
  - 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

### BulkCreateItems
```curl
~~~cURL
curl -X POST \
  "https://www.wixapis.com/benefit-programs/v1/bulk/items/create" \
  -H 'Content-type: application/json' \
  -H 'Authorization: <AUTH>' \
  -d '{
    "items": [
      {
        "itemSetId": "201db180-5043-45cf-a501-bd9c06df5ae5",
        "namespace": "benefit_programs_app",
        "providerAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
        "externalId": "3f9a7c91-4e2b-4d5e-b6f8-0c2e5a9d4f34"
      },
      {
        "itemSetId": "4febfe37-2fec-40da-b41f-0aad7279ba5c",
        "namespace": "benefit_programs_app",
        "providerAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
        "externalId": "3f9a7c91-4e2b-4d5e-b6f8-0c2e5a9d4f36"
      }
    ],
    "returnEntity": true
  }'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.benefitPrograms.items.bulkCreateItems(items, options)
 Description: Creates benefit items.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  items, items.itemSetId, items.externalId, items.providerAppId, items.namespace
 Method parameters: 
   param name: items | type: array<Item> | description: Items to create. | required: true | validation: minItems 1, maxItems 100
              - 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`. | required: true | read-only: true | validation: format GUID, immutable
              - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of. | required: true | read-only: true | validation: format GUID, immutable
              - name: displayName | type: string | description: Benefit item display name.  | validation: maxLength 400
              - 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`. | required: true | read-only: true | validation: format GUID, immutable
              - 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).  | validation: format map
              - 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. | required: true | read-only: true | validation: minLength 1, maxLength 20, immutable
   param name: options | type: BulkCreateItemsOptions  none  
        - name: returnEntity | type: boolean | description: Whether to return the full item entities.  Default: `false`  
 Return type: PROMISE<BulkCreateItemsResponse>
  - name: results | type: array<BulkItemResult> | description: List of created items and associated metadata.  | validation: minItems 1, maxItems 100
     - 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).  | validation: format GUID
        - 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.  | read-only: true | validation: format GUID, immutable
        - 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.  | read-only: true | validation: format int64
        - name: _createdDate | type: Date | description: Date and time the item was created.  | read-only: true 
        - name: _updatedDate | type: Date | description: Date and time the item was updated.  | read-only: true 
        - 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`.  | read-only: true | validation: format GUID, immutable
        - name: category | type: string | description: Benefit item category.  | read-only: true | validation: maxLength 20, immutable
        - name: itemSetId | type: string | description: Item set GUID of the benefit that this benefit item is a part of.  | read-only: true | validation: format GUID, immutable
        - name: displayName | type: string | description: Benefit item display name.  | validation: maxLength 400
        - 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`.  | read-only: true | validation: format GUID, immutable
        - 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).  | validation: format map
        - 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.  | read-only: true | validation: minLength 1, maxLength 20, immutable
  - 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

### bulkCreateItems
```javascript
import { items } from '@wix/benefit-programs';

async function bulkCreateItems(items,options) {
  const response = await items.bulkCreateItems(items,options);
};
```

### bulkCreateItems (with elevated permissions)
```javascript
import { items } from '@wix/benefit-programs';
import { auth } from '@wix/essentials';

async function myBulkCreateItemsMethod(items,options) {
  const elevatedBulkCreateItems = auth.elevate(items.bulkCreateItems);
  const response = await elevatedBulkCreateItems(items,options);
}
```

### bulkCreateItems (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 { 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 bulkCreateItems(items,options) {
  const response = await myWixClient.items.bulkCreateItems(items,options);
};
```

---