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.
To use the Site API, install the @wix/site package.
Follow the installation instructions for your development environment.
| Development environment | Installation method |
|---|---|
| Wix Studio or Wix Editor | Use the package manager. |
| Wix Vibe | Package is automatically available. |
| CLI and self-hosted apps | Run npm install @wix/site or yarn add @wix/site. |
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.
The following example uses the Consent Policy Manager submodule to get the site visitor's consent policy for GDPR or CCPA compliance:
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 and embedded scripts, to securely interact with the Wix site environment.
For 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:
For self-hosted apps, first create a Wix Client 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:
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 and Embedded Scripts.
Note: You can find your app ID in the OAuth page of the Wix Dev Center.
Finally, use the client constant to call the frontend module's methods. For example: