Subchapter 8.28
references/cms/cms-schema-management.mdMarkdown6 KBView on GitHub
Standard call shape (every curl below). The
<AUTH>placeholder is shorthand forAuthorization: Bearer <TOKEN>only. Body-bearing requests also needContent-Type: application/json.
This recipe covers managing the structure (schema) of Wix CMS collections using the REST API.
e593b0bd-b783-45b8-97c2-873d42aacaf4)Lightweight listing (recommended for existence checks):
curl -X GET \
'https://www.wixapis.com/wix-data/v2/collections?fields=displayName' \
-H 'Authorization: <AUTH>'Full listing (includes all field schemas):
curl -X GET \
'https://www.wixapis.com/wix-data/v2/collections' \
-H 'Authorization: <AUTH>'Collection Types: NATIVE (user-created), WIX_APP (Wix app collections), BLOCKS_APP, EXTERNAL
Endpoint: GET /wix-data/v2/collections/{collectionId}
curl -X GET \
'https://www.wixapis.com/wix-data/v2/collections/Products' \
-H 'Authorization: <AUTH>'Endpoint: POST /wix-data/v2/collections
{
"collection": {
"id": "Products",
"displayName": "Products",
"fields": [
{"key": "title", "displayName": "Title", "type": "TEXT", "required": true},
{"key": "price", "displayName": "Price", "type": "NUMBER"},
{"key": "description", "displayName": "Description", "type": "TEXT"},
{"key": "inStock", "displayName": "In Stock", "type": "BOOLEAN"}
],
"permissions": {
"insert": "ADMIN",
"update": "ADMIN",
"remove": "ADMIN",
"read": "ANYONE"
}
}
}Endpoint: POST /wix-data/v2/collections/create-field
{
"dataCollectionId": "Products",
"field": {
"key": "sku",
"displayName": "SKU",
"type": "TEXT",
"description": "Product SKU code"
}
}Warning: This permanently deletes all data stored in this field across all items.
Endpoint: POST /wix-data/v2/collections/delete-field
{
"dataCollectionId": "Products",
"fieldKey": "sku"
}Endpoint: PATCH /wix-data/v2/collections/{collectionId}
{
"dataCollection": {
"id": "Products",
"displayName": "Product Catalog"
}
}This works for displayName/displayField. Permission updates currently fail with WDE0075: Not recognized role provided in permissions. Use the full-replace endpoint below to update a collection’s permissions.
To change permissions on an existing collection, use the full-replace endpoint instead (UpdateDataCollection, not PatchDataCollection) — it requires the collection’s current revision and full fields array (get both from a GET first), but it does work:
Endpoint: PUT /wix-data/v2/collections
{
"collection": {
"id": "Products",
"revision": "3",
"displayName": "Product Catalog",
"fields": [ /* the collection's full current non-system fields, from GET */ ],
"permissions": {
"insert": "ADMIN",
"update": "ADMIN",
"remove": "ADMIN",
"read": "SITE_MEMBER"
}
}
}Don’t delete and recreate a collection just to change its permissions — this full-replace call is the working path.
| Type | Description | Example Value |
|---|---|---|
TEXT | String | "Hello World" |
NUMBER | Numeric | 99.99 |
BOOLEAN | True/false | true |
DATE | Date only | "2024-01-15" |
DATETIME | Date and time | { "$date": "2024-01-15T10:00:00.000Z" } |
IMAGE | Image reference | "wix:image://v1/..." |
MEDIA_IMAGE | Wix Media Image | { "id": "<mediaId>", "url": "http://...", "height": 640, "width": 480, "altText": "Picture" } |
MEDIA_VECTOR_ART | Wix Media Vector Art | { "uri": "wix:vector://v1/...", "viewBox": "0 0 100 100", "contentType": "shape", "svgContent": "<svg>...</svg>" } |
URL | Web URL | "https://example.com" |
RICH_TEXT | HTML content | "<p>Rich text</p>" |
ARRAY_STRING | Array of strings | ["tag1", "tag2"] |
OBJECT | JSON object | {"key": "value"} |
REFERENCE | Single reference | Item ID string |
MULTI_REFERENCE | Multiple references | Array of IDs |
| Role | Description |
|---|---|
ANYONE | All visitors (including anonymous) |
SITE_MEMBER | Logged-in site members |
SITE_MEMBER_AUTHOR | Members who created the item |
PRIVILEGED | Access to collection is controlled per role |
ADMIN | Site admins only |
| Error | Cause | Solution |
|---|---|---|
WDE0110 | Wix CMS (Wix Data) app is not installed on the site | Install it: POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install with body {"tenant":{"tenantType":"SITE","id":"<SITE_ID>"},"appInstance":{"appDefId":"e593b0bd-b783-45b8-97c2-873d42aacaf4"}}, then retry. See the Install Wix Apps recipe. |