> 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

# UnpublishSite

# Package: siteManagement

# Namespace: SitePublishStateService

# Method link: https://dev.wix.com/docs/api-reference/account-level/enterprise/site-management/site-publish-state-v1/unpublish-site.md

## Permission Scopes:
Manage Enterprise Site Publish State: SCOPE.ENTERPRISE.MANAGE-SITE-PUBLISH-STATE

## Introduction

Takes a published site offline.

Unpublishing doesn't delete the site or any of its content. The site stays in the account and remains editable. To make the site live again, call [Publish Site](https://dev.wix.com/docs/rest/account-level/sites/site-actions/publish-site.md).

When called with an Enterprise API key, the key must have the Manage Enterprise Site Publish State permission scope.

The site must currently be published. The call fails for a site that's already offline.

---

## REST API

### Schema

```
 Method: unpublishSite
 Description: Takes a published site offline.  Unpublishing doesn't delete the site or any of its content. The site stays in the account and remains editable. To make the site live again, call [Publish Site](https://dev.wix.com/docs/rest/account-level/sites/site-actions/publish-site.md).  When called with an Enterprise API key, the key must have the Manage Enterprise Site Publish State permission scope.  The site must currently be published. The call fails for a site that's already offline.
 URL: https://www.wixapis.com/enterprise-public-proxy/v1/sites/unpublish
 Method: POST
 Method parameters:
   param name: metaSiteId | type: metaSiteId | description: GUID of the site to take offline.  | validation: format GUID
 Return type: UnpublishSiteResponse
  - name: metaSiteId | type: string | description: GUID of the site that was taken offline.  | validation: format GUID
  - name: published | type: boolean | description: Whether the site is live on the internet. Always `false` after a successful call.  


```

### Examples

### Take a site offline
Unpublishes a site so visitors can no longer reach it. The site stays in the account and remains editable.

```curl
curl -X POST \
'https://www.wixapis.com/enterprise-public-proxy/v1/sites/unpublish' \
-H 'Authorization: <AUTH>' \
-H 'wix-account-id: <ACCOUNT_ID>' \
-H 'Content-Type: application/json' \
-d '{
  "metaSiteId": "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.enterpriseSiteManagement.sitePublishState.unpublishSite(options)
 Description: Takes a published site offline.  Unpublishing doesn't delete the site or any of its content. The site stays in the account and remains editable. To make the site live again, call [Publish Site](https://dev.wix.com/docs/rest/account-level/sites/site-actions/publish-site.md).  When called with an Enterprise API key, the key must have the Manage Enterprise Site Publish State permission scope.  The site must currently be published. The call fails for a site that's already offline.
 Method parameters:
   param name: options | type: UnpublishSiteOptions  none  
        - name: metaSiteId | type: string | description: GUID of the site to take offline.  | validation: format GUID
 Return type: PROMISE<UnpublishSiteResponse>
  - name: metaSiteId | type: string | description: GUID of the site that was taken offline.  | validation: format GUID
  - name: published | type: boolean | description: Whether the site is live on the internet. Always `false` after a successful call.  


```

### Examples

### Take a site offline
Unpublishes a site so visitors can no longer reach it. The site stays in the account and remains editable.

```javascript
import { sitePublishState } from "@wix/enterprise-site-management";

async function unpublishSite() {
  const response = await sitePublishState.unpublishSite({
    metaSiteId: "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd",
  });
}

/* Promise resolves to:
 * {
 *   "metaSiteId": "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd",
 *   "published": false
 * }
 */

```

### unpublishSite (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 { sitePublishState } from '@wix/enterprise-site-management';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function unpublishSite(options) {
  const response = await myWixClient.sitePublishState.unpublishSite(options);
};
```

---