> 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

# UpdateTemplate

# Package: studioWorkspace

# Namespace: Templates

# Method link: https://dev.wix.com/docs/api-reference/account-level/studio-workspace/template-v1/update-template.md

## Permission Scopes:
SCOPE.STUDIO.MANAGE-CUSTOM-TEMPLATES: SCOPE.STUDIO.MANAGE-CUSTOM-TEMPLATES

## Introduction

Updates a template.

Each time the template is updated, `revision` increments by 1. The current `revision` must be passed when updating the template. This ensures you're working with the latest template and prevents unintended overwrites.

Currently, only the template's `name` can be updated.

---

## REST API

### Schema

```
 Method: updateTemplate
 Description: Updates a template.  Each time the template is updated, `revision` increments by 1. The current `revision` must be passed when updating the template. This ensures you're working with the latest template and prevents unintended overwrites.  Currently, only the template's `name` can be updated.
 URL: https://www.wixapis.com/wixstudio/templates/v1/templates/{template.id}
 Method: PATCH
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  template, template.id, template.revision
 Method parameters: 
   param name: template | type: Template | description: A template is a reusable starting point for creating new sites, based on an existing site.  Wix Studio partners create a template from one of their sites, then use that template to create new sites within their account. Each new site is a duplicate of the template's site. A partner can also publish a template, turning it into a public template that other Wix accounts can clone. | required: true 
        - name: id | type: string | description: Template GUID. | required: true | read-only: true | validation: format GUID
        - name: name | type: string | description: Template name.  | validation: minLength 4, maxLength 20
        - name: revision | type: string | description: Revision number, which increments by 1 each time the template is updated. To prevent conflicting changes, the current revision must be passed when updating the template. Ignored when creating a template. | required: true | read-only: true | validation: format int64
        - name: hidden | type: boolean | description: Whether the template is hidden from template galleries and pickers. A hidden template still exists and can be used to create sites, but doesn't appear in template lists. Default: `false`.  
 Return type: UpdateTemplateResponse
  - name: template | type: Template | description: Updated template.  
     - name: id | type: string | description: Template GUID.  | read-only: true | validation: format GUID
     - name: name | type: string | description: Template name.  | validation: minLength 4, maxLength 20
     - name: sites | type: Sites | description: Sites created from this template within the current account.  | read-only: true 
        - name: metaSiteIds | type: array<string> | description: IDs of the sites created from this template within the current account.  | validation: maxItems 1000, format GUID
        - name: count | type: integer | description: Number of sites created from this template within the current account.  | read-only: true | validation: format int32
     - name: createdBy | type: string | description: GUID of the user who created the template.  | read-only: true | validation: format GUID
     - name: lastEditedBy | type: string | description: GUID of the user who last edited the template's site.  | read-only: true | validation: format GUID
     - name: lastEditedDate | type: string | description: Date and time the template's site was last edited.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, which increments by 1 each time the template is updated. To prevent conflicting changes, the current revision must be passed when updating the template. Ignored when creating a template.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the template was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the template was updated.  | read-only: true | validation: format date-time
     - name: templateType | type: TemplateType | description: Type of the template. A template is always created as `STUDIO`, and becomes `PUBLIC` when it's published.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown template type.
         -     STUDIO: Standard template created from a site.
         -     PUBLIC: Published template that other Wix accounts can clone.
     - name: hidden | type: boolean | description: Whether the template is hidden from template galleries and pickers. A hidden template still exists and can be used to create sites, but doesn't appear in template lists. Default: `false`.  
     - name: platform | type: Platform | description: Platform the template's site was built on. Derived automatically from the site.  | read-only: true 
         - enum:
         -     STUDIO: Site built with Wix Studio.
         -     WIX: Site built with the Wix Editor.
         -     HARMONY: Site built with the Wix Harmony Editor.
         -     STUDIO_TWO: Site built with Wix Studio 2.


```

### Examples

### Update Template
Updates a template's `name`. The current `revision` must be passed to prevent unintended overwrites.

