SDK search
Call Kelp search and browse from the JS SDK.
This page is the JS SDK surface. Request fields match the API. Ranking, semantic search, merchandising, and query parameters live under Search & browse. Keys: Get your keys.
import { createKelpClient } from '@kelpclick/client';
const kelp = createKelpClient({
searchUrl: 'https://{TENANT_ID}-search.kelp.click',
analyticsUrl: 'https://{TENANT_ID}-events.kelp.click',
apiKey: 'kelp_...',
});
const res = await kelp.search('products', { q: 'shirt', perPage: 20 });
console.log(res.found, res.hits, res.queryId);Need search without analytics? Use createKelpSearch from @kelpclick/client/search and pass searchUrl plus apiKey only.
search and browse append /api/v1/collections/{collection}/search or /browse to searchUrl. Pass '' as searchUrl for a same-origin proxy. See Configuration.
The response is KelpSearchResponse: hits, facetCounts, found, page, processingTimeMs, queryId. Each hit has document and highlights. Keep queryId for later click events.