> 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: Manage Custom Site Templates

## Article: Manage Custom Site Templates

## Article Link: https://dev.wix.com/docs/api-reference/account-level/studio-workspace/skills/manage-custom-site-templates.md

## Article Content:

# Manage Custom Site Templates

Helps Wix Studio partners create, manage, and use their own custom templates — reusable starting points that partners build from their existing sites and spin up new client sites from. Backed by the [Template V1 API](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/introduction.md).

## When to use

Use this when the partner's message is about saving one of their sites as a reusable template, managing templates they've already created, or spinning up new sites from those templates. Use it ONLY when the partner is clearly talking about creating or managing their OWN templates — building one to reuse, share or sell, or working with ones they already made. A generic request about templates ("show templates", "I need a template", "find me a template", "template for a restaurant") does NOT qualify unless the partner says it's their own/custom template or the context makes that unmistakable. Examples:

* "Save this site as a template."
* "Turn my portfolio site into a template I can reuse for clients."
* "Create a new site from my [template name] template."
* "Show me all my templates."
* "How many client sites have I created from the [template name] template?"
* "Rename my template."
* "Delete the [template name] template."
* "Publish my template so other accounts can use it."
* "Hide my template from the template picker."
* "Edit my [template name] template."
* "Preview the [template name] template."
* "Duplicate my [template name] template."
* "Get a shareable file for my template." / "Download my template."
* "I want to sell my template." / "How do I share my template with other people?" / "Can I list my template on the marketplace?"
* Partner is viewing the Your Templates section in the Studio workspace and asks "what templates do I have?" or "which template has the most sites?"

Not for:

* Browsing or using Wix's public template gallery (templates made by Wix, not by the partner) — those are not manageable through this API.
* Generic or ambiguous requests to see, find or pick templates (e.g. "show templates", "show me templates", "I need a template for my site") with no mention of the partner's own, custom, saved or reusable templates. These are about Wix's template gallery, not this recipe. If the request is like that, don't assume custom templates — ask whether they mean their own custom templates or Wix's templates before calling any API.
* Themes, color palettes, or style presets — separate product, not templates.
* Site duplication that doesn't involve saving a reusable template (e.g. "copy my site") — use the Rename, Duplicate, Publish or Delete a Site recipe instead unless the partner explicitly wants a reusable template.

## Who uses this

Wix Studio partners (freelancers/agencies) building and reusing their own design starting points within their account. Custom templates are private to the partner's account (type STUDIO) unless explicitly published (type PUBLIC). Each new client site spun up from a template is a full duplicate of the template's underlying site.

## API Endpoints

Every call here is account-level: make it with account scope, with no site ID. Templates belong to the partner's account, not to a site.

