Wix Headless
WixOfficialPublished by Wix
- Skill
- Tool integration
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The wix-headless skill acts as an orchestrator for integrating Wix business services (such as Stores, Bookings, and CMS) into a headless frontend architecture. It handles the end-to-end configuration of the Wix backend, including app installation, content seeding, and the generation of a tailored SDK integration guide. Depending on the project type (managed, self-managed, or stripe), the skill can either provide a comprehensive integration guide for the user to implement or, in managed scenarios, actively scaffold, wire, and deploy the frontend project.
What it does
- Infers required Wix capabilities based on user intent and project context.
- Installs necessary Wix apps and seeds backend content automatically.
- Generates a custom SDK integration guide for calling Wix services from the frontend.
- Scaffolds or connects existing frontend projects to Wix for managed hosting.
- Handles project-type-specific authentication and deployment workflows.
- Provides a mechanism to relay feedback to Wix regarding the headless experience.
When to use it
- When you need to integrate Wix business services into a custom-built headless frontend.
- When you want to automate the setup and content seeding of a Wix backend.
- When you are building a new site on Wix infrastructure and need a scaffolded frontend.
- When you have an existing frontend design and need to wire it to Wix business capabilities.
- When working with Stripe Projects and requiring a Wix backend configuration.
Advantages
- Reduces manual configuration by automating app installation and content seeding.
- Provides a clear, actionable SDK integration guide tailored to your specific capabilities.
- Supports multiple project architectures including managed, self-managed, and Stripe-based setups.
- Ensures consistent backend setup by following verified inline recipes.
- Simplifies the transition from design to a functional, Wix-powered headless site.
Usage examples
- “Set up a Wix Headless backend for a store with products and a blog.”
- The skill will install the Stores and Blog apps, seed sample products and posts, and provide an SDK guide for fetching this data in your frontend.
- “I have an existing design; connect it to Wix and host it on their managed infrastructure.”
- The skill will initialize the project, wire the existing UI to the necessary Wix business services, and prepare it for release on Wix.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wix/wix-headless/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wix-headless.zip -d .agents/skills
Documentation by Wix
Wix Headless
This skill connects Wix business services to a Wix Headless frontend. Its core job is to configure the Wix backend: infer the needed capabilities, install the Wix apps, seed the backend content, and produce an SDK-integration guide describing how to call Wix from the frontend.
What happens with the frontend depends on the project type and operation:
Backend-only (self-managed, stripe, or a managed "just set up the backend" run) — the skill emits the SDK guide as its final output; the host owns the frontend, build, and hosting.
Managed create / connect — the skill also owns the frontend: it scaffolds a new project (create) or attaches Wix to an existing one (connect), wires it to the backend using that same guide, builds, and releases to Wix. (There is no Designer or template library — the frontend is built ad-hoc to intent.)
On a backend-only run the skill does not own the project scaffolding. When the work needs a frontend, scaffold it according to user intent — framework and structure follow the prompt; the skill's job is the Wix backend plus the emitted SDK guide describing how to call Wix from whatever frontend exists, not choosing or generating the app. This is the norm for a stripe run: the project is provisioned via Stripe Projects (credentials land in
.env— seestripe/AUTHENTICATION.md), the skill configures the backend and emits the guide, and the live site is finalized perstripe/DEPLOYMENT.md— while the frontend is scaffolded and wired to intent, by the host.
Project types
The skill behaves identically across project types except for authentication and deployment, which are isolated in a per-type folder under references/:
| Project type | Hosting | Authentication & deployment live in |
|---|---|---|
managed | Wix infrastructure (maintained by Wix) | references/managed/ |
self-managed | the user's own host (TBD) | references/self-managed/ |
stripe | the user's own host, provisioned via Stripe Projects | references/stripe/ |
Everything else — Discovery, Setup, Seed, the SDK handoff — is project-type-agnostic and refers to "the provided authentication mechanism" rather than any specific method.
Resolving the project type
Resolve the type before Discovery, in this order — stop at the first that decides:
Caller-provided. If the host/caller passed a project type (
managed|self-managed|stripe), use it. An explicit value always wins.Detect from project signals (on disk). Check the working directory (read-only):
stripe—.envcarriesWIX_WIX_CLIENT_ID/WIX_WIX_CLIENT_SECRET/WIX_WIX_METASITE_ID(or the plainWIX_*fallback). This is the Stripe-Projects fingerprint.managed— a Wix CLI project:wix.config.jsonpresent, or a.wix/directory, or@wix/cli/@wix/astroinpackage.json.self-managed— a frontend project on disk (e.g.package.jsonwith a bundler/framework) with neither the Stripe.envfingerprint nor the Wix-CLI markers above.
Detect from user intent. If disk is inconclusive, read the prompt:
managed— "managed", "host on Wix", "Wix-hosted", "deploy to Wix", "wix release".stripe— "stripe projects", "I added Wix via Stripe", a Stripe-Projects context.self-managed— "self-hosted", "my own host", names a non-Wix host, "I'll deploy it myself".
Ask. If signals are absent or conflict, ask the user which type applies — don't guess.
Hold the resolved type in scratch; it selects <TYPE_DIR> (see Path resolution). Note self-managed is TBD — once resolved to it, the auth step will stop with a clear "not wired yet" error.
Resolving the operation (managed only)
create/connect/iterate are managed-only. For managed, resolve the operation by intent first, directory second — never let an empty directory override what the user is asking for. Check iterate first (it's decided by an unambiguous on-disk signal):
iterate→references/managed/CONNECT.md. The project is already connected to Wix — awix.config.json(or.wix/) is already present — and the owner wants to add or change capabilities. Same flow asconnect, but §1 skipsinitand reuses the existingwix.config.json; never re-initan already-connected project.connect→references/managed/CONNECT.md. The user brings a design not yet connected to Wix and wants it wired: a frontend project on disk without awix.config.json, or a brought-in/fetched design (a.zip/folder/file you unzip or read, a design-file URL, a Claude-Design/v0/Lovable export), or language like "connect this / implement this design (… connecting to Wix) / host this on Wix / deploy this to Wix / add Wix Headless to this project". A brought-in or fetched design isconnecteven when the current directory is empty — the design arrives from elsewhere (zip/fetch/URL), so emptiness at trigger time is not a create signal. (CONNECT.mdstep 1 places the brought design into CWD, theninits it.)create→references/managed/CREATE.md. The user wants a new site built from a prompt with nothing brought in — "build me a site / store / blog…", no design file, no project on disk.backend-only— the user only wants the backend configured (no frontend work). → the shared spine + emit the SDK handoff.
For self-managed and stripe, the operation is always backend-only (the host owns the frontend). Only when there is genuinely no brought-in design and no connect language does directory emptiness decide: empty → create; an existing frontend on disk → connect.
Preconditions (the host provides these — we read, never create)
The project type —
managed|self-managed|stripe— provided by the caller, else detected from project signals / user intent (see Project types § "Resolving the project type"), else asked. It selects<TYPE_DIR>(see Path resolution).A Wix metasite + a headless OAuth app exist, and credentials are available — obtained via the project type's
AUTHENTICATION.md. The skill needs a bearer token authorized for the metasite and the metasite id.The user intent — free text describing what Wix should power ("add a store", "blog + contact form", "persist my app's data").
(Optional) the project on disk — read-only, to sharpen brand/capability inference.
If the credentials are absent, the Wix backend isn't reachable — stop with a clear error.
What this skill does
Always open DISCOVERY.md first (it's agnostic — capability/brand/intent inference + the imagery gate, no auth). Then route by project type + operation:
Backend-only (self-managed, stripe, or managed backend-only) — the lean spine:
Discovery (
references/DISCOVERY.md) — infer capabilities + brand + intent + imagery.Setup (
references/SETUP.md) — install the Wix apps those capabilities need.Seed (
references/SEED.md) — create the backend content (+ entity images if imagery is on).Handoff (
references/SDK_HANDOFF.md) — after Setup and Seed, emit the integration guide: SDK bootstrap, per-capability call shapes, the seeded IDs, and the@wix/*package list.Finalize deployment (
<TYPE_DIR>/DEPLOYMENT.md) — run the project-type's finalize steps.
Throughout any run — if the user asks to send feedback to Wix, complains/gets frustrated, or the
run hits any real friction (a confusing error, a doc gap, a tooling dead end, a workaround you had to
invent — it doesn't need to repeat), offer to relay it to Wix per references/FEEDBACK.md. Default
to offering rather than waiting to be asked. Every flow's finalize step (<TYPE_DIR>/DEPLOYMENT.md /
managed/CREATE.md / managed/CONNECT.md) ends with the same checkpoint — treat it as a required
self-check, not optional. Send only after an explicit yes — never automatically.
Managed create / connect / iterate — after Discovery, hand the whole run to the managed flow:
create →
references/managed/CREATE.md(scaffold → Setup → Seed → build the frontend → release).connect →
references/managed/CONNECT.md(init → Setup → Seed → wire the existing UI → release).iterate →
references/managed/CONNECT.md— the project is already connected, so it reuses the existingwix.config.json(noinit). Setup / Seed / wiring are incremental: it may already be set up and seeded from a prior run, so the agent checks current state first (installed apps, already-seeded content, existing wiring) and applies only the delta the new intent needs — never blindly re-installing or re-seeding. Re-release only if the frontend build output changed. These reuse the sameSETUP.md/SEED.md/SDK_HANDOFF.md, but apply the SDK guide to build/wire the frontend themselves rather than emitting it, and release viamanaged/DEPLOYMENT.md.
Each Wix call uses the universal call shape (SETUP.md §1) with $TOKEN/$SITE_ID obtained per <TYPE_DIR>/AUTHENTICATION.md. The skill runs non-interactively except for the one imagery question (and asking the project type if it can't be resolved).
Don't smoke-test the frontend locally unless the user asks to verify. The deliverable is the built-and-released site (managed) or the SDK guide (backend-only) — not a local test report. By default do not start a dev server (
wix dev/astro dev/npm run dev) to curl pages, drive the cart / booking / login flow, or launch a headless browser: correctness comes from following the recipes, real errors surface atwix build/wix release, and a headless run can't complete an interactive login or a real payment anyway — so these loops routinely burn minutes of wall for little signal (this is distinct from, and in addition to, the "release once at the very end" rule — that one only bans extra build+release cycles, not dev-server testing). Only spin up a dev server and smoke-test when the user's prompt explicitly asks to verify / test / confirm it works — and then keep it to a single lightweight pass (pages compile and render), not a full purchase/booking/login drive. The one post-release check in<TYPE_DIR>/DEPLOYMENT.mdis the sanctioned verification.
Donations exception to the smoke-test policy above: for a build that accepts donations, follow
the bounded anonymous API handoff check in references/inline-recipes/how-to-code-donations.md
before claiming it works. It does not authorize a payment or campaign mutation, and does not require
a dev-server testing loop. That recipe also defines the separate hosted-checkout and payment checks.
Path resolution
Compute <SKILL_ROOT> from this file (<SKILL_ROOT>/SKILL.md — strip /SKILL.md); hold the absolute path in scratch. Then resolve the project type to its folder and hold it too:
<TYPE_DIR>=<SKILL_ROOT>/references/<projectType>/— one ofmanaged/,self-managed/,stripe/.
| What | Path |
|---|---|
| Vertical index (intent matching + per-vertical site spec) | <SKILL_ROOT>/references/CAPABILITIES.md |
| Discovery (infer capabilities + brand + intent; existing site → the Dynamic Context call in §1) | <SKILL_ROOT>/references/DISCOVERY.md |
| Setup (install apps) | <SKILL_ROOT>/references/SETUP.md |
| Seed (create backend content) | <SKILL_ROOT>/references/SEED.md |
| SDK-integration handoff (emitted, or applied by create/connect) | <SKILL_ROOT>/references/SDK_HANDOFF.md |
| Image generation (opt-in; agnostic) | <SKILL_ROOT>/references/IMAGE_GENERATION.md |
| Design — fallback visual quality bar for the built frontend, when the user gave no design direction of their own (managed create only) | <SKILL_ROOT>/references/DESIGN.md |
| Content — fallback copy quality bar for the built frontend, when the user gave no copy/voice direction of their own (managed create only) | <SKILL_ROOT>/references/CONTENT.md |
| Experience overlays — a vertical's own design + copy bar on top of DESIGN/CONTENT (optional per vertical; read when that vertical is loaded) | <SKILL_ROOT>/references/inline-recipes/experience-<vertical>.md (today: experience-store.md, experience-donations.md) |
| AI features — text/chat + embeddings (opt-in; agnostic) | <SKILL_ROOT>/references/AI_FEATURES.md |
| Feedback — relay the user's headless-experience feedback to Wix (opt-in; user-approved) | <SKILL_ROOT>/references/FEEDBACK.md |
Authentication — obtain $TOKEN/$SITE_ID/clientId (project-type-specific) | <TYPE_DIR>/AUTHENTICATION.md |
| Deployment — finalize the live site (project-type-specific) | <TYPE_DIR>/DEPLOYMENT.md |
| Managed create flow (scaffold a new project) | <SKILL_ROOT>/references/managed/CREATE.md |
| Managed connect flow (wire an existing project) | <SKILL_ROOT>/references/managed/CONNECT.md |
| Frontend-axis references (how a frontend wires to Wix) | <SKILL_ROOT>/references/astro.md, non-astro.md |
Start a run by opening DISCOVERY.md. The flow files (CAPABILITIES, DISCOVERY, SETUP, SEED, SDK_HANDOFF, IMAGE_GENERATION, AI_FEATURES) are project-type-agnostic; the per-type specifics live under <TYPE_DIR>/ (AUTHENTICATION.md, DEPLOYMENT.md, and — managed only — CREATE.md/CONNECT.md).
Where the how comes from
This skill has no skill upstream — the how is read from the live Wix docs at dev.wix.com/docs. Read-priority: a page this skill links is read by curl-ing its .md twin directly (first priority — don't re-discover a curated link with search); the Wix MCP doc/search tools are second priority, for finding pages the skill doesn't link or as a fallback if a fetch fails. (Append .md to any docs URL for raw markdown; menu pages list child links, content pages carry the schema.)
Doc discovery is the shared fallback for both tracks — never the first move. Each track's primary source is its pinned material (below); when that doesn't cover what you need, fall back to references/DOC_DISCOVERY.md — a semantic doc-search + schema lookup that works with or without the Wix MCP.
Seed reads each capability's create flow from its inline recipe — a self-contained local
inline-recipes/setup-*.md(mapped per capability inSEED.md§ "What to seed per capability") that inlines the calls and supersedes the REST doc pages, so read it and seed from it alone. Only a capability with no inline recipe (e.g.coupons) falls back to doc discovery (DOC_DISCOVERY.md).Handoff links the SDK docs for each capability's API shape, and supplies the runtime package set from the inlined map in
SDK_HANDOFF.md(the SDK.mdpages don't expose@wix/*import strings to navigation, so packages are mapped, not navigated).
Setup carries its app-install call (and the appDefId constants) inline in SETUP.md; CAPABILITIES.md is the vertical index that lets Discovery match intent and declares, per built vertical, the Required site features + Implementation checklist that Seed enables (backend-backed features) and the Handoff carries into the guide (so the host builds a complete site, not a bare data dump). This skill carries the what (which capabilities, how much content, what a finished site includes) and reads the how off the docs.
Files
- ATTRIBUTION.mdAdded by AutoGineer811 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md16.0 KiB
- references/AI_FEATURES.md10.3 KiB
- references/CAPABILITIES.md20.6 KiB
- references/CONTENT.md3.8 KiB
- references/DESIGN.md5.3 KiB
- references/DISCOVERY.md8.2 KiB
- references/DOC_DISCOVERY.md2.5 KiB
- references/FEEDBACK.md8.0 KiB
- references/IMAGE_GENERATION.md7.3 KiB
- references/SDK_HANDOFF.md22.5 KiB
- references/SEED.md21.6 KiB
- references/SETUP.md5.1 KiB
- references/astro.md17.3 KiB
- references/inline-recipes/experience-donations.md8.0 KiB
- references/inline-recipes/experience-store.md8.2 KiB
- references/inline-recipes/how-to-code-a-blog.md18.8 KiB
- references/inline-recipes/how-to-code-a-store.md52.6 KiB
- references/inline-recipes/how-to-code-bookings.md28.2 KiB
- references/inline-recipes/how-to-code-cms.md15.3 KiB
- references/inline-recipes/how-to-code-donations.md10.9 KiB
- references/inline-recipes/how-to-code-events.md21.4 KiB
- references/inline-recipes/how-to-code-forms.md43.7 KiB
- references/inline-recipes/how-to-code-members-astro.md11.7 KiB
- references/inline-recipes/how-to-code-members-custom-login.md15.0 KiB
- references/inline-recipes/how-to-code-members-non-astro.md12.4 KiB
- references/inline-recipes/how-to-code-portfolio.md11.7 KiB
- references/inline-recipes/how-to-code-pricing-plans.md18.3 KiB
- references/inline-recipes/how-to-code-rentals.md19.6 KiB
- references/inline-recipes/how-to-code-restaurant-orders.md16.8 KiB
- references/inline-recipes/how-to-code-restaurant-reservations.md19.0 KiB
- references/inline-recipes/how-to-code-restaurants.md11.9 KiB
- references/inline-recipes/setup-blog.md14.2 KiB
- references/inline-recipes/setup-bookings.md19.8 KiB
- references/inline-recipes/setup-cms.md20.5 KiB
- references/inline-recipes/setup-donations.md981 B
- references/inline-recipes/setup-events.md14.1 KiB
- references/inline-recipes/setup-forms.md18.7 KiB
- references/inline-recipes/setup-online-store.md17.0 KiB
- references/inline-recipes/setup-portfolio.md13.2 KiB
- references/inline-recipes/setup-pricing-plans.md17.1 KiB
- references/inline-recipes/setup-rentals.md24.6 KiB
- references/inline-recipes/setup-restaurant-experiences.md7.6 KiB
- references/inline-recipes/setup-restaurant-orders.md19.7 KiB
- references/inline-recipes/setup-restaurant-reservations.md11.6 KiB
- references/inline-recipes/setup-restaurants.md12.7 KiB
- references/managed/AUTHENTICATION.md4.2 KiB
- references/managed/CONNECT.md5.6 KiB
- references/managed/CREATE.md9.9 KiB
- references/managed/DEPLOYMENT.md8.5 KiB
- references/non-astro.md10.4 KiB
- references/self-managed/AUTHENTICATION.md1.2 KiB
- references/self-managed/DEPLOYMENT.md1.1 KiB
- references/stripe/AUTHENTICATION.md4.2 KiB
- references/stripe/DEPLOYMENT.md5.3 KiB
- scripts/bootstrap.mjsScript6.2 KiB
references/inline-recipes/how-to-code-bookings.md
name: "How to Code Bookings" description: The frontend read/booking contract for a Wix Bookings (Services V2) site — which SDK modules to import, how to list services, fetch appointment vs class availability, render the schema-driven booking form, and run the createBooking → ecom Cart V2 → checkout-or-place sequence. Specifies the how (modules + exact calls + the failure modes the docs omit); which services to render and how the page looks come from the request.
RECIPE: How to Code a Wix Bookings Frontend (Services V2 + ecom Cart V2 checkout)
A concise contract for writing the frontend code of a Bookings site: listing services, picking an availability slot, collecting the booking form, and completing the booking. This recipe is the how (which modules, which calls, which fields), not the what — which services to show, how the page looks, and the framework are decided by the request you're fulfilling.
This recipe is for CODING the booking flow, not for seeding it. It assumes a Services V2 backend already exists (services with a category, staff resources, durations/prices, and — for classes — scheduled sessions). It says nothing about creating services — only how to read and book them from frontend code.
⚠️ Reading rule — always append
.md?apiView=SDKto every doc link below. The Wix docs render two views of the same page. The bare / REST view showsid; the?apiView=SDKview shows_id— and the SDK is what your frontend calls. Reading the REST view by mistake is the most common source of theservice.id-is-undefinedbug. If a field name surprises you, you're probably reading the REST view — re-open it with?apiView=SDK. Discover any shape not pinned here withSearchWixSDKDocumentation, not by guessing a URL.
The modules and the client (read this first)
Constants (a frontend file, e.g. src/services/constants.ts):
Wix Bookings app id (the cart's
catalogReference.appId):13d21c63-b5ec-5912-8397-c3a5ddb27a97Staff-member resource type id (the ANY_RESOURCE fallback + staff filtering):
1cd44cf8-756f-41c3-bd90-3e2ffcaf1155
⚠️ CRITICAL: there is NO availability namespace. import { availability } / availability.queryAvailability does not exist and fails. Appointment availability is availabilityTimeSlots.listAvailabilityTimeSlots; class availability is eventTimeSlots.listEventTimeSlots — two different namespaces. Import only:
| Need | Package | Module |
|---|---|---|
| Services (list, query by slug) | @wix/bookings | services |
| Appointment availability | @wix/bookings | availabilityTimeSlots |
| Class availability | @wix/bookings | eventTimeSlots |
| Categories (optional filter) | @wix/bookings | categoriesV2 |
| Locations (optional filter) | @wix/bookings | services (queryLocations) |
| Create the booking | @wix/bookings | bookings (createBooking) |
| Cart that holds the seat (add / calc / place) | @wix/auto_sdk_ecom_cart-v-2 | createCart, calculateCart, placeOrder |
| Redirect to hosted checkout | @wix/redirects | redirects |
| Booking-form schema | @wix/forms | forms (getFormSummary) |
Never use confirmBooking (see Creating the booking) — the ecom cart confirms the seat here, not a server-side confirm.
Auth / client — framework split:
Astro (Wix-managed): authentication is ambient. Call the modules directly from server components / backend routes and from browser islands (the
@wix/astrovisitor client) — nocreateClient, noOAuthStrategy, noclientId. Nothing here needs elevation (the reads below all run as the visitor); a public-envclientIdread in.astroSSR isundefinedat server render → 500, so don't build anOAuthStrategyclient there.Non-Astro (Vite/React/Vue/static): build one manual visitor client and reuse it:
import { createClient, OAuthStrategy } from '@wix/sdk'; import { services, availabilityTimeSlots, eventTimeSlots, categoriesV2, bookings } from '@wix/bookings'; import { createCart, calculateCart, placeOrder } from '@wix/auto_sdk_ecom_cart-v-2'; import { redirects } from '@wix/redirects'; import { forms } from '@wix/forms'; const client = createClient({ modules: { services, availabilityTimeSlots, eventTimeSlots, categoriesV2, bookings, createCart, calculateCart, placeOrder, redirects, forms }, auth: OAuthStrategy({ clientId: /* the project's PUBLIC OAuth client id */ }), });The
clientIdis public, not a secret. A mis-wired public env var inlines asundefinedand 400s every call.
The shapes you read (field cheat-sheet)
V2 service objects are flat. The exact paths the frontend reads, and the plausible-wrong sibling each is mistaken for:
// services.queryServices(...).find() → result.items[] (filter out s.hidden)
service = {
_id, // links · cart catalogItemId base (NOT .id → undefined)
name, description, tagLine,
type, // "APPOINTMENT" | "CLASS"
hidden, // skip hidden services
mainSlug: { name }, // the URL slug (NOT service.slug; fallback supportedSlugs[0].name)
schedule: { id, availabilityConstraints: { sessionDurations: [60] } }, // duration = sessionDurations[0] (minutes)
payment: { fixed: { price: { value, currency } } }, // value is a STRING; currency is the site's
media: { mainMedia: { image } }, // image is a "wix:image://…" string — resolve via media.getImageUrl()
category: { _id }, // the service's category
form: { _id }, // the booking form (fetch via @wix/forms)
bookingPolicy: { cancellationFeePolicy: { enabled } }, // drives the checkout-vs-place decision
staffMemberDetails: { staffMembers: [{ staffMemberId, name }] }, // STAFF_MEMBER_DETAILS conditional field
}
// availabilityTimeSlots.listAvailabilityTimeSlots(...) → result.timeSlots[] (APPOINTMENT)
apptSlot = { localStartDate, localEndDate, scheduleId, location, availableResources } // fields at TOP level (NOT slot.startDate); availableResources may be []
// availableResources[] = { resources: [{ _id, name }] } // NESTED; each resource id is _id NOT id — this is what you read to label/group a slot by its staff/instructor
// eventTimeSlots.listEventTimeSlots(...) → result.timeSlots[] (CLASS)
classSlot = { localStartDate, localEndDate, eventInfo: { eventId } } // carries eventId; NO scheduleId⚠️ CRITICAL: entity ids are _id, NOT id. service._id, booking._id. service.id is undefined in SDK code. This includes the resource objects nested under a slot — slot.availableResources[].resources[]._id (NOT .id); reading .id there silently yields undefined, so grouping/labeling/filtering slots by staff or instructor breaks with no error (an image-led class site rendering blank instructor names/photos is the tell). staffMemberDetails.staffMembers[].staffMemberId is the exception — despite the name it IS the resource GUID (it matches the seed's staff resourceId), and it's the value you filter availability and book by.
The booking features (build the ones the site needs)
Each section is a self-contained feature — implement only the ones the site uses; the only ordering is within the flow (pick a slot → collect the form → book). The minimal path is: list services → pick a slot → submit the form → book.
Listing services (and the _id rule)
Always filter by appId, request STAFF_MEMBER_DETAILS, and call .find():
// Catalog (list):
const { items } = await services
.queryServices({ conditionalFields: ['STAFF_MEMBER_DETAILS'] })
.eq('appId', BOOKING_APP_ID).limit(100).find(); // filter out items where s.hidden
// Single service by slug — the same .eq() builder chain:
const { items: [service] } = await services
.queryServices({ conditionalFields: ['STAFF_MEMBER_DETAILS'] })
.eq('mainSlug.name', slug).eq('appId', BOOKING_APP_ID).limit(1).find();⚠️
queryServicesis a fluent builder — its only argument isQueryServicesOptions(conditionalFields, etc.), NOT a{ query: { filter, paging } }object. Apply theappIdfilter and paging as.eq(...)/.limit(...)chain calls, then.find(). The{query:{filter,paging}}form is the REST body shape; it does not type-check against the SDK ('query' does not exist in type 'QueryServicesOptions') — if the SDK reference page shows an object-param form, trust the installed builder, not that doc example.appIdfilter is required — omitting it returns services from other apps / nothing useful.Read V2 flat fields (cheat-sheet): slug
mainSlug.name(notservice.slug),name/description/tagLine, durationschedule.availabilityConstraints.sessionDurations[0], pricepayment.fixed.price.value(a string). A missing service usually means it wasn't seeded with a category (the visibility invariant), not a query bug.
Filtering — location & category (both auto-skip)
Both filter the catalog query and re-render. Show each filter only when there is more than one choice.
Category:
categoriesV2.queryCategories().find()→result.items[{ _id, name }]. Non-fatal — wrap in try/catch and render without the bar if it fails. Show the bar only whenitems.length > 1(the seed creates at least one category, so a single-category site shows no bar). Filter:filter['category.id'] = { $eq: categoryId }; a service's category isservice.category._id.Location:
services.queryLocations()→{ businessLocations, customLocations: { exists }, customerLocations: { exists } }. Show the selector only when the total count > 1. A real business id →filter['locations.business.id'] = { $hasSome: [id] }; the synthetic"custom"/"customer"→filter['locations.type'] = { $hasSome: ['CUSTOM'|'CUSTOMER'] }. Carry the chosen location to the slots step so availability is scoped too (next section).
Availability (the slots step) — appointment vs class
⚠️ CRITICAL: APPOINTMENT and CLASS use different namespaces, and the slot fields are at the TOP level.
// APPOINTMENT — serviceId is a single GUID STRING:
const { timeSlots } = await availabilityTimeSlots.listAvailabilityTimeSlots({
serviceId, fromLocalDate, toLocalDate, timeZone, bookable: true, cursorPaging: { limit: 100 },
// staff (optional): resourceTypes: [{ resourceTypeId: STAFF_MEMBER_RESOURCE_TYPE_ID, resourceIds: [staffMemberId] }],
// includeResourceTypeIds: [STAFF_MEMBER_RESOURCE_TYPE_ID],
// one business location: locations: [{ _id: locationId, locationType: 'BUSINESS' }],
}); // slots: result.timeSlots[] — localStartDate/localEndDate/scheduleId at TOP level
// CLASS — different namespace, PLURAL serviceIds; slots carry eventInfo.eventId, NO scheduleId:
const { timeSlots } = await eventTimeSlots.listEventTimeSlots({
serviceIds: [serviceId], fromLocalDate, toLocalDate, timeZone, includeNonBookable: false,
// staff/location (optional): eventFilter: { 'resources.id': { $hasSome: [staffMemberId] }, 'location.id': [locationId] },
});Docs: https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/time-slots-v2/list-availability-time-slots.md?apiView=SDK · https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/time-slots-v2/list-event-time-slots.md?apiView=SDK
fromLocalDate/toLocalDateare LOCAL stringsYYYY-MM-DDThh:mm:ss(noZ) plus a separatetimeZone. Passing UTC ISO strings withZreturns the wrong window.Slot fields are top-level — read
timeSlot.localStartDate/.localEndDate/.scheduleId, NOTtimeSlot.slot.startDate. CLASS slots carryeventInfo.eventIdand have noscheduleId.⚠️ Scope availability to exactly ONE business location on a multi-location service. Unscoped,
listAvailabilityTimeSlotsreturns one slot per location per time → every time appears N× (duplicated rows). Build the location list fromqueryLocations()intersected with the service's location ids (aservice.locationsid alone can be one the availability engine doesn't recognize → 0 slots). Staff does not multiply rows — one slot carries manyavailableResources.Staff picker auto-skips ≤1 staff (
service.staffMemberDetails.staffMembers). Filter bystaffMemberId(the resource GUID). When a slot is picked with a specific staff, recordresource = { _id: staffMemberId, name }; with "any staff", leave it unset (the booking emits the ANY_RESOURCE fallback below).Group slots by day — don't render a flat time-only grid (the visitor can't tell which day a slot is on). Week / month / N-day is your choice.
The booking form — schema-driven (@wix/forms)
The booking form is a @wix/forms form attached to the service at service.form._id. Render it schema-driven — never hardcode field names.
⚠️ CRITICAL: use getFormSummary, NOT getForm. getForm returns the full nested schema (form.formFields[].inputOptions.stringOptions.componentType…), and hand-parsing that deep shape is the #1 source of a silently empty form — when your guess at the nested path is wrong, the parse yields zero fields and the form renders no inputs (→ empty formSubmission → createBooking 400 first_name must have required property) or hangs on a "loading" state. Use the flat summary instead:
const { formSummary } = await forms.getFormSummary(service.form._id);
// formSummary.fields[] = { target, label, type, options?, deleted, _id } ← FLAT, no nesting
const fields = (formSummary?.fields ?? [])
.filter(f => !f.deleted)
.filter(f => f.type && ['STRING', 'EMAIL', 'PHONE', 'NUMBER', 'URL'].includes(f.type)); // simple text-like only (`f.type` is optional on the summary field — guard it or strict build errors)Doc: https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/get-form-summary.md?apiView=SDK · bookings↔forms: https://dev.wix.com/docs/api-reference/business-solutions/bookings/wix-forms-integration.md?apiView=SDK
targetis the submission key (top-level on each field — noinputOptionsdigging).typeis a clean enum: renderEMAIL→type=email,PHONE→type=tel,NUMBER→type=number, else text; a field withoptions[]→a<select>.Each input writes straight into one values object keyed by
target({ [target]: value }). That object IS theformSubmission— pass it directly tocreateBooking. Do not rebuild a second object by looping the schema at submit time.
⚠️ CRITICAL: render the contact-basics fallback whenever the parsed list is EMPTY — not only on a thrown error. A successful getFormSummary that yields zero usable fields (all filtered out, or an unexpected shape) must still produce a working form. Default to first_name / last_name / email (the booking enforces exactly these) so the form always renders and submits:
const formFields = fields.length ? fields : [
{ target: 'first_name', label: 'First Name', type: 'STRING' },
{ target: 'last_name', label: 'Last Name', type: 'STRING' },
{ target: 'email', label: 'Email', type: 'EMAIL' },
];Never gate the form's render on a loading flag that can't resolve (e.g. showing "Loading form…" while formFields.length === 0) — with the fallback above the list is never empty, so render directly.
⚠️ Skip complex, object-valued field types — MULTILINE_ADDRESS, OBJECT, ARRAY, WIX_FILE, SIGNATURE, PAYMENT, DATE/TIME (the filter above already keeps only the simple text-like types). Rendering one as a text input sends a string where the API wants an object and createBooking rejects it with "must be object". Only the contact basics are enforced, so dropping optional complex fields is safe.
Creating the booking — the createBooking → ecom Cart V2 sequence
This is one feature with a fixed sequence. Use it as-is — the payload shapes are exact and easy to get subtly wrong. APPOINTMENT and CLASS share the same sequence; they differ only in the slot fields.
createBooking(...) // booking lands CREATED — the cart holds the seat (no confirmBooking)
createCart(...) // one catalogItem per bookingId, appId = BOOKING_APP_ID, channelType WEB
calculateCart(cartId) // → { cart, summary }; totals on summary.priceSummary.total.amount
isCheckoutRequired ? redirect to hosted checkout (paid) : placeOrder(cartId) (free / pay-in-person)1 · createBooking. Doc: https://dev.wix.com/docs/api-reference/business-solutions/bookings/bookings/bookings-writer-v2/create-booking.md?apiView=SDK
const created = await bookings.createBooking({
selectedPaymentOption, // derive from service.payment.options — see below
totalParticipants: 1,
bookedEntity: {
slot: {
serviceId,
scheduleId: slot.scheduleId ?? undefined, // APPOINTMENT only — the SELECTED SLOT's own scheduleId, NOT service.schedule.id (the availability slot types it `string | null`; `?? undefined` to satisfy the `string | undefined` param under strict)
eventId: slot.eventInfo?.eventId, // CLASS only (Wix derives startDate/endDate/resource/location from it)
startDate: slot.localStartDate, // local "YYYY-MM-DDThh:mm:ss"
endDate: slot.localEndDate,
timezone,
// specific staff: resource: { _id: staffMemberId, name }
// any staff: resourceSelections: [{ resourceTypeId: STAFF_MEMBER_RESOURCE_TYPE_ID, selectionMethod: 'ANY_RESOURCE' }]
location: { locationType: 'OWNER_BUSINESS' }, // map BUSINESS→OWNER_BUSINESS, CUSTOMER→CUSTOM
},
},
}, { formSubmission }); // the form values keyed by `target`
const bookingId = created.booking._id;⚠️
scheduleIdMUST come from the SELECTED SLOT (slot.scheduleId), not from the service. The APPOINTMENT slot carries its own top-levelscheduleId(cheat-sheet) — carry it from the slots step into the booking. The service object also has aschedule.id(you read it for duration), but it is a different value: sendingservice.schedule.id(or an emptyscheduleIdprop) makescreateBooking400 withVALIDATION_FAILURE: "…startDate, endDate, location.locationType, resource.id, and scheduleId must be set". (CLASS sendsslot.eventInfo.eventIdinstead — noscheduleId.)⚠️ Pass
formSubmission, NOTcontactDetails.contactDetailsis what Wix derives back onto the response; sending it instead offormSubmissiondrops the visitor's input.⚠️
formSubmissionis the object your inputs wrote to (values keyed bytarget) — send it DIRECTLY; do NOT rebuild it by iterating the parsed form-field schema. If you re-derive the submission by looping over the schema array and your render falls back to a hardcoded field list when the schema parse comes back empty, the rebuild loop reads the empty schema and sends an empty body →createBooking400s withINVALID_ARGUMENT: "first_name must have required property 'first_name'…"even though the form looked filled. Keep the typed-values object ({ [target]: value }) as the single source and pass that.⚠️ ANY_RESOURCE fallback (staff). With no specific staff chosen, send
resourceSelections: [{ resourceTypeId: STAFF_MEMBER_RESOURCE_TYPE_ID, selectionMethod: 'ANY_RESOURCE' }]and Wix auto-assigns a bookable resource — appointment slots can returnavailableResources: []yet book fine this way. A specific choice sendsresource: { _id, name }instead.⚠️ Derive
selectedPaymentOptionfrom the service — do NOT hardcode"ONLINE".online && !inPerson → "ONLINE";!online && inPerson → "OFFLINE"; else"ONLINE". A free / pay-in-person service bookedONLINEmakes the cart reject it withINSUFFICIENT_INVENTORY(available_quantity: 0).locationTypeon the booking slot isOWNER_BUSINESS(the booking endpoint's enum), NOTBUSINESS(which is the services endpoint's enum). Map the slot'sBUSINESS→OWNER_BUSINESS,CUSTOMER→CUSTOM.Wrap in try/catch —
createBookingcan reject (slot taken between fetch and submit, strict phone validation). Surface a friendly message; don't crash.
2 · Cart holds the seat → checkout or place.
const cart = await createCart({
catalogItems: [{ quantity: 1, catalogReference: { catalogItemId: bookingId, appId: BOOKING_APP_ID } }],
cart: { source: { channelType: 'WEB' } },
});
if (!cart._id) throw new Error('cart creation failed'); // Cart V2 types `_id` as `string | undefined`; narrow once so the strict build accepts it downstream
const cartId = cart._id;
const { cart: calc, summary } = await calculateCart(cartId); // totals are NOT stored on the Cart V2 entity
// checkout required? cancellation-fee policy → yes; total 0 → no; FULL_PAYMENT_OFFLINE → no; else yes
if (checkoutRequired) {
const { redirectSession } = await redirects.createRedirectSession({
ecomCheckout: { checkoutId: cartId }, // the cartId IS the checkoutId here
callbacks: { postFlowUrl: `${origin}/booking-confirmation` },
});
window.location.href = redirectSession.fullUrl; // Wix-hosted checkout
} else {
const order = await placeOrder(cartId); // free / pay-in-person → confirmation
}⚠️ No
confirmBooking. The classic server-side confirm step is not used — the ecom Cart V2 holds the seat:placeOrder(free/offline) or the hosted checkout (paid) drives confirmation, so a client-only site completes the whole flow with no server elevation.⚠️ CRITICAL:
origininpostFlowUrlMUST be thehttps://published host — fromwindow.location.origin, NEVERnew URL(request.url).origin. The Headless redirect allowlist registers thehttps://host and treatshttp://<same host>as a different, unlisted origin; ahttp://postFlowUrlmakes the return ("Continue Browsing") 403 with "… isn't listed as an allowed redirect domain." Server-derivednew URL(request.url).originishttp://behind Wix's proxy → passwindow.location.originfrom the client, or forcehttps. Doc: https://dev.wix.com/docs/go-headless/getting-started/setup/manage-urls/add-allowed-redirect-domains.⚠️ CRITICAL: the confirmation page must reflect REAL status — do NOT hardcode
?status=successinpostFlowUrl, and do NOT default the page to success. The buyer lands onpostFlowUrlwhether they completed payment or clicked "Continue Browsing" to abandon the hosted checkout. A confirmation page that readsstatus ?? 'success'(or trusts a?status=successyou baked into the URL) renders "confirmed" for an unpaid, abandoned booking. Drive the confirmation from the actual order/booking — look up the booking (it'sCREATEDaftercreateBooking; payment is a separate state) or the order — and don't present an unconfirmed booking as confirmed. For the free/offline branch,placeOrderhaving returned anorderIdis a real success signal; for the paid branch, returning from the redirect is not.⚠️ Read the booking back as the anonymous visitor —
getBookingis a manage-scope read that403s the visitor (same axis as the eventsticketDefinitionstrap; do NOTauth.elevate). The visitor-public path is a two-step token handoff, both exports on@wix/bookings— use these exact calls, don't hunt the installed.d.tsfor them:At booking time (right after
createBookingreturnsbooking._id) mint a one-shot read token:const { token } = await bookings.getAnonymousActionToken(bookingId)—bookingIdis a POSITIONAL string arg, not{ bookingId }(the object form failstsc). Append the token to yourpostFlowUrl(e.g.?bookingId=…&token=…).On the confirmation page read it back:
const { booking } = await bookings.bookingsGetBookingAnonymously(token)— the response is wrapped ({ booking }). Drive the UI offbooking.status(CREATED= seat held / payment pending;CONFIRMED/PENDING= done) and the time offbooking.bookedEntity.slot.startDate.
The cart's
catalogReference.catalogItemIdis thebooking._idandappIdis the Bookings app id (a booking id is automatically valid as an ecom catalog item).
Rendering & mounting
Price:
service.payment.fixed.price.value(string) +.currency(the site's stored currency — format from it, don't assume USD).Image:
service.media.mainMedia.imageis a string, not an object (the installed type isimage?: string, so.image.urlfailstsc) — but its value is a Wix media URI likewix:image://v1/…, not an absolute URL (.startsWith("https://")isfalse). Putting it straight into<img src>ships broken images. Resolve it first:import { media } from "@wix/sdk", thenmedia.getImageUrl(service.media.mainMedia.image).url→https://static.wixstatic.com/media/…. Guard for services with no image.Mount slots + form + book in a
client:only="react"island (Astro) — availability is timezone/session-specific. SSR only the read pages (catalog/detail) for SEO.
SEO on item pages (Astro, Wix-managed)
A service detail page is a Wix item page: its <title>/description/OG/canonical come from what the owner sets in the dashboard. On the Astro (Wix-managed) frontend, wire it per the canonical guide — Add SEO Support to Item Pages — which covers the three steps: export wixMetadata (registers the route → sitemap + dashboard SEO editor), call loadSEOTagsServiceConfig(...), and render <SEO.Tags> (from @wix/seo; deps + @wix/essentials ≥ 1.0.10 are in the guide's "Before you begin").
For a service page use:
wixMetadatafromWIX_APPS.bookings.servicePageMetadata— referenced directly in the export (module scope). Route paramslug→identifiers.slug.itemType:seoTags.ItemType.BOOKINGS_SERVICE.
Run loadSEOTagsServiceConfig in the same Promise.all as the service read, with .catch(() => null), so a SEO hiccup falls back to the layout's default title instead of failing the page. Optional: render a Service schema.org JSON-LD <script> from the fetched service (see the guide's structured-data step).
Out of scope
Waitlist, on-site manage/cancel, payment/deposit breakdown, multi-service packages, and COURSE bookings. Waitlist and manage/cancel have no headless source of truth — don't invent them on the anonymous-token layer; post-booking self-service is the Wix-hosted flow / member area.
Conclusion
A correct Services V2 booking frontend:
imports
services/availabilityTimeSlots/eventTimeSlots/bookingsfrom@wix/bookings, plus Cart V2 (@wix/auto_sdk_ecom_cart-v-2),@wix/redirects, and@wix/forms— and never the nonexistentavailabilitynamespace orconfirmBooking;uses
service._id(neverservice.id) and reads the flat V2 fields (mainSlug.name,payment.fixed.price.value,schedule.availabilityConstraints.sessionDurations[0]);fetches availability per type (
availabilityTimeSlotsfor APPOINTMENT,eventTimeSlotsfor CLASS) with local date strings, reads slot fields at the top level, and scopes to one location to avoid duplicate rows;renders the booking form schema-driven via
getFormSummary(the flatformSummary.fields[].target, nevergetForm/formFields), falls back tofirst_name/last_name/emailwhenever the parsed list is empty (so the form never renders blank or hangs), keys values bytarget, skips complex field types, and passes that object asformSubmission(notcontactDetails);runs createBooking → createCart → calculateCart → checkout-or-place, deriving
selectedPaymentOptionfrom the service (free/offline →OFFLINE, elseONLINE— the wrong choice rejects the cart withINSUFFICIENT_INVENTORY) and using the ANY_RESOURCE fallback when no staff is chosen.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Wix
- Publisher
- Wix (Official)
- Source
- wix/skills · skills/wix-headless · commit d168bc2
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Wix or Wix.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-headless.zip