### onGalleryNavigationStart Source: https://dev.wix.com/docs/velo/velo-only-apis.md Registers a callback function to run when the gallery starts navigating between items. ```APIDOC ## onGalleryNavigationStart ### Description Registers a callback function to run when the gallery starts navigating between items. ### Method `POST` (or equivalent event registration) ### Endpoint `$w("yourGallerySelector").onGalleryNavigationStart(handler) ### Parameters #### Request Body - **handler** (function) - Required - The callback function to execute when navigation starts. It receives a `GalleryNavigationStartEvent` object. ### Request Example ```javascript $w("#myGallery").onGalleryNavigationStart( (event) => { console.log("Navigation started:", event.currentIndex); } ); ``` ### Response #### Success Response (200) - (void) - Event handler registered successfully. ### Response Example (No response body for success) ``` -------------------------------- ### onPlay Source: https://dev.wix.com/docs/velo/velo-only-apis.md Registers a callback function to run when the gallery's slideshow starts playing. ```APIDOC ## onPlay ### Description Registers a callback function to run when the gallery's slideshow starts playing. ### Method `POST` (or equivalent event registration) ### Endpoint `$w("yourGallerySelector").onPlay(handler) ### Parameters #### Request Body - **handler** (function) - Required - The callback function to execute when the slideshow starts playing. ### Request Example ```javascript $w("#myGallery").onPlay( () => { console.log("Gallery playing"); } ); ``` ### Response #### Success Response (200) - (void) - Event handler registered successfully. ### Response Example (No response body for success) ``` -------------------------------- ### play Source: https://dev.wix.com/docs/velo/velo-only-apis.md Starts or resumes the gallery's slideshow. ```APIDOC ## play ### Description Starts or resumes the gallery's slideshow. ### Method `POST` (or equivalent method call) ### Endpoint `$w("yourGallerySelector").play() ### Parameters None ### Response #### Success Response (200) - (void) - Operation successful. ### Response Example (No response body for success) ``` -------------------------------- ### Complete Wix AI SDK Setup Example Source: https://dev.wix.com/docs/api-reference/articles/ai-apis/set-up-the-wix-ai-sdk A full example demonstrating the import of generateText from Vercel AI and openai from Wix AI, followed by text generation. ```javascript // Import AI functionality from the Vercel SDK import { generateText } from "ai"; // Import the provider module import { openai } from "@wix/ai"; // Generate text by specifying the model name const { text } = await generateText({ model: openai("gpt-5.2"), // or openai.responses('gpt-5.2') prompt: "Write a vegetarian lasagna recipe for 4 people.", }); ``` -------------------------------- ### Get Item Variant Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/item-variants/get-variant.md Retrieves an item variant using its GUID. Ensure the Wix Restaurants Menus app is installed and the `variantId` is a valid GUID. ```javascript import { itemVariants } from '@wix/restaurants'; async function getVariant(variantId) { const response = await itemVariants.getVariant(variantId); }; ``` -------------------------------- ### List Sample Programs (Self-Hosted) Source: https://dev.wix.com/docs/api-reference/business-management/online-programs/programs/list-sample-programs.md For self-hosted SDK calls, you need to create a Wix client first. This snippet shows the setup for a self-hosted environment, including importing necessary modules and creating the client. ```javascript import { createClient } from '@wix/sdk'; import { programs } from '@wix/online-programs'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { programs }, // Include the auth strategy and host as relevant }); async function listSamplePrograms() { const response = await myWixClient.programs.listSamplePrograms(); }; ``` -------------------------------- ### Get Section Example Source: https://dev.wix.com/docs/velo/apis/wix-restaurants-v2/menus/sections/get-section.md Retrieves a menu section by its ID. Ensure the Wix Restaurants Menus (New) app is installed. This example is suitable for frontend code. ```javascript import { sections } from 'wix-restaurants.v2'; async function getSection(sectionId) { try { const result = await sections.getSection(sectionId); return result; } catch (error) { console.error(error); // Handle the error } } ``` -------------------------------- ### List Reservations with Default Options Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/reservations/reservations/list-reservations.md Fetches a list of reservations using default options. This is a basic example to get started. ```javascript import { wixClientAdmin } from "wix-admin-client"; async function getReservations() { const { reservations, pagingMetadata } = await wixClientAdmin.tableReservations.reservations.listReservations(); return { reservations, pagingMetadata }; } ``` -------------------------------- ### Install SDK Package Source: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pool-definitions/introduction.md This snippet shows how to set up the SDK package. Ensure you have the Pricing Plans app installed on your site. ```bash npm install @wix/benefit-programs ``` -------------------------------- ### Create Product (Self-Hosted SDK) Source: https://dev.wix.com/docs/api-reference/business-solutions/suppliers-hub/products/create-product.md For self-hosted environments, create a Wix client instance first. This example shows how to initialize the client with the products module and then create a product. ```javascript import { createClient } from '@wix/sdk'; import { products } from '@wix/suppliers-hub'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { products }, // Include the auth strategy and host as relevant }); async function createProduct(product) { const response = await myWixClient.products.createProduct(product); }; ``` -------------------------------- ### Retrieve All Categories Source: https://dev.wix.com/docs/velo/apis/wix-blog-backend/categories/query-categories.md Imports the categories module and demonstrates how to retrieve all categories using the queryCategories method. This is a basic example to get started. ```javascript import { categories } from 'wix-blog-backend'; // Retrieve a list of all categories const categoriesQuery = categories.queryCategories(); // To run the query, use the find() method: // const result = await categoriesQuery.find(); // console.log(result.items); ``` -------------------------------- ### Play a Wix Animations Frontend Timeline Source: https://dev.wix.com/docs/velo/velo-only-apis/wix-animations-frontend/time-line/play.md Import the wix-animations-frontend module and play a timeline. This is a basic example to get started with timeline playback. ```javascript import wixAnimationsFrontend from 'wix-animations-frontend'; let timeline = wixAnimationsFrontend.timeline(); // ... timeline.play(); ``` -------------------------------- ### Create Wix Client and Bulk Create Products Source: https://dev.wix.com/docs/api-reference/business-solutions/suppliers-hub/products/bulk-create-products.md Demonstrates how to initialize the Wix client with the Suppliers Hub module and then use the bulkCreateProducts function. Ensure you import the correct authentication strategy and host module for your environment. ```javascript import { createClient } from '@wix/sdk'; import { products } from '@wix/suppliers-hub'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { products }, // Include the auth strategy and host as relevant }); async function bulkCreateProducts(products,options) { const response = await myWixClient.products.bulkCreateProducts(products,options); }; ``` -------------------------------- ### Install App (Self-Hosted) Source: https://dev.wix.com/docs/api-reference/business-management/app-installation/app-installation/install-app.md For self-hosted SDK calls, you must first create a Wix client. This example shows how to install an app using a pre-configured client. ```javascript import { createClient } from '@wix/sdk'; import { appsInstaller } from '@wix/apps-installer'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { appsInstaller }, // Include the auth strategy and host as relevant }); async function installApp(tenant,options) { const response = await myWixClient.appsInstaller.installApp(tenant,options); }; ``` -------------------------------- ### Get a label by ID Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/item-labels/get-label.md Retrieves an item label by its unique identifier (GUID). This operation requires the Wix Restaurants Menus app to be installed. ```APIDOC ## GET /restaurants/menus/v1/labels/{labelId} ### Description Retrieves an item label by its ID. This API is specific to the Wix Restaurants Menus app. ### Method GET ### Endpoint https://www.wixapis.com/restaurants/menus/v1/labels/{labelId} ### Parameters #### Path Parameters - **labelId** (string) - Required - The unique identifier (GUID) of the item label to retrieve. ### Request Example ```curl curl -X GET https://www.wixapis.com/restaurants/menus/v1/labels/6046e53c-4ce3-41f7-9e2a-0f7352fe4975 \ -H 'Authorization: ' ``` ### Response #### Success Response (200) - **label** (Label) - The retrieved item label object. - **id** (string) - Item label GUID. - **revision** (string) - Revision number of the item label. - **createdDate** (string) - Date and time the item label was created. - **updatedDate** (string) - Date and time the item label was updated. - **name** (string) - Item label name. - **icon** (Image) - Item label icon details. - **id** (string) - WixMedia image GUID. - **url** (string) - Image URL. - **height** (integer) - Original image height. - **width** (integer) - Original image width. - **altText** (string) - Image alt text. - **filename** (string) - Image filename. - **extendedFields** (ExtendedFields) - Extended field data. - **namespaces** (object) - Extended field data organized by app namespace. #### Response Example ```json { "label": { "id": "6046e53c-4ce3-41f7-9e2a-0f7352fe4975", "revision": "1", "createdDate": "2023-10-27T10:00:00.000Z", "updatedDate": "2023-10-27T10:00:00.000Z", "name": "Spicy", "icon": { "id": "some-wix-media-guid", "url": "https://example.com/image.jpg", "height": 100, "width": 100, "altText": "Spicy icon", "filename": "image.jpg" }, "extendedFields": { "namespaces": { "com-wix-restaurants-menus": { "someField": "someValue" } } } } } ``` ``` -------------------------------- ### Wix Stores: Full Product Creation Flow Example Source: https://dev.wix.com/docs/velo/apis/wix-stores-backend/create-product.md Demonstrates a complete backend and page code flow for creating a new product, assigning it to a collection, and adding media. Requires backend functions to be imported. ```javascript import { createProduct, addProductsToCollection, addProductMedia } from 'backend/products'; $w.onReady(function () { $w("#addProductButton").onClick(async () => { const product = { "name": "Pants", "description": "Straight-legged skinny jeans.", "price": 70, "productOptions": { "Color": { "choices": [{ "description": "Black", "value": "Black" }, { "description": "Blue", "value": "Blue" } ] } }, "manageVariants": true, "productType": "physical", } try { let newProduct = await createProduct(product); // The product was created. Now assign it // to a collection. Convert the product ID // to an array. const newProducts = [newProduct._id]; const collectionId = // get collection ID addProductsToCollection(collectionId, newProducts); // The product was assigned to a collection. // Now let's add media. const option = // get option, such as "Color." Can be undefined. const choice = // get choice, such as "Black." Can be undefined. const src = // get src const mediaData = [{ src }] // If a choice and option are defined, // addProductMedia() adds media to choice if (choice !== "" && option !== "") { mediaData[0].choice = { choice, option } } addProductMedia(newProduct, mediaData); } catch (err) { // handle the error } }); }) ``` -------------------------------- ### Get Menu by ID Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/menus/get-menu.md Retrieves a menu by its GUID. This method requires the Wix Restaurants Menus app to be installed. The menu ID is a required parameter. ```APIDOC ## GET /restaurants/menus/{menuId} ### Description Retrieves a menu by its GUID. This method only works with the Wix Restaurants Menus app installed. ### Method GET ### Endpoint /restaurants/menus/{menuId} ### Parameters #### Path Parameters - **menuId** (string) - Required - Menu GUID. ### Response #### Success Response (200) - **_id** (string) - Menu GUID. - **revision** (string) - Revision number, which increments by 1 each time the menu is updated. Ignored when creating a menu. - **_createdDate** (Date) - Date and time the menu was created. - **_updatedDate** (Date) - Date and time the menu was updated. - **name** (string) - Menu name. - **description** (string) - Menu description. - **visible** (boolean) - Whether the menu is visible to site visitors. - **sectionIds** (array) - Menu section GUIDs. - **extendedFields** (ExtendedFields) - Extended fields. - **urlQueryParam** (string) - Part of the site URL that redirects to the menu. - **seoData** (SeoSchema) - Custom SEO data for the menu. - **businessLocationId** (string) - GUID of the business location where this menu is available. ``` -------------------------------- ### Create Bookmark JavaScript SDK Example (Self-Hosted) Source: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/schedule-items/create-bookmark.md For self-hosted applications, this example shows how to create a Wix client with the necessary modules and then use it to bookmark a schedule item. Remember to configure the appropriate authentication strategy and host. ```javascript import { createClient } from '@wix/sdk'; import { scheduleBookmarks } from '@wix/events'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { scheduleBookmarks }, // Include the auth strategy and host as relevant }); async function createBookmark(itemId,eventId) { const response = await myWixClient.scheduleBookmarks.createBookmark(itemId,eventId); }; ``` -------------------------------- ### Get Item Modifier Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/item-modifiers/get-modifier.md Retrieves an item modifier by its GUID. Ensure the Wix Restaurants Menus app is installed. This method requires the `modifierId` as a string. ```javascript import { itemModifiers } from '@wix/restaurants'; async function getModifier(modifierId) { const response = await itemModifiers.getModifier(modifierId); }; ``` -------------------------------- ### Get Time Slots Response Example Source: https://dev.wix.com/docs/velo/apis/wix-table-reservations-v2/time-slots/get-time-slots.md This example shows the structure of the response when retrieving time slots. It includes details like start date, duration, availability status, table combinations, and manual approval settings for each slot. ```json { "timeSlots": [ { "startDate": "2023-12-29T12:45:00.000Z", "duration": 90, "status": "UNAVAILABLE", "tableCombinations": [], "manualApproval": false }, { "startDate": "2023-12-29T13:00:00.000Z", "duration": 90, "status": "UNAVAILABLE", "tableCombinations": [], "manualApproval": false }, { "startDate": "2023-12-29T13:15:00.000Z", "duration": 90, "status": "UNAVAILABLE", "tableCombinations": [], "manualApproval": false }, { "startDate": "2023-12-29T13:30:00.000Z", "duration": 90, "status": "UNAVAILABLE", "tableCombinations": [], "manualApproval": false }, { "startDate": "2023-12-29T13:45:00.000Z", "duration": 90, "status": "UNAVAILABLE", "tableCombinations": [], "manualApproval": false }, { "startDate": "2023-12-29T14:00:00.000Z", "duration": 90, "status": "AVAILABLE", "tableCombinations": [ { "tableIds": [ "1ed802ae-708f-4da6-9177-54c3df5d3dd5" ] } ], "manualApproval": false }, { "startDate": "2023-12-29T14:15:00.000Z", "duration": 90, "status": "AVAILABLE", "tableCombinations": [ { "tableIds": [ "1ed802ae-708f-4da6-9177-54c3df5d3dd5" ] } ], "manualApproval": false }, { "startDate": "2023-12-29T14:30:00.000Z", "duration": 90, "status": "AVAILABLE", "tableCombinations": [ { "tableIds": [ "1ed802ae-708f-4da6-9177-54c3df5d3dd5" ] } ], "manualApproval": false }, { "startDate": "2023-12-29T14:45:00.000Z", "duration": 90, "status": "AVAILABLE", "tableCombinations": [ { "tableIds": [ "1ed802ae-708f-4da6-9177-54c3df5d3dd5" ] } ], "manualApproval": false }, { "startDate": "2023-12-29T15:00:00.000Z", "duration": 90, "status": "AVAILABLE", "tableCombinations": [ { "tableIds": [ "1ed802ae-708f-4da6-9177-54c3df5d3dd5" ] } ], "manualApproval": false } ] } ``` -------------------------------- ### Initialize Wix Client and List Project Items Source: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/project-items/list-project-items.md Demonstrates how to initialize the Wix client with the projectItems module and then call the listProjectItems function. Ensure you import the correct authentication strategy and host module based on your access type. ```javascript import { createClient } from '@wix/sdk'; import { projectItems } from '@wix/portfolio'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { projectItems }, // Include the auth strategy and host as relevant }); async function listProjectItems(projectId,options) { const response = await myWixClient.projectItems.listProjectItems(projectId,options); }; ``` -------------------------------- ### Self-hosted SDK Client Example Source: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/get-file-descriptors.md This example shows how to initialize a Wix client with the `files` module and then use it to call the `getFileDescriptors` method. This is relevant for self-hosted environments where you need to explicitly create a client. ```APIDOC ## getFileDescriptors (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { files } from '@wix/media'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { files }, // Include the auth strategy and host as relevant }); async function getFileDescriptors(fileIds) { const response = await myWixClient.files.getFileDescriptors(fileIds); }; ``` ``` -------------------------------- ### Get Menu by ID Source: https://dev.wix.com/docs/velo/apis/wix-restaurants-v2/menus/menus/get-menu.md Retrieves a menu using its ID. Ensure the Wix Restaurants Menus (New) app is installed. This example is suitable for frontend code. ```javascript import { menus } from 'wix-restaurants.v2'; async function getMenu(menuId) { try { const result = await menus.getMenu(menuId); return result; } catch (error) { console.error(error); // Handle the error } } ``` -------------------------------- ### Create Wix Client and Get Items (Self-Hosted) Source: https://dev.wix.com/docs/api-reference/business-management/marketing/social-media/item-v1/get-items.md Demonstrates how to initialize the Wix client with the 'items' module and then call the getItems function. Ensure you import the appropriate authentication strategy and host module. ```javascript import { createClient } from '@wix/sdk'; import { items } from '@wix/promote-growth-tools-publisher'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { items }, // Include the auth strategy and host as relevant }); async function getItems(ids) { const response = await myWixClient.items.getItems(ids); }; ``` -------------------------------- ### Query User Members with Default Settings Source: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/user-member/query-user-members.md Retrieves a list of user members using default settings for paging and sorting. This is a basic example to get started. ```javascript import { wixClientAdmin } from "wix-members-api"; async function queryMembers() { const query = { // Add your query parameters here if needed, otherwise defaults will be used. // For example: // filter: { "status": "ACTIVE" }, // sort: [{"fieldName": "_createdDate", "order": "DESC"}], // cursorPaging: { "limit": 50, "cursor": "" } }; try { const response = await wixClientAdmin.members.userMember.queryUserMembers(query); console.log(response.userMembers); return response.userMembers; } catch (error) { console.error("Error querying user members:", error); throw error; } } ``` -------------------------------- ### Install Wix SDK Package Source: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/items/introduction.md This snippet shows how to set up the Wix SDK package. Ensure the Pricing Plans app is installed on your site. ```bash @sdk_package_setup ``` -------------------------------- ### Get Currencies JavaScript SDK Example Source: https://dev.wix.com/docs/api-reference/business-solutions/stores/site-currency/get-currencies.md Retrieves the list of currencies enabled for the site using the Wix JavaScript SDK. Ensure the '@wix/currency-converter' package is installed. ```javascript import { siteSettings } from '@wix/currency-converter'; async function getCurrencies() { const response = await siteSettings.getCurrencies(); }; ``` -------------------------------- ### AI Coding Agent Initial Setup Prompt Source: https://dev.wix.com/docs/go-headless/wix-managed-headless/start-from-your-own-frontend/development-of-a-project-started-from-your-own-frontend.md Example prompt for an AI coding agent to download project files and set up the Wix Headless skill for initial project configuration. ```text Download my project from "https://www.wix.com/_api/wixstro-deployments/v1/instant-sites/YOUR_SITE_ID/download.zip" and use the Wix Headless skill at "https://wix-headless.dev/skill.md" to finish setting up my project. ``` -------------------------------- ### Get Item Label Source: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/menus/items/item-labels/get-label.md Retrieves an item label using its GUID. Ensure the Wix Restaurants Menus app is installed. This method requires the `labelId` parameter. ```javascript import { itemLabels } from '@wix/restaurants'; async function getLabel(labelId) { const response = await itemLabels.getLabel(labelId); }; ``` -------------------------------- ### Create Wix Client and Get Site Properties Source: https://dev.wix.com/docs/api-reference/business-management/site-properties/properties/get-site-properties.md Demonstrates how to initialize the Wix client with the siteProperties module and then call the getSiteProperties function. Ensure you import the correct authentication strategy and host module as needed for your setup. ```javascript import { createClient } from '@wix/sdk'; import { siteProperties } from '@wix/business-tools'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { siteProperties }, // Include the auth strategy and host as relevant }); async function getSiteProperties(options) { const response = await myWixClient.siteProperties.getSiteProperties(options); }; ``` -------------------------------- ### Get Consent Config by ID Source: https://dev.wix.com/docs/api-reference/business-management/cookie-consent-policy/consent-configs/get-consent-config.md Use this cURL command to fetch a consent configuration. Replace `` with your actual authorization token. The example ID is a GUID. ```curl curl -X GET \ 'https://www.wixapis.com/consent/consent-config/v1/consent-configs/334afbf6-5c8b-4b43-9e9e-dd28664ca28f' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Get Event Time Slot Response Source: https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/time-slots-v2/get-event-time-slot Example JSON response for the Get Event Time Slot API call, detailing the service ID, start and end times, booking status, capacity, and available resources for a specific event. ```json { "timeSlot": { "serviceId": "ecbf8d5f-abef-40de-9831-96ef99882450", "localStartDate": "2025-09-01T09:00:00", "localEndDate": "2025-09-01T10:00:00", "bookable": true, "location": { "locationType": "BUSINESS" }, "eventInfo": { "eventId": "agOw1p5v1Fslm9S0DuDy3uLuwSs643xA04BBUJJEymzTeCztdLpz3I0E8dFVh4H2GRGn6ZpaOVNFG4kHWp2L3TTBL5r9nwsDmKH170LR4CQQljERwwWfIG" }, "totalCapacity": 50, "remainingCapacity": 50, "bookableCapacity": 50, "bookingPolicyViolations": { "tooEarlyToBook": false, "tooLateToBook": false, "bookOnlineDisabled": false }, "availableResources": [ { "resourceTypeId": "1cd44cf8-756f-41c3-bd90-3e2ffcaf1155", "resources": [ { "id": "fdb27a53-9750-4b3f-b8fe-589b5328779a", "name": "John Smith" } ] } ], "nestedTimeSlots": [] }, "timeZone": "America/New_York" } ``` -------------------------------- ### Initialize Wix Client for Programs Source: https://dev.wix.com/docs/api-reference/business-management/online-programs/programs/search-programs.md Demonstrates how to create a Wix client instance configured with the programs module for self-hosted SDK usage. Ensure you import the correct authentication strategy and host module as needed. ```javascript import { createClient } from '@wix/sdk'; import { programs } from '@wix/online-programs'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { programs }, // Include the auth strategy and host as relevant }); async function searchPrograms(search) { const response = await myWixClient.programs.searchPrograms(search); }; ```