CMS Data Items CRUD

Download skillThe skill is a reference md and part of wix-manage skill. You can use the following command to add the full wix-manage skill to your project:
Copy

Standard call shape (every curl below). The <AUTH> placeholder is shorthand for Authorization: Bearer <TOKEN> only. Body-bearing requests also need Content-Type: application/json.

This recipe covers Create, Read, Update, Delete (CRUD) operations for Wix CMS data items, plus count, upsert, truncate, aggregate, and reference-field links.

Prerequisites

  1. Wix CMS enabled on the site (appDefId: e593b0bd-b783-45b8-97c2-873d42aacaf4)
  2. Collections already created (see CMS Schema Management)
  3. API access with CMS permissions

Required APIs

  • Data Items API: REST

Know the Schema First

Before inserting or updating items, you need to know the collection's field names and types. If you don't already know the schema:

  1. Query existing items - Fetch a few items to infer field names from the data
  2. Get collection schema - Use GET https://www.wixapis.com/wix-data/v2/collections/{dataCollectionId} for full field definitions, including plugins — don't omit the plugins field when fetching or listing schemas
  3. List collections - Use GET https://www.wixapis.com/wix-data/v2/collections?fields=displayName,plugins to see what collections exist (see Schema Management)

It may be, that user refers to schema by its displayName rather than id, if collection is not found list all collections to find the right id (dataCollectionId) to use.

Check for the Draft Items plugin. If the collection's plugins include the Draft Items plugin, this collection gates items behind a draft/publish workflow. Stop and load CMS Draft & Publish Workflow before making any data changes, and follow its instructions instead of the plain CRUD flow below for that collection.


Insert Data Item

Endpoint: POST https://www.wixapis.com/wix-data/v2/items

Request Body:

Copy

Response:

Copy

Bulk Insert Items

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/insert

Request Body:

Copy

Query Data Items

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/query

Basic Query:

Copy

Advanced Query with Multiple Conditions:

Copy

Text Search:

Copy

Get Single Item

Endpoint: GET https://www.wixapis.com/wix-data/v2/items/{itemId}?dataCollectionId={collectionId}

Copy

Update Data Item

Endpoint: PUT https://www.wixapis.com/wix-data/v2/items/{itemId}

Request Body:

Copy

Patch Data Item (Partial Update - Single Item)

Endpoint: PATCH https://www.wixapis.com/wix-data/v2/items/{dataItemId}

Unlike Update, this only modifies the specified fields — all other fields remain unchanged.

Note: Only works on user-created collections. Wix app collections (e.g. Wix Stores Products) cannot be patched.

Copy

Bulk Update Items

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/update

There is no update-by-filter endpoint. To update the items matching a filter, query them first (see Query Data Items), then send their ids to bulk update or bulk patch.

Important: Use id (not _id) at the element level. The data object should NOT contain _id.

Copy

Note: This replaces the entire item. Include all fields you want to keep, not just the ones you're changing.

Bulk Patch Items (Partial Update)

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/patch

Unlike bulk update, this only modifies the specified fields - other fields remain unchanged. Use this for partial updates.

Important: This endpoint uses patches array with fieldModifications, NOT dataItems. Do not confuse with bulk update.

Copy

Setting a single REFERENCE field (the value is one item ID; for MULTI_REFERENCE the value shape differs, see the next example):

Copy

Setting a MULTI_REFERENCE field (verified live): the value is an array of item IDs, and SET_FIELD replaces the whole link set. To add links without dropping the existing ones, use Insert Multi-Reference Links instead. A plain string, or APPEND_TO_ARRAY, fails per item with WDE0303 inside a 200 bulk response — check results[].itemMetadata.

Copy

Available actions: SET_FIELD, REMOVE_FIELD, INCREMENT_FIELD, APPEND_TO_ARRAY, REMOVE_FROM_ARRAY

Common error: If you get WDE0080: patches must not be empty, you sent dataItems instead of patches. Use the format above.

Recommended: Use bulk patch instead of bulk update when you only need to change specific fields.

Reference fields: a single REFERENCE field is set like any other value ("venue": "venue-item-id", as above). MULTI_REFERENCE links are written only by a SET_FIELD patch (single or bulk) or by the reference endpoints in Reference Fields below; insert, bulk insert, bulk save, PUT and bulk update all return 200 but silently drop multi-reference values (verified live) — read the item back after any of them.

Delete Data Item

Deletes are irreversible. Confirm with the user before calling either delete endpoint unless the request already names the items to remove.

Endpoint: DELETE https://www.wixapis.com/wix-data/v2/items/{itemId}?dataCollectionId={collectionId}

Copy

Bulk Delete Items

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/remove

Copy

Count Data Items

Count items in a collection, optionally with filters.

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/count

Count All Items:

Copy

Response:

Copy

Count with Filter:

Copy

Count returns only totalCount. When the user needs to know which items match, run Query Data Items with the same filter instead of, or after, counting.

Bulk Save (Upsert)

Insert new items or update existing items in a single operation. This is useful for syncing data.

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/save

Copy
ScenarioAction
No id providedINSERT - Creates new item with generated ID
id provided, doesn't existINSERT - Creates new item with provided ID
id provided, existsUPDATE - Replaces existing item

Warning: When updating, the entire item is replaced. Include all fields you want to keep. Confirm with the user before saving over existing items.

Truncate Collection

Remove all items from a collection.

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/truncate

Copy

Warning: This permanently deletes ALL items in the collection and cannot be undone. Ask the user to confirm before calling it.

Aggregate Data

Perform calculations on collection data using a pipeline of sequential stages. The example shows one group stage; the full set of stages (filter, group, sort, projection, unwindArray, skip, limit) and accumulators is in the Aggregate Pipeline Data Items reference.

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/aggregate-pipeline

Count by Category:

Copy

Operation Comparison

OperationUse CaseBehavior
Bulk InsertAdd new items onlyFails if ID exists
Bulk UpdateUpdate existing itemsFails if ID doesn't exist, replaces entire item
Bulk SaveUpsert (insert or update)Creates or updates based on ID
Bulk PatchPartial updateOnly modifies specified fields

Reference Fields

Reference fields link items across collections. A single REFERENCE field holds one item ID and is set like any other value in insert, update, or patch. A MULTI_REFERENCE field holds many links, and only two kinds of write create them: a SET_FIELD patch on the field (single or bulk), or the reference endpoints below, which add, replace, or remove links without touching the rest of the item. To add a reference field to a collection, see Add a Reference Field.

Warning (verified live): writing IDs into a MULTI_REFERENCE field through insert, bulk insert, bulk save, or PUT update returns 200 and silently drops that field's value — no error is raised. Bulk update is a full-item replace like PUT and does the same: success: true, value dropped (verified live, bulk save on both its insert and update paths). Never trust the write response for reference links: read the item back with includeReferencedItems and confirm the linked items are there.

Linking flow, every time:

  1. Resolve the referring item ID and the referenced item IDs (query by a field value; never guess IDs).
  2. Write the links with the reference endpoints below, or with a SET_FIELD patch on the reference field. If the field already has links, insert-references adds without dropping them; replace-references and SET_FIELD discard the rest — confirm with the user before replacing unless the request says to.
  3. Read the referring item back with Query Data Items and includeReferencedItems: ["<field>"] (or includeReferences: [{ "field": "<field>" }]), and confirm the linked items are present. The write's 200 is not proof; only the read-back is.

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/insert-references

Copy

Replace All References

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/replace-references

Copy

Note: To remove all references, pass an empty array for newReferencedItemIds.

Remove References (Bulk)

Endpoint: POST https://www.wixapis.com/wix-data/v2/bulk/items/remove-references

Copy

Query with Referenced Items Expanded

Endpoint: POST https://www.wixapis.com/wix-data/v2/items/query

Copy

The method article documents the same expansion as "includeReferences": [{ "field": "category" }, { "field": "tags", "limit": 50 }]; both forms work (verified live). Either way the expanded value is an array of item objects (with _id, name, …), not an array of IDs. Without one of these properties a MULTI_REFERENCE field is absent from the returned item, and a single REFERENCE field is returned as the item ID string (it is stored on the item; verified live).

Reference Query Operators

OperatorDescriptionExample
$eqExact match (single reference){ "category": "id" }
$hasSomeHas at least one of{ "tags": { "$hasSome": ["id1", "id2"] } }
$hasAllHas all of{ "tags": { "$hasAll": ["id1", "id2"] } }

Field Types Reference

TypeDescriptionExample Value
TEXTString"Hello World"
NUMBERNumeric99.99
BOOLEANTrue/falsetrue
DATEDate only"2024-01-15"
DATETIMEDate and time{ "$date": "2024-01-15T10:00:00.000Z" }
IMAGEImage reference (HTTP url or wix:image://v1/{mediaId}/{friendlyName})"wix:image://v1/3f72369f2219e2ee853e9e3df0217ce1.jpg/Colorful%20Business%20Cards.jpg"
VIDEOVideo reference (HTTP url or wix:video://v1/{mediaId}/{friendlyName})"wix:video://v1/11062b_484182533ede4b9a81329daf20238867/Sketching%20Design%20Concepts#posterUri=11062b_484182533ede4b9a81329daf20238867f000.jpg&posterWidth=1920&posterHeight=1080"
DOCUMENTDocument reference (HTTP url or wix:document://v1/{mediaId})"wix:document://v1/..."
MEDIA_IMAGEWix Media Image{ "id": "<mediaId>", "url": "http://...", "height": 640, "width": 480, "altText": "Picture" }
MEDIA_VECTOR_ARTWix Media Vector Art{ "uri": "wix:vector://v1/...", "viewBox": "0 0 100 100", "contentType": "shape", "svgContent": "<svg>...</svg>" }
URLWeb URL"https://example.com"
RICH_TEXTHTML content"<p>Rich text</p>"
EMAILEmail"example@wix.com"
RICH_CONTENTStructured contentComplex object
ADDRESSAddress objectAddress fields
ARRAY_STRINGArray of strings["tag1", "tag2"]
OBJECTJSON object{"key": "value"}
REFERENCESingle referenceItem ID string
MULTI_REFERENCEMultiple references. Write with a SET_FIELD patch (array of item IDs, replaces the set) or the reference endpoints (add / replace / remove); expand in queries with includeReferencedItems or includeReferencesWrite: array of item IDs (SET_FIELD). Read: absent unless expanded with includeReferencedItems / includeReferences, then an array of item objects

Query Operators

OperatorDescriptionExample
$eqEqual{ "status": { "$eq": "active" } }
$neNot equal{ "status": { "$ne": "archived" } }
$gtGreater than{ "price": { "$gt": 100 } }
$gteGreater or equal{ "price": { "$gte": 100 } }
$ltLess than{ "price": { "$lt": 50 } }
$lteLess or equal{ "price": { "$lte": 50 } }
$inIn array{ "status": { "$in": ["active", "pending"] } }
$containsContains string{ "title": { "$contains": "pro" } }
$startsWithStarts with{ "title": { "$startsWith": "Wireless" } }
$andAll conditions{ "$and": [{...}, {...}] }
$orAny condition{ "$or": [{...}, {...}] }

Pagination

Offset-Based (Simple)

Copy

Cursor-Based (Large Datasets)

Copy

Error Handling

Recovering from WDE0110

WDE0110 means the Wix CMS (Wix Data) app is not installed on the site. If the user has explicitly asked to install it, install the app before retrying the data-item request:

Copy
Copy

After the installation succeeds, retry the original POST https://www.wixapis.com/wix-data/v2/items request. If the user only asks what the error means or how to fix it, explain this installation step and ask for confirmation before performing the install.

ErrorCauseSolution
COLLECTION_NOT_FOUNDInvalid collection IDCheck collection exists
ITEM_NOT_FOUNDInvalid item IDVerify item exists
VALIDATION_ERRORInvalid field valueCheck field types
DUPLICATE_KEYDuplicate unique fieldUse unique values
PERMISSION_DENIEDInsufficient accessCheck API permissions
WDE0007Bulk update: wrong ID field nameUse id not _id at element level
WDE0080Validation failed (multiple causes)Bulk update: don't include _id in data; Bulk patch: use patches array not dataItems
WDE0303Multi-reference field value is not an array of item IDs (a single ID string, or APPEND_TO_ARRAY); reported per item inside a 200 bulk responseSend "value": ["id1", "id2"] with SET_FIELD, or use the reference endpoints
WDE0110Wix CMS (Wix Data) application is not installedInstall application with appDefId: e593b0bd-b783-45b8-97c2-873d42aacaf4

Last updated: 30 September 2026

Did this help?