Wix app APIs, SDKs and data handling

Module 47: How to Build a Wix App: Complete Developer Guide | Lesson 535 of 687 | 55 min read

By Michael Andrews, Wix SEO Expert UK

The Wix platform exposes a rich set of APIs and SDKs that your app can leverage to interact with every part of a Wix site: data, content, eCommerce, bookings, CRM, members, events and more. This lesson provides a comprehensive deep dive into the most important APIs, with practical examples showing how to use each one in your Wix app. Mastering these APIs is what separates basic apps from powerful, deeply integrated solutions.

The Wix SDK Landscape

Wix provides three layers of APIs for app developers. Understanding which to use and when is critical for building efficient, maintainable apps.

Wix SDK architecture showing Dashboard SDK, Editor SDK, and REST API layers
The three API layers: Dashboard SDK for admin pages, Editor SDK for widget configuration, REST APIs for backend integrations.

Wix Data API: Database Operations

The Wix Data API is the most commonly used API in app development. It provides full CRUD operations on Wix database collections, including your app's custom collections and the site's existing collections (with appropriate permissions).

// Wix Data API - Complete CRUD example
import { items } from '@wix/data';
import { createClient, OAuthStrategy } from '@wix/sdk';

// Initialize the Wix SDK client
const wixClient = createClient({
  modules: { items },
  auth: OAuthStrategy({
    clientId: 'YOUR_APP_CLIENT_ID',
  }),
});

// CREATE - Insert a new item
async function createSeoReport(report) {
  const result = await wixClient.items.insertDataItem({
    dataCollectionId: 'SeoReports',
    dataItem: {
      data: {
        siteUrl: report.url,
        score: report.score,
        issues: report.issues,
        scannedAt: new Date().toISOString(),
      },
    },
  });
  return result;
}

// READ - Query items with filters
async function getRecentReports(siteUrl, limit = 10) {
  const result = await wixClient.items.queryDataItems({
    dataCollectionId: 'SeoReports',
    query: {
      filter: { siteUrl: { $eq: siteUrl } },
      sort: [{ fieldName: 'scannedAt', order: 'DESC' }],
      paging: { limit },
    },
  });
  return result.dataItems;
}

// UPDATE - Modify an existing item
async function updateReport(itemId, updates) {
  const result = await wixClient.items.updateDataItem({
    dataCollectionId: 'SeoReports',
    dataItemId: itemId,
    dataItem: {
      data: updates,
    },
  });
  return result;
}

// DELETE - Remove an item
async function deleteReport(itemId) {
  await wixClient.items.removeDataItem({
    dataCollectionId: 'SeoReports',
    dataItemId: itemId,
  });
}

Wix CRM and Contacts API

If your app needs to interact with the site's contacts, leads or members, the Wix CRM API provides everything you need. This is essential for marketing apps, lead generation tools and member management solutions.

Wix eCommerce API for Store Apps

The eCommerce API is one of the most powerful Wix APIs, providing access to products, orders, inventory, carts, checkout and more. If you are building a store enhancement app, this API is your foundation.

// Wix eCommerce API - Product operations example
import { products } from '@wix/stores';

// Query products with filters
async function getProductsForSeo(limit = 50) {
  const result = await wixClient.products.queryProducts()
    .limit(limit)
    .find();

  return result.items.map(product => ({
    id: product._id,
    name: product.name,
    slug: product.slug,
    description: product.description,
    seoTitle: product.seoData?.title || '',
    seoDescription: product.seoData?.description || '',
    images: product.media?.items?.length || 0,
    hasAltText: product.media?.items?.every(
      img => img.image?.altText
    ) || false,
  }));
}

// Check product SEO completeness
function auditProductSeo(product) {
  const issues = [];

  if (!product.seoTitle || product.seoTitle.length < 30) {
    issues.push('SEO title is missing or too short (min 30 chars)');
  }
  if (!product.seoDescription || product.seoDescription.length < 120) {
    issues.push('Meta description is missing or too short (min 120 chars)');
  }
  if (product.images === 0) {
    issues.push('Product has no images');
  }
  if (!product.hasAltText) {
    issues.push('One or more images are missing alt text');
  }

  return {
    ...product,
    seoScore: Math.max(0, 100 - (issues.length * 25)),
    issues,
  };
}

Wix Bookings and Events API

For apps serving service-based businesses, the Bookings API lets you interact with services, schedules, sessions and bookings. The Events API handles event management, ticketing and RSVPs.

Handling Webhooks and Real-Time Events

Webhooks let your app react to events happening on the Wix site in real time: new orders, updated contacts, published blog posts and more. This is how you build reactive, event-driven apps.

// src/backend/events/orders.ts
// Handle new order events from Wix Stores
import { orders } from '@wix/ecom';

export async function onOrderCreated(event) {
  const order = event.data;

  // Process the new order
  console.log('New order received:', order._id);

  // Example: Check if the order source page has good SEO
  const referringUrl = order.channelInfo?.externalOrderUrl;
  if (referringUrl) {
    await logOrderSource({
      orderId: order._id,
      source: referringUrl,
      value: order.totals?.total,
      timestamp: new Date().toISOString(),
    });
  }
}

// Handle order status changes
export async function onOrderUpdated(event) {
  const { previousOrder, currentOrder } = event.data;

  if (previousOrder.status !== currentOrder.status) {
    console.log(
      'Order status changed:',
      previousOrder.status,
      '->',
      currentOrder.status
    );
  }
}

Rate Limits, Pagination and Error Handling

Production Wix apps must handle API constraints gracefully. Here are the critical patterns you must implement.

API Best Practice: Always check the API response for partial success. Some Wix bulk operations can partially succeed (e.g., 8 of 10 items created). Your code should handle partial results and report which items failed rather than treating the entire batch as failed.
Permission Scope Warning: Only request the minimum permissions your app needs in wix.config.ts. Requesting unnecessary scopes (like full CRM access when you only need contacts read) will raise red flags during the Wix review process and may lead to rejection. Users also hesitate to install apps that request excessive permissions.

This lesson on Wix app APIs, SDKs and data handling is part of Module 47: How to Build a Wix App: Complete Developer Guide in The Most Comprehensive Complete Wix SEO Course in the World (2026 Edition). Created by Michael Andrews, the UK's No.1 Wix SEO Expert with 14 years of hands-on experience, 750+ completed Wix SEO projects and 425+ verified five-star reviews.