> 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 ## Resource: Introduction ## Article: Introduction ## Article Link: https://dev.wix.com/docs/sdk/host-modules/site/introduction.md ## Article Content: # Site API The Site API enables you to interact with Wix sites from frontend code. Use it to build Wix Apps or extend site capabilities by accessing site-specific features like visitor consent management, site data, and secure integration with Wix business solutions such as Stores, Bookings, and SEO. ## Setup @package_metadata:@wix/site To use the Site API, install the `@wix/site` package. ### Install the package Follow the installation instructions for your development environment. | Development environment | Installation method | | ----------------------- | ------------------- | | Wix Studio or Wix Editor | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor.md). | | Wix Vibe | Package is automatically available. | | CLI and self-hosted apps | Run `npm install @wix/site` or `yarn add @wix/site`. | ## Sites Site developers using Wix Studio, Wix Editor, or Wix Vibe can use the Site API to access features available only within a live Wix site environment, such as managing visitor consent and analytics. ### Example The following example uses the [Consent Policy Manager](https://dev.wix.com/docs/sdk/host-modules/site/consent-policy-manager/get-current-consent-policy.md) submodule to get the site visitor's consent policy for GDPR or CCPA compliance: ```js import { consentPolicyManager } from "@wix/site"; const policyDetails = await consentPolicyManager.getCurrentConsentPolicy(); const policy = policyDetails.policy; console.log("Essential cookies allowed:", policy.essential); console.log("Functional cookies allowed:", policy.functional); console.log("Analytics cookies allowed:", policy.analytics); ``` ## Apps Wix Apps use the Site API to access Wix APIs and site data. You can use it in both Wix-hosted and self-hosted apps, including [site widgets](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-widgets/about-site-widget-extensions.md) and [embedded scripts](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/embedded-scripts/about-embedded-scripts.md), to securely interact with the Wix site environment. ### Wix-hosted Apps For [Wix-hosted apps](https://dev.wix.com/docs/sdk/articles/get-started/about-the-wix-java-script-sdk.md#wix-hosted-apps), import one of the frontend SDK modules in your code and call its methods directly. Supported modules are listed under **Frontend Modules** in the menu of this SDK reference. The following example uses the [seo module](https://dev.wix.com/docs/sdk/frontend-modules/seo/introduction.md): ```js import { seo } from "@wix/site-seo"; // Frontend module of your choice seo.title().then((title) => { console.log("Site title:", title); }); ``` ### Self-hosted apps For [self-hosted apps](https://dev.wix.com/docs/sdk/articles/get-started/about-self-hosted-apps.md), first create a [Wix Client](https://dev.wix.com/docs/sdk/core-modules/sdk/wix-client.md) with the relevant frontend modules. Supported modules are listed under **Frontend Modules** in the menu of this SDK reference. The following example uses the [seo module](https://dev.wix.com/docs/sdk/frontend-modules/seo/introduction.md): > **Note:** To call backend modules from your frontend code, use `site.auth()` to authenticate your client. This requires an access token. See the authentication guides for [Custom Elements](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/site-extensions/site-widgets-and-plugins/authenticate-using-the-wix-client-in-custom-elements-for-self-hosted-site-extensions.md) and [Embedded Scripts](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/self-hosting/supported-extensions/site-extensions/embedded-scripts/authenticate-using-the-wix-client-in-self-hosted-embedded-script-extensions.md). ```js import { site } from "@wix/site"; import { createClient } from "@wix/sdk"; import { seo } from "@wix/site-seo"; // Frontend module of your choice const myWixClient = createClient({ host: site.host({ applicationId: '' }), modules: { seo, }, }); ``` > **Note:** You can find your app ID in the **OAuth** page of the [Wix Dev Center](https://dev.wix.com/apps/my-apps). Finally, use the `client` constant to call the frontend module's methods. For example: ```js myWixClient.seo.title().then((title) => { console.log("Site title:", title); }); ```