> 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

# Resource: Background Tasks

# Type: Background Task Object

# Link: https://dev.wix.com/docs/api-reference/business-solutions/cms/operations/background-tasks/background-task-object.md

## Description: Background task job that processes data items in bulk.

## Schema:

```json
 Type: Background Task Object | type: Task
 Description: Background task job that processes data items in bulk.
       - name: id  | type: string | description: Task ID.
       - name: type  | type: string | description: Task type.
           enum: DELETE_BY_QUERY, COPY_FIELD_DATA, EDIT_FIELD_DATA, UPDATE_PUBLISH_STATUS
       - name: status  | type: string | description: Task status.
           enum: NEW, RUNNING, COMPLETED, FAILED
       - name: startedAt  | type: string | description: Task start time. Empty if the task status is `NEW`.
           - name: seconds  | type: string | description: 
           - name: nanos  | type: number | description: 
       - name: finishedAt  | type: string | description: Task finish time. Empty until the task status updates to `COMPLETED` or `FAILED`.
       - name: itemsFailed  | type: number | description: Number of items whose processing failed.
       - name: failures  | type: Array<ApplicationError> | description: List of errors generated during the task.  Learn more about [Wix Data error codes](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-error-codes.md).
           - name: code  | type: string | description: Error code.
           - name: description  | type: string | description: Description of the error.
           - name: data  | type: Struct | description: Data related to the error.
               - name: fields  | type: object | description: 
       - name: estimatedItemCount  | type: number | description: Estimated number of items affected by the task.
       - name: itemsSucceeded  | type: number | description: Number of items successfully processed so far.
       - ONE-OF:
           - name: deleteByQueryOptions  | type: DeleteByQueryOptions | description: Options for tasks of the type `DELETE_BY_QUERY`.
               - name: dataCollectionId  | type: string | description: ID of the collection from which to delete the items that match the filter.
               - name: environment  | type: string | description: [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing) from which to delete item.  Default: `LIVE`.
                   enum: SANDBOX, SANDBOX_PREFERRED, LIVE
               - name: filter  | type: Struct | description: Query filter. If not specified, all items are deleted.  Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md).
               - name: appOptions  | type: Struct | description: Additional options specific to the [Wix app collection](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) you are querying.  Learn more about [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections.md).
               - name: publishPluginOptions  | type: PublishPluginOptions | description: Options for the [Publish plugin](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection).  This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object.md) to be marked as draft or published. Published items are visible to site visitors, while draft items are not.
                   - name: includeDraftItems  | type: boolean | description: Whether to include draft items.  When `true`, both published and draft items are affected. Default: `false`.
           - name: copyFieldDataOptions  | type: CopyFieldDataOptions | description: Options for tasks of the type `COPY_FIELD_DATA`.
               - name: dataCollectionId  | type: string | description: ID of the collection in which to copy and write item field data.
               - name: environment  | type: string | description: [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to copy and write field data.  Default: `LIVE`.
               - name: sourceFieldKey  | type: string | description: ID of the field to copy data from.
               - name: targetFieldKey  | type: string | description: ID of the field to copy data to.
           - name: editFieldDataOptions  | type: EditFieldDataOptions | description: Options for tasks of the type `EDIT_FIELD_DATA`.
               - name: dataCollectionId  | type: string | description: ID of the collection in which to edit the specified field.
               - name: environment  | type: string | description: [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to edit the specified field.  Default: `LIVE`.
               - name: filter  | type: Struct | description: Query filter. Only items that match the filter are edited.  Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md).
               - name: fieldKey  | type: string | description: ID of the field to update.
               - name: operations  | type: Operations | description: Operations to perform on the specified field.
                   - name: addItems  | type: Array<Value> | description: Add elements to a field of type Array.  Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).
                   - name: removeItems  | type: Array<Value> | description: Remove elements from a field of type Array.  Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).
                   - name: replaceItems  | type: Array<Replace> | description: In a field of type Array, replace all matching elements. In a field of another type, replace all matching values.  Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).
                   - name: removeDuplicates  | type: boolean | description: In a field of type Array, remove duplicate elements. Default: `false`.  Learn more about [field types](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).
           - name: updatePublishStatusOptions  | type: UpdatePublishStatusOptions | description: Options for tasks of the type `UPDATE_PUBLISH_STATUS`.
               - name: dataCollectionId  | type: string | description: ID of the collection whose items' publish status is to be updated.
               - name: environment  | type: string | description: [Collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing#sandbox-collections) in which to update the publish status of the items.  Default: `LIVE`.
               - name: filter  | type: Struct | description: Query filter. If not specified, the publish status of all items is updated.  Learn about working with [API query language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md).
               - name: operation  | type: string | description: Publish status update operation.
                   enum: SET_PUBLISHED_STATUS, SET_DRAFT_STATUS, SCHEDULE_PUBLISHED_STATUS, SCHEDULE_DRAFT_STATUS, CANCEL_SCHEDULING
               - ONE-OF:
                   - name: scheduleDraftStatusOptions  | type: ScheduleOperation | description: In a `SCHEDULE_DRAFT_STATUS` operation, options for scheduling the status update to `DRAFT`.
                       - name: date  | type: string | description: When to update the item's publish status.
                   - name: schedulePublishedStatusOptions  | type: ScheduleOperation | description: In a `SCHEDULE_PUBLISHED_STATUS` operation, options for scheduling the status update to `PUBLISHED`.

```