```curl
curl -X PATCH \
  'https://www.wixapis.com/wixstudio/templates/v1/templates/d7a341c4-196b-46e7-813c-2b0fb1847ec6' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "template": {
      "id": "d7a341c4-196b-46e7-813c-2b0fb1847ec6",
      "name": "Agency Portfolio",
      "revision": "1"
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.templates.wixTemplatesBackend.updateTemplate(_id, template)
 Description: Updates a template.  Each time the template is updated, `revision` increments by 1. The current `revision` must be passed when updating the template. This ensures you're working with the latest template and prevents unintended overwrites.  Currently, only the template's `name` can be updated.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  template, _id, template.revision
 Method parameters: 
   param name: _id | type: string | description: Template GUID. | required: true | validation: format GUID
   param name: template | type: UpdateTemplate | description: A template is a reusable starting point for creating new sites, based on an existing site.  Wix Studio partners create a template from one of their sites, then use that template to create new sites within their account. Each new site is a duplicate of the template's site. A partner can also publish a template, turning it into a public template that other Wix accounts can clone. | required: true 
        - name: name | type: string | description: Template name.  | validation: minLength 4, maxLength 20
        - name: revision | type: string | description: Revision number, which increments by 1 each time the template is updated. To prevent conflicting changes, the current revision must be passed when updating the template. Ignored when creating a template. | required: true | read-only: true | validation: format int64
        - name: hidden | type: boolean | description: Whether the template is hidden from template galleries and pickers. A hidden template still exists and can be used to create sites, but doesn't appear in template lists. Default: `false`.  
 Return type: PROMISE<Template>
  - name: _id | type: string | description: Template GUID.  | read-only: true | validation: format GUID
  - name: name | type: string | description: Template name.  | validation: minLength 4, maxLength 20
  - name: sites | type: Sites | description: Sites created from this template within the current account.  | read-only: true 
     - name: metaSiteIds | type: array<string> | description: IDs of the sites created from this template within the current account.  | validation: maxItems 1000, format GUID
     - name: count | type: integer | description: Number of sites created from this template within the current account.  | read-only: true | validation: format int32
  - name: createdBy | type: string | description: GUID of the user who created the template.  | read-only: true | validation: format GUID
  - name: lastEditedBy | type: string | description: GUID of the user who last edited the template's site.  | read-only: true | validation: format GUID
  - name: lastEditedDate | type: Date | description: Date and time the template's site was last edited.  | read-only: true 
  - name: revision | type: string | description: Revision number, which increments by 1 each time the template is updated. To prevent conflicting changes, the current revision must be passed when updating the template. Ignored when creating a template.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the template was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the template was updated.  | read-only: true 
  - name: templateType | type: TemplateType | description: Type of the template. A template is always created as `STUDIO`, and becomes `PUBLIC` when it's published.  | read-only: true 
     - enum:
     -     UNKNOWN: Unknown template type.
     -     STUDIO: Standard template created from a site.
     -     PUBLIC: Published template that other Wix accounts can clone.
  - name: hidden | type: boolean | description: Whether the template is hidden from template galleries and pickers. A hidden template still exists and can be used to create sites, but doesn't appear in template lists. Default: `false`.  
  - name: platform | type: Platform | description: Platform the template's site was built on. Derived automatically from the site.  | read-only: true 
     - enum:
     -     STUDIO: Site built with Wix Studio.
     -     WIX: Site built with the Wix Editor.
     -     HARMONY: Site built with the Wix Harmony Editor.
     -     STUDIO_TWO: Site built with Wix Studio 2.


```

### Examples

### Update template //
Renames a template, passing the current revision to prevent unintended overwrites

```javascript
import { wixWixstudioTemplatesV1Template } from "@wix/dev";

const template = {
  id: "d7a341c4-196b-46e7-813c-2b0fb1847ec6",
  name: "Agency Portfolio",
  revision: "1",
};

async function updateTemplate() {
  const response = await wixWixstudioTemplatesV1Template.updateTemplate(
    template.id,
    template,
  );
}

/* Promise resolves to:
 * {
 *   "template": {
 *     "_id": "d7a341c4-196b-46e7-813c-2b0fb1847ec6",
 *     "name": "Agency Portfolio",
 *     "sites": { "metaSiteIds": ["f3e8a2d1-9c4b-4a6e-8d5f-2b1c7e9a4f68"], "count": 1 },
 *     "revision": "2",
 *     "_createdDate": "2026-06-01T09:15:00.000Z",
 *     "_updatedDate": "2026-06-03T08:05:00.000Z",
 *     "templateType": "PUBLIC",
 *     "hidden": false,
 *     "platform": "STUDIO"
 *   }
 * }
 */

```

### updateTemplate (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { wixTemplatesBackend } from '@wix/templates';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { wixTemplatesBackend },
  // Include the auth strategy and host as relevant
});


async function updateTemplate(_id,template) {
  const response = await myWixClient.wixTemplatesBackend.updateTemplate(_id,template);
};
```

---