Content, Search & Leads
This page covers three smaller modules — sdk.content, sdk.search, and sdk.leads — plus the instance-level contactSiteOwner helper.
Content
The sdk.content module reads pages, the sitemap, and legal policies.
get(handle)
Fetch a content item by its handle or slug.
const { content } = await sdk.content.get('about-us');
list(params?)
Return the sitemap: pages, categories, and products.
const sitemap = await sdk.content.list();
// → { status, pages, categories, products }
getLegalPages()
Fetch all legal policies (refund, shipping, privacy, terms), keyed by type.
const { policies } = await sdk.content.getLegalPages();
Search
query(phrase, options?)
Run a storefront search. Throws if the phrase is empty.
const { results } = await sdk.search.query('running shoes');
Wrap live search in a debounce (250–300 ms) so a fast typist doesn't burn through the rate-limit budget. See Security & Rate Limiting.
Leads
leads.generate(leadData) / generateLead(leadData)
Capture a lead. email is required. generateLead(...) on the instance is a convenience alias for leads.generate(...).
await sdk.leads.generate({ email: 'jane@example.com', name: 'Jane' });
// or
await sdk.generateLead({ email: 'jane@example.com' });
Contacting the site owner
contactSiteOwner(contactData)
Send a contact request to the store owner. message is required; name, email, and subject are recommended.
await sdk.contactSiteOwner({
name: 'Jane Doe',
email: 'jane@example.com',
subject: 'Question about my order',
message: 'When will order #1234 ship?'
});
The contact endpoint is throttled (5 submissions / hour per visitor) and includes honeypot detection. Do not add a full_name field to your payload — it is treated as a spam signal.
Related pages
- API Reference — full method list.
- Security & Rate Limiting — limits and safe usage.