Skip to content

JavaScript SDK

Mehrdad Pajuhaan edited this page Oct 23, 2026 · 1 revision

JavaScript SDK

This page is the reference for window.$vendor, the request layer of @selldone/sdk-vendor. It lists every namespace and method registered by VendorSDK.Setup(), the vendor API route behind each one, and the main response fields. Routes are relative to the selldone-vapi base URL. For setup, see Getting Started.

Globals

Global What it is
window.VAPI Catalog of vendor API URL builders (apis/VAPI.ts). See Vendor API URL Builders.
window.$vendor Typed request wrappers: page, product, category, article, logistic.
window.axios The Axios instance used by all wrappers, with the vendor's bearer token.

Conventions:

  • The first argument is always the vendor ID.
  • Lists take (vendor_id, offset, limit, options?); options are sent as query parameters.
  • Promises resolve with the response body. They reject with the API error body ({ error: true, error_msg, code }) or with an Axios error.
  • Each namespace extends APIAbstract from Selldone Core, so .optimize(seconds), .force(), .cancellation() and promise.cache(callback) work exactly as in the Backoffice SDK.

product

Method Route Response
list(vendor_id, offset, limit, options?) GET /vendors/{vendor_id}/products/all-admin { folders, products, parent_folders, total, tax_profile?, valuation?, time_filter? }
getInfo(vendor_id, product_id, offset, limit, options?) GET /vendors/{vendor_id}/products/{product_id}/admin { product, product_data, orderQue }
setQuantity(vendor_id, product_id, quantity) POST /vendors/{vendor_id}/products/{product_id}/quantity { success, quantity }
changeCategory(vendor_id, product_id, category_id, bundle?) PUT /vendors/{vendor_id}/products/{product_id}/edit/category { success, count }
  • list options: statuses, types, sort, available, set ("default" or "spec"), dir (category ID), with_product_variants, with_parent, search, vendor, products_only, with_total, show_deletes, show_vendors.
  • getInfo option: with_trashed. The product object includes product_variants, images, category, vendor, subscription_prices, extra_pricings, articles and more.
  • changeCategory: pass null as category_id to move the product to the root. bundle is an optional array of product IDs to move together.

product.importer

Method Route Response
send(vendor_id, dataset, keep_image_urls = true) POST /vendors/{vendor_id}/import/products { success, success_count, fail_count, errors }
info(vendor_id) GET /vendors/{vendor_id}/importing { importing, images }
que.products(vendor_id, offset, limit, options?) GET /vendors/{vendor_id}/import/products { products, total }
que.removeProduct(vendor_id, item_id) DELETE /vendors/{vendor_id}/import/products/{item_id} { success, id }
que.images(vendor_id, offset, limit, options?) GET /vendors/{vendor_id}/import/images { images, total }
que.removeImage(vendor_id, item_id) DELETE /vendors/{vendor_id}/import/images/{item_id} { success, id }
que.syncImage(vendor_id, item_id) PUT /vendors/{vendor_id}/import/images/{item_id}/try { success, id }

send requires the first row of dataset to be an array of header strings; otherwise it throws before sending. Columns match the backoffice importer (Title, Type, Price, Currency, Status, Quantity, SKU, Category, Images, V_Color, …; see vapi.product.importer.post.IProduct). Queue options: sortBy, sortDesc, search.

product.tags

Method Route Response
set(vendor_id, product_id, tags) POST /vendors/{vendor_id}/products/{product_id}/tags { success, tags }

product.variants

Method Route Response
remove(vendor_id, product_id, variant_id) DELETE /vendors/{vendor_id}/products/{product_id}/variants/{variant_id}/delete { success, variants, quantity, variant_id }
restore(vendor_id, product_id, variant_id) POST /vendors/{vendor_id}/products/{product_id}/variants/{variant_id}/restore { success, variants, quantity, variant_id }

product.vendor

Method Route Response
list(vendor_id, product_id, offset, limit, options?) GET /vendors/{vendor_id}/products/{product_id}/vendors { vendor_products, total }

Options: sortBy, sortDesc, search, vendor_id.

category

Method Route Response
list(vendor_id, offset, limit, options?) GET /vendors/{vendor_id}/categories { categories, total, parent_folders }

Options: contain, updated_at (ISO 8601), sortBy (id, name, title, star, icon, parent_id, visits, products, categories, vendor_id, page_id, created_at, updated_at), sortDesc, search, children, parent, page.

page

Method Route Response
getPageAugment(vendor_id, page_id, current_augment?) GET /vendors/{vendor_id}/pages/{page_id}/augment { augment }

Returns the augment items of a page ({ key, value, type: "image" | "text" }). If you pass current_augment, the SDK merges it with the server structure.

article

Method Route Response
tags.getTags(vendor_id) GET /vendors/{vendor_id}/articles/tags { tags }
tags.setArticleTags(vendor_id, article_id, tags) POST /vendors/{vendor_id}/articles/tags/{article_id} { tags }

logistic

Method Route Response
profile.list(vendor_id, offset, limit, options?) GET /vendors/{vendor_id}/logistic-profiles { profiles, total }

Options: sortBy, sortDesc, search, contain, compact, type (a LogisticProfileType key).

Example: a product table with search

const productsApi = window.$vendor.product.cancellation(); // drop superseded searches

function loadProducts(search, page = 1, perPage = 20) {
  return productsApi
    .list(VENDOR_ID, (page - 1) * perPage, perPage, {
      search,
      products_only: true,
      with_total: true,
    })
    .then(({ products, total }) => ({ products, total }))
    .catch((error) => {
      if (error === undefined) return null; // canceled by a newer request
      throw error;
    });
}

Next steps