> 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`).
> - 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 Site SSL & Publish State: SCOPE.ENTERPRISE.MANAGE-SITE-PROXY

## 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).

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).  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).  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-hosted)
Self-hosted 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);
};
```

---