Quickstart
Get a session and make first call.
Start here to run your first SDK call. Pick a session type before you code.
Install
npm install heb-sdk-unofficial# orpnpm add heb-sdk-unofficialCreate a session
Bearer sessions use OAuth tokens and work with search, orders, and account APIs. Cookie sessions use browser cookies and work with cart and shopping lists.
Use heb-auth-unofficial to generate tokens via PKCE flow. Or use createTokenSession directly.
import { createTokenSession, HEBClient } from "heb-sdk-unofficial"
const session = createTokenSession({ accessToken: process.env.HEB_ACCESS_TOKEN ?? "", refreshToken: process.env.HEB_REFRESH_TOKEN, idToken: process.env.HEB_ID_TOKEN, expiresIn: 1800})
const heb = new HEBClient(session)See the sessions guide for heb-auth-unofficial setup, token refresh, and cookie bridge options.
Set a store
Store context drives pricing and availability. Set it before search, product details, homepage, and weekly ad calls.
await heb.setStore("790")Run a call
Search uses the mobile API and needs bearer tokens. Cart reads work with either auth mode.
const results = await heb.search("coffee", { limit: 10 })const names = results.products.map((product) => product.name)console.log(names)const cart = await heb.getCart()console.log(cart.itemCount, cart.total.formatted)Explore next steps
Read the configuration guide for session options. Review the SDK guide and error handling pages.