OCTO_API_KEY, and you can search products by keyword and facet, find products similar to a source product, and look up any product by URL — all with complete TypeScript interfaces so your editor catches mistakes before they reach production.
Installation
1
Install the package
Requires Node.js 20 or later. The SDK ships as ESM only.
2
Set your API key
The client reads your key from the You can also pass
OCTO_API_KEY environment variable automatically.apiKey: in the constructor options if you prefer to manage secrets yourself (see Authentication below).Authentication
OctogenClient resolves your API key in this order:
- The
apiKeyoption passed to the constructor, if provided. - The
OCTO_API_KEYenvironment variable (process.env.OCTO_API_KEY).
MissingAPIKeyError immediately — before any network request is made. Every request then sends the key as Authorization: Bearer <api-key>.
Client options
OctogenClient accepts an optional OctogenClientOptions object:
Methods
lookupProduct
resolutionMode: "index_only" when your integration requires indexed identity and catalog context.
Promise<MerchantProductUrlLookupResponse>
searchProducts
catalog only when you want to restrict search to one catalog.
SearchProductsParams fields:
Returns:
Promise<MerchantProductListPage>
Each
MerchantProductListItem includes uuid, catalogKey, productUrl, title, brand, currentPrice, originalPrice, imageUrl, images, rating, isActive, optional match scores, and updatedAt.
moreLikeThisProducts
catalog to search all active crawled catalogs, or pass a catalog key to keep the results within one catalog.
MoreLikeThisProductsParams fields:
Returns:
Promise<MoreLikeThisProductsResponse>
Complete example
The following example searches all active crawled catalogs for women’s linen dresses and prints each result with its brand and price:Faceted search
UseFacet objects to filter by brand, gender, color, category, and other attributes. Pass them in the facets field of SearchProductsParams.
Pagination
WhennextCursor is not null in a response, pass it as cursor in your next call to retrieve the following page:
Error handling
All SDK errors extendOctogenError. HTTP errors extend OctogenAPIError, which exposes statusCode, detail, and response properties.
OctogenAuthenticationError — 401
OctogenAuthenticationError — 401
Thrown when your API key is missing, malformed, or has been revoked. Check that
OCTO_API_KEY is set correctly and that the key is still active in Octogen Platform.OctogenForbiddenError — 403
OctogenForbiddenError — 403
Thrown when a valid key attempts an action it is not authorized for — for example, accessing a catalog that has not been granted to your organization.
OctogenNotFoundError — 404
OctogenNotFoundError — 404
Thrown when a catalog or product URL cannot be found. For
lookupProduct, verify the URL belongs to a catalog your key can access.OctogenValidationError — 422
OctogenValidationError — 422
Thrown when the API rejects a request due to invalid parameters. The
detail property contains the validation error list from the API.OctogenConnectionError
OctogenConnectionError
Thrown when the SDK cannot reach the API — for example, due to a network timeout or DNS failure. Does not have a
statusCode.OctogenAPIError to handle all HTTP errors in one place: