SDK

The SDK module can be used to authenticate and communicate with the Wix platform from JavaScript code. It offers a client for making authenticated calls to the Wix JavaScript SDK and REST APIs.

When developing sites or Wix apps with the CLI or Blocks, most authentication is taken care of for you. Therefore, when developing on those platforms, you don't need to use this module to create a Wix client. Learn more about the Wix Client.

The SDK module provides the following methods and objects:

  • WixClient: A client for executing authenticated API requests and handling webhooks. The client employs the authentication strategy provided during initialization.
  • ApiKeyStrategy: Authenticates API requests for admin actions using an API Key.
  • OAuthStrategy: Authenticates API requests for Wix Headless using OAuth tokens.
  • AppStrategy: Authenticates API requests for apps using OAuth tokens. This strategy is only intended for backend extensions. To extend frontend environments such as the dashboard, editor, or site, use host modules instead.
  • media: Features for working with media content returned by Wix APIs.

Setup

@wix/sdk

To use the SDK module, install the @wix/sdk package.

Install the package

Follow the installation instructions for your development environment.

Development environmentInstallation method
Wix sites (editor or IDE)Use the package manager.
Wix sites (local IDE)Run wix install @wix/sdk using the Wix CLI.
Blocks appsUse the same installation method as Wix sites.
CLI and self-hosted appsRun npm install @wix/sdk or yarn add @wix/sdk.
Headless sites and appsRun npm install @wix/sdk or yarn add @wix/sdk.

Authentication and permissions

SDK API calls must be authenticated using the OAuth protocol.

In Wix sites and Wix-hosted apps (CLI and Blocks), authentication is handled by Wix.

In self-hosted apps and headless projects, you need to create and use a Wix client.

Depending on the context of your code, you may need to elevate the method you want to call.

If you’re developing a wix App, you need to add permissions for the APIs you're calling in the Permissions page in your app's dashboard.

Did this help?