Skip to main content

Installation

Quick Start

Constructor

If both apiKey and m2mToken are provided, m2mToken takes precedence.

Methods

search(params)

Full-text product search with faceting, sorting, and personalization.

autocomplete(params)

Query suggestions with optional product previews for search-as-you-type.

browse(params)

Category-based product listing — no free-text query required.

recommend(params)

ML-powered product recommendations.
Available models: related-products, frequently-bought-together, trending-items, trending-facet-values, personalized-trending, recently-viewed, bought-together, visually-similar

trackEvent(params)

Track user interactions for personalization and analytics.
Supported event types: home-page-view, search, category-view, detail-page-view, add-to-cart, shopping-cart-page-view, purchase-complete

Error Handling

Retry Behavior

The SDK retries automatically: Backoff schedule (without Retry-After): 100ms → 400ms → 1600ms (max 3 retries).

TypeScript Types

All request params and response shapes are fully typed. Key types:

Package

  • npm: @alana-shopping/search-sdk
  • Zero runtime dependencies — uses native fetch (Node 18+, Edge, browser)
  • Dual ESM + CJS — works with both import and require
Last modified on March 18, 2026