> 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: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md

## Article Content:

# About the Data Collections API

The Data Collections API manages the structure of [CMS collections](https://support.wix.com/en/article/content-manager-creating-a-collection) on a site. A collection defines the fields, data types, item permissions, and plugins for its data items.

With the Data Collections API, you can:

- Create collections and retrieve their definitions.
- Replace a collection definition or update selected collection and field properties.
- Configure plugins for publishing, dynamic page URLs, multilingual content, and CMS display settings.
- Delete collections and restore recently deleted collections.

Use the [Data Items API](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/introduction.md) to store and retrieve the items in these collections.

## Data collections and their structure

Wix sites store data in collections. A collection determines the structure of the data to be stored, defining the fields each item contains, and the data type of each field. Wix users can [create and modify collections](https://support.wix.com/en/article/content-manager-creating-a-collection) for their site using the Content Management System (CMS).

> **Note:**
> In addition to user-created collections, some Wix business apps automatically create and manage CMS collections on the site. To learn about these, see [Wix App Collections](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/wix-app-collections/introduction.md).

With the Data Collections API, you can use code to create, modify, and delete collections in a Wix site. You can then store and retrieve data in these collections using the [Data Items API](https://dev.wix.com/docs/api-reference/business-solutions/cms/data-items/introduction.md).

> **Note:**
> The structure you define for a data collection isn't enforced. This means that if you add or update an item containing a field or data type that doesn't match the collection's structure, your data is stored anyway.

## Permissions

Access to a data collection is controlled by its permissions. These permissions are defined in the collection object and they specify which types of user can perform actions on the items contained in the collection.

Wix Data recognizes 4 roles:

- `ADMIN`: The site owner.
- `SITE_MEMBER_AUTHOR`: A signed-in user who has added content to the collection.
- `SITE_MEMBER`: Any signed-in user.
- `ANYONE`: Any site visitor.

For each of the 4 basic actions (inserting, updating, removing, and reading content) the minimal role required must be set. For example, if you want to allow only site members to read items, and only the site owner to insert, update, and remove items, set the collection permissions as follows:

- `insert`: `ADMIN`
- `update`: `ADMIN`
- `remove`: `ADMIN`
- `read`: `SITE_MEMBER`

## Update collection and field definitions

Use [Patch Data Collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/patch-data-collection.md) or [Patch Data Collection Field](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/patch-data-collection-field.md) to change selected properties while preserving the others. The field mask identifies which supported properties to change. When omitted in a REST request, the mask is inferred from the supplied object.

[Update Data Collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection.md) replaces the collection definition. [Update Data Collection Field](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection-field.md) replaces one field's definition while retaining other fields. Include every writable property you need to preserve when using these methods.

## Before you begin

It's important to note the following points before starting to code:

- Wix Data APIs require the site's [code editor](https://dev.wix.com/docs/develop-websites/articles/get-started/development-environments.md) to be enabled. For an app, add a [data collections extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/data-collections/about-data-collections-extensions.md) to enable it automatically and create collections when the app is installed.
- Collection capabilities determine which collection and item operations are supported. App-managed and external collections can support different operations from user-created collections.
- Calls to retrieve a collection or bulk-retrieve collections with a visitor identity return a limited view. Don't rely on these calls to retrieve item permissions or index limits.

## Use cases

- [Set up a tutorials collection with references to categories and authors](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/sample-flows.md#set-up-a-tutorials-collection-with-references-to-collections-for-categories-and-authors).
- [Add draft/publish functionality to a collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/sample-flows.md#add-draftpublish-functionality-to-a-collection).
- [Rename a collection field without changing its other properties](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/sample-flows.md#rename-a-field-without-replacing-its-definition).

## Terminology

- Collection definition: The fields, data types, permissions, and plugins that describe a collection.
- Reference field: A field that links an item to an item in another collection. A multi-reference field links to multiple items.
- Collection plugin: Configuration that extends a collection's behavior, such as publication status or URL generation.

