Standard call shape (every curl below). The <AUTH> placeholder is shorthand for Authorization: Bearer <TOKEN> only. Every actual call ALSO needs wix-site-id: <SITE_ID> and (for body-bearing requests) Content-Type: application/json. POST/PATCH against wix-data/* returns 403 without wix-site-id — recipe examples below show <AUTH> only for brevity, but the header is required on every call you make. Token: npx @wix/cli@latest token --site "$SITE_ID".
This recipe covers linking CMS collections together using reference fields.
| Type | Field Type | Relationship | Example |
|---|---|---|---|
| Single Reference | REFERENCE | One-to-one, Many-to-one | Product → Category |
| Multi-Reference | MULTI_REFERENCE | One-to-many, Many-to-many | Product → Tags |
Endpoint: POST /wix-data/v2/collections/create-field
Endpoint: POST /wix-data/v2/collections/create-field
Endpoint: POST /wix-data/v2/bulk/items/insert-references
Endpoint: POST /wix-data/v2/items/replace-references
Note: To remove all references, pass an empty array for newReferencedItemIds.
Endpoint: POST /wix-data/v2/bulk/items/remove-references
Endpoint: POST /wix-data/v2/items/query
| Operator | Description | Example |
|---|---|---|
$eq | Exact match (single reference) | { "category": "id" } |
$hasSome | Has at least one of | { "tags": { "$hasSome": ["id1", "id2"] } } |
$hasAll | Has all of | { "tags": { "$hasAll": ["id1", "id2"] } } |