Make REST API Calls with an API Key

Once you've generated an API key and obtained the IDs for your Wix account or site, you can authenticate and perform admin operations.

REST API

Step 1 | Set authorization headers

To make an API call using an API key, include the key from the API Keys Manager in the Authorization header. You must also include one of the following headers, depending on the type of call:

  • wix-account-id: The ID of the Wix account that owns the API key. Required for account-level API calls.
  • wix-site-id: The ID of the Wix site you're working with. Required for site-level API calls.

Notes:

  • API calls require either the wix-account-id header or the wix-site-id header, but not both. Most APIs are site-level, while account-level APIs are specified as such in the reference documentation.
  • Site-level calls only work with API keys that belong to the account that owns the site.

A complete header for an account-level API request looks like this:

Copy

A complete header for a site-level API request looks like this:

Copy

Step 2 | Make a REST API call

With your headers set up, call Wix APIs. The following example calls Query Product and retrieves a list of visible products from a specific site:

Copy

JavaScript SDK

Important: To implement this flow, you must install Node.js version 18 or higher.

Step 1 | Install packages

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:

Copy

Or, with Yarn:

Copy

Step 2 | Import modules

To use the APIs you have installed, import createClient and ApiKeyStrategy from the @wix/sdk package, and import functionality from the desired domain-specific packages. For example:

Copy

Step 3 | Create a client

Use the createClient() method to connect an external client with a Wix site:

Copy

The createClient() method returns a new Wix client.

  • The modules parameter contains key
    pairs. Each value is an imported module, and the key defines the name to use when working with that module.
  • The auth parameter contains the authentication method and credentials. Pass ApiKeyStrategy() with an object containing:
    • apiKey: An API key generated in the API Keys Manager.
    • siteId: ID of the Wix site you are working with. Required for site-level calls.
    • accountId: ID of the Wix account the API key belongs to. Required for account-level calls.

Step 4 | Call an SDK method

The following code example retrieves a list of visible products from a specific site:

Copy

Common errors

403 forbidden

REST API

If you receive a 403 Forbidden error, check that you have:

  • An Authorization header with your API key.
  • The correct permissions configured for your API key.
  • A wix-site-id header for site-level methods, or a wix-account-id header for account-level methods.
  • An API key that can access the site you're calling. A key scoped to specific sites only works for those sites.
  • An API key that belongs to the account that owns the site you're calling. A key works only for sites in its own account, no matter which account member generated it.

JavaScript SDK

If you receive a 403 Forbidden error, check that you have:

  • The correct permissions configured for your API key.
  • A siteId value in ApiKeyStrategy for site-level calls, or an accountId value for account-level calls.
  • An API key that can access the site you're calling. A key scoped to specific sites only works for those sites.
  • An API key that belongs to the account that owns the site you're calling. A key works only for sites in its own account, no matter which account member generated it.

Unable to generate a key

If you don't receive an SMS for 2-step verification when generating a key, contact Wix Support.

See also

Last updated: 1 September 2026

Did this help?