Develop with the SDK

This article explains how to call methods from backend SDK modules across different Wix development frameworks and environments. Backend modules are SDK packages with REST API equivalents, and you can find them in this reference. They're universal and work in both Wix-hosted and self-hosted environments.

The approach you use depends on:

  • Your development environment. Learn more about website development, app development frameworks, and headless development paths.
  • The context where your code runs. For example, in a site you can call SDK methods from a site page, a dashboard page, or backend code.
  • Whether you need elevated permissions to call restricted methods. Elevation lets you call methods that require higher-level permissions than the calling identity has, such as performing administrative operations from frontend code or handling sensitive data on behalf of site visitors or members.

SDK methods are asynchronous. Always call them inside an async function using await.

Note: The examples in this article use methods from the @wix/ecom module:

Learn more about identities.

This article covers the majority of typical use cases. If your specific scenario isn't included, consult the relevant documentation for further guidance.

Wix Sites

When developing websites on Wix, you can add custom code to a site using the code editor, the Wix IDE, or a local IDE with Git integration.

In Wix Sites, authentication is handled automatically. You don't need to create a Wix client.

Choose the tab that matches your use case:

  • Site page: Call SDK methods from a site page with a visitor or member identity.
  • Site page with elevation: Call SDK methods from a site page using elevation when they require higher-level permissions than the calling identity has.
  • Dashboard page: Call SDK methods from a dashboard page with a Wix user identity.
  • Backend: Call SDK methods from backend code that isn't exposed to the frontend.
  • Backend with elevation: Call SDK methods from backend code using elevation when they require higher-level permissions than the calling identity has.

Wix-hosted apps (Wix CLI)

The Wix CLI is the recommended CLI for new apps. It supports Wix app development with a unified, Astro-based development experience.

In Wix CLI app projects, authentication is handled automatically. You don't need to create a Wix client.

Choose the tab that matches your use case:

  • Dashboard extension: Call SDK methods from a dashboard extension with a Wix user identity.
  • Backend extension: Call SDK methods from a backend extension with an app identity.
  • Backend extension with elevation: Call SDK methods from a backend extension using elevation when they require higher-level permissions than the calling identity has.
  • Site extension: Call SDK methods from a site extension with a visitor or member identity.
  • Site extension with elevation: Call SDK methods from a site extension using elevation when they require higher-level permissions than the calling identity has.

Self-hosted apps

Self-hosted apps are Wix apps where you host the code on your own infrastructure. This gives you full control over your technology stack.

In self-hosted apps, you must create a Wix client to make authenticated SDK calls. The authorization strategy depends on the context.

Choose the tab that matches your use case:

Note: Site, editor, and dashboard extensions in self-hosted apps use host module authentication. Learn more about host modules.

Wix-managed headless (Wix CLI)

The Wix CLI is the recommended CLI for new headless projects. It supports headless development with a unified, Astro-based development experience.

In Wix CLI headless projects, authentication is handled automatically. You don't need to create a Wix client.

Choose the tab that matches your use case:

  • Dashboard extension: Call SDK methods from a dashboard extension with a Wix user identity.
  • Backend extension: Call SDK methods from a backend extension with an app identity.
  • Backend extension with elevation: Call SDK methods from a backend extension using elevation when they require higher-level permissions than the calling identity has.
  • Frontend: Call SDK methods from a headless frontend with a visitor or member identity.
  • Frontend with elevation: Call SDK methods from a headless frontend using elevation when they require higher-level permissions than the calling identity has.

Self-managed headless

Self-managed headless projects let you build a custom frontend with any framework while using Wix backend services. You're responsible for hosting and authentication.

In self-managed headless projects, you must create a Wix client with an appropriate authentication strategy.

Choose the tab that matches your use case:

  • Visitor or member: Call SDK methods with a visitor or member identity.
  • Admin: Call SDK methods with admin-level permissions using an API key.

Wix Blocks

Wix Blocks is a visual editor for building Wix apps. You can create widgets, dashboard pages, and other app components using drag-and-drop design tools and custom code.

In Wix Blocks, authentication is handled automatically. You don't need to create a Wix client.

Choose the tab that matches your use case:

  • Widget: Call SDK methods from a widget with a visitor or member identity.
  • Widget with elevation: Call SDK methods from a widget using elevation when they require higher-level permissions than the calling identity has.
  • Dashboard page: Call SDK methods from a dashboard page with a Wix user identity.
Did this help?