| Call | Purpose |
|---|---|
| `POST https://www.wixapis.com/wixstudio/templates/v1/templates/query` | [Query Templates](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/query-templates.md) |
| `GET https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}` | [Get Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/get-template.md) |
| `POST https://www.wixapis.com/wixstudio/templates/v1/templates/copy-site` | [Copy Site As Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/copy-site-as-template.md) |
| `POST https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}/create-site` | [Create Site From Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/create-site-from-template.md) |
| `PATCH https://www.wixapis.com/wixstudio/templates/v1/templates/{template.id}` | [Update Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/update-template.md) |
| `DELETE https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}` | [Delete Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/delete-template.md) |
| `POST https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}/publish` | [Publish Template](https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/publish-template.md) |
| `POST https://www.wixapis.com/site-list/v2/sites/query` | [Query Sites](https://dev.wix.com/docs/api-reference/account-level/sites/sites/query-sites.md): find a site's ID from its name, or a site's name from its ID |

## Key terminology

| Term | Meaning |
|---|---|
| Template | A reusable starting point created by duplicating one of the partner's own sites. The duplicate becomes the template's underlying site. |
| Source site | The partner's existing site that gets duplicated when creating a template. It is left unchanged. |
| Template site | The duplicate site that backs the template. Editing this site changes the template. Deleting the template also deletes this site. |
| templateType | STUDIO = private to the partner's account. PUBLIC = published as a public snapshot other accounts can clone. |
| hidden | When true, the template is hidden from template galleries and pickers but still exists and can be used programmatically. |
| sites | The list of client sites created from this template within the partner's account (tracked by metaSiteIds and count). |
| Publish | A technical action that turns a STUDIO template into a PUBLIC one. Does NOT list the template anywhere or make it discoverable on its own. |

## Data model (condensed)

A Template has:

* id (GUID, read-only)
* name (string, 4 to 20 characters)
* sites.metaSiteIds (array of site IDs created from this template in the partner's account)
* sites.count (number of those sites)
* templateType (enum: STUDIO, PUBLIC, UNKNOWN)
* hidden (boolean, default false)
* platform (enum: STUDIO, WIX, HARMONY, STUDIO_TWO — derived automatically from the source site, not settable)
* createdBy, lastEditedBy (user IDs)
* createdDate, updatedDate, lastEditedDate
* revision (required on Update to prevent conflicting overwrites)

## Actions

### 1. List / browse the partner's templates

Use when the partner asks to see their templates, find a specific one, or count how many they have.

Run this script as its own call, unchanged except for its inputs. It calls Query Templates (`POST https://www.wixapis.com/wixstudio/templates/v1/templates/query`), follows `pagingMetadata.cursors.next` for at most 5 calls, and returns every template in the account.

- `NAME` (optional): part of a template name the partner gave; matching ignores case.
- `ONLY_TYPE` (optional): `"STUDIO"` to show only the partner's private templates, `"PUBLIC"` for published ones; leave `""` to include both.
- `MOST_USED`: `true` if the partner is asking which templates are most used; the list is then sorted by `sitesCount`, highest first. Otherwise it keeps the default order, newest first (`createdDate` DESC).

```javascript
async function () {
  const NAME = "";
  const ONLY_TYPE = "";
  const MOST_USED = false;

  const templates = [];
  let cursor = "";
  for (let call = 0; call < 5; call++) {
    const query = cursor ? { cursorPaging: { cursor: cursor, limit: 100 } } : { cursorPaging: { limit: 100 } };
    const res = await wix.request({
      scope: "account",
      method: "POST",
      url: "https://www.wixapis.com/wixstudio/templates/v1/templates/query",
      body: { query: query }
    });
    const data = res.templates ? res : res.data || {};
    for (const t of data.templates || []) templates.push(t);
    cursor = ((data.pagingMetadata || {}).cursors || {}).next || "";
    if (!cursor) break;
  }
  const needle = NAME.trim().toLowerCase();
  let rows = templates
    .filter(t => !ONLY_TYPE || t.templateType === ONLY_TYPE)
    .filter(t => !needle || String(t.name || "").toLowerCase().indexOf(needle) >= 0)
    .map(t => ({
      id: t.id,
      name: t.name,
      revision: t.revision,
      templateType: t.templateType,
      hidden: Boolean(t.hidden),
      platform: t.platform,
      sitesCount: (t.sites || {}).count || 0,
      createdDate: t.createdDate,
      lastEditedDate: t.lastEditedDate
    }));
  if (MOST_USED) rows = rows.sort((a, b) => b.sitesCount - a.sitesCount);
  return { totalInAccount: templates.length, incomplete: Boolean(cursor), matched: rows.length, templates: rows };
}
```

Query Templates can't filter on `templateType` or `hidden`, and can't sort by `sites.count` (each returns 400), so the script does those in code. It can filter and sort on `name`, `id`, `createdBy`, `lastEditedBy`, `platform`, `createdDate`, `updatedDate` and `lastEditedDate`.

If the partner names a specific template, pass it as `NAME`. If only one match, proceed; if multiple, clarify which one. If none match, list the partner's templates by name and ask which one they mean. If the account has no templates at all, say so plainly. If `incomplete` is true, say the list covers only the first templates returned, so a ranking may be partial.

### 2. Get details on a specific template

Use when the partner asks about a template they already know by name or ID — how many sites were made from it, when it was created, who last edited it, etc.

1. If you have the ID from context, call Get Template (`GET https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}`).
2. If you only have a name, query first to resolve the ID (action 1), then get the template.
3. Surface sites.count for "how many client sites" questions. The individual site IDs are in sites.metaSiteIds — use Query Sites (`POST https://www.wixapis.com/site-list/v2/sites/query` with `{"query": {"filter": {"id": {"$in": [<metaSiteIds>]}}, "cursorPaging": {"limit": 100}}}`) to get site names if the partner wants a labeled list.
4. Key detail fields and how to present them:

| UI label | API field | Notes |
|---|---|---|
| Last updated | lastEditedDate | Date the template's backing site was last edited — this is what changes when a partner edits the template design. Also available: updatedDate (last metadata change, e.g. rename) and createdDate. |
| Editor type | platform | STUDIO = Wix Studio, WIX = classic Wix Editor, HARMONY = Wix Harmony, STUDIO_TWO = Wix Studio 2. Derived automatically from the source site; cannot be changed. |
| Created by | createdBy | Returned as a user ID (GUID), not a display name. The API does not resolve this to a human-readable name — if the partner needs the name, direct them to the Studio workspace UI where it is displayed. lastEditedBy follows the same pattern. |

### 2a. Usage details

The Studio workspace shows a Usage details breakdown per template with three counts:

| Label | Source | API field |
|---|---|---|
| This workspace | Sites created from this template within the partner's own account | sites.count (and sites.metaSiteIds for the list) |
| From Marketplace | Sites created by other accounts who cloned this template from the marketplace | Not available in Template V1 API |
| From downloaded file | Sites created from a downloaded .wix shareable file of this template | Not available in Template V1 API |

When a partner asks about template usage:

* You can answer "how many sites have I created from this template in my workspace" using sites.count from Get Template.
* You cannot answer the Marketplace or downloaded-file counts — tell the partner those figures are only visible in the Studio workspace UI (hover over the template's usage number to see the breakdown tooltip).
* If the partner asks for the list of specific sites, use sites.metaSiteIds and resolve names with Query Sites (action 2, step 3).

### 3. Create a template from an existing site

Trigger: partner wants to turn one of their sites into a reusable template.

Confirm before calling: if the partner asked for this exact action with these details (for example "save my Bakery site as a template called Bakery Base"), that request is the go-ahead; otherwise say what will be created (the template name and the site it copies) and wait for their reply before calling.

1. Confirm the name for the new template and which site to base it on. The name must be 4 to 20 characters; if the partner's name is longer or shorter, ask for one that fits. The site is identified by its metaSiteId (not its display name — resolve it with Query Sites, `{"query": {"filter": {"name": {"$startsWith": "<site name>"}}}}`, if the partner gives a site name; if the partner means the site they have open, use its site ID).
2. Call Copy Site As Template (`POST https://www.wixapis.com/wixstudio/templates/v1/templates/copy-site`) with:
   * templateName: the name the partner chose
   * siteMetaSiteIdToCopy: the source site's metaSiteId
   * templateType: "STUDIO" (default for a private partner template)

   ```json
   { "templateName": "Portfolio Starter", "siteMetaSiteIdToCopy": "<siteId>", "templateType": "STUDIO" }
   ```
3. The original site is left untouched. The response returns the new Template object including its id (`template.id`).
4. Tell the partner the template was created and clarify: the template has its own backing site (a duplicate). Editing that backing site changes the template for future use; it doesn't affect the original source site or any sites already spun up from it.

### 4. Create a new client site from a template

Trigger: partner wants to start a new client project using one of their templates.

Confirm before calling: if the partner asked for this exact action with these details (for example "create a new client site from my Bakery Base template"), that request is the go-ahead; otherwise say what will be created (a new site from that template) and wait for their reply before calling.

1. Confirm which template to use (by name or ID). If ambiguous, list templates and let the partner pick.
2. Call Create Site From Template (`POST https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}/create-site`). No request body needed.
3. The response returns createdSiteMetaSiteId — the ID of the new site.
4. The new site is tracked in the template's sites list automatically.
5. Tell the partner the site was created. Note: the new site starts as a duplicate of the template's site at this point in time — future changes to the template won't retroactively affect already-created sites.

### 5. Rename a template

Confirm before calling: if the partner asked for this exact action with these details (for example "rename Bakery Base to Bakery Pro"), that request is the go-ahead; otherwise say what will be renamed (the current and the new name) and wait for their reply before calling.

1. Fetch the template first to get the current revision (or use it from context if recently retrieved).
2. Call Update Template (`PATCH https://www.wixapis.com/wixstudio/templates/v1/templates/{template.id}`) with the new name and current revision: `{"template": {"id": "<templateId>", "name": "<new name>", "revision": "<revision>"}}`. The new name must be 4 to 20 characters.

### 6. Delete a template

1. Confirm with the partner which template to delete, naming it explicitly.
2. Warn: deleting a template also permanently deletes the template's underlying site. Sites already created from the template are not affected — they are independent copies.
3. Call Delete Template (`DELETE https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}`).

### 7. Sell or share a template with others

Trigger: partner expresses intent to sell, distribute, share, or make their template available to others outside their account. Examples: "I want to sell my template", "How do I share my template with other people?", "Can I list my template on the marketplace?", "I want others to use my template."

There is no template listing management in the Studio workspace. **Marketplace submissions are currently paused (IMPORTANT; verified November 2026):** Submitting templates to the Wix Templates Marketplace is temporarily not possible for any template, regardless of editor. If the Templates Marketplace documentation or the partner shows that submissions have reopened, follow that instead of this paragraph. Do NOT tell the partner they can submit or sell a template on the Wix marketplace, do NOT give the marketplace submission link, and do NOT offer to help with a marketplace submission. Do not speculate about when submissions will resume.

When a partner asks about selling, distributing or sharing a template, explain the one available option:

**Download a shareable file** (to sell the template anywhere they want, or to share it directly with a specific person or account):
Guide the partner to download a .wix shareable file from the Studio workspace (hover over the template → Download shareable file) and send it to whoever needs it. The recipient imports it into their own account. See action 12 for details.

Do NOT suggest any template listing, gallery management, or publishing workflow within the Studio workspace — no such UI exists. The Publish Template API action (7a below) changes the template's internal type to PUBLIC; it does not list the template anywhere or make it discoverable. It is only relevant as a backend prerequisite if the Wix marketplace submission process requires it.

### 7a. Publish a template (technical action)

Trigger: only when the partner explicitly asks to publish the template or make it PUBLIC, or asks specifically about the templateType field.

1. Get the template to confirm it's currently STUDIO type.
2. Publishing can't be undone through this API. Before calling Publish, tell the partner that, and that publishing doesn't list the template anywhere; end your reply with the question, and publish only after the partner confirms.
3. Call Publish Template (`POST https://www.wixapis.com/wixstudio/templates/v1/templates/{templateId}/publish`).
4. This creates a public snapshot of the template's site. The response returns the updated Template object with templateType: "PUBLIC".
5. Make clear: this does NOT list or advertise the template anywhere. It is a technical state change only.

### 8. Hide / unhide a template

The hidden field controls whether the template appears in template galleries and pickers. It can't be changed through the API: Copy Site As Template and Update Template accept `hidden` but ignore it (the template stays visible, and Update still increments the revision). Don't call either to hide or unhide a template. Tell the partner you can't hide or unhide a template, and never say a template was hidden.

### 9. Edit a template

"Edit template" opens the template's backing site in the Studio editor so the partner can change the design. This is a UI navigation action — there is no API call. Guide the partner to:

1. Go to the Your Templates section in the Studio workspace (https://manage.wix.com).
2. Hover over the template and choose Edit template from its context menu (or the three-dot/kebab menu).

Alternatively, the template's backing site appears as a regular site in their account with a "Template" badge — they can also open it from the Sites dashboard. Changes to the template's backing site take effect for all future sites created from it; existing sites created from the template are unaffected.

### 10. Preview a template

"Preview" shows a live read-only preview of the template without entering the editor. This is a UI navigation action — there is no API call. Guide the partner to:

1. Go to Your Templates in the Studio workspace.
2. Hover over the template and choose Preview from the context menu.

### 11. Duplicate a template

"Duplicate" creates a new template that is a copy of an existing one — useful for making a variation without changing the original. Internally this reuses the same Copy Site As Template flow, but targeting the template's own backing site rather than a regular site.

The Template V1 API does not expose the backing site's metaSiteId directly on the Template object. This action is best performed from the UI (hover over the template → Duplicate). If a partner needs to do this programmatically and knows the backing site's metaSiteId, use Copy Site As Template with that ID. Otherwise, direct them to the UI.

### 12. Download shareable file

"Download shareable file" exports the template as a portable .wix file that can be shared with others or imported into a different account. This is a UI-only action — the Template V1 API has no endpoint for it. Guide the partner to:

1. Go to Your Templates in the Studio workspace.
2. Hover over the template and choose Download shareable file from the context menu.

The downloaded file can be shared and imported by another Wix account via the Studio workspace import flow.

## Guardrails

* Account-scoped, always. Query and Get only return templates belonging to the partner's own account. Never accept a template ID from outside the current conversation without confirming it belongs to this partner.
* Deletion destroys the template's site. This is permanent and also removes the template's backing site. Get explicit partner confirmation naming the specific template before calling Delete. Sites already spun up from the template are unaffected.
* Only name is updatable. Update Template currently only accepts name. Don't promise to update hidden, templateType, or other fields via Update — hidden can't be set through the API at all (action 8), and templateType changes only through Publish.
* Revision required on updates. Always pass the current revision on Update calls to prevent overwriting concurrent changes. If rejected for a stale revision, re-fetch and retry rather than asking the partner to resolve it.
* Publishing is one-way (via this API). There is no "unpublish" endpoint in this API. Don't suggest the partner can revert a public template to STUDIO.
* Platform is derived, not set. The platform field (STUDIO, WIX, HARMONY or STUDIO_TWO) is determined automatically from the source site. Don't accept partner input to change it.
* No listing management exists in the Studio workspace. Never suggest the partner can manage, list, or configure a marketplace listing from within the workspace. The only way to distribute or sell a template externally is the downloadable shareable file (usable to sell the template anywhere the partner chooses). Marketplace submissions are currently paused for all templates — never suggest them.

## Error handling

* Template ID not found: likely wrong ID or template was already deleted. Re-confirm the template name with the partner and re-query.
* Stale revision on Update: re-fetch the template to get the current revision and retry.
* PERMISSION_DENIED: the partner's account doesn't have the required scope (SCOPE.STUDIO.MANAGE-CUSTOM-TEMPLATES). Escalate to support if the partner believes they should have access.

## Escalation

Hand off to human support if: the partner reports that templates they created are missing (possible account issue), deletion fails or partially succeeds, or any call returns a 5xx error after one retry.