> 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 # PublishSite # Package: sites # Namespace: SitePublisher # Method link: https://dev.wix.com/docs/api-reference/account-level/sites/site-actions/publish-site.md ## Permission Scopes: Manage SEO Settings: SCOPE.PROMOTE.MANAGE-SEO ## Introduction Publishes a site. Publishing a site makes any changes previously saved on the site available on the internet. After publishing, changes to your site appear in the [site's history](https://support.wix.com/en/article/viewing-and-managing-your-site-history). When using an API key for authentication, include a `wix-site-id` header with the ID of the site you want to publish. --- ## REST API ### Schema ``` Method: publishSite Description: Publishes a site. Publishing a site makes any changes previously saved on the site available on the internet. After publishing, changes to your site appear in the [site's history](https://support.wix.com/en/article/viewing-and-managing-your-site-history). When using an API key for authentication, include a `wix-site-id` header with the GUID of the site you want to publish. URL: https://www.wixapis.com/v1/site/publish Method: POST Return type: PublishSiteResponse EMPTY-OBJECT {} Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SITE_IS_NOT_DEFINED_AS_PUBLISHABLE | Description: Can't publish the site. The site needs either a template or a headless structure. ``` ### Examples ### Publish Site ```curl curl -X POST \ 'https://www.wixapis.com/site-publisher/v1/site/publish' \ -H 'Authorization: ' \ -H 'wix-site-id: 4339fba7-b533-4d10-a91b-822d825f29a5' -H 'Content-Type: application/json' \ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.sites.SitePublisher.publishSite() Description: Publishes a site. Publishing a site makes any changes previously saved on the site available on the internet. After publishing, changes to your site appear in the [site's history](https://support.wix.com/en/article/viewing-and-managing-your-site-history). When using an API key for authentication, include a `wix-site-id` header with the GUID of the site you want to publish. Return type: PROMISE EMPTY-OBJECT {} Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SITE_IS_NOT_DEFINED_AS_PUBLISHABLE | Description: Can't publish the site. The site needs either a template or a headless structure. ``` ### Examples ### publishSite ```javascript import { siteActions } from '@wix/sites'; async function publishSite() { const response = await siteActions.publishSite(); }; ``` ### publishSite (with elevated permissions) ```javascript import { siteActions } from '@wix/sites'; import { auth } from '@wix/essentials'; async function myPublishSiteMethod() { const elevatedPublishSite = auth.elevate(siteActions.publishSite); const response = await elevatedPublishSite(); } ``` ### publishSite (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 { siteActions } from '@wix/sites'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { siteActions }, // Include the auth strategy and host as relevant }); async function publishSite() { const response = await myWixClient.siteActions.publishSite(); }; ``` ---