Skip to main content

API Reference

A compact map of every SDK method to the endpoint it calls. All endpoints live under /api/sdk and are protected as described in Security & Rate Limiting. Every network method returns a Promise.

Initialization

const sdk = new SitePackSDK({ type: 'theme' | 'app', id: 'my-theme-or-app' });
OptionDefaultNotes
type'theme''theme' or 'app'.
id'default'Non-empty identifier for attribution.

Instance methods

MethodEndpointVerb
generateLead(leadData)/leads/generatePOST
contactSiteOwner(contactData)/contactPOST

Ecommerce — sdk.ecommerce

MethodEndpointVerb
getProducts(params?)/ecommerce/products/listGET
getProduct(productUuid)/ecommerce/productGET
fetchRelatedProducts(productUuid)/ecommerce/products/relatedGET
getCart(forceRefresh?)/ecommerce/cartGET
addToCart(productUuid, quantity?, retries?)/ecommerce/cart/addPOST
updateCartQuantity(productUuid, quantity)/ecommerce/cart/updatePATCH
clearCart()/ecommerce/cart/clearDELETE
getCheckoutInfo(data?)/ecommerce/checkout-infoPOST
claimCoupon(couponCode)/ecommerce/cart/couponPOST
fetchAddress(countryCode, postalCode, number)/ecommerce/addressGET
getCategories()/ecommerce/categoriesGET
getFilters(categorySlug)/ecommerce/category/filtersGET
getStockInfo(productUuid)/ecommerce/stockGET
checkOrderCapability(productUuid, forceRefresh?)/ecommerce/products/check-capabilityGET

Cart-mutating methods emit sitepack:cart:updated on window. See Ecommerce.

Account

MethodEndpointVerb
getUserInfo()/account/infoGET
login(email, password)/account/loginPOST
resetPassword(email)/account/reset-passwordPOST

Extra throttling applies — see Account.

Content — sdk.content

MethodEndpointVerb
get(handle)/content/getGET
list(params?)/content/listGET
getLegalPages()/content/legalGET

Search — sdk.search

MethodEndpointVerb
query(phrase, options?)/search/queryGET

Leads — sdk.leads

MethodEndpointVerb
generate(leadData)/leads/generatePOST

Payments

MethodEndpointVerb
getStatus(orderUuid)/payments/statusGET

UI — sdk.ui

MethodTransportNotes
setHeight(height)postMessageTo the trusted site origin only.
notify(message, type?)postMessage + /ui/notify (POST)type: success | info | warning | error.

Cookies — sdk.cookies

MethodNotes
set(name, value, days)First-party, SameSite=Lax, path=/. Client-side only.
get(name)Returns the value or null. Client-side only.

Globals injected by the platform

GlobalPurpose
SITEPACK_CLIENT_IDRequest-binding hash (not a secret).
SITEPACK_CSRF_TOKENCSRF token for /api/sdk/*.
SITEPACK_SITE_UUIDCurrent site identifier.
SITEPACK_DOMAINSite origin, e.g. https://example.com.