Home > widget-integration > InstantSearchAPI > getTemplate

InstantSearchAPI.getTemplate() method

Fetch ISW template by ID.

**Legacy**: getTemplateByIds() in api/template.js **New**: getTemplate(templateId) with proper typing

Query params must match the legacy format exactly: - shop – shop domain - theme_lib – theme name lib (NOT theme) - widgets[]name:id format, bracket suffix required (NOT ids, NOT widgets)

NOTE: This endpoint does NOT accept customer_id or custom boost params, so we build URLSearchParams directly instead of using this.buildQueryParams().

Signature:

getTemplate(templateId: string): Promise<string>;

Parameters

Parameter

Type

Description

templateId

string

Template ID to fetch (from templateMetadata.instantSearchWidget)

Returns:

Promise<string>

Template HTML string (empty string on failure)