The Octogen TypeScript SDK gives you a fully typed, async client for the Octogen commerce API. Install it from npm, configure yourDocumentation Index
Fetch the complete documentation index at: https://www.octogen.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
OCTO_API_KEY, and you can list catalogs, search products by keyword and facet, and look up any product by URL — all with complete TypeScript interfaces so your editor catches mistakes before they reach production.
Installation
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:
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | process.env.OCTO_API_KEY | Your Platform API key. |
baseUrl | string | https://api.octogen.ai/v1 | Override the API base URL (useful for testing). |
timeoutMs | number | 30000 | Request timeout in milliseconds. |
fetch | FetchLike | globalThis.fetch | Custom fetch function — useful for edge runtimes or test mocks. |
Methods
listCatalogs
catalog field from each result as the identifier for searchProducts.
Promise<MerchantCatalogSummary[]>
Each MerchantCatalogSummary has:
| Field | Type | Description |
|---|---|---|
catalog | string | Catalog identifier — pass this to searchProducts. |
displayName | string | Human-readable catalog name. |
productCount | number | Number of indexed products. |
sourceBaseUrl | string | null | Base URL of the catalog source. |
lastIndexedAt | string | null | ISO 8601 timestamp of the last index run. |
lookupProduct
Promise<MerchantProductUrlLookupResponse>
| Field | Type | Description |
|---|---|---|
catalogKey | string | Catalog the product belongs to. |
catalogDisplayName | string | Human-readable catalog name. |
product | MerchantProductView | Full product record with all detail fields. |
searchProducts
catalog is required.
SearchProductsParams fields:
| Field | Type | Default | Description |
|---|---|---|---|
catalog | string | — | Required. Catalog identifier from listCatalogs(). |
q | string | — | Keyword search query. |
facets | Facet[] | — | List of facet filters to apply. See Faceted search. |
priceMin | number | — | Minimum price filter (inclusive). |
priceMax | number | — | Maximum price filter (inclusive). |
cursor | string | — | Pagination cursor from a previous response’s nextCursor. |
limit | number | 50 | Number of results per page. Must be an integer between 1 and 100. |
Promise<MerchantProductListPage>
| Field | Type | Description |
|---|---|---|
items | MerchantProductListItem[] | Products on this page. |
nextCursor | string | null | Pass as cursor in your next call to get the next page. null means no more results. |
MerchantProductListItem includes uuid, productUrl, title, brand, currentPrice, originalPrice, imageUrl, images, rating, and updatedAt.
Complete example
The following example lists your first catalog, searches 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 the partner portal.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: