Storefront API quickstart
The Storefront API is the buyer-facing GraphQL API for catalog, cart, checkout, and customer account experiences. This quickstart makes a contextual product query and uses the same commerce context to create a cart.
Send requests as JSON over HTTPS. Replace {project} with your Thor Commerce project slug.
Public storefronts can allow anonymous requests. Protected storefronts must send a storefront token in x-thor-storefront-token. Never send an Admin API key from storefront code.
1. Choose the request context
Storefront results depend on the market and shopper. Resolve the store, price channel, currency, country, and locale once, then reuse them across product queries and cart creation.
Not every operation requires every value. Pass the dimensions your storefront supports instead of relying on implicit defaults.
Read Storefront request context before adding market switching or public caching.
2. Query products
Query only the fields needed by the current surface. Product lists use cursor pagination; keep endCursor with the filters, sort, and request context that produced it.
Prices use integer minor units. Format centAmount with currencyCode and fractionDigits, and treat the returned contextual price as authoritative.
See the complete products reference for filtering, facets, and backward pagination.
3. Create a cart
Create the cart with the same store, price channel, currency, and country used for discovery. The cart recalculates price, discounts, availability, tax, and totals; do not copy a product price into checkout state.
Inspect both cart and the typed payload errors. A successful HTTP response does not guarantee that the business operation succeeded.
Persist the returned cart ID and use the latest cart returned by every subsequent mutation.
Continue the integration
Use the dedicated guides when you move beyond the first request: