Once you have generated an API key and obtained the IDs for your Wix account and Wix site, you can use them to create an SDK client that uses your API key to authenticate.
Note: Before you start, make sure you are using Node.js version 18 or higher.
Install @wix/sdk
and the packages for the domain-specific APIs you wish to work with. Domain-specific packages follow the naming convention @wix/{domain}
. For example:
or
To use the APIs you have installed, import createClient
from the @wix/sdk
package along with an authentication strategy, and import functionality from the desired domain-specific packages you installed. For example:
To get started connecting an external client with a Wix site, use the createClient()
function imported from the @wix/sdk
package.
The createClient()
function returns a new Wix client.
modules
parameter property contains key:value pairs. Each value is an imported module you wish to enable in the client, and the key defines the name to use for working with that module.auth
parameter property contains the authentication method and credentials for connecting with your Wix project. To create a client for your Wix project, pass ApiKeyStrategy()
with an object containing:
apiKey
: An API key that you generated in the API Key Manager.siteId
: ID of the Wix site or project you are working with. Required for site-level API calls.accountId
: ID of the Wix account the API key belongs to. Required for account-level API calls.Once you have created a client successfully, you can begin using it to call functions in the API Reference.