@usethrottle/mcp 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract-index.json +1 -1
- package/dist/docs-index.json +1 -1
- package/dist/lib.cjs +79 -2
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +79 -2
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +79 -2
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
package/dist/docs-index.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":"2026-12-05T08:59:09.995Z","entries":[{"title":"Docs","route":"/","headings":["Docs","Product docs","{c.title}","Developer docs"],"text":"Documentation Docs Look up how one thing works. Product docs explain what a feature does and where its edges are; developer docs are the API contract. New to Throttle? What Throttle stores → Integrating? Developer quickstart → Doing a job end to end? Guides by role → Product docs totalProduct pages on how each feature behaves — for operators, finance, and admins. productCards.map((c) => ( c.title c.blurb c.links.map((l) => l.label ) )) Developer docs The API, SDKs, webhooks, and extension platform. Building something new? Start with the developer overview . developerCards.map((c) => ( c.title c.blurb && c.blurb c.links.map((l) => ( l.label isExternal(l.href) && ↗ )) c.more && c.more.label )) Looking for what Throttle connects to? See integrations . For what each part of the product does, see features . .hub max-width: 1180px; margin: 0 auto; padding: 48px 24px 96px; .hub-head margin-bottom: 56px; .hub h1 font-size: clamp(34px, 4vw, 48px); line-height: 1.1; letter-spacing: -0.03em; margin: 8px 0 16px; .hub-lead font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 62ch; margin: 0 0 28px; .hub-start display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; .hub-start a display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); text-decoration: none; .hub-start a:hover border-color: var(--teal); .hub-start strong font-size: 15px; color: var(--ink); .hub-start span font-size: 14px; color: var(--teal); font-weight: 600; .hub-band margin-bottom: 64px; .hub-band-head display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px; .hub-band-head h2 font-size: 24px; letter-spacing: -0.02em; margin: 0; .hub-band-head p font-size: 15px; color: var(--muted); margin: 0; .hub-band-head a color: var(--teal); .hub-grid display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; .hub-card padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); .hub-card h3 font-size: 17px; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--ink); .hub-card > p font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0 0 14px; .hub-card ul list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; .hub-card li a font-size: 14.5px; color: var(--ink); text-decoration: none; .hub-card li a:hover color: var(--teal); .hub-more display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--teal); text-decoration: none; .hub-foot font-size: 15px; color: var(--muted); .hub-foot a color: var(--teal); @media (max-width: 960px) .hub-grid grid-template-columns: repeat(2, minmax(0, 1fr)); @media (max-width: 640px) .hub padding: 40px 16px 80px; .hub-grid, .hub-start grid-template-columns: 1fr;"},{"title":"Throttle Builder","route":"/builder","headings":["Throttle Builder","Where things live","How a page is built","The guide","{page.label}","Show when: control who sees a section","How the rules combine","Examples","For developers"],"text":"Throttle Builder Throttle Builder Throttle Builder is where you build your store's website without code: the home page, shop and product templates, content pages, cart and account pages, the header and footer, menus and the announcement bar. You can build in the visual editor, or connect an AI agent such as Claude, Cursor or VS Code and let it build for you within the access you give it. Your products, cart and checkout stay in Throttle. Where things live Throttle Builder opens from your installed extensions in the Throttle dashboard. Its left menu has three groups: How a page is built A page is a stack of sections . A section has one to six columns , and a column holds components : headings, images, buttons, product grids, forms and more ( builderData.components.length are built in). A column can also hold an inner section with its own columns. A section can turn its columns into tabs, an accordion, a carousel or a show-and-hide toggle. Every setting can differ on desktop, tablet and phone. Everything you change is a draft until you publish . Every change is kept in history, so you can undo it or restore an older version. The guide pages.map((page) => ( page.label page.description Open guide )) Show when: control who sees a section Show when lets a section, inner section or component appear only for some shoppers. Select it in the editor (a column has no Show when in the editor; an AI agent can set one), open the Advanced tab and find Show when . At the top, one line tells you in plain words what the rule does right now, for example Shown only to signed-in shoppers when the cart has items . With no rule it says Always shown . The line updates as you change the controls. How the rules combine Every control you set must be true at the same time (an AND , never an OR ). A control left on its default, such as Everyone or Any cart, is ignored. Picking groups always means signed-in shoppers. Devices work with no script, so the section is in the page for every device and the browser's screen width decides (the same breakpoints as the per-device Hide setting). Dates are decided in the shopper's browser after the page loads, so a page is never rebuilt when a date passes: the content of a section with dates is not in the server HTML (search engines and visitors without JavaScript never see it), it is an empty placeholder until the browser knows the time, an expired window collapses its placeholder, an open tab flips at the date, and a shopper whose device clock is wrong sees it at the wrong time. Menu items take both: a menu item limited to some devices is hidden by CSS on the others, in the header, the drawer and the mega menu alike. Examples A welcome banner for new visitors. Who sees it: Signed-out shoppers. Summary: Shown only to signed-out shoppers . A free-shipping nudge in the cart. The cart: Cart has items. Summary: Shown only when the cart has items . A members-only message. Only these groups: Wholesale, and The cart: Cart has items. Summary: Shown only to signed-in shoppers in the group Wholesale when the cart has items . Use it for messages, not for member prices. A phone-only banner. Devices: Phone. Summary: Shown only on phones . A Black Friday strip. Dates from 2026-11-27 00:00 until 2026-12-01 00:00, time zone Europe/Istanbul. Summary: Shown from 27 Nov 00:00 to 1 Dec 00:00 (Europe/Istanbul) . A countdown for tablets and desktops. Devices: Tablet and Desktop, Dates: until 5 Dec 18:00. Summary: Shown on tablets and desktops, until 5 Dec 18:00 . It only hides things on the store page. The content is still in the page's source, so never use it for anything private. The full details, including older renderers and AI agent use, are in Layout . Menu items take the same rule; see Header and footer . For developers If you build the store's code, start with Developers and the Builder developer reference ."},{"title":"Connect and AI agents","route":"/builder/ai-agents","headings":["Connect and AI agents","The Keys and AI agents screen","The address","Key kinds","Publishable key channels","Limits","Access levels","Set up your tool","Claude: claude.ai or the desktop app (sign in, no key)","Claude Code (uses a key)","Cursor (uses a key)","VS Code (GitHub Copilot, uses a key)","Let it see your store","Revoking","Next"],"text":"Throttle Builder Connect and AI agents An AI agent can build and edit your store with the Builder: it reads your site, edits drafts, checks its work in a preview and, if you allow it, publishes. You give it one address and either a key or a sign-in, and you choose what it may do. It can never change your catalog data. The Keys and AI agents screen In the Builder dashboard, open Keys and AI agents . From top to bottom it has: Connect an AI agent : choose your tool, then paste the address and a key into it (step by step below). Let it see your store : how to give the agent a browser so it can look at its own work. Test the connection : paste a key to see that it works and which tools your agent gets. It is checked once and not kept. Keys : your keys, each with its name, last four characters, level and when it was last used, and a Revoke button. Hosted assistants : assistants such as claude.ai that signed in instead of using a key. Troubleshooting : the common problems with their fixes ( copied on the Troubleshooting page ). The address Every assistant connects to the same address. Your key or your sign-in decides which store it works on. Key kinds Choose Create key , give the key a name after the tool or place that will use it, then say what it is for. A key is shown once, when you create it. Copy it then. It cannot be read back later. Publishable key channels Limits Up to 2 active secret keys and 20 active publishable keys . Revoke one to free a place. Keys do not expire. A key cannot be changed or read back: to rotate one, create a new key and revoke the old one. Each key or assistant may make 120 tool calls and 60 writes a minute ( rate limits ). Access levels Each secret key and each signed-in assistant has a level. You can change it at any time, and it applies on the very next call. Code permission. Code can read and change anything on your store pages. There is no separate code switch for a key: a key or assistant at Draft or above may write custom code components. They reach your store only when someone with Publish access publishes the page. See code components . Full can be granted only by the workspace owner or the person who installed Throttle Builder. Allow publishing. Keys and connections made before access levels are shown as Custom (legacy) and keep exactly the scopes they had. Only these have an Allow publishing switch: with it on, the agent can publish pages to your live store without asking you. Once a key matches a level, lower the level instead. New keys use levels. A tool a level may not use is not even listed to the agent. The full list is on the MCP tool reference . Set up your tool Choose your tool in Connect an AI agent . Supported: Claude (claude.ai, the desktop app and Claude Code), Cursor and VS Code with GitHub Copilot. Each snippet below uses the placeholder tb_sk_PASTE_YOUR_KEY . Replace it with your own key. Claude: claude.ai or the desktop app (sign in, no key) claude.ai connectors cannot send a key, so they sign in to Throttle instead. There is no key and no client ID: paste the address only. In claude.ai or the Claude desktop app, open Settings , then Connectors , then Add custom connector . Name it Throttle Builder and paste address as the URL. Leave Advanced settings empty. Do not paste a client ID or a secret. Choose Add , then Connect . Throttle opens: sign in. Pick the workspace, the application and the environment where Throttle Builder is installed, choose the level, and choose Approve . The assistant then appears under Hosted assistants , where you can change its level or revoke it. A new connection can take up to 5 minutes to work; if claude.ai says it could not connect, wait and reconnect. Claude Code (uses a key) Choose Create a key , pick a level and copy the key from the dialog. Run this once in a terminal, from the folder you work in: Then run claude mcp list : throttle-builder should say Connected. Cursor (uses a key) Save this as ~/.cursor/mcp.json (your own user config, which is not part of any project), then restart Cursor. To keep it in a project file ( .cursor/mcp.json ), keep the key out of it: set an environment variable named THROTTLE_BUILDER_KEY to your key and use this. In Cursor Settings, MCP: throttle-builder shows a green dot and its tools. VS Code (GitHub Copilot, uses a key) Save this as ~/.copilot/mcp-config.json (VS Code's user-level Copilot config, not part of any project), then run MCP: List Servers and check throttle-builder is listed (start it if it shows Stopped). To keep it in the project, save this as .mcp.json in the workspace root. Project files are often committed, so it reads the key from an environment variable named THROTTLE_BUILDER_KEY : set it to your key. VS Code reads an existing .mcp.json as is; to add one with MCP: Add Server , turn on the setting chat.mcp.workspaceRootConfig.enabled . Copilot Chat in Agent mode lists the throttle-builder tools. The screen also shows VS Code's older, deprecated setup ( .vscode/mcp.json ) for people who still use it. VS Code on macOS opened from the Dock does not see variables exported in your shell, so the key would be empty. Start it from a terminal where the variable is set ( export THROTTLE_BUILDER_KEY=tb_sk_PASTE_YOUR_KEY && code . ) and restart VS Code. Let it see your store An agent that cannot look at a page is guessing. Add one browser tool to your agent: it asks Throttle Builder for a preview link, opens it, looks and fixes what it sees. It opens preview links at 390, 768 and 1280 px wide. The screen offers three: Playwright MCP (start here): opens a clean browser the agent controls, at any width. In Claude Code: claude mcp add playwright -- npx @playwright/mcp@latest . Claude in Chrome : uses your own Chrome, signed in as you. Needs a direct Anthropic plan and the Claude in Chrome extension (version 1.0.36 or later); start Claude Code with claude --chrome . Chrome DevTools MCP : adds the console, network requests and performance. In Claude Code"},{"title":"MCP tool reference","route":"/builder/ai-agents/tools","headings":["MCP tool reference","How the tools work","Rules that apply to every tool","baseRev: do not overwrite someone else's edit","Idempotency keys","Rate limits","Errors every tool can return","What each level can call","Tools by area","{g.label}"],"text":"Throttle Builder MCP tool reference The Builder gives an AI agent tools.length tools. This page lists every one, grouped by what it is for: the access level it needs, each input, what it answers and the errors it can return. How to connect an agent is on Connect and AI agents . How the tools work An agent sees only the tools its access level allows. A tool it is not allowed is not listed at all. Every change goes to a draft . Nothing reaches the store until a tool that publishes is called, and only a Publish or Full key has those. Answers are JSON text. A refusal comes back with isError set and an error object holding a code and a message , and sometimes more (for example issues ). Every change in a draft is recorded in the page history and can be undone with undo_change . Catalog data (products, collections, categories) is read only here. An agent cannot change it. Rules that apply to every tool baseRev: do not overwrite someone else's edit Reading a page or the site answers a draftRev . Send it back as baseRev on the next write. If the draft changed in between (you or another agent edited it), the write is refused with DRAFT_CONFLICT , nothing is saved, and the agent reads the page again. Leaving baseRev out writes on top of the current draft, except for update_menu and restore_site_settings_version , which always need it. Publishing always needs it too. Idempotency keys Most writes take an optional idempotencyKey (1 to 128 characters). Repeating a call with the same key within 24 hours returns the first answer instead of writing again. Keys belong to one key and one tool, so two keys that pick the same text do not collide. Use a new key for each different change. Tools that insert something also need an index when you send a key, otherwise INDEX_REQUIRED . Rate limits Each key or connected assistant may make 120 tool calls a minute , and 60 writes a minute (a write also counts as a call). Over the limit the answer is 429 RATE_LIMITED with Retry-After: 60 . A write that cannot be counted is not made. Errors every tool can return [ code: e.code , e.when]) /> Input that does not match a tool's schema is refused before the tool runs. Fixes for the errors you meet most are on Troubleshooting . What each level can call [ LEVEL_NAME[l]!, $ tools.filter((t) => level(t) === l).length tools at exactly this level , ]) /> Each level also has every tool of the levels below it. A key made before access levels (shown as Custom) keeps the scopes it had, and the tools marked "Needs Allow publishing" below need that switch on as well. Tools by area groups.map((g) => ( g.label ( g.tools.length ) )) groups.map((g) => ( g.label g.blurb g.tools.map((tool) => const note = TOOL_NOTES[tool.id]!; const lv = level(tool); return ( tool.id tool.description Needs: LEVEL_NAME[lv] access or above. Scopes: tool.scopes.join( , ) . tool.requires.length > 0 ? Also requires: $ tool.requires.join( , ) . : tool.needsAllowPublishing ? A key made before access levels also needs Allow publishing. : Kind: tool.kind === read ? reads only : writes tool.destructive ? ; changes the live store or throws work away, so a client may ask you first : tool.affectsLive ? ; changes what shoppers see : . Answers: note.returns tool.inputs.length === 0 ? ( No inputs. ) : ( [ code: f.name , f.required ? Yes : No , f.type, [f.description ?? , constraint(f)].filter(Boolean).join( ), ]) /> ) note.errors.length > 0 && ( [ code: e.code , e.when]) /> ) ); ) ))"},{"title":"Components","route":"/builder/components","headings":["Components","{group.label}","Options every component has","How the option tables read"],"text":"Throttle Builder Components Components are the blocks you place in a column: a heading, an image, a product grid, a contact form. The Components library in the editor holds three kinds: Built-in components (this page), your own Custom code components and Saved sections. The store has builderData.components.length built-in components. Custom and saved components are on Saved and code components . Sections, columns and inner sections, which hold the components, are on Sections and layout . groups.map((group) => ( group.label group.blurb [ html: $ c.title , c.description, ]) /> )) Options every component has These options are on every component, whatever its type, and are not repeated on each component page. [ s.label, code: s.key , TAB_LABEL[s.tab], s.key === anchor ? Starts with a letter; letters, digits, - and _; 64 characters at most. It becomes the element id, so a link to #name scrolls to it. : allowedValues(s), defaultValue(s), ]) /> How the option tables read Theme colour values are written token:name and follow the theme, including dark mode; a hex colour stays fixed. Spacing takes a step of the theme's spacing scale (none, xs, s, m, l, xl, 2xl) or a size in pixels. Size takes a step of the theme's type scale (xs to 3xl) or a size in pixels. One value per language means the text is translated: each store language has its own value. Every option can be overridden for tablet and phone. See responsive overrides ."},{"title":"Contact forms","route":"/builder/contact-forms","headings":["Contact forms","Add a form","Where messages go","Spam protection","What an AI agent can see","If the picker says Builder needs an update"],"text":"Throttle Builder Contact forms The contact form component puts a form on a page. Every message is saved in Throttle and emailed to the store owner, or to addresses you choose. It works without JavaScript; with it, the shopper stays on the page and sees the success message. Add a form Add the Contact form component to a column. In its settings, under Form , pick one of your Throttle site forms or create a new one. Choose Email to : Store owner (the default) or Custom addresses . Choose which fields to show (name, email, phone, subject, message, consent checkbox), their labels and which are required. Email and message are shown and required by default. Set the Submit label , the Success message and the Error message , or set Go to this page after sending to send the shopper to a page instead of showing the message. Publish the page. The component never holds or shows an email address in the page. The Builder writes the recipient setting to the form in Throttle. A subject can be a free field or a list: put the choices in Subject options , separated by commas. Where messages go Saved in Throttle. Every submission is stored with the form. You read them in the Throttle dashboard (the Forms area), not in the Builder. Emailed. To the store owner, or to the custom addresses you set. Your own team members' addresses are notified at once. Any other address (a shared sales inbox, say) is first sent a confirmation email and receives nothing until someone clicks Confirm. Webhook. Developers can subscribe to the form.submitted event. See Site forms . Spam protection There is no captcha. These protections run on every form: Hidden trap field. The component includes an invisible field named _gotcha that people never see or fill in. A submission with it filled in gets the normal success answer, but nothing is stored or emailed. Rate limit. At most 10 submissions a minute from one IP address; more are refused with a 429 answer. Own site only. A form made through the Builder accepts posts from your store's own address only, so other websites cannot use it from a browser. Fixed recipients. Emails go only to the addresses set on the form. A submission can never choose who receives mail. Size limits. At most 50 fields and a 64 KB body per submission. The full list, with the error codes, is on Site forms . If the email does not arrive, check spam folders and filters first. What an AI agent can see An AI key can list your forms ( list_site_forms ), create one ( create_site_form ) and read submission metadata only ( list_form_submissions ): how many there are, when each came in, its topic and whether its email was delivered. It never sees names, email addresses, phone numbers or messages. The topic is shown only when it is exactly one of the subject options you set on the form. Free text a visitor typed is hidden, because it could hold personal details, and so is any option that looks like an email address, phone number or web address. If the picker says Builder needs an update Listing and creating forms needs a permission ( forms:write ) that only newer Builder versions ask for. In the Throttle dashboard open Extensions, then Throttle Builder, upgrade it and approve the new Forms permission. Then reload the Builder. More on Troubleshooting ."},{"title":"Builder for developers","route":"/builder/developers","headings":["Builder for developers","The packages","Install","Minimum versions that fit together","create-store","storefront-react without the Builder","Which setting wins","Developer reference"],"text":"Throttle Builder Builder for developers Your store reads what you publish in the Builder through a few npm packages. create-store scaffolds a Next.js store; with --builder-mode build it also adds a Builder site wired to them. This page lists each package, its current version and what it is for. The packages Install Minimum versions that fit together storefront-react 0.4.3 expects builder-react ^0.5.0 and builder-schema ^0.4.0 (both are optional peers: needed only when you use the Builder). It also expects @usethrottle/catalog ^1.4.1 || ^2.0.0 , @usethrottle/money ^1.1.0 , @usethrottle/auth 0.15.0 or later, @usethrottle/scripts 0.4.0 or later, and Next.js 15 or later. The SDK sends the minimum schema version it needs (0.4.0) on every read, which the Builder uses to serve the current site settings format. Keep builder-schema on 0.4.x. A component that is newer than your installed storefront-react is not available in your store. Update the package. See Troubleshooting . create-store It asks for your catalog's browser key ( pc_pk_... ) and then its server key, writes them to .env.local and installs dependencies. The store has the shop, collections, categories, tags, product, search and account pages, the cart drawer, and the cache-safe webhook and sync routes. The default, --builder-mode live , adds no Builder. To show Builder pages in a store made that way, set up the SDK yourself: see Builder for developers . Only --builder-mode build adds a Builder site. Its options: , The catalog browser key. With --yes it asks nothing. ], [ code: --server-key , The catalog server key, for reads made by your store server. It is asked for after the browser key. ], [ code: --offline , Do not call the catalog to tell the keys apart. Then --catalog-key and --server-key are both needed. ], [ code: --pm , The package manager. ], [ code: --skip-install , Write the files and stop. ], ] /> More options and the hosting-cost rules are in the create-store guide . storefront-react without the Builder @usethrottle/storefront-react is a components package on its own: drop-in React storefront components that read their display from your catalog's settings. You do not need the Builder to use it. Which setting wins When you use the Builder, the order is: Builder setting , then the SDK prop you pass to the component, then the default . A value a merchant sets in the Builder overrides the same value passed as a prop; a prop overrides the default. Without the Builder, the prop and the default are all there is. Card, badge, product and catalog wording is no longer read from the catalog's /config . Pass strings or localization , or use the Builder's per-locale wording. See Storefront components for every component and its props. Developer reference Builder for developers : how the pieces fit together. The SDK ( @usethrottle/builder ). Rendering ( @usethrottle/builder-react ). The document format ( @usethrottle/builder-schema ). MCP for developers and the guide's tool reference . Widget API and widgets guide . Delivery modes , Media and Site forms ."},{"title":"Getting started","route":"/builder/getting-started","headings":["Getting started","Before you start","1. Install Throttle Builder","2. Connect your store","Product Catalog","Your store","3. Give your developer a key","4. Tell your store when you publish","5. Choose how pages reach your store","6. Make your first page","7. Preview","8. Publish","What to do next"],"text":"Throttle Builder Getting started This page takes you from nothing to a published page. Most of the time goes into two steps that need the person who builds your store's website, called your developer below: giving them a key, and giving them a secret for store webhooks. Before you start You need: A Throttle workspace with your store's application. Product Catalog, if you sell products. Without it the shop templates and the cart are not part of your store. A developer who connects your store's website to the Builder once. 1. Install Throttle Builder The left menu has three groups. Everything in this guide is in one of these places. 2. Connect your store Open Connections in the Connect group. It has two cards. Product Catalog The card shows whether Product Catalog is Installed , with its version, or Not installed . Choose Check again after you install it. If it is not installed, the product components are hidden from the library. Without a linked key, product components show placeholders in the editor. Your store Under Your store , enter the Store URL , for example https://shop.example.com . Use the address only, with no path. It is used for links in the editor and as the default place change notices are sent. Choose Save to draft , then Publish site settings . The same card has a Throttle publishable key field (it starts with pk_ ). It lets the sign-in and order components talk to your store. Your developer gives you the value. 3. Give your developer a key Your developer's code needs a key to read what you publish. Your developer sets it as THROTTLE_BUILDER_KEY in the store's server and build environment. It must never go in the browser. If you lose it, make a new one and remove the old one from the same screen. The developer side is on Developers . An AI agent uses a secret key with an access level. See Connect and AI agents . 4. Tell your store when you publish On Store webhooks your store gets a signed notice when pages or settings are published, so it refreshes what it saved. Set it up once. Your store needs the revalidate route /api/throttle/builder-revalidate , which your developer sets up. Without it the notice has nowhere to go. Your developer sets the secret as THROTTLE_BUILDER_WEBHOOK_SECRET . You can have up to 5 endpoints. Rotate secret gives an endpoint a new secret at once, so your store must be updated with it. 5. Choose how pages reach your store Open Site , then the Delivery tab. There are two modes. Live : the store reads each page as it is published and refreshes only what changed. It is the default. Build-time : published changes wait until you choose Release . Your host then rebuilds the store once from a frozen copy of everything published. This mode also needs a deploy hook. If you are not sure, stay on Live. You can switch at any time. The choices are explained on Wording, delivery and shop . 6. Make your first page The editor saves as you work, and the top bar shows Saved · draft . Pages are covered on Pages and templates , and how a page is laid out on Sections and layout . 7. Preview Choose Preview in the top bar to see the page without the editor. Share link makes a preview link you can open in a new tab or copy and send. To look at the page on phone, tablet and desktop widths, use the device buttons. 8. Publish Nothing you change is live until you publish it. Choose Publish in the top bar and confirm in the dialog. If the site settings have unpublished changes, the dialog offers Also publish the site settings . On Pages & templates , each page shows Draft , Unpublished changes or Published . History, undo and restoring an older version are on Publishing and history . What to do next Set the look of the whole store under Site : Site settings . Build your menus and your header and footer . Upload images on Media . Let an AI agent build for you: Connect and AI agents ."},{"title":"Header and footer","route":"/builder/header-and-footer","headings":["Header and footer","Open them","Build a header","Menu items for some shoppers","Phones","Sticky header","Build a footer","Templates without the header and footer","Publishing"],"text":"Throttle Builder Header and footer The header and the footer are shown on every page of your store. In the Builder they are parts : documents you design with the same sections, columns and components as a page. Open them On Pages & templates , choose Header and footer in the Show filter. The two rows are Header and Footer (kind Part ). Both exist from the start. In the editor you can also switch to them from the document list at the top, under Header and footer . A store has exactly limits.partsPerSite parts: one header and one footer. An AI agent addresses them as part:header and part:footer in get_page , add_section , add_widget and the other page tools. The published header is written as a header element and the footer as a footer element, on the server with every page. A part with no sections draws nothing. Build a header A typical header is one section with a few columns. Components for it: Logo , Your logo from Site settings, linked to the home page. ], [ html: Menu , Your header menu. Use the Drawer mode so it becomes a menu button on phones, or Mega for wide panels. ], [ html: Announcement , The announcement bar from Site settings. Put it in the top section. ], [ html: Search box , Search with live suggestions. ], [ html: Cart button , The cart with its item count; it opens the cart drawer. ], [ html: Account button , A link to the account page. ], [ html: Locale switch and Currency switch , Language and currency selects, shown when the store offers two or more. ], ] /> The catalog components (search, cart, locale and currency) need Product Catalog. The announcement text, the logo and the menus are set under Site ; see Announcement , Brand and Menus . Menu items for some shoppers Each menu item takes the same Show when rule as a section: signed-in or guest, cart state, Only these groups and a date window (from and until). A menu item has no device rule: use the separate header and mobile menus. The Menu component and the header drawer leave a hidden item out. An item with a rule is left out until the buyer is known , so the server-rendered header never shows it and it appears after the page loads. The store has to pass the viewer to the Builder. Like every Show when rule this is presentation only: a hidden link's page is still reachable by its URL. A store on an older renderer ( @usethrottle/builder-react 0.5.14 or earlier) loses menu items that carry any visibility rule (signed-in, cart or groups) until you upgrade @usethrottle/builder-react and @usethrottle/builder together; the same store also hides group-ruled sections. Phones Use the Phone device button to check the header at 390 px. Columns stack on phones, so give the header columns phone widths, or set the Menu to the Drawer mode so the links collapse into a menu button that opens a full-screen drawer. See Sections and layout . Sticky header Select a header section and open Header behaviour on its Content tab. Turn on Stick to the top so the header stays in view while the shopper scrolls (the editor keeps the page still; Preview shows it sticking). Collapse into a menu button below folds the header into a menu button under a width: Never , Tablet width and below (1024 px) , Phone width and below (768 px) or Custom width ( Collapse below (px) , from 768 to 1280). Menu button label sets the words on that button for the current language; leave it empty for the store's own word. See Sections and layout . Build a footer The footer is fully yours. Add sections and columns, then use the Menu component for your footer menu, text and rich content for contact details, images, buttons, and the Copyright component for the line at the bottom. The copyright text comes from the footer wording under Site , with the year and your store name filled in. A contact form can sit in the footer; see Contact forms . Templates without the header and footer The header and footer normally appear around every page and template. A template whose meta has frame set to none (default site ) is drawn without them, for example a frameless 404 page: the store hides them with CSS, so they stay in the page HTML. You turn it off with Show header and footer in the template's Search and sharing dialog, or an AI agent sets seo.frame with update_page_meta . See Pages and templates . Publishing The header and the footer are published on their own, like a page: choose Publish in the editor. They are shown on every page after that. See Publishing and history ."},{"title":"Sections and layout","route":"/builder/layout","headings":["Sections and layout","How a page is built","Section options","Content tab","Style tab","Advanced tab","Columns","Inner sections","Limits","Responsive: desktop, tablet and phone","How overrides work","In the editor","Column widths on tablet and phone","Interactions: tabs, accordion, carousel and show / hide","Things to know","Entrance animations","Sticky sections and the drawer","Show when: signed in, cart, buyer groups, devices and dates","How dates are decided","Older renderers","Next"],"text":"Throttle Builder Sections and layout A page is a stack of sections. A section has columns, and a column holds components or an inner section. Every setting can be different on desktop, tablet and phone, and a section can turn its columns into tabs, an accordion, a carousel or a show and hide toggle. How a page is built In the editor, the Add tab has a Layout group. Choose Section (one column) or a section with 2 to 6 columns to add it to the page, and Inner section to put a row of columns inside a column. The Layers tab shows the whole page as a tree. Click a section, column or component to change it on the right. Settings are on three tabs: Content , Style and Advanced . AI agents use add_section , set_columns , add_inner_section and update_node . Section options Content tab Style tab Two more background settings sit on the Style tab, next to Background image ( background.mobileImage and background.priority in the page document): Phone image ( mobileImage ), an image picker, is a second picture used instead of the background image at phone width (767 px and below), so you can crop differently for a narrow screen. Load the image first ( priority ), a toggle that is off by default, marks the background as the main image of the page. The page then asks the browser to load it early with high priority, one request for the desktop picture and one for the phone picture when they differ (a preload with a media query). Use it only for the background at the top of the page. Tablet overrides are not preloaded. An AI agent sets both in background with add_section or update_node : mobileImage is a media id and priority is true or false. Advanced tab Hide hides the section (it can be set per device), Anchor gives it an id so a link can jump to it (a letter first, then letters, digits, dashes or underscores, 64 characters at most), and Entrance animation animates it in. See Entrance animations . Columns A section has 1 to 6 columns. Use Columns with the minus and plus buttons on the Content tab of a section, then choose one of the width presets (for two columns: 50 / 50, 33 / 67 and 67 / 33; for three: three equal columns, or 25 / 50 / 25). You can also drag the edge between columns on the canvas. The column widths always add up to 100. On a phone, columns stack one under another at full width by default. Use Order when columns stack to reverse them. On a tablet, columns keep their desktop widths unless you set tablet widths. Inner sections An inner section is a row of columns inside a column, for a layout inside a layout. It has the same options as a section. An inner section cannot contain another inner section. It can only sit in a column of a section, not inside another inner section, and saved sections go on the page itself, not inside a column. Limits Responsive: desktop, tablet and phone There are three screen sizes. Every option of a section, column and component can be set differently for each. How overrides work Your normal settings are the desktop settings. Tablet inherits desktop. A tablet setting is an override that applies only on tablets. Phone inherits tablet. If you set something on tablet and not on phone, phones use the tablet value. Removing an override makes the device follow the wider one again. In the editor Use the Device buttons at the top ( Desktop 1280 , Tablet 768 , Phone 390 ). The settings panel then says Editing for Tablet. A change here is an override that only applies at this width. A setting with an override shows a small chip with the device name. Choose Reset to inherited on the chip to remove the override. An AI agent uses set_responsive ; a null value removes an override. Column widths on tablet and phone On desktop the widths add up to 100. On tablet the columns keep their desktop widths unless you set widths for tablet. On phone every column is 100 wide, so they stack, unless you set widths for phone. When you set tablet or phone widths, set them for every column of the section, not just some. Use the width presets while the Tablet or Phone device is selected. If columns do not fit in one row, the one that does not fit moves to the next row. Column count can be changed only while the Desktop device is selected. Interactions: tabs, accordion, carousel and show / hide Choose a section's Interaction on its Content tab. Its columns become the panels, so a section with three columns becomes three tabs, three accordion items or three slides. It works for sections and inner sections, can differ per device, and each mode shows only its own options. Things to know Panel title sits on each column and is shared by all devices. If a tabs or accordion panel has no title it shows a number, and the editor and AI tools warn you ( PANEL_TITLE_MISSING ). Autoplay pauses when the shopper hovers or focuses the carousel, and has a visible Pause button. It does not run for shoppers who asked their device for reduced motion. All the panels are in the page HTML, so their text can be read by search engines. Without JavaScript the tabs show every panel one under the other, and the accordion and show / hide use the browser's own open and close. An AI agent sets these with update_node on the section, for example interaction , carouselAutoplay , carouselIntervalMs , accordionMultiple and toggleLabelOpen . Entrance animations Sections, columns and components have Entrance animation and Entrance delay on the Advanced tab. The animation plays once, when the block scrolls into view. The animations are None (default), Fade in , Slide up , Slide in from the left and Zoom in . The delay is in milliseconds, from 0 to 2000. Shoppers who asked their device for reduced motion see no animation. Content is hidden before it animates in only where scripts run, so without JavaScript everything is visible. Sticky sections and the drawer A section in the page document can be sticky ( frame.sticky set to top ) so it stays at the top while the shopper scrolls, and can collapse into a drawer under a w"},{"title":"Media","route":"/builder/media","headings":["Media","Upload images","Add from URL","Sizes and width variants","Alt text","Where images are used","Deleting an image","What an AI agent can do"],"text":"Throttle Builder Media Every image on your pages comes from the media library. You upload an image once, describe it with alt text, and pick it in any component or setting that takes an image. Pages use these library images, never a typed address. Upload images Open Media , then drop images on the drop area or choose files with the file picker. You can upload several at once. A file that is too big or the wrong type is refused with a message that names the file. You can also pick or upload an image from the picker inside any image setting. Add from URL Choose Add from URL above the drop area. Type the Image address , optionally write Alt text (optional) , and choose Add image ( Cancel closes the form). Throttle downloads the image once and keeps its own copy in your library, so it needs a public https address (PNG, JPEG, WebP, GIF, AVIF or SVG, up to 10 MB, 20 KB for an SVG). The same button is in the picker inside any image setting. The library itself is Throttle's media library, shared with the rest of your store, with its own limits (60 uploads a minute, 10,000 images and 5 GB of originals). See Media for developers . Sizes and width variants Throttle keeps your original and makes WebP copies at 320, 640, 1024, 1600 and 2400 pixels wide, never larger than the original (a 1100 pixel image gets 320, 640 and 1024). The Builder uses these copies so a phone does not download a desktop-size image. You do not choose a size; the store picks the right one. Alt text Select an image to see its size, then write Alt text (up to 500 characters) and choose Save alt text . Alt text describes the image for people who cannot see it and for search engines. An image without it shows as "Image with no alt text" in the library, and an image setting shows "No alt text" until you add it. Use Search by alt text to find an image. An AI agent changes alt text with update_media . Where images are used Choose an image in a component's image setting, in a section or column background, in the brand settings or as a page's share image. The setting holds the image's id. When you publish, the Builder freezes the images a page uses into the published copy, so a store never has to ask the library for them one by one. Deleting an image Select the image, choose Delete , then Yes, delete . Delete does not refuse an image that pages use. It is a soft delete. Pages that were already published keep showing it, because their copy was frozen when you published, until its file is removed (30 days). When you publish a page that still uses a deleted image, the publish succeeds with a warning ( ASSET_DELETED ): "This image was deleted from the media library. It keeps showing until its file is removed; replace it." Replace it before then. An image that no longer exists at all blocks the publish. An AI agent deletes with delete_media , which needs the Publish level, or Allow publishing on a key made before access levels. Ask the agent to check where an image is used first. What an AI agent can do Details and errors are on the tool reference ."},{"title":"Menus and mega menu","route":"/builder/menus","headings":["Menus and mega menu","The Menus editor","Several menus","The mobile menu","Items, levels and links","What an item can link to","Category tree","More item options","Mega menu","Showing a menu on a page","On the server","Next"],"text":"Throttle Builder Menus and mega menu Menus are the lists of links in your header and footer. You build them once under Site , then show them anywhere with the Menu component. They are written into the page on the server, so shoppers and search engines get the links straight away. Opening a link in a new tab, CSS classes, descriptions, badges, the mega menu and category-tree items are saved only once your store has moved to the new site settings. Until then the Menus tab shows them and says they are not in the draft you publish yet ("They show in the editor now and save once the store upgrade is live"); labels, links, nesting, order and named menus always save. Until then a mobile menu with items also counts as one of the extra named menus, and the tab says phones keep showing the header menu until the Builder update ships. The Menus editor Open Site and choose the Menus tab. It has three panels: Add items on the left, the menu as a tree in the middle, and the selected item on the right. A preview under the editor draws your changes as you make them. Changes go to your site draft; publish them with the site settings (see Publishing and history ). Undo and redo cover every edit. Drag an item to move it, or select it and use Up , Down , Nest and Un-nest . Tick items in Add items and add them to the end of the menu. Select an item to edit its Label and Link . An AI agent edits one menu with update_menu , or all of it with update_site_settings . Several menus Every site has a Header menu , a Footer menu and a Mobile menu . You can add up to limits.namedMenusMax more named menus, for example help . Choose the menu to edit in Menu to edit . Use New menu to add one (lower case letters, digits and dashes, starting with a letter, 40 characters at most), Rename to rename it and Delete menu to delete it. A component that shows a deleted menu shows no links. A named menu is shown by choosing its name in the Menu component's Menu option. The default name is header . The mobile menu Phones use the header menu unless you make a mobile menu. On the Mobile menu tab, choose Make a mobile menu from the header to start from a copy, then remove what phones do not need. When a mobile menu has items, a Menu component set to header shows it on phones (up to 767 px wide) and the header menu on larger screens. Both are in the page HTML and CSS chooses which is shown. Items, levels and links A menu has up to limits.menuDepth levels : top-level items, then items under them, then one more level. A menu holds up to limits.menuItems items in total, counting an automatic category tree after it fills itself. What an item can link to The catalog kinds need Product Catalog linked. An item whose target cannot be found is shown as plain text on the store, not as a link. Category tree With Product Catalog, Add category tree adds one item that fills itself with your live categories, so new categories appear without editing the menu. Choose where it Starts from (all categories or one) and Levels shown (One level or Two levels). Items cannot be nested under a category tree. More item options Mega menu A mega menu opens a wide panel under a header item. It works only on top-level items of the header menu . Select such an item and switch on Mega menu panel . To show the panels, set the Menu component to the mega mode. On phones the panels become a list that opens one level at a time, and the featured block is hidden. Turn the panel off before nesting an item that has one. Showing a menu on a page Add the Menu component to a column of the header, footer or any page. Choose the Menu name and a Mode . On the server The menu is written into the page HTML with the page. The browser does not fetch it afterwards. Every level is a nested list of links inside a navigation element, so search engines can follow all of it. Without JavaScript, submenus open when you hover or focus an item. Menus are part of the site settings, so they go live when you publish the site settings, not with a page. Next Header and footer : where menus usually go. Saved sections for mega menu featured blocks."},{"title":"Pages and templates","route":"/builder/pages-and-templates","headings":["Pages and templates","The Pages & templates screen","Content pages","Create a page","Page settings","Templates","Shop templates need Product Catalog","The one component each template needs","The product template layouts","Components that belong to templates","Default layout and Reset template","Which templates search engines skip","Search and sharing for a template","Scripts","The 404 page","Frameless templates","Content around catalog pages","Next"],"text":"Throttle Builder Pages and templates Your store is made of two kinds of page. A page is one page you write, such as the home page or About. A template is designed once and filled in for every product, collection, category and so on. The Pages & templates screen The table has a Show filter ( All , Pages , Templates , Header and footer ) and a search box. Every row opens in the editor. Each row shows its Kind , its Status and when it was Last edited . Draft : never published. Unpublished changes : live, with newer changes waiting. Published : what is live is what you see. Default layout : a template you have not changed yet. The More actions menu of a page has Publish (when it has changes), Settings , Duplicate and Delete . The home page cannot be deleted. A deleted page stays live until you publish the deletion; it is listed as Deleted · Publish to remove with a Publish deletion button. Content pages Create a page Type a name in New page name , choose Content page or Landing page under Page type , and choose Create page . The page opens in the editor as a draft. The home page already exists. An AI agent uses create_page . Page settings Open Settings from the row menu. If the store has more than one language, pick the language to edit first. An AI agent changes all of these with update_page_meta . When you change a live page's address, visitors to the old address are sent to the new one after you publish. After you publish a page path, the /pages/ address redirects to the path with a permanent redirect (308). The store itself answers on the shop, cart, account, checkout and system addresses, so a page cannot use those paths. Templates Open a template from Pages & templates like any page. A bar at the top says which template it is and where the store answers it. You design it with the same editor: sections, columns and components. Shop templates need Product Catalog The shop, collection, category, tag, search, product and cart templates appear only when Product Catalog is installed. Without it the table says how many shop templates are hidden, and your edits to them are kept. The account, sign-in, sign-up, verify email, order complete and not-found templates are always part of your store. The one component each template needs Each template must hold one particular component exactly once. Publishing is blocked until it is there, and the editor shows a banner telling you which one to add from the Add tab. Listing grid ], [ Product , html: Product buy box (or a Product main , which includes it) ], [ Cart , html: Cart lines ], [ Account , html: Account dashboard ], [ Verify email , html: Verify email ], [ Sign in , html: Sign in ], [ Sign up , html: Sign up ], [ Order complete , html: Clear cart ], [ Not found , Nothing in particular ], ] /> The product template layouts The product template ships these starting layouts: productVariants.join( , ) . There are three real layouts: Classic (the gallery beside the buy box), Stacked and Editorial ; split is the old name of classic and draws the same page. They are the same three choices as the Layout option of Shop display and the Page layout option of the Product main component. Every starting layout holds the breadcrumbs, the product main block and the product details. An AI agent picks one when it resets the template, with reset_template and its variant option. The visual editor has no variant picker on the template itself: choose the layout in Shop display and apply it with Reset template , or change Page layout on Product main. Components that belong to templates Product main, Product gallery, Product buy box, Product breadcrumbs, Product details, Product related and Product reviews can be used only on the Product template. The listing components (Listing header, Listing grid, Listing filters, Listing toolbar) and the cart components read the page they sit on. Outside their template the editor shows a note instead. Everything else can be used on any page, template, header, footer or saved section. All of them are listed on Components . Default layout and Reset template A template you have not changed shows Default layout in the list. Throttle supplies the default design: for example the listing templates hold a header, toolbar, filters and grid, and the cart holds a heading, cart lines, an empty-cart message and a summary. To go back, open the template and choose Reset template , then Reset to default . Only your draft changes. What is live stays until you publish, and you can still restore an older version from History. Choose Keep my draft to cancel. Which templates search engines skip These templates start as noindex, which asks search engines to leave them out: Search results , Cart , Account , Verify email , Sign in , Sign up and Order complete . The shop, collection, category, tag, product and not-found templates are indexed. A template can have its own title template, description and noindex setting; an AI agent sets them with update_page_meta and the document template:product (or another template name). The page-level search settings are on Search and sharing . Search and sharing for a template In the editor, open the More actions menu of a template row and choose Search and sharing . The dialog Search and sharing: (template name) has: Title pattern : up to 200 characters, with buttons to insert the tokens that mean something on that template ( product.title on Product, listing.title on Shop, Collection, Category and Tag, query on Search, and store on all). It shows an example title. Empty uses the store's own title for the template. Description , per language, up to 300 characters, with a length meter. Empty uses the site's default description. Hide this template from search engines : a switch that says what the template does by default and whether you changed it. Choose Save settings to write it to the template draft; publish the template to make it live. A template row shows Hidden from search when it is hidden, "},{"title":"Publishing and history","route":"/builder/publishing","headings":["Publishing and history","Drafts and autosave","Preview","Publish","History: versions and undo","Changes and undo","Versions and restore","Discard draft","Delivery: Live or Build-time","Releases (Build-time)"],"text":"Throttle Builder Publishing and history You never edit what visitors see directly. You edit a draft , look at it in a preview, and publish when it is right. Every change is kept in a history you can undo or restore from. Drafts and autosave Every page, the header and footer, saved sections and templates have a draft and, once published, a live copy. Site settings have their own draft too. The editor saves your draft by itself, a moment after you stop typing (less than a second, and at most every 3 seconds while you keep editing). You never press Save. The top bar shows the state: Saved · draft , Unpublished changes , Offline, changes kept (they are saved when you are back online) or Not saved . If the draft was changed elsewhere, for example by an AI agent, a banner says This page changed elsewhere and offers Keep mine or Reload their version . Preview Preview in the top bar shows the page without the editor. Exit preview goes back. The Preview link menu makes a link to share the draft with someone who has no Throttle account. It needs no sign-in, is read only and expires (1 hour for a person's link). For an AI agent, get_preview_url answers draftUrl (the draft, no sign-in, 12 hours, drawn at the window's own width so it can be checked at 390, 768 and 1280 px), liveUrl (the published page, or null) and storePreviewUrl (the draft on your store itself, 1 hour). The store preview needs a store URL in the site settings, and it is the only place a code component runs. Publish Choose Publish in the top bar. The dialog says "This makes the current draft live for visitors." and lists problems that would break the live store; fix them and publish again. Publish saves your draft first, so what goes live is exactly what you see. If the draft changed after the preview (you or another agent edited it), publishing stops with a conflict, so nothing you have not looked at goes live. Images are frozen into the published copy (see Media ). AI agents: publish (page, header, footer, template; with includeSite also the settings) and publish_site_settings need the Publish level. Publishing a page deletion or a saved section needs Full . publish always needs the baseRev the agent previewed. History: versions and undo Choose Version history in the top bar. It has two lists. Changes and undo Undo and Redo in the top bar ( ⌘Z , ⇧⌘Z ) step back through your editing, up to L.undoSteps steps. The change list shows each draft change, by you or by an AI agent, newest first. Undoing a change says "Undone. Nothing was published.": it only changes the draft. An agent uses list_changes and undo_change (with document site for the site settings). It must undo the newest change that is not undone first. Versions and restore Every publish saves a version. Each document keeps the latest L.versionsPerDocument . Restore puts an older version into your draft. Your current draft is saved first as a checkpoint, so you can go back to it. Nothing goes live until you publish. An agent uses list_versions and restore_version ; for site settings list_site_settings_versions and restore_site_settings_version . Discard draft Discard draft throws away your unpublished changes and goes back to the published copy. It is not offered when nothing has been published. An agent uses discard_draft . Delivery: Live or Build-time How your store gets what you publish is a setting you can change at any time, in the Site screen ( Wording, delivery and shop ). Only an admin or developer can change it. Releases (Build-time) In Build-time mode the dialog says "this page goes live when you press Release ". The Release panel lists what was published since the last release. Set a deploy hook (a public https address from Vercel, Netlify or your host) and Release calls it once to rebuild. Without a hook a release is still made, but nothing is sent. Releases are limited: one every 10 seconds and 20 an hour. The latest 50 are kept. Roll back to this on a release rebuilds the store with exactly what that release held, as a new release. AI agents: create_release , list_releases and rollback_release need the Full level and a store in Build-time mode (otherwise NOT_BUILD_MODE ). The technical side is in Delivery modes for developers. See Troubleshooting ."},{"title":"Saved and code components","route":"/builder/saved-and-code-components","headings":["Saved and code components","The Components library","Saved sections","Create one","Insert it on a page","Edit once, change everywhere","Detach","Publishing and deleting","Code components","On by default, with one store-wide switch","Who can do what","How it renders: server first, then hydration","Safety and kill switch","Never on cart, checkout, account or sign-in","Limits","Versions and rolling back","What an AI agent uses","The template language for custom components"],"text":"Throttle Builder Saved and code components Beyond the built-in components you can reuse a section on many pages (a saved section), and write your own components with HTML, CSS and JavaScript (a code component). Both live in the Components library next to the built-in ones. The Components library Open Components in the Builder. It has three kinds, shown as tabs and as a Kind of component filter. The address #/components?kind=builtin , custom or saved opens a tab directly. Choose a card to see its details: its kind, how it renders, when it last changed, where it is used and what pages it works on. A custom or saved component shows the pages that use it, each with an Open button. New component offers Code (your own HTML, CSS and JavaScript, rendered with the page) and Saved section (an empty section you build once and add to many pages). The advanced kinds Composite (several built-in components bundled as one) and Template (markup with placeholders that reads your catalog data) are made by an AI agent or through the Widget API. See Components . Saved sections A saved section is a section you build once and use on many pages. A page that uses it holds a link , not a copy. Edit the saved section once and every page that uses it changes, after you publish it. Create one Open a page and select a top-level section. Choose Save as section in its toolbar and give it a name. This makes a copy you can add to any page. Or choose New component , then Saved section , to start from an empty one. An AI agent does the same with create_saved_section . Only a top-level section can be saved, and a saved section cannot hold another saved section. Insert it on a page Add it from the Saved tab of the Add panel in the editor, or with insert_saved_section . The block shows as Linked saved section , with the buttons Edit saved section and Detach . Edit once, change everywhere Edit saved section opens it in the editor. The panel shows its state: "Published as version N", with or without unpublished changes, and the other pages that use it. A change reaches the pages that use it only when the saved section is published. Detach Detach turns the block into a copy that belongs to this page. Other pages keep the link. An agent uses detach_saved_section . Detach is one undo step. Publishing and deleting A page cannot be published while a saved section it uses has never been published ( SAVED_SECTION_UNPUBLISHED ). Publish the saved section first. A person can publish a saved section from the editor. An AI agent needs the Full level ( publish_saved_section ). A saved section that a draft or published page still uses cannot be deleted ( SAVED_SECTION_IN_USE , with the list of pages). Detach or remove the links, publish those pages, then delete it. Limit: L.savedSectionsPerSite saved sections per store. Code components A code component is your own HTML, CSS and JavaScript, saved as versions you can roll back. You place it on a page like any component and it is drawn with the page. Only people and AI agents you trust should write code. Anything you publish with a code component runs for every visitor on the pages that allow it. On by default, with one store-wide switch Code components are on by default for every store. The switch is Allow code widgets on this store in Site settings . Only an admin can turn code on . Anyone who edits can turn it off with Turn off all code , and every code component then stops on your store with the next page load. No AI key can change this switch. If an agent is told CODE_WIDGETS_OFF , only a person can fix it. Who can do what How it renders: server first, then hydration Server-rendered HTML. The markup and CSS are written into the page by the server, like any other component, so the content is there before any script runs and search engines can read it. The script runs after load. On a live store page where code is on, the component also carries its input (its settings and data) and one <script async> for its own script. The script starts after the document is ready, once for each copy of the component on the page. The script receives the component's element and its input. Errors stay inside. If a script throws, the element is marked with an error and the rest of the page is left alone. A run that takes longer than 50 ms logs a warning in the browser console. Where it is only drawn. In the editor, in the Builder preview and anywhere code may not run, the markup and CSS are drawn but the script never runs, with a Runs on your store badge. To see it run, open the store preview link ( storePreviewUrl from get_preview_url ). Safety and kill switch The script is stored once per version and is never part of the published page. The page holds only a fingerprint of it and a link to a Throttle address. That address checks on every request that code is on and that this version is active. If not, it answers an empty script that does nothing. So turning code off, or turning a version off, stops it even on pages your host has cached. The markup and CSS are checked again by the store before they are drawn, the same way as a template component, and the CSS is sanitised. Code is not sandboxed: it runs in the store page with the page's own power. The switch and the version history are the protection, not a sandbox. The syntax is checked when you save, which says nothing about what the code does. A script runs once per copy of a component, so guard anything global (such as adding a listener to document ). Never on cart, checkout, account or sign-in Scripts never run on the cart, checkout, account, sign-in, sign-up, account verification or order-complete pages, and the rule is not a setting. The renderer refuses any path with a segment such as checkout, cart, basket, account, sign-in, log-in, register, order, pay, payment, password or wallet, or one that begins with confirm, thank, receipt, invoice or quote. The templates in CODE_TEMPLATE_DENY (cart, account, account-verify, sign-in, "},{"title":"Site settings","route":"/builder/site-settings","headings":["Site settings","The tabs","Saving and publishing site settings","Which setting wins"],"text":"Throttle Builder Site settings Site holds everything that applies to the whole store rather than to one page: its look, its name and logos, menus, the announcement bar, how it appears in search and when shared, its wording and how it reaches your store. Open it from Build in the left menu. The tabs Saving and publishing site settings Site settings are a draft, like pages. A change on any tab is saved to the site draft on its own (the bar says All changes saved ) and shows in the editor and in preview. Nothing changes on your store until you choose Publish site settings in the Site screen's bar. Publishing the site refreshes every page of the store once, because every page uses the theme, menus and brand. See Publishing and history . An AI agent reads the site with get_site and changes it with update_site_settings ; each section it sends replaces that whole section of the draft. Agents cannot change the Throttle key in Connections or the store page paths: only a person can. Which setting wins Many site settings, such as card style, badges and shop wording, can also be set by your developer in code, as props of the @usethrottle/storefront-react components. The order is always: The Builder setting , when you have set one. The SDK prop your developer set in code (a component's own prop beats the store-wide one). The standard default. A setting left on Default in the Builder defers to the code. So a developer can give the store a sensible look in code, and you can change any part of it from the Builder without a deploy. The editor decides this from your store: a store that has moved to the new site settings saves everything on this page and shows none of the notices below. Until then these settings are held in the editor and are not in what you publish: several announcement messages with targeting, style and rotation (only the first message that has not ended is kept); the mobile logo and the logo heights; the extra menu settings (new tab, CSS class, description, badge, mega menu and category-tree items); and the store paths on the Settings tab, Shop display and Shop wording (their notice says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet."). On Search and sharing, structured data, indexing, robots.txt, the sitemap and redirects are read-only. Title, description and share image always save. Leaving the Site screen warns you when an edit is held only in the editor."},{"title":"Announcement","route":"/builder/site-settings/announcement","headings":["Announcement","Turn it on","Messages","Rotation","Style","With an AI agent"],"text":"Throttle Builder · Site settings Announcement The announcement bar is the thin strip at the top of the store for news such as free shipping or a sale. Set it up on the Announcement tab of Site. It shows wherever the Announcement component is placed, usually at the top of the header. Until your store has moved to the new site settings, the tab says: "This Builder keeps the first message that has not ended; it turns the bar off if every message has ended. Extra messages, targeting, the style and the rotation show here and are saved and published once the Builder is updated." Turn it on Switch on Announcement bar . The Live bar preview shows the bar as a new visitor sees it today, from your draft. An enabled bar needs at least one message. Messages Choose Add message to add one. A bar holds up to five. Move messages up and down to set their order. Each message shows a status: Live , Scheduled or Ended . Times are in your time zone, shown under the fields. A scheduled message appears and disappears on its own: the store is refreshed at the next start or end time. Messages for everyone are in the page HTML from the server. A message only for signed-in shoppers or only for guests appears after the page loads, in space the bar has already reserved, so the page does not jump. Rotation With several live messages, turn on Rotate messages to show one at a time, changing on its own. Shoppers can also step through them. Change every sets the time on each message, 3 to 15 seconds (6 by default). Transition is Fade or Slide. Rotation pauses on hover and keyboard focus, and stays still for shoppers who ask their device to reduce motion. Style With your own colours, the tab warns when text and background contrast is under 4.5:1 (WCAG AA), because shoppers will struggle to read it. You can still save. Contrast is not checked for a colour with transparency. With an AI agent An agent sets the bar in the announcement section of update_site_settings . See the MCP tool reference ."},{"title":"Brand","route":"/builder/site-settings/brand","headings":["Brand","Store name","Logos","Logo height","Favicon","Share image"],"text":"Throttle Builder · Site settings Brand The Brand tab of Site holds your store name, your logos, the favicon shown in the browser tab and the image shown when a page is shared. Every image comes from your Media library : upload a file or choose one already there. Store name The store name is shown in the header when there is no logo, in emails and in search results. It is the only store name. Use 1 to 80 characters. Logos Each slot has Upload a file and Choose from Media . The Logo component in the header shows the right logo for the shopper's screen and colour scheme. Until your store has moved to the new site settings, the tab says: "The mobile logo and the logo heights are saved once the Builder is updated. Until then they show in the preview here and are not saved or published." The light and dark logos always save. Logo height Set the height for Desktop and tablet (16 to 120 px, 32 by default) and for phones (16 to 80 px, 28 by default). The header grows to fit, and the width follows the logo's shape. The preview shows the logo at either height. Favicon The favicon is made for you from the mobile logo, or else the light logo. Choose Regenerate to make it again after you change a logo. To use your own, upload a square image of at least 512 × 512 px; it replaces the generated icon. The card previews it in a browser tab. Share image The share image is shown when a page is shared and has no image of its own. Use 1200 × 630 px. The tab previews how it looks on Facebook and LinkedIn , as an X, large card , in iMessage and in Slack . Each network crops a little differently, so keep the important part in the middle. A page's own share image, set in its page settings, wins over this one. The default title and description that go with it are on Search and sharing ."},{"title":"Search and sharing","route":"/builder/site-settings/search-and-sharing","headings":["Search and sharing","Site defaults","Previews","Structured data","Indexing","Hide the whole site","Canonical base address","Per page and per template","Sitemap","robots.txt","Redirects","With an AI agent"],"text":"Throttle Builder · Site settings Search and sharing The Search and sharing tab of Site decides how your store looks in Google and when a page is shared, which facts search engines read, what they may crawl and where old addresses go. Each page can override the defaults in its own page settings. Site defaults Used by every page that has not set its own. page is the page title and store your store name; the default is page – store . Up to 200 characters. ], [ Default description , The description for pages that have none of their own. One per store language. ], [ Default share image , Used when a page has no image of its own. You can also set it on the Brand tab. ], ] /> Previews Previews shows how a page looks when found or shared: a Google result on a computer and on a phone, and the cards that Facebook, X, iMessage and Slack draw. Pick the page to preview, for example a product page or a collection page. Google writes its own snippet sometimes, and the price and stock in a product result come from Product structured data. Structured data Structured data are facts search engines read to show prices, ratings and paths in results. They are written into the page HTML as JSON-LD. The tab has a switch for each kind, but only some of them change what your store writes today. A store that already writes its own Organization data can turn the automatic data off with the siteJsonLd: false option of createBuilderRoute . See Builder for developers . Structured data, indexing, robots.txt, the sitemap and redirects are read-only until your store has moved to the new site settings. The tab says: "Structured data, indexing, robots.txt, the sitemap and redirects switch on with the next Builder update. Until then you can edit the title, description and share image, and the other sections are read-only." Indexing What search engines may crawl, and where old addresses go. Hide the whole site Hide this whole site from search engines is for a store that is not ready. Every page tells Google and other crawlers not to list it, but pages still open for anyone with the link. While it is on, every Site tab shows a red warning. Turn it off before you go live. Canonical base address Search engines treat this address as the real one for every page. Use the site address without a path, such as https://shop.example.com. Leave it empty to use your store address. Per page and per template Noindex and canonical are set per page: open a page in Pages, then Page settings , Search . Templates set them once for every page they draw. These templates start as noindex: search results, cart, account, account verification, sign in, sign up and order complete. Sitemap The store publishes /sitemap.xml . Choose which kinds of address it lists: pages, products, collections, categories and tags (all on by default). Under Leave out of the sitemap , list addresses to skip, one per line, up to 200, or pick a page. robots.txt The store publishes a generated robots.txt . By default it disallows /cart, /account, /sign-in, /sign-up, /order/ and /search. Under Extra robots.txt lines you can add up to 50 lines of your own (User-agent, Allow, Disallow, Crawl-delay, Sitemap or # comments, 200 characters each); they go between the generated ones. Reset to default restores the standard lines. The tab warns about a line that would block the whole site. Redirects Redirects sends old addresses to new ones. Each row has From (a path such as /old-address; end it with * to match everything under it), To (a path or a full address) and Type : A site has up to 500 redirects, and a chain of redirects may be 3 hops long at most. Paths the store needs for itself cannot be redirected: /api, /_next, /sitemap.xml, /robots.txt, /favicon.ico and /.well-known. You can import and export the table as a CSV file. A store that is still being built is best hidden with the switch above rather than with robots.txt: robots.txt only asks crawlers not to read pages, while noindex tells them not to list them. With an AI agent An agent sets these in the seo section of update_site_settings , and a page's own title, description, image, noindex and canonical with update_page_meta . See the MCP tool reference and Pages and templates ."},{"title":"Theme and custom CSS","route":"/builder/site-settings/theme-and-css","headings":["Theme and custom CSS","Presets","Colours","Fonts, corners and spacing","Custom CSS","Custom CSS rules and limits","Related"],"text":"Throttle Builder · Site settings Theme and custom CSS The Theme tab of Site sets the look of every page at once: colours, fonts, corners and spacing. Below it, Custom CSS lets you add your own styles to the store. The tab has a live preview of the store as you change it. Presets A preset sets every colour, font and corner at once. There are three: Clean , Editorial and Bold . Pick one to start, then change what you like. Once you change a colour or a font, the theme is customized and your values are used instead of the preset's. Picking another preset then asks first: Replace my changes or Keep mine . Reset to preset throws your changes away. Colours The store has a Light palette and a Dark palette , each with the same 14 colours. Switch between them at the top of Colours . The tab warns when text and its background are under a 4.5:1 contrast ratio, the level that reads comfortably. [label, code: key , code: cssVar ]) /> A component's colour option takes either one of these theme colours or a fixed hex colour. A theme colour follows the palette, so it changes in dark mode; a hex colour does not. Fonts, corners and spacing [kind, list]) /> Custom CSS Custom CSS applies to your store pages, never to checkout. It is one stylesheet for the whole site, and it is not scoped: a rule can reach any element of the store pages. Use theme variables so presets and dark mode keep working. The editor is a code editor built for this: Highlighting and suggestions. Press Ctrl Space for suggestions: the store's theme variables with their current values, and the CSS class names your pages, header and footer use. Lint. Problems show as you type, with their line; Go to line jumps there. A variable your site does not set is a warning: it falls back to the property's default. Format. Shift Alt F tidies the stylesheet. Live preview. 300 ms after you stop typing, the preview takes the new CSS, as long as it has no errors. Save. Cmd or Ctrl S saves to the draft. A stylesheet with errors is not saved: fix them first. Publish the site to put it live. Custom CSS rules and limits The stylesheet is checked before it is saved, and any problem refuses the whole sheet, so a store never gets half a stylesheet. The rules keep the stylesheet from loading anything or running code: @media , @supports and @keyframes . @import , @font-face and every other at-rule are refused. At-rules nest 4 deep at most. ], [ Media queries , Widths in px, em or rem, plus prefers-reduced-motion, prefers-color-scheme, hover and pointer. ], [ url() , Only an absolute https address on your store’s media origin (an image from Media), with no query or fragment, or a small data:image/svg+xml (4 KB at most). ], [ Functions , The usual value functions are allowed: var, calc, min, max, clamp, colour functions (rgb, hsl, oklch, color-mix, light-dark and more), gradients, transforms, filters, shapes and counters. Functions that load a resource or run code (image-set, image, cross-fade, element, paint, src, expression) are refused. ], [ Properties , Any property and any custom property (--name), except behavior and binding. ], [ Selectors , Elements, classes, ids, :has, :not, :is, :where, :nth-*(An+B) and pseudo-elements. Attribute selectors only on data-*, aria-*, role, type, hidden, open and disabled. ], [ Text , Printable ASCII outside comments and strings; no backslash escapes in names or url(); no ; no javascript: or expression( in strings. ], ] /> Each refusal names its line and column and a stable code, such as SITE_CSS_AT_RULE , SITE_CSS_URL , SITE_CSS_URL_ORIGIN , SITE_CSS_FUNCTION , SITE_CSS_PROPERTY , SITE_CSS_SELECTOR , SITE_CSS_ESCAPE , SITE_CSS_SYNTAX or SITE_CSS_TOO_LARGE . Anyone who can edit the site can change custom CSS; others see it read only. An AI agent sets it as theme.customCss with update_site_settings , and the same rules apply. Related Sections and layout : per-section spacing and backgrounds. Components : colour and size options of each component. Site settings : which setting wins."},{"title":"Wording, delivery and shop","route":"/builder/site-settings/wording-delivery-shop","headings":["Wording, delivery and shop","Wording","Languages","Shop wording","Delivery","Shop display","Settings","Code components","Store pages"],"text":"Throttle Builder · Site settings Wording, delivery and shop Four smaller tabs of Site: Wording for the words around the store, Delivery for how published pages reach it, Shop display for product cards and product pages, and Settings for the code switch and the paths of the store's own pages. Wording The words around your store: the menu button, the account link, the announcement close button, the skip to content link, the breadcrumb home label, the footer copyright line and more. Leave a box empty to use the standard wording. Each box shows its key, such as nav.menu . Languages The tab lists the languages your store speaks; with Product Catalog installed, they are the languages set there. Otherwise choose Add language and use a language code such as fr or pt-BR. Switch the language at the top to edit its words. Words you do not translate show in the default language. Shop wording With Product Catalog installed, Shop wording holds the words of your shop, in groups: Shop page, Home page, Search, Product lists, Filters, Sorting, Product page, Cart, Navigation, Empty states, Errors, and Yes and no. Leave a box empty to use your catalog's wording. Each group shows how many words you changed. Until your store has moved to the new site settings, the tab says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet." Delivery How your store gets the pages you publish. You can switch at any time. Only an admin or developer of the store can change it. On build-time, Next release lists what is waiting. Release now builds your store once with everything published; you can release once every 10 seconds and 20 times an hour. The release history lists earlier releases, and Roll back to this makes the store use one of them again. The Deploy hook is the address your host (Vercel, Netlify or any https URL) gives you to start a build. Throttle calls it once for each release. Without one you can still release, but nothing is sent to your host. Your developer sets up the store side: see Builder delivery modes . Shop display Shop display comes with Product Catalog: without it, the tab asks you to install the catalog and link it in Connections. It sets how products look everywhere in the store. Every option starts on Default , which defers to your developer's code and then the standard look; what you set here wins over both (see which setting wins ). Until your store has moved to the new site settings, the tab says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet." An AI agent's import_catalog_display is refused with SETTINGS_V2_NOT_ENABLED until then. Import from catalog copies how your Product Catalog shows products today into your draft, to start from. Review it, then publish. Badge colours come across too: the sale colour, the new colour and each custom badge's colour. A badge left on the catalog's default colour isn't copied, so it keeps your theme's colour, exactly as the store shows it today. Settings Code components Allow code widgets on this store is the store-wide switch for code components . It is on by default. Only an admin can turn code on; anyone who edits can turn it off. Turning it off stops every code widget on your store with the next page load, and nothing is deleted. Code never runs on checkout, cart, account or sign-in pages, whatever this switch says. Store pages Where the store's own pages live. Change a path only if it clashes with a page you already have. Only a person can change these, not an AI agent. Checkout is Throttle's hosted checkout. The cart page hands the shopper over to it, and the Order complete page welcomes them back."},{"title":"Troubleshooting","route":"/builder/troubleshooting","headings":["Troubleshooting","Common errors","PERMISSION_REQUIRED","Stale baseRev (DRAFT_CONFLICT)","Validation errors","A component is not available in your store","Changes are not showing on the store","A preview link has expired","Code does not run on the cart, checkout or account","Catalog components show placeholders","The Troubleshooting list on the Keys and AI agents screen","{entry.symptom}"],"text":"Throttle Builder Troubleshooting Find the symptom, read why it happens and follow the steps. The first part is every entry of the Troubleshooting list on the Keys and AI agents screen; the second covers common problems in the store itself. Common errors PERMISSION_REQUIRED The key or connection has too low a level for the call. The answer names what is missing: level:publish , level:full or draft . Raise its level under Keys or Hosted assistants ; it applies on the next call. See access levels and the full entry below . Stale baseRev (DRAFT_CONFLICT) The draft changed after the draftRev the agent wrote against, because you or another agent edited it. Nothing was saved. Ask the agent to read the page again and redo the change. When publishing, ask for a new preview and look at it first. In the editor the same thing shows as the banner with Keep mine and Reload their version . See baseRev . Validation errors DOCUMENT_INVALID means a change would break a placement rule or a setting value. Nothing was saved, and the answer lists each issue with its path and message. Ask the agent to fix those and try again, and to run validate_page before publishing. PUBLISH_BLOCKED lists what would break the live store. A component is not available in your store A component newer than the @usethrottle/storefront-react installed in your store cannot be drawn there. Update the package (and keep @usethrottle/builder-react on 0.5 and @usethrottle/builder-schema on 0.4). See Builder for developers . Changes are not showing on the store Check that you published , not only saved. The top bar should not say Unpublished changes. In Build-time delivery a publish waits for Release . See Publishing . In Live delivery your store learns of a publish through a signed webhook and a cache check, so the page refreshes within moments. If the webhook is not set up or your host cannot receive it, a page can stay cached for up to an hour. Reload with the cache bypassed once. If one page stays stale, publish it again. A preview link has expired Preview links run out: a person's link after 1 hour, an agent's draft link after 12 hours and the store preview link after 1 hour. Make a new one with Preview link , or ask the agent for fresh ones with get_preview_url . Code does not run on the cart, checkout or account That is on purpose. Scripts never run on cart, checkout, account, sign-in, sign-up or order-complete pages, whatever you set. The markup and CSS still show. If code does not run elsewhere, check that Allow code widgets on this store is on in Site settings, that you published the page, and that you are looking at the store preview link, not the editor preview. See code components . Catalog components show placeholders Product grids, collections and similar components need your Product Catalog. With no catalog key linked, they show a placeholder in the editor and the preview ("Connect your catalog key in Site settings, Connections"). Open Connections , check that Product Catalog says Installed and link the catalog server key (a pc_pk_ key made with the server channel). See also the menu entry below . The Troubleshooting list on the Keys and AI agents screen These are all entries.length entries, in the same order and words as the screen. On the screen, #/keys?help=<id> opens one. entries.map((entry) => ( entry.symptom Code: entry.code Why: entry.why Fix: entry.fix.map((step) => step ) entry.copy && ))"},{"title":"Build a checkout that settles cleanly.","route":"/developers","headings":["Build a checkout that settles cleanly.","Choose Your Path","{title}","Canonical URLs"],"text":"Native checkout docs Build a checkout that settles cleanly. Throttle gives your storefront a hosted payment surface, server-side checkout sessions, signed webhooks, native carts, and shipping/tax calculation. Start the quickstart View API reference 1. Merchant backend Creates a checkout session with a secret API key. 2. Buyer browser Mounts the payment iframe and receives postMessage events. 3. Merchant webhook Receives signed durable payment and order events. Choose Your Path V1 focuses on native Throttle checkout and carts. Start with a payment-only embed, then add carts, shipping, tax, and webhooks as your integration grows. Building an app for other merchants to install rather than integrating your own store? That path starts with extensions. paths.map(( href, title, body, icon ) => ( title body Open guide )) Canonical URLs Examples use the branded Throttle URLs below. Keep these values on your backend unless the variable is explicitly prefixed for browser use."},{"title":"Analytics","route":"/developers/analytics","headings":["Analytics","Which one","Pages in this section"],"text":"Analytics Analytics There are two ways to get analytics off a Throttle checkout: Throttle s first-party tracking settings for GA4 and Meta, or your own script. Pick based on whether a vendor secret is involved. Which one Google Analytics 4 and GTM — the built-in path. The Measurement Protocol API secret stays server-side. , ], [ Meta purchase tracking, including the Conversions API, and attribution capture , html: Track conversions — Meta s Conversions API token stays server-side. , ], [ Something Throttle does not build in — a custom collector, cookie-based attribution stitching, a vendor with no secret to protect , html: Your own scripts — merchant-authored JavaScript Throttle runs in an isolated sandbox on hosted checkout. , ], [ A product feed for Google Merchant Center / Meta Commerce Manager , html: Product feeds — Throttle stores no catalog, so this is a recipe for building one from your own catalog source. , ], ] /> Pages in this section Google Analytics 4 and GTM — setup for every surface, the event reference, consent, and server-side purchases and refunds. Track Conversions — Meta purchase events, server-side forwarding, clientContext attribution. Your Own Scripts — the register() contract, consent, external domains, and the management API. Product Feeds — feeds live with your catalog; keep referenceId equal to the feed item id."},{"title":"Google Analytics 4 and GTM","route":"/developers/analytics/google-analytics-4","headings":["Google Analytics 4 and GTM","What runs where","Set up","Hosted pages","Embedded checkout","Option 1: the loader on your page","Option 2: the React embed","Secure Fields (your own card form)","What is automatic","Funnel events","Passing the visit from your server instead","Headless storefronts","Script tag","npm","Next.js App Router","Options","GTM and a Google tag together","GA4 inside your GTM container only","Event and dataLayer reference","Ecommerce params","What you publish","The dataLayer shape","Custom events","Consent and Consent Mode v2","Cross-domain","Joining the purchase to the visit","analyticsContext()","clientContext on cart routes","Server-side purchases and refunds","Status","Debugging","FAQ","Purchases show as Unassigned or Direct in GA4","I see two purchases","I get no events on a headless site","Events fire twice on a Next.js site","Which environment does a sandbox use?","Does Throttle change my GTM container?","Related"],"text":"Analytics Google Analytics 4 and GTM Throttle sends the GA4 ecommerce funnel from hosted pages, embedded checkout and your own storefront. It sends purchase and refund from its server, so ad blockers and closed tabs do not lose a sale. What runs where gtag.js for your G-ID. GTM never loads on a Throttle domain. , Sent by the hosted page. , Throttle server. , ], [ Embedded checkout (iframe) , None in the iframe. Your page owns the tag. , html: The iframe forwards each event to your page. @usethrottle/scripts or onAnalyticsEvent sends it. , Throttle server. , ], [ Secure Fields (your own card form) , Your page owns the tag. , html: You send them. See Secure Fields . , Throttle server. , ], [ Headless storefront , html: @usethrottle/scripts loads gtag.js, GTM, or both. , html: You publish storefront events. The loader maps them to GA4. Checkout events come from Throttle. , Throttle server. , ], ] /> A GTM container runs arbitrary code. Hosted pages show a card form and buyer details, so Throttle will not run your container there. A GTM container ID saved in Tracking settings is used on your own storefront only. Hosted pages ignore it. Set up The server sends a purchase whenever both the Measurement ID and the API secret are saved. serverSideEnabled no longer controls GA4. It now gates the Meta Conversions API only. With an ID and no secret, purchases come from the browser, and the dashboard shows a warning that ad blockers and embedded checkouts will miss them. Hosted pages No code. Once the ID is saved, these pages load your G-ID and send the events in the event table . page_view , begin_checkout , add_shipping_info , add_payment_info . The Meta pixel runs here too. ], [ code: /cart/:cartSessionId , html: page_view , view_cart , add_to_cart , remove_from_cart . ], [ code: /q/:token , html: page_view , view_quote , accept_quote . ], [ code: /q/request/:formToken , html: page_view , generate_lead . ], [ code: /billing/:token , html: page_view only. ], ] /> URLs are redacted. Hosted URLs contain a capability id. GA4 receives /c/:token as page_location and page_referrer , with only utm_* and gclid kept from the query. This holds whatever your data stream s Google tag settings are, including "Ignore duplicate instances of on-page configuration". Enhanced measurement does not see hosted pages. Your tag runs in a hidden, token-free frame on the hosted page, so the automatic page_view is the only page-level event it sends there. Scrolls, outbound clicks, form interactions and file downloads on hosted pages are not measured. Page titles. Each page has its own: Checkout, Cart, Quote, Request a quote and Update payment method. Meta pixel. Only /c and /s load it. The other pages do not. Consent. Append ?consent=granted or ?consent=denied to the hosted URL. See Consent . Abandoned-cart links ( /r ) render nothing. They, the hosted cart's Checkout button, the quote page's accept and continue-to-checkout buttons, and the /c to /s redirect pass consent , utm_* , gclid , gbraid , wbraid , _gl and _tga on to checkout. Never in the iframe. Hosted analytics does not run in embed mode. Embedded checkout The iframe runs no Google tag. It posts each funnel event to your page as throttle.scriptEvent , only to origins in the application s allowed origins. Your page sends them to GA4. Pick one of two ways. Option 1: the loader on your page Install @usethrottle/scripts (see Headless below). It listens for the iframe, maps each event, and sends it. On throttle.ready it also hands the iframe your GA client id, session id, UTMs and consent. Option 2: the React embed onAnalyticsEvent receives GA4 names and params. It does not fire purchase when the server is already sending it. The embed reads your _ga cookies and posts them into the iframe, because the iframe s own cookies are third-party. If you send purchase yourself from throttle.completed or onSucceeded , remove it. With an API secret saved, Throttle sends the purchase from the server, and a second one double-counts revenue. If you must keep yours, turn off Throttle sends purchase events in Tracking settings ( sendPurchaseEvents: false ). Secure Fields (your own card form) With Secure Fields the whole checkout page is yours, so Throttle sends no browser events from it. Purchases and refunds still come from Throttle s server. What is automatic Purchase and refunds. Once the Measurement ID and API secret are saved, Throttle sends purchase when the payment is captured and refund for each refund, from its server. The visit. When pay() or complete() runs, useSecureCard reads your page s _ga and _ga_<stream> cookies, UTMs and click ids, and sends them as clientContext on /complete . The server purchase then joins the buyer s GA4 session. Reading the context can never fail the payment. Overrides. Pass the clientContext prop on SecureCardProvider to set keys yourself, for example consent: analytics: false when the visitor declined, or a gaSessionId when your page runs more than one GA4 property. Your keys win, one by one. With a custom completeFn , the hook passes the context as clientContext in its arguments; send it on your own /complete call. Funnel events Send the funnel from your own page. With @usethrottle/scripts , publish the cart events ( cart.viewed , cart.item_added , ...) and use Throttle.track() for custom events. track() refuses purchase , refund , begin_checkout , add_shipping_info and add_payment_info , and publish() refuses every checkout.* name. Send the three checkout steps with gtag directly. Do not send purchase from the browser: the server already sends it, and a second one double-counts revenue. Passing the visit from your server instead You can also send clientContext when your server creates the checkout session. Read it in the browser with Throttle.analyticsContext() and pass it through. At completion the hook s context is merged over it, key by key, and the completion value wins. Headless storefronts Throttle cannot see "},{"title":"Product Feeds Live With Your Catalog","route":"/developers/analytics/product-feeds","headings":["Product Feeds Live With Your Catalog","Why Throttle does not generate feeds","Reference: Next.js feed route from a CMS","The ID-consistency contract"],"text":"Analytics Product Feeds Live With Your Catalog Throttle stores no product catalog by design — feeds for Google Merchant Center, Meta Commerce Manager, and other ad platforms belong to your catalog source. Why Throttle does not generate feeds Products are not stored in Throttle. Product and line item data arrives from your cart/checkout payload and is saved as cart and order line items — Throttle is the system of record for transactions , not for your catalog. A product feed needs the full catalog (every product, in stock or not, with images, descriptions, and category data), which only your catalog source has. Reference: Next.js feed route from a CMS A compact route handler that renders a Google Merchant Center RSS 2.0 feed from a CMS query. Meta Commerce Manager accepts the same format, so one feed URL usually serves both platforms. The ID-consistency contract Dynamic remarketing only works when the ids in your purchase events match the ids in your feed. Throttle carries your catalog id through checkout untouched — but only if you send it. The referenceId your cart integration sends Throttle on each line item (surfaced as sku on throttle.completed and used as content_ids / item_id in purchase events ) must equal the feed item id ( <g:id> ). If they diverge, Google and Meta cannot join purchases back to catalog items and dynamic remarketing silently degrades. Use one canonical id — typically the SKU — in both places. Same id everywhere: feed g:id , cart line item referenceId , and any pixel ViewContent / AddToCart events your storefront fires. Variants: if your feed lists variants as separate items ( g:item_group_id grouping), send the variant id as referenceId , not the parent product id. Server-side too: Throttle's server-side conversions build content_ids from the order line items' referenceId — a missing referenceId drops that item from the join."},{"title":"Track Conversions in GA4 and Meta","route":"/developers/analytics/track-conversions","headings":["Track Conversions in GA4 and Meta","How it works","Embed recipe","Hosted setup","Server-side conversions","Attribution capture (clientContext)"],"text":"Analytics Track Conversions in GA4 and Meta Fire purchase events from the embed with zero extra fetches, let the hosted page inject your pixels for you, or forward conversions server-side — with attribution captured end to end. How it works Where the purchase event fires depends on which checkout surface you use. In the embed, your page hosts the pixels; on the hosted page, Throttle injects them. Google Analytics 4 and GTM . For Meta, throttle.completed (and onSucceeded in the React SDK) carries total , currency , and lineItems so you fire the pixel event yourself — no extra fetch. Throttle never injects pixels inside the iframe; that would double-count. , ], [ Hosted checkout page , Throttle — gtag.js and/or the Meta pixel are injected when tracking settings are configured. The GA4 tag loads under Consent Mode; the Meta pixel waits for consent. , The GA4 funnel fires from the page. With a GA4 API secret, the GA4 purchase comes from the server; without one, the page sends it before the redirect, using beacon transport. The Meta purchase fires from the page. , ], [ Server-side (either surface) , Nobody — Throttle forwards the purchase from its backend. , html: When enabled, Throttle POSTs the purchase to the GA4 Measurement Protocol and Meta Conversions API at the payment moment, using the attribution snapshot on order.clientContext . , ] ] /> Embed recipe Protocol v1.4 additively extends throttle.completed with total (minor units), currency , and lineItems . Convert minor units to major with toDecimalString(total, currency) from @usethrottle/money before handing values to analytics; dividing by 100 is wrong for JPY and KWD. Each line item's sku is the merchant catalog id (the cart line item's referenceId ). Use it as item_id / content_ids so purchase events join against your product feed for dynamic remarketing. The analytics fields are optional — payment-only sessions with no cart snapshot omit them, so guard with fallbacks as above. Hosted setup For the hosted checkout page, configure tracking once per application and environment via GET/PUT /api/v1/tracking-settings . Only the public ids reach the buyer's browser; secrets stay server-side and come back masked from GET . requireConsent defaults to false . When it is on, the GA4 tag loads with every signal denied until you pass consent=granted on the checkout URL, and the Meta pixel waits for the same signal. An explicit consent=denied always wins. Server-side forwarding reads the same choice from clientContext.consent : marketing gates Meta, and for GA4 a denied choice sends the purchase with denied ad flags. See Google Analytics 4 and GTM . Server-side conversions Browser pixels miss buyers with ad blockers and tabs closed mid-redirect. Save the per-channel secrets and Throttle forwards the purchase from its backend at the payment moment. GA4 needs only its ID and API secret. serverSideEnabled gates Meta only. Throttle sends: card payments at capture, Net-N invoices at authorization (issuance), and subscription renewal charges skipped — renewals are not new acquisitions. GA4 Measurement Protocol — sends a purchase event with transaction_id set to the order id, using the captured gaClientId / gaSessionId when available. Requires ga4MeasurementId + ga4ApiSecret (create the API secret under the GA4 data stream's Measurement Protocol settings). Meta Conversions API — sends a Purchase event with event_id set to the order id and user_data built from the SHA-256-hashed buyer email, server-stamped IP address and user agent, and the fbp / fbc cookies from clientContext . Requires metaPixelId + metaCapiAccessToken . or server — Measurement Protocol and gtag purchases do not reliably dedup. With a GA4 API secret saved, the hosted page and the embed bridge skip the browser purchase . If you send your own from throttle.completed , remove it. transaction_id = orderId guards against page-level double-fires. , ], [ Meta , html: Both fire — the browser pixel and CAPI event are deduplicated natively by Meta via eventID = orderId . Keep the browser fbq Purchase in place; it improves match quality. , ] ] /> Forwarding failures are logged and not retried in v1. Treat server-side conversions as an analytics signal, not an accounting source of truth — use webhooks for durable side effects. Attribution capture (clientContext) POST /api/v1/checkout/sessions accepts an optional clientContext attribution blob. The hosted page also auto-captures what it can at completion (UTMs, click ids, GA and Meta cookies, landing page, referrer) and Throttle merges the two per key — completion-time values win — then server-stamps ipAddress and userAgent . The merged snapshot lands on order.clientContext (merchant order GET ) and on the order.created webhook payload. clientContext is also accepted on POST /api/v1/cart-sessions/{id}/checkout-session and POST /api/v1/carts/{id}/finalize . Accepted keys: landingPage , referrer , utmSource , utmMedium , utmCampaign , utmTerm , utmContent , gclid , fbclid , msclkid , ttclid , gaClientId , gaSessionId , fbp , fbc , and consent ( analytics?, marketing?, adUserData?, adPersonalization? ). Unknown keys are rejected; ipAddress / userAgent are server-stamped and rejected as client input. The buyer's first-party attribution cookies live on your domain, not the checkout domain. Capture UTMs, click ids, and the _ga / _fbp / _fbc cookies on your storefront, persist them with the cart, and send them as clientContext when your server mints the session. The hosted page's completion-time capture is a best-effort fallback."},{"title":"API Surface by Integration Task","route":"/developers/api-reference","headings":["API Surface by Integration Task","{group.title}"],"text":"Curated reference API Surface by Integration Task Start here for the endpoints most native checkout integrations need. Use the full OpenAPI reference when you need every schema and response field. Open full Swagger docs Download OpenAPI JSON endpointGroups.map((group) => ( group.title group.description group.endpoints.map((endpoint) => ( )) ))"},{"title":"Throttle Builder","route":"/developers/builder","headings":["Throttle Builder","The pieces","Versions: what a store must run","Keys","Quick start: a live Next.js store","What it costs your host","Build with an AI agent","For merchants and for authors of widgets"],"text":"Developers / Throttle Builder Throttle Builder Throttle Builder is a marketplace extension where a merchant builds the pages, header, footer and announcement bar of a headless store with a visual editor, an API or an AI assistant. Your store reads what the merchant published and draws it with its own widgets. Nothing about the store's catalog, cart or checkout moves into the Builder. The pieces The SDK ], [ code: @usethrottle/builder-react , Renders a page document as React: the provider, header, footer, slots, the page route and the sitemap. , html: Rendering ], [ code: @usethrottle/builder-schema , The page document, site settings, limits and widget definitions as zod schemas. Pure TypeScript, no React. , html: Document schema ], [ code: @usethrottle/storefront-react/builder , The catalog and commerce widget packs: product grids, shelves, carousels, search, cart and account widgets. , html: Widget guideline ], [ MCP server , One address for an AI agent: connect with a key or by signing in, choose read, draft, publish or full, and the agent checks its own work in a browser. , html: MCP server ], [ Widget API , Create, version, validate and switch off custom widgets with a secret key. , html: Widget API ], [ Delivery modes , A store reads the Builder live, or from a frozen release at build time. , html: Delivery modes ], ] /> Images the merchant uploads live in the media library . The Builder freezes each one it uses, with its width variants, into the published page, so a store never calls Throttle for an image while rendering. Versions: what a store must run The Builder can place saved sections, interactions (tabs, accordion, carousel, show and hide), the countdown widget, entrance animation, custom CSS and code widgets. A store must run @usethrottle/builder-react 0.4.0 or later and @usethrottle/builder-schema 0.2.1 or later before a merchant or an AI agent uses any of them. Upgrade the store first. Fails to render. The page does not draw. ], [ A code widget , Draws nothing and runs nothing: code needs the renderer of 0.4.0. ], ] /> Pages that use none of these draw exactly as before on every version, so upgrading changes nothing for them. If you manage a store for a merchant, upgrade before turning the code switch or an agent's level up. Keys A merchant has at most 20 active publishable keys and 2 active secret keys. A key is shown once, when it is made, and only its last four characters afterwards. createBuilderClient refuses a tb_sk_ key. Quick start: a live Next.js store In live mode the store reads the Builder while it runs and clears its cache when the Builder sends a signed change notice. This is the default. For a store that reads a frozen release at build time instead, see Builder delivery modes . In the Builder, open Store webhooks and add an endpoint: left empty, its URL is your store address followed by /api/throttle/builder-revalidate , the route above. The secret it shows once is THROTTLE_BUILDER_WEBHOOK_SECRET . Without it, a published change reaches the store only when the hour-long cache runs out. Each part is explained on its own page: rendering , the SDK . Put THROTTLE_BUILDER_KEY in your server environment only, never in a NEXT_PUBLIC_ variable. A server-channel key refuses any request that carries an Origin , so a browser could not use it anyway. What it costs your host The Builder is built so a store pays close to nothing for it on a host that bills for cached pages. Live mode. Every Builder read is cached for at least an hour ( revalidate: 3600 , with no option for less). A change notice clears only the cache tags of what changed, so a page edit refreshes that page and not the whole site. Publishing the site (theme, menus, brand, announcement) or the header or footer is different: every page reads those, so every page you then visit is rebuilt once. The catalog product pages prerender no product by default ( staticParams is 0, and the cap is 50), and a Builder page is rendered on its first visit. Build mode. One full build per release and no Builder-driven ISR writes. Every page of the release is generated at build, on purpose. The cost rules of the catalog routes are in Keeping ISR costs down . Build with an AI agent Connect an AI agent with one address, https://builder.usethrottle.dev/mcp : claude.ai and Claude desktop sign in with that address alone, and coding tools (Claude Code, Cursor, VS Code, Windsurf) add a key. The agent reads your store, edits the draft, opens a preview link in a browser of its own at 390, 768 and 1280 px, and publishes only if you gave it the Publish or Full level. Start at Connect an AI agent . For merchants and for authors of widgets Widget guideline : write a widget pack, a data source, link targets, slots and migrations. Widget API : endpoints, errors, the Throttle Template reference, the CSS rules and the limits. Document schema : the page document, its limits and the edit operations. Merchant guides, in plain language: set up Throttle Builder , live or build-time delivery , search and sharing and custom pages ."},{"title":"Builder delivery modes","route":"/developers/builder-delivery-modes","headings":["Builder delivery modes","Live and build","Releases, the Release button and the deploy hook","The build client","The announcement bar","Next.js"],"text":"Developers / Throttle Builder Builder delivery modes A store reads its Throttle Builder pages in one of two ways, chosen per store: live (the default) or build . In build mode the store generates every page from a frozen release when you build it and makes no Builder request while it runs. Live and build Live mode is unchanged by build mode. In the Builder, a store's release settings say which mode it is in; switching to build mode gives up any change notices still waiting, because nothing reads them. Releases, the Release button and the deploy hook In build mode, published changes pile up. Release (in the Builder, or a secret key holding releases:write ) freezes everything published at that moment into one immutable release: site settings, every page, the header and footer, slots, the frozen custom widgets and the frozen assets. A release id never changes what it holds, and a rollback is a new release of an older snapshot. Set a deploy hook in the Builder's release settings (Vercel: Project Settings, Git, Deploy Hooks; Netlify and any https URL work too). Each release calls it once, with retries, and the host builds the store again. A store with no hook still releases; you start the build yourself. The build client getReleaseBundle({ release? }) reads GET /v1/releases/latest/bundle or GET /v1/releases/:id/bundle , once per process. The release is the argument, else the client's release option, else the BUILDER_RELEASE_ID environment variable, else the newest. A value that is not a 26-character release id fails with a message naming it, before any request. The client sends no cache tags, runs no generation watcher and listens for no notices. Every other read of the client ( site , pages , parts , slots , bundle ) is answered from the bundle, so @usethrottle/builder-react renders it with no network. Put THROTTLE_BUILDER_KEY in your server and build environment only, never in a NEXT_PUBLIC_ variable. The browser needs no Builder key in build mode. A bundle is read into memory whole, up to 48 MB, so the build machine needs that headroom. A response that is cut short fails with "bundle truncated (too large or interrupted)". A build that cannot read its release (a wrong id, a site with no release yet, a refused key, Builder down) fails the build with a clear error. It never bakes a store without its header and footer into every page, which is what a live store does to ride out an outage. The announcement bar A release holds the announcement with its on/off switch and its startsAt and endsAt . The window is decided when a page is rendered, not when the release is made, because build-time sites get no change notices. The Builder pages of a build-mode store are generated once, at build, so on them a start or end time that passes after the build only takes effect with the next release. The bar also shows on pages rendered per request (the catalog pages: shop, search, products), and on those it turns on and off at its times with no rebuild. Next.js builderStaticParams lists every page of the release and refuses a live client. Build mode is the one place a store generates every page: a release is one build, not one write per visit. create-store sets all of this up: The scaffold reads the newest release (or BUILDER_RELEASE_ID ) once, in next.config.ts , and writes it to .builder/release.json . Next copies that file into the build output ( outputFileTracingIncludes ), and every page, the layout's header, footer and slots, and the sitemap render from it. The running store makes no Builder request at all, not even on a cold instance rendering search or a product page, and needs no Builder key. If the file is missing or corrupt at run time the page fails with a clear error, even when the key is set on the host: a quiet fallback would download the whole release on every cold start. Only next dev reads from the Builder (a fresh release when the key is set, the file of the last build otherwise, and it logs which). A whole build is one release even if someone presses Release meanwhile, and the build workers read the file instead of downloading the bundle again. A renamed page answers its old /pages/<old-slug> with a permanent redirect from redirects() in next.config.ts . The Builder home page is at /pages/home , and the sitemap lists it there. The layout reads the catalog settings with a one-year cache policy instead of the default hour, because a page lives only as long as its shortest read; without that Next would render the release pages again every hour. A catalog change still re-renders pages through the signed revalidate webhook, as in live mode, from the same frozen release. The file is in every server function that renders a page (not the /api webhook routes), and the build warns when it passes about 20 MB, so mind your host's function size limit. It keeps the cost rules of Keeping ISR costs down : no revalidate under an hour, no revalidatePath . See create-store for the option."},{"title":"Document schema","route":"/developers/builder/document-schema","headings":["Document schema","The page document","Responsive overrides","Data bindings","Validating and upgrading","Edit operations","Limits","Site settings","Saved sections","Interactions and entrance animation","Countdown","Custom CSS and code widgets","What the package exports"],"text":"Developers / Throttle Builder Document schema @usethrottle/builder-schema is the one definition of what a Builder page is. The Worker, the editor, the MCP tools and the renderer all validate with it. It is pure TypeScript plus zod 4: no React, no I/O, no Node imports. The page document A document is { schemaVersion: 1, sections, customWidgets?, assets? } (a section in sections may be a saved-section reference). The last two appear only in a published snapshot: the frozen custom widgets and the frozen media assets the page uses. The header, the footer and each slot are documents of the same shape. columns , , html: Props: width (boxed or full), contentWidth (600 to 1600), gap , paddingX , paddingY , minHeight , verticalAlign , background , stackOrder , flat (true makes the inner box, row, columns and built-in widget boxes display: contents , so widget markup lays out as the section\\ s own content; the boxes that go lose their own margin, padding and background (a built-in widget\\ s spacing, a column\\ s padding and background) and the section\\ s vertical align stops applying; anchors and entrance animations on a column or built-in widget have no effect; a custom or code widget keeps its box, and a section with an interaction ignores it), hidden , anchor . ], [ code: column , Widgets and inner sections , html: Props: width (a percent from 10 to 100, at most 2 decimals), verticalAlign , padding , background , hidden , anchor . Desktop widths add up to 100. ], [ code: saved-section , Nothing (a reference) , html: Root only: ref is the ULID of a saved-section document. See Saved sections . ], [ code: inner-section , 1 to 6 inner columns of widgets , Goes inside a top-level column only, never inside another inner section. ], [ widget , Nothing , html: type ( basic. , catalog. , commerce. or custom. ), v , props , optional responsive and data . ], ] /> A node id is 8 to 24 lower-case letters and digits, unique in the document. Every object is strict : an unknown key is an error, and prototype names ( __proto__ , constructor , prototype ) are refused anywhere in props, params or overrides. A colour is token:name or #rrggbb (or with alpha). Spacing is a token ( none xs s m l xl 2xl ) or a number of pixels. An anchor starts with a letter and uses letters, digits, - and _ (64 at most). A setting value is a string, number, boolean, null, a list or a map of those. A translatable text is a map of locale tag to text. Responsive overrides A node's props are the desktop values. responsive.tablet and responsive.phone hold sparse overrides. Desktop is 1025 pixels and wider, tablet 768 to 1024, phone 767 and narrower. Tablet inherits desktop, and phone inherits tablet. In an override, null means no override here : inherit again. A setting can therefore never be overridden to null . A tablet or phone width override must set every column of its section, or none. Data bindings A widget's data maps each input name to a binding: { source: catalog.products , params } for a source, or { source: context.product } (no params) for what the slot it sits in knows. An unknown source is SOURCE_NOT_ENABLED , and a source whose result type the input does not accept is RESULT_TYPE_MISMATCH . Money in a source's answer is { amount, currency, display } ; show display . Validating and upgrading An issue is { path, code, message } (at most 50 per answer). CURRENT_SCHEMA_VERSION is 1. A client upgrades an older document and refuses a newer one. validateDocument checks a document against a widget registry ( createRegistry ), which is how the Worker knows a widget, its settings and its sources exist. Edit operations The MCP apply_ops tool takes exactly these ( agentDocOpsSchema , 1 to 500 operations, atomic). The editor's own schema also allows replaceDocument and the restore form of upgradeNode ; both are refused for an agent, and an agent upgrades forward only. invertOps returns the batch that undoes one. The undo contract is deep equality, not byte equality. Limits An editor autosaves after 800 ms of quiet and at least every 3 seconds. A preview link lasts one hour. The widget limits are on the Widget API page . Site settings brand : store name, light and dark logo and favicon, as media asset ids. theme : a preset ( clean , editorial or bold ); while customized is false the preset's tokens apply, and when true the store's own light and dark palettes do. Fonts for heading, body and mono come from a fixed list. radius is 0 to 32, and the spacing scale is compact, comfortable or roomy. menus : named menus of items (a label per locale and a target: a page, a URL, or a catalog category, collection, product or search). announcement : the bar, with an on/off switch and an optional startsAt and endsAt . seo : the title template ( {page} and {store} ), the default description and the default share image. routes.page is where Builder pages live in the store ( /pages/{handle} by default). The Builder calls its home page / , and the store decides where to serve it (by default /pages/home ; see pagePath in the rendering docs). locales , strings (wording per locale), connections.throttlePublishableKey and storeUrl . The read API answers settings resolved for one locale, so a localized value is a string there, not a map. Saved sections A saved section is a document of its own, so many pages can share one section. A page uses it through a reference node, which is allowed at the root of a document only and counts as one section. A reference inside a column is SAVED_SECTION_ROOT_ONLY . ref is the ULID of the saved-section document. That document is a page document with exactly one section and no reference ( savedSectionDocumentSchema ; anything else is SAVED_SECTION_ONE_SECTION ). A site holds up to 200 saved sections ( LIMITS.savedSectionsPerSite ). insert , remove , move and setProps ( hidden and anchor only) work on a reference like on"},{"title":"Builder MCP server","route":"/developers/builder/mcp","headings":["Builder MCP server","What this is, if you have never used MCP","Connect an AI agent","claude.ai or Claude desktop: the address only","Coding tools: the address and a key","Claude Code","Cursor","VS Code","Windsurf","Other MCP clients","Let your agent see its work","What the preview call returns","A first request to try","Levels, and the code switch","Who may grant what","What a level cannot do","Keys you made before levels","How an agent works on your store","Undo","What an agent can build","Code widgets","Credentials","OAuth for hosted assistants","Levels on the consent screen","Drafts, and publishing when the level allows","Scopes","Conventions","Tools","{group.title}","Troubleshooting"],"text":"Developers / Throttle Builder Builder MCP server An AI agent can build a store's pages, saved sections and design through the Builder's MCP server. It is one address for every store: https://builder.usethrottle.dev/mcp (Streamable HTTP, POST only, stateless, JSON answers). The store is chosen by the key you give the agent, or by what you pick when you sign in. What the agent may do is set by its level : read, draft, publish or full. Saved sections, interactions (tabs, accordion, carousel, show and hide), the countdown, custom CSS and code widgets need a store that runs @usethrottle/builder-react 0.4.0 or later and @usethrottle/builder-schema 0.2.1 or later . A store still on 0.3.x is not broken by an agent that uses them, but it shows less: interactions are drawn as a plain row of columns, a countdown is empty, custom CSS is ignored, and a page that contains a saved-section reference fails to render . Upgrade the store first. See Versions . What this is, if you have never used MCP MCP (Model Context Protocol) is the standard way to plug a tool into an AI assistant. The Builder is the tool; the assistant (Claude, or the AI in your code editor) is the one that uses it. Once connected, you describe what you want in plain words ("add a winter sale page with a countdown") and the assistant reads your store, makes the change as a draft , looks at the result in a browser, and, if you allowed it, publishes. Connecting means telling the assistant two things: the address above, and who it is allowed to act as. There are two ways to do that, and you only need one. The address only. You sign in to Throttle and approve. No key. , A Throttle login with access to the store. ], [ Claude Code, Cursor, VS Code, Windsurf or any other coding tool , html: The address and a key. The key is a password you make in the Builder and paste into the tool. , A key from Keys and AI agents in Throttle Builder. ], ] /> Connect an AI agent claude.ai or Claude desktop: the address only If Claude says it could not connect, wait up to 5 minutes after you added it (Claude takes a moment to recognise a new connector) and connect again. You can change the level later without connecting again, and revoke the connection at any time, in Throttle Builder under Keys and AI agents . Coding tools: the address and a key In every snippet, tb_sk_PASTE_YOUR_KEY stands for your key. Use a secret key ( tb_sk_... ); a publishable key ( tb_pk_... ) never works here. Claude Code Run this once in a terminal, from the folder you work in. Then run claude mcp list : throttle-builder should say Connected. Cursor Save as ~/.cursor/mcp.json (your own user config, which is not part of any project), then restart Cursor. In Cursor Settings, MCP: throttle-builder shows a green dot and its tools. Want it in a project file ( .cursor/mcp.json )? Those files are often committed, so keep the key out of it: set an environment variable named THROTTLE_BUILDER_KEY to your key and use this. VS Code Save as ~/.copilot/mcp-config.json (VS Code's user-level Copilot config, not part of any project), then run MCP: List Servers and check throttle-builder is listed (start it if it shows Stopped). Copilot Chat in Agent mode then lists its tools. Want it in the project? Save this as .mcp.json in the workspace root. Project files are often committed, so it reads the key from an environment variable named THROTTLE_BUILDER_KEY : set it to your key. VS Code reads an existing .mcp.json as it is; to add one with MCP: Add Server , turn on the setting chat.mcp.workspaceRootConfig.enabled . For VS Code's older MCP setup (deprecated; VS Code plans to remove it in February 2027), use .vscode/mcp.json or MCP: Open User Configuration . The project form asks for the key instead of storing it. Windsurf Add to ~/.codeium/windsurf/mcp_config.json , then refresh MCP in Cascade. Cascade shows throttle-builder with its tools. Other MCP clients Any client that speaks Streamable HTTP MCP and can send a header: give it the address and this one header. To try the key from a terminal, the MCP inspector prints the tools the key allows. The Claude Code snippet and the inspector command were run against a real store. The VS Code JSON shape was checked against VS Code's own documentation. The Cursor and Windsurf snippets follow each tool's documented format but have not been run in the apps themselves: if your tool shows no tools after a restart, check its MCP log for the first error. Let your agent see its work An agent that cannot look at a page is guessing. Throttle never takes screenshots for the agent : there is no server-side screenshot. Instead the agent asks for a preview link, opens it in a browser of its own , looks, and fixes what it sees. So add one browser tool to your agent. Start with Playwright MCP. In another tool, add the same server in its MCP settings: the command is npx with @playwright/mcp@latest (or chrome-devtools-mcp@latest ) as its argument. What the preview call returns get_preview_url answers three links, and the widths to check: draftUrl : the draft drawn by the Builder itself, readable without signing in, valid for 12 hours, and marked noindex . It is responsive, so the agent resizes its own window to 390, 768 and 1280 px and checks each. There is no device input: the agent chooses the size. storePreviewUrl : the same draft drawn by your store , with your store's own fonts and widgets. It lasts 1 hour; ask again for a new one. It is built from the published store address, and it is null when the site has no published store address. A link made for an agent runs only the code that a published page already holds; code that exists only in a draft shows as off. Code widgets run only here : the Builder's own preview draws a code widget's markup and CSS with a "Runs on your store" badge and never runs its script. liveUrl : the page as shoppers see it now, or null for a page never published. A first request to try"},{"title":"Rendering Builder pages","route":"/developers/builder/rendering","headings":["Rendering Builder pages","Entries","The site: loadSite and BuilderProvider","Saved sections","Code widgets","Slots","Next.js: createBuilderPage","The sitemap","Change notices","Preview","Interactions, countdown, entrance and custom CSS","What the renderer guarantees","Build mode"],"text":"Developers / Throttle Builder Rendering Builder pages @usethrottle/builder-react draws a published page document as React and gives the store its header, footer, slots and site design. It reads through the SDK and never calls a cache API of its own. Entries use client ): BuilderProvider , BuilderHeader , BuilderFooter , BuilderSlot , BuilderPage , BuilderPageView , BuilderRenderer , AssetImage , compileResponsiveCss , createRendererRegistry , basicPack and the types. Re-exports BuilderUnavailableError and BuilderNotFoundError . ], [ code: @usethrottle/builder-react/server , html: Server loaders: loadSite , loadBuilderPage , builderSitemap , getBundle . ], [ code: @usethrottle/builder-react/next , html: createBuilderPage , which returns Page, generateMetadata . ], ] /> It needs React 18 or newer, and Next.js 15 or newer for ./next . The widgets come from packs: the Builder's own basic widgets are always present, and @usethrottle/storefront-react/builder adds the catalog and commerce widgets (see the widget guideline ). The site: loadSite and BuilderProvider loadSite makes one Builder read for the request (the settings, header, footer and the slots you name) and resolves the data of their widgets that does not depend on the shopper. Reads of one request are shared: an ask that an earlier read already covers reuses it, and asks in the same tick merge into one. A layout does not know the page, so on a Builder page route the layout read and the page read are two reads unless loadSite is given page . BuilderProvider is a client component, because a pack holds components and functions that a server component cannot pass down: create the packs in a client module of your store. It fills the site design (menus, brand, announcement, strings, theme), the slot outlets and the page renderer for the rest of the tree. site is plain data, so the server can pass it. Give the provider a builderKey or a client only if a BuilderPage below it reads its own page in the browser; that needs a key of the browser or app channel. With no answer and no last good answer, loadSite returns { status: unavailable } and logs once per process. The header, footer and slots then render nothing and the catalog pages keep working. A Builder page throws BuilderUnavailableError and lets your error boundary answer, never a blank 200. A widget that throws blanks only itself. Media. An image shows only when its src is https on exactly mediaOrigin . With no origin, no image shows. The logo, favicon and share image follow the same rule. Saved sections A page, header, footer or slot can hold a reference to a saved section: one section kept once and used by many pages. The read answer carries the published section of every saved section the document uses ( savedSections ), and the renderer draws it where the reference stands. loadSite and loadBuilderPage keep it with the page or part, so there is nothing to pass. Every id inside a saved section is written as <reference id>-<inner id> in data-b-id , so two references to the same saved section on one page never share CSS. A reference whose section the answer does not hold renders an empty box with data-b-missing and nothing else; the rest of the page is not affected. A page holds at most 20,000 nodes with its saved sections expanded; references past that are left out and render as missing. Code widgets A code widget is a widget with markup, CSS and a script. The page document holds only the markup, the CSS and the script s hash; the script itself is served from the Builder, one file per widget. A store runs a code widget only when all of these hold: the merchant turned code on in the dashboard ( code.enabled in the read answer), the widget is not turned off, the page is on the route allow-list, and the render is a live store page (not the editor, not a preview, and not interactive={false} ). Then the widget carries data-b-code , its input as <script type= application/json data-b-code-input> and one <script async src> for its script. In every other case only its markup and CSS are drawn, marked data-b-code-inert , and no script is written. Route allow-list. It lives in the renderer and is not a setting. Code never runs on /checkout , /cart , /account , /sign-in , /sign-up , /login , /register , /order(s) and /pay (and below them), whatever else matches, and the same words on any segment of the path ( /fr/checkout , /de/account/orders ), whatever your page route is. The words include common synonyms ( basket , bag , payment , my-account , login , password , wallet and others); a handle with one of those names (a product called bag ) runs no code either. The limit: with a root-level page route such as /{handle} , code may run on any root-level page whose name is not on that list, so never put your own checkout or account under another root page name. Elsewhere it runs only on / , your page route ( routes.page of the site settings) and the catalog routes: /p/{handle} , /c/{handle} , /collections/{handle} , /tags/{tag} , /search and /shop , or the templates you pass as catalogRoutes . The path is normalised first ( /pages/../checkout is /checkout ). Without pathname no code runs. Leaving a code route is a full page load. A script that has loaded cannot be unloaded, so when a client-side navigation moves from a page that loaded code to a path that is not a code route (checkout, account, sign-in, cart), BuilderProvider loads the new address again from the server and no code survives there. The check also runs when the provider unmounts. Put BuilderProvider in a layout that also covers checkout, account and sign-in: only then does it draw an empty placeholder instead of the denied page while the reload is pending. pathname is the path without a Next basePath , and the unmount check reads the browser s full path, so with a basePath leaving the provider s layout can cause one needless reload. Pass pa"},{"title":"Builder SDK","route":"/developers/builder/sdk","headings":["Builder SDK","The client","Answers","Errors and last good answers","Caching in Next.js","Change notices: @usethrottle/builder/next","A backstop for a missed notice: @usethrottle/builder/watch","Preview","Build mode"],"text":"Developers / Throttle Builder Builder SDK @usethrottle/builder is the headless client of Throttle Builder. A store reads the published pages, the header and footer, the slots and the site settings with it, and clears its own cache when the Builder says something changed. The client tb_pk_... ), sent as X-Builder-Key . A secret key ( tb_sk_ ) is refused with a TypeError . ], [ code: baseUrl , code: https://builder.usethrottle.dev , The Builder host. ], [ code: timeoutMs , 3000 , Per read, the body included. ], [ code: fetch , global fetch , Your own fetch, for tests. ], [ code: previewToken , none , html: Reads drafts with X-Builder-Preview . Never cached, never answered from a last good copy. ], ] /> Every read takes { locale } , which picks the text of a translated value (the locale, then its language, then English). A page slug or slot name is a non-empty string of at most 128 characters. The client sends no Origin header, so on a server it needs a key of the server or app channel. A browser key works only from the exact https origins it lists. A page document of an older schema version is upgraded on read, and one of a newer version throws BuilderUnavailableError with reason unsupported-document , so an old SDK never renders what it cannot read. Answers { redirectTo } (a site path) for an address that moved. An unpublished page is 404 PAGE_NOT_FOUND . ], [ code: parts.get(name) , code: GET /v1/parts/:name , html: The header or footer document. Unpublished is an empty document. ], [ code: slots.get(name) , code: GET /v1/slots/:name , A slot document. Unpublished is an empty document. ], [ code: bundle( page, slots ) , code: GET /v1/bundle , Site, header, footer, optionally one page and the named slots, in one read. ], ] /> A page answer also carries a seo object ( title , description , shareImage and noindex ) next to its document. Every document carries its frozen custom widgets and frozen assets, so rendering needs no further request. A page, part, slot or bundle answer can also carry savedSections (the published section of every saved section the document references, by the id of its document) and code ( { enabled, scriptOrigin, codeSiteId } : whether the store runs code widgets and where their scripts come from); the client passes both through unchanged, and a code store allows script-src https://builder.usethrottle.dev . The shapes are in the document schema . Errors and last good answers reason is timeout , network , status , invalid-response or unsupported-document ; status holds the HTTP status when there was one. ], [ code: BuilderNotFoundError , A page that is not published and has no redirect. ], [ code: PreviewExpiredError , A preview token that is expired or not valid (401). A preview read never falls back to the published page. ], ] /> A published read that fails with BuilderUnavailableError within 10 minutes of a good one answers the good one (per process, at most 200 reads kept) and logs once. After that the failure reaches you. A not-found or an expired preview is an answer, and is never softened. Caching in Next.js Every published read is kept until a change notice clears it: next: { revalidate: 3600, tags } . The hour is only a safety net behind the notices, and there is no option for a shorter time, so a Builder read can never cost ISR writes on a timer. The client never calls revalidatePath . A preview read is no-store . , One page. ], [ code: throttle-builder:part: , The header or the footer. ], [ code: throttle-builder:slot: , One slot. ], ] /> A read carries the tag of what it holds, so a change clears only that. A change to the site or the menus clears the site, header and footer reads and never the pages. Constants and helpers: BUILDER_TAGS , scopesToTags and UNTIL_CHANGED_REVALIDATE_S . Change notices: @usethrottle/builder/next The handler checks the X-Throttle-Builder-Signature header and clears the cache tags of the notice's scopes with revalidateTag , never a path. When a notice names more than 20 tags it clears the coarse tag once instead. { revalidated: [...tags] } ], [ code: 400 , The body is not a builder.changed notice. ], [ code: 401 , The signature is missing, stale (over 300 seconds) or wrong. ], [ code: 413 , The body is over 64 KB. ], [ code: 500 , No signing secret is set in this environment. Nothing is revalidated. ], ] /> The signature is t=<unix seconds>,v1=<hex> , an HMAC-SHA256 over throttle.builder-notice.v1.<t>.<raw body> (up to 8 v1 values are accepted, compared in constant time). The label means a catalog or webhook signature never verifies as a Builder notice. To check one yourself: secret may be a list. Add the new secret, change it in the Builder, then remove the old one. A backstop for a missed notice: @usethrottle/builder/watch It reads the site generation with a conditional request (an unchanged answer is a 304 ) at most every 30 seconds (60 by default), only while the tab is visible, and calls onChange when it moves. It never revalidates a cache itself. It takes a publishable key and refuses a secret one. router.refresh() renders from the server s data cache, so the store needs a route that clears it. createWatchSyncHandler from @usethrottle/builder/next is that route: it reads the site generation from the Builder (at most once every 20 seconds per instance), and compares it with the generation the store s own data cache holds (a throttle-builder -tagged read of the same answer, shared by every instance). Only when they differ does it clear the throttle-builder tag, so a cold start or repeated calls clear nothing: purges follow real publishes. It answers 500 with no key and 502 when the Builder cannot be read. Preview previewMiddleware(req) , getPreviewToken() and PREVIEW_COOKIE from @usethrottle/builder/next carry a one-hour preview token from the link a merchant opens to the client. See rendering . Build mode createBuilderClient({ mode: build &#"},{"title":"Widget API","route":"/developers/builder/widget-api","headings":["{{settings.heading}}","Widget API","Authentication and limits","Endpoints","Errors","A definition","Throttle Template reference","CSS rules","Limits","Versioning","200: nothing was stored","200: not valid","201","A new version: the same body with \"v\": 2","Turn one version, or every version, off"],"text":"Developers / Throttle Builder Widget API A custom widget is a definition (data, not code) that a merchant can place on any page. Two kinds exist: a template widget (Throttle Template plus restricted CSS) and a composite widget (other widgets wired to a few settings). The Widget API stores them. The editor and the MCP tools use the same checks. Authentication and limits Base URL https://builder.usethrottle.dev . Send a secret key as Authorization: Bearer tb_sk_... . A secret key is refused when the request carries an Origin , and a publishable key never works here. Writes need widgets:write ; the two reads accept widgets:read or widgets:write . Every answer is cache-control: no-store . 30 writes a minute for the whole store (two keys share it): the 31st is 429 RATE_LIMITED with Retry-After: 60 . Validation has its own allowance of the same size. A request body is at most 128 KB, a definition at most 64 KB, and JSON may nest at most 40 levels. An answer lists at most 50 issues. Endpoints 200 { ok, issues, definition? } . Nothing is stored. ], [ code: POST /v1/widgets , code: widgets:write , html: Stores a new widget type. 201 { type, version, status: active } . ], [ code: POST /v1/widgets/:type/versions , code: widgets:write , html: Stores the next version of an existing type. The body\\ s type must equal the path. 201 , as above. ], [ code: PATCH /v1/widgets/:type , code: widgets:write , html: Body { status: active | disabled } . :type may be custom.name@2 to change one version. 200 { type, status, versions } . ], [ code: GET /v1/widgets , code: widgets:read , html: { widgets: [{ type, title, kind, latestVersion, versionCount, status }] } ], [ code: GET /v1/widgets/:type , code: widgets:read , html: The latest version, or custom.name@2 for one: { type, version, kind, status, createdAt, definition, versions } . ], ] /> A definition is plain JSON data. A type is custom. followed by a lower-case name of letters, digits and hyphens (at most 64 characters after the dot). A new widget, and each new version, is stored as active. A widget a merchant turned off in the Builder can only be turned back on by the merchant: a key gets 403 WIDGET_REENABLE_DASHBOARD_ONLY . Errors An issue is { path, code, message } . The codes you will meet are INVALID_SHAPE , INVALID_VALUE , REQUIRED , FORBIDDEN_KEY , DUPLICATE_KEY , LIMIT_EXCEEDED , VERSION_RULE , TEMPLATE_SYNTAX , TEMPLATE_FORBIDDEN , ELEMENT_NOT_ALLOWED , ATTRIBUTE_NOT_ALLOWED , FIELD_NOT_ALLOWED , UNKNOWN_REFERENCE , CSS_SYNTAX , CSS_FORBIDDEN , CSS_PROPERTY_NOT_ALLOWED , NO_RECURSION , BINDING_TARGET_MISSING and BINDING_TYPE_MISMATCH . A path inside the template or CSS carries a line and column, such as css:1:25 . A definition Settings. At most 40 of your own, each with a key (a letter, then letters and digits, at most 40), a label , a tab ( content , style or advanced ), an output and a control : text , richtext , number , select , toggle , color , spacing , image , link , icon , alignment or font-size . The common settings hidden , anchor , spacingTop and spacingBottom are added for you and do not count. Every setting needs a default that passes its own control. A select needs options. Output. A markup setting is read by the template. A css setting reaches the stylesheet as var(--w-<key>) , so it must use the color , spacing , font-size , alignment , number , toggle or select control, never free text, and it cannot be translatable. A select option that reaches CSS is lower-case letters, digits, hyphens and colons. Translatable text. A text setting with translatable: true takes a map of locale to text, such as { en : Hello , fr : Bonjour } . Data inputs. At most 5. Each names the result types it accepts ( product[] , product , collection , category[] , review[] , customer , cart ), whether it is required and a label. The merchant binds the input to a data source; a template may read only the fields of the sources the input accepts. Money is printed only as price.display (or price.currency ): a template that reads a money amount as a number is refused. Composite. The body is either columns (an inner section, which then only goes at the top level of a column) or a stack of widgets. Each binding copies a setting into a node's prop and must use the same control. Data inputs reach inner nodes through targets . A composite cannot hold another composite. Throttle Template reference A template is HTML-like markup with {{ }} tags, parsed into a closed set of nodes. Nothing builds a string of HTML from it: the renderer returns React elements, so a value is always text. A tag holds one plain path (letters and digits, up to six segments) and optional filters. Helpers, arguments, comparisons, index access, parent paths and {{else if}} are refused. Paths start at settings , data , locale or a loop variable. Names that exist on every object (such as constructor ) are refused. Elements: div span p h1 h2 h3 h4 h5 h6 a img ul ol li strong em small figure figcaption section article header footer details summary br hr . A heading or block element cannot sit inside a p . details with a summary gives a click-to-open section (an FAQ accordion, for example) with no script; it always starts closed, since the open attribute is not allowed. Attributes: class , title , aria-label , aria-hidden and role on any element; href on a ; src and alt on img ; and data-* (not data-b- , which the renderer owns). No id , no style , no event handlers. class , role , aria-hidden and data-* are static text. A class is 1 to 10 tokens of lower-case letters, digits and hyphens, and none may start with b- , tb- , tsf- or throttle- . A role is a non-interactive one (such as region , list or img ). href is either one {{ }} value with no filters (a link setting or a url field) or a fixed https URL or path. src is one {{ }"},{"title":"Widget guideline","route":"/developers/builder/widgets-guide","headings":["{String(props.title)}","Widget guideline","Three kinds of widget","A widget definition","The component","Data sources","Packs, link targets and slots","Versions and migrations","Interactions, countdown, saved sections and code","Interactions","Countdown","Custom CSS","Saved sections","Code widgets","The integration contract"],"text":"Developers / Throttle Builder Widget guideline A widget is a definition (data) plus a React component. The Builder editor, the Worker and the MCP tools read only the definition. The store renders the component. This page is for the person writing a widget. To add a widget without writing code, use a custom widget . Three kinds of widget @usethrottle/builder-schema , components in @usethrottle/builder-react : heading, text, image, button, spacer, divider, video, logo, menu, announcement, copyright. Every renderer carries them. , The Builder. ], [ Pack , code: catalog.* commerce.* , html: Definitions, data sources and components in @usethrottle/storefront-react/builder . The Builder bundles the data half ( builder-pack.json ). , Throttle, in a release of the package. ], [ Custom , code: custom.* , A template or composite definition stored with the Widget API. Rendered by the Builder\\ s own template runtime. , A merchant or an agent, no deploy. ], [ Code , code: custom.* , html: A custom widget of kind: code : markup, CSS and a script that runs on the store page. Off unless a person turned code on. See Code widgets . , A merchant, or an agent with the code switch. ], ] /> The Worker validates against the builder-pack.json of one pinned version of @usethrottle/storefront-react , plus the store's custom widgets. A widget appears in the editor only if it is in that manifest. A pack you write in your own store can render widgets that are already in a page, but it cannot add a new one to the library. A widget definition type is basic. , catalog. , commerce. or custom. followed by a lower-case name. v starts at 1. group is layout , basic , catalog , commerce or custom . Each setting has a tab ( content , style , advanced ), an output ( markup reaches the component as a prop, css reaches the stylesheet as a custom property) and a control . A css setting must use a control whose value is a token, number, colour or enum ( color , spacing , font-size , alignment , number , toggle , select ), never free text. At most 40 settings of your own. The common settings ( hidden , anchor , spacingTop , spacingBottom , entrance , entranceDelayMs ) are appended and do not count. entrance is drawn by the renderer around every widget, so your component needs no code for it. data names the inputs: what result types each accepts, whether it is required, a label and an optional default binding. placement may say slotsOnly , notIn ( header , footer , slot ) or topLevelOnly (not inside an inner section). Every setting reaches the component already prepared: defaults filled in, translatable text resolved to the page locale, and an image setting replaced by its frozen asset with its width variants. The component The component gets WidgetRenderProps : node , props , data , editMode , locale , mediaOrigin , resolveLink , inlineEdit (editor only) and budget (custom widgets). Rules every widget keeps: Money is printed through display only. A price is { amount, currency, display } . Never format an amount yourself. Images go through AssetImage with the mediaOrigin you were given: https, on exactly that origin, or no image. Links use resolveLink for a link target, and every href is checked again with safeUrl from @usethrottle/builder-schema . No raw HTML. No dangerouslySetInnerHTML or innerHTML . Rich text is parsed into React elements. No data, no noise. With nothing to show, render the hint when editMode is on and nothing in a store. A widget that throws blanks only itself. Own properties only ( Object.hasOwn ) when you look up anything keyed by document or settings data. Shopper data is browser-only. A source with perShopper: true is never read on the server; the widget draws nothing until it arrives, so the server and first browser render match. Do not set a revalidate time or call a cache API. Reads go through the client, which keeps them for at least an hour and clears them when something changes. Data sources id is provider.name , lower case. provider is catalog or commerce . result is one of product[] , product , collection , category[] , review[] , customer , cart . fields is the allow-list of what a template may read, by dotted name, with a type ( string , number , boolean , money , image , url , date , list ). A money field is printed only as .display or .currency . cacheKind is listings , product , reviews or none . Params are checked by the resolver, because they come from a document: clamp numbers, default what is missing. A binding is { source, params } , or { source: context.product } inside a slot, which takes what the page knows. The catalog pack ships catalog.products , catalog.product , catalog.collection , catalog.categories , catalog.reviews , catalog.cart , context.product , context.listing and, in the commerce pack, throttle.customer . Packs, link targets and slots Link targets. A pack may give linkTargets.resolve(target) , which turns a menu or link target it owns (a category, collection, product or search) into an href, or null when it cannot. null means no link, never a wrong one. A catalog target holds the catalog id, so call warmCatalogLinks on the server before rendering menus. Slots. A pack lists the places its pages render a slot ( { name, context: product | listing | none } ). The catalog pack's are CATALOG_SLOT_POINTS . A slot's widgets read the context through context.* bindings. Registration. createRendererRegistry puts the built-in pack first. A pack cannot replace a basic.* type, and the first definition of a type and version wins. catalogPack({ catalogKey, cartStorage?, onLocaleChange?, onCurrencyChange?, display? }) (with a client , display is { builderOverrides: shopDisplayOverrides(site) } , or a function that answers it per request, so the shop description, the search heading and the Shop crumb follow Site > Wording > Shop wording) and commercePack({ auth? }) are the two packs in @usethrottle/st"},{"title":"Build Cart State That Checkout Can Trust","route":"/developers/cart-api","headings":["Build Cart State That Checkout Can Trust","0. Configure your application","Who owns each step","End-to-end cart flow","Shipping and tax","The cart is the source of truth for shipping and totals","Addresses","Discounts","Subscription lines","Resolved carts","Two add-item shapes","Owned lines","Open the hosted cart page for a cart","Native cart endpoints","{title}","unitPrice is per period, per seat; quantity is seats.","Stored as: type \"subscription\", name \"Barista Club — 14-day free trial\",","unitPrice 0, recurring.amount 2000, subscriptionId null (until checkout completes).`;","Add a line the app prices","The body is optional. 201 (new) or 200 (reused):","\"data\": {","\"sessionId\": \"cart_9f2c…\",","\"cartUrl\": \"https://checkout.usethrottle.dev/cart/cart_9f2c…\",","\"expiresAt\": \"2026-10-27T12:00:00.000Z\",","\"urls\": {","\"returnUrl\": \"https://shop.example.com/thanks\",","\"cancelUrl\": \"https://shop.example.com/cart\",","\"storefrontUrl\": \"https://shop.example.com\"","}","}`;"],"text":"Native carts Build Cart State That Checkout Can Trust Use @usethrottle/cart when Throttle owns the cart, totals, and checkout handoff for your application. 0. Configure your application Following the SDK example verbatim before this step fails with missing_application_id on POST /carts , or the embed renders Embed not authorized . Both checks happen before any SDK error path. From the dashboard, copy your Application UUID (Settings → Identifiers) into THROTTLE_APPLICATION_ID . From Embed Config , add your storefront origin (e.g. http://localhost:3000 ) to allowedOrigins . From API Keys , create a secret key in the workspace environment you want to use. Non-production keys look like sk_uat_* ; production keys look like sk_live_* . Every field on the wire is camelCase ( applicationId , unitPrice , referenceId ). Single shape — no snake_case aliases. See Conventions for the full rule. You don't have to plug in a payment processor to test cart → checkout end-to-end. Every new Application gets a sandbox payment sub-account on signup, so a checkout session minted with an non-production environment key renders the Card Simulator out-of-the-box. See Workspace environments for provider routing details. Who owns each step Your backend owns cart mutations and secret-key calls. The browser renders buyer controls and the checkout iframe, but it never receives your sk_ key. End-to-end cart flow The cart client wraps the native cart endpoints and throws ThrottleApiError for non-2xx responses. It extends the shared ThrottleError (from @usethrottle/errors , re-exported by every SDK), so one instanceof ThrottleError catch handles errors from all Throttle SDKs. See the error reference . The full request/response schemas for every endpoint on this page live in the public OpenAPI 3.1 document at api.usethrottle.dev/openapi.json . Open it in Swagger UI to try requests against a sandbox key, or pipe it into openapi-typescript / openapi-fetch for typed client generation. The pre-generated client lives at @usethrottle/cart . Most applications use native Throttle carts : create a cart with POST /api/v1/carts , then pass its cartId to POST /api/v1/checkout/sessions . The externalCartId field is only for applications that have connected an external cart provider. Passing externalCartId on a native application returns 400 invalid_mode (“this application uses native Throttle carts”) — create a cart first and use cartId instead. Shipping and tax Use cart calculation from your backend when a cart already exists in Throttle. Use storefront quote tokens for read-only estimates before checkout. Quote tokens start with qt_ (tokens minted before this change start with pk_ and remain valid indefinitely) and are scoped by application and allowed origin. They can estimate totals, but they cannot mutate carts or create orders. POST /api/v1/shipping-tax/quotes also accepts an X-API-Key carrying shipping_quotes:write instead of a quote token — see the API reference . carts.create and carts.update accept an optional customerEmail — a way to attach a buyer’s email to a cart without minting a full customer record (e.g. an “email me my cart” field). When set, an otherwise-anonymous abandoned cart becomes recoverable: the cart.abandoned webhook carries it as customer.email (with id: null ). A fully linked customer’s email always takes precedence. Pass null on update to clear it. Pass customerId: null on update to detach the customer; omit it to keep the customer. Detaching does not clear customerEmail ; send customerEmail: null too. Detaching does not clear the addresses either; send shippingAddress: null and billingAddress: null to clear them. carts.create and carts.update accept an optional buyerVatNumber , and the public POST /api/v1/checkout-sessions/:id/calculate accepts it too so a hosted or embedded checkout can capture it as the buyer types. Pass null to clear it. On a cross-border supply between two EU member states, a buyer VAT number zero-rates the sale under the reverse-charge rules — the buyer self-accounts for the VAT. A domestic B2B sale still carries VAT, so supplying a VAT number there changes nothing. The decision is recorded once, at calculation time, and surfaces as taxReverseCharge on the cart and on the resulting order; the customer invoice PDF renders the required notice. This applies when the tax axis is in app_based mode with a connected provider. Your provider decides the final treatment — setting a VAT number does not by itself guarantee zero tax. Because of that, the public GET /api/v1/checkout-sessions/:id response carries collect.vatNumber . It is true only when the merchant s published tax mode is app_based , and Throttle s own hosted checkout hides the VAT field when it is false. Build a custom checkout the same way: asking for a number no provider will read records data that changes nothing, while implying the buyer s supply will be zero-rated. The field is read-only and derived server-side — the collect object you pass at session create still only accepts shippingAddress and billingAddress . The same public POST /api/v1/checkout-sessions/:id/calculate accepts an optional email . Send it from a custom checkout the moment the buyer has entered one. A tax exemption belongs to a customer, so the calculation can only apply one if it knows who is buying. A cart that carries no customerId — a guest checkout, or a quote accepted by its buyer — is quoted as an anonymous buyer unless the email identifies an existing customer. Completing the checkout resolves that email anyway, so an exempt buyer who was never identified during calculation is charged tax on screen while the document filed with your tax provider records the sale as exempt. The email is written onto the cart and never cleared from this route, so a later estimate that omits it does not erase one the cart already had. No customer is created here — an email that matches nothing is simply quoted as a guest. The cart is the source of t"},{"title":"Cart sessions","route":"/developers/cart-sessions","headings":["Cart sessions","How it works","Set your allowed origins first","Create a cart session","Build the cart","Cart badge: just the number","Buyer details","Shipping & discounts","Hand off to checkout","Skip the UI: Throttle's hosted cart page","One hook for the whole flow: useThrottleCheckout","Resolved carts: lines priced by an installed app","Mobile apps: no Origin needed","Adding and changing lines","Refresh","Shipping on resolved carts","Checkout hand-off","Signing in","Switching currency: absorb a cart","In @usethrottle/cart","Only allow prices from installed apps","Extra cart currencies","Endpoints","Add a line by the app's id for the item. The app sets name, price and image.","Re-check every line the app owns (send {} as the body)","→ { \"data\": { \"cartSessionId\": \"cart_<id>\", \"cart\": { … }, \"changed\": false } }`;","Update an item","Remove an item","Read the current cart","\"data\": {","\"cartSessionId\": \"cart_<id>\",","\"status\": \"active\",","\"unitCount\": 4,","\"total\": 12497,","\"currency\": \"USD\"","}","}`}","Apply a discount code (a goods code or a free-shipping code)","Remove only the free-shipping code (kind=order removes the goods code)"],"text":"Guide Cart sessions Create and own a Throttle cart directly from the browser — no backend required. Cart sessions are the front door for JAMstack / static storefronts that don't run a server with a secret key. Prefer a typed client? CartSessionClient in @usethrottle/cart wraps every endpoint below — create/resume a session, then addItem , selectShipping , applyDiscount , checkout . In React, the useCartSession hook in @usethrottle/checkout-react adds reactive cart state + automatic localStorage persistence. The raw HTTP API is documented here for reference. How it works Server-side integrations build carts with a secret sk_ key. A frontend-only storefront can't hold a secret key, so it uses a cart session instead: You create a cart session with your storefront quote token ( qt_… — the same token used for shipping/tax quotes, from the dashboard Shipping & Tax page or POST /api/v1/shipping-tax/quote-tokens ) from an allowed origin. Quote tokens minted before qt_ start with pk_ and keep working. A pk_ publishable API key is a different credential and is refused with 401 invalid_quote_token . Throttle creates the cart and returns an opaque cart_… session id. That id is a bearer capability scoped to exactly one cart — hold it client-side (e.g. in localStorage ) and use it to add, update, and remove items. Because the cart lives in Throttle from the first add-to-cart, you get abandoned-cart recovery and a clean hand-off to checkout for free. Creation is authorized by your publishable token + the application origin allowlist. Every later call is authorized by possession of the opaque cart_… id + origin. No secret key is ever exposed to the browser, and a session can only ever touch its own cart. Set your allowed origins first Cart-session requests are rejected unless the request Origin is on the application's allowlist (the same allowlist used by embedded checkout and quotes). Set it via PUT /api/v1/embed-config . A resolved cart also accepts a request that sends neither Origin nor Referer , as a mobile app does. Create a cart session Returns cartSessionId (the cart_… token), expiresAt , a branding block ( logoUrl , primaryColor , merchantName — each nullable), and a cart snapshot. The same branding block is also returned by GET /api/v1/cart-sessions/ id , so a storefront rendering its own cart UI can brand it without a separate call. Build the cart /items \\\\ -H Origin: https://shop.example.com \\\\ -H Content-Type: application/json \\\\ -d name : Premium Widget , unitPrice : 2999, quantity : 2 # Update an item curl -X PATCH https://api.usethrottle.dev/api/v1/cart-sessions/cart_ /items/ \\\\ -H Origin: https://shop.example.com -H Content-Type: application/json \\\\ -d quantity : 3 # Remove an item curl -X DELETE https://api.usethrottle.dev/api/v1/cart-sessions/cart_ /items/ \\\\ -H Origin: https://shop.example.com # Read the current cart curl https://api.usethrottle.dev/api/v1/cart-sessions/cart_ \\\\ -H Origin: https://shop.example.com /> quantity is an integer between 1 and 10,000 on both add and update. Above that the request is rejected with Quantity cannot exceed 10000. — a cart line is not a bulk order; larger asks belong on the quote surface. The add-item route (and the SDK s addItem ) accepts the same recurring block as the Cart API, so a browser cart can hold subscription lines. The limits and codes are identical: see Cart API → Subscription lines . Cart badge: just the number A storefront header shows a count next to the cart icon on every page load. Reading it from GET /api/v1/cart-sessions/ id works, but that response carries the line items, both addresses, the buyer's email and their notes — the whole cart, shipped to every page of the site, to render one integer. /summary is the small read for it: /summary \\\\ -H Origin: https://shop.example.com # # data : # cartSessionId : cart_ , # status : active , # unitCount : 4, # total : 12497, # currency : USD # # /> unitCount counts units , not distinct lines: a cart holding 1 stand, 2 notebooks and 1 keyboard reports 4 , not 3 . The same field is on the cart object every other cart-session endpoint returns, so a page that already has the cart doesn't need this call. The typical shape on a storefront: restore the session id from localStorage on page load, draw the number, and forget the id once the session is finished. A finished session answers 200 with zeros — unitCount: 0 , total: 0 , currency: null — and a status of expired or converted . A third value, checkout , means the cart is mid-payment: keep the id, because the checkout cancel path reopens that cart and the buyer will want it back. This is the one endpoint that does not send cart_session_expired (410): a badge runs on every page, and drawing a zero shouldn't need a try / catch . An id that was never issued is still a cart_session_not_found (404) — that is a bug in the integration, not a finished cart. A cart the abandoned-cart sweep has taken reports its real unitCount with status: active — the buyer can still come back to it — and the summary never reopens it. Only a write does that, so a link prefetcher or an email scanner hitting a badge cannot resurrect a cart with nobody present. Buyer details PATCH /api/v1/cart-sessions/ id sets buyer-editable fields on the cart: customerEmail and notes , both optional. Send null for either to clear it. The body must carry at least one of the two — an empty object is rejected with Provide at least one of customerEmail or notes. On a cart backed by an external cart provider, customerEmail is rejected with mode_not_supported (422) rather than accepted and dropped; notes works on both providers. \\\\ -H Origin: https://shop.example.com -H Content-Type: application/json \\\\ -d customerEmail : buyer@example.com , notes : Leave at the door /> A guest cart is invisible to abandoned-cart recovery until it has a known email. Setting customerEmail here — even without a full customer record — is what makes the cart eligible for th"},{"title":"Developer Changelog","route":"/developers/changelog","headings":["Developer Changelog","2026-12-05 — Order fees in the API, webhooks and exports","2026-12-05 — Order fees in order emails","2026-12-04 — Resend an order email","2026-12-04 — Invoice on terms respects the maximum order total","2026-12-03 — Invoice terms for approved customers only","2026-12-03 — Imports report paid orders with a balance","2026-12-03 — Cancelling an order closes its balance link","2026-11-28 — Catalog weight and dimensions drive live shipping rates","2026-11-29 — Collect a balance on a placed order","2026-11-24 — Emails sent to a customer, per order and per customer","2026-11-24 — order.edited; order line edits: SKUs, shipped orders, webhook detail","2026-11-22 — Customer segments","2026-11-21 — Extra email recipients on a subscription; cancelsAt on a failed renewal","2026-11-20 — Checkout pay button text","2026-11-20 — Trial-ending email; no renewal reminder during a trial","2026-11-19 — subscription.trial_will_end","2026-11-19 — Invoices name their subscription; PATCH can move or end a trial","2026-11-18 — Clear a cart's addresses","2026-11-17 — Charge a saved card on an order","2026-11-17 — Manual line discounts when editing an order","2026-11-17 — Take a card payment on a draft order","2026-11-17 — Delete a draft order","2026-11-15 — Extensions: sandbox flags and a full-width layout","2026-11-14 — Dashboard feature switches","2026-11-13 — Exclude products from a discount code","2026-11-13 — Site forms","2026-11-11 — Customer groups","2026-11-10 — Integration history entries","2026-11-09 — Record history","2026-11-08 — Installations carry the pinned version's iframe URL","2026-11-08 — Move an order to another customer","2026-11-07 — More currencies can be enabled, in their own minor units","2026-11-06 — Customer search matches company; carts can detach a customer","2026-11-02 — Quotes: catalog lines","2026-11-01 — Customer carts follow the buyer","2026-10-27 — Internal notes on orders and customers","2026-10-26 — Physical subscriptions","2026-10-24 — Line items on the order list","2026-10-23 — Customer directory for extensions"],"text":"Release notes Developer Changelog Public, developer-facing contract changes for the Throttle API, embedded checkout, webhooks, and SDKs. Internal refactors and UI-only changes are excluded. Breaking marks an entry where code that worked before may stop working or behave differently. Deprecated marks an entry where something still works but is on its way out. Entries with no marker are additions or fixes; a fix can still change what you see, so read any that touch a route you call. 2026-12-05 — Order fees in the API, webhooks and exports New Order fees : fee definitions ( /api/v1/fees , /api/v1/fees/settings ) and per-document fee routes on carts, orders, quote revisions and subscriptions. Fee edits need a merchant credential. Orders, carts, quote revisions and invoices gain feeTotal and fees ; subscriptions gain fees . Both read 0 and [] while fees are off. POST /api/v1/orders accepts fees and feeCharge . subscription.* webhooks carry subscription.fees ; quote events carry revision.feeTotal and revision.fees . The orders CSV export appends two columns at the end: fee_total and fees . The MCP server has a list_fees tool. 2026-12-05 — Order fees in order emails Order confirmation, payment receipt, Net-N invoice and subscription-renewed emails print one row per order fee between Shipping and Tax. Rows with an amount of 0 are never shown. Templates receive order.fees (an array of label, amount ) and order.feeTotal . If you have overridden one of these templates, add the rows yourself: #each order.fees this.label money this.amount ../order.currency /each 2026-12-04 — Resend an order email New: POST /api/v1/orders/ id /emails/ emailId /resend ( orders:write ) sends the customer one of the order s emails again: the same email, to the same address. The dashboard shows it as Resend on the order and customer Emails tabs. Emails sent to the customer 2026-12-04 — Invoice on terms respects the maximum order total Changed: POST /api/v1/orders/ id /invoice-on-terms now applies the Invoice Terms maximum order total, as checkout already did. An order over the cap for its currency, or in a currency with no cap once any cap is set, is refused with 422 net30_over_limit before anything is placed. 2026-12-03 — Invoice terms for approved customers only New: eligibility on the Invoice Terms connection ( all_customers , the default, or approved_customers ). With approved_customers , only customers whose profile has netN , or terms negotiated on a quote, can be invoiced on terms. Everyone else gets 422 terms_not_approved . Existing connections are unchanged. 2026-12-03 — Imports report paid orders with a balance New: errorSummary.paid_below_total on an order import. It counts and names re-imported orders the file says are paid whose recorded payments come to less than the total. It is not a row error, it appears in the dry run too, and no payment is changed. 2026-12-03 — Cancelling an order closes its balance link Changed: POST /orders/:id/cancel and moving an order to cancelled with POST /orders/:id/status now close an open balance link first. If the customer is paying it right then, the order is not cancelled and the request answers 409 payment_in_progress ; if the link cannot be closed, it answers 502 payment_link_cancel_failed . 2026-12-02 — Orders CSV export writes decimal amounts Breaking Changed: money columns in GET /orders/export.csv . Every amount, including the existing total and comp_amount , is now a decimal in the row s currency: 5.00 , not 500 . If you parse this file and divide by 100, stop. JSON responses still use integer minor units. New: rows=lineItems answers one row per line item, and the orders file gains customer, money, tracking and address columns at the end. amount_paid , amount_refunded and amount_due are blank for an imported order with no payment record. 2026-12-02 — OpenAPI document names production and version 1.0.0 Breaking Changed: servers . The OpenAPI document lists https://api.usethrottle.dev first, so Try it out in the API reference calls the API instead of your own machine. The local development server is still listed second. Changed: info.version is 1.0.0 (was 0.1.0 ), matching the /api/v1 paths. No path, request or response changed. Changed: the Organizations and Stores tags are listed last and described as the legacy names for the workspace and its applications. The routes are unchanged and still supported. SDK: @usethrottle/api-client . OpenAPI.BASE now defaults to https://api.usethrottle.dev (was http://localhost:3000 ). Code that sets OpenAPI.BASE is unaffected; to call a local server, set it explicitly. 2026-11-28 — Catalog weight and dimensions drive live shipping rates New: shipping on a line resolver answer. Optional { weightGrams, lengthMm, widthMm, heightMm } per line, in grams and millimetres. Omitted means unknown, never 0; a malformed object is dropped and the line still prices. Throttle stores weight and weightUnit: "kg" , and length , width , height and dimensionUnit: "cm" (only when all three are present) on the line, when the answer says requiresShipping: true . Shipping measures Changed: catalog lines carry shipping measures. Cart lines, quote lines picked from the catalog and the checkout cart built from an accepted quote now carry those keys, so live rates use real weights. The keys stay read-only for a browser ( 400 price_locked ). A line with no weight is unchanged, and a line without shipping stores exactly what it did before. Changed: Shippo and EasyPost parcels. Each line is converted from its own unit and sent in lb and in. A one-unit cart with all three dimensions ships in its own box. A parcel over 150 lb is not quoted and the cart falls back to your own shipping rules. New: @usethrottle/storefront-react . The product page's Specifications show Weight and Dimensions in the store's units ( product.units : imperial or metric ); formatWeight and formatDimensions are exported. Product page 2026-11-29 — Collect"},{"title":"API Conventions","route":"/developers/conventions","headings":["API Conventions","Base URL","Field naming: camelCase, single shape","Money: integer minor units","Errors","Typed errors in the SDK","Request IDs","Rate limits","Headers","When you go over","Pagination","Identifier prefixes","Timestamps and timezones","Quote and order numbers","Dashboard feature switches"],"text":"Reference API Conventions One section captures the rules that apply across every Throttle endpoint: base URL, naming, money, error shapes, rate limits, pagination, and workspace environments. When in doubt, this page wins over the per-endpoint docs. Base URL Every endpoint lives under one base URL, for every workspace and every environment: There is no separate host for test data. The API key you send selects the workspace, application and environment, so the same URL serves production and every non-production environment. Paths in these docs are written in full, for example POST /api/v1/carts . Field naming: camelCase, single shape Every request and response field on the wire is camelCase . One name per concept — no aliases, no alternate forms. Type generation from the OpenAPI spec is the intended workflow. Throttle public request and response bodies use camelCase. Use applicationId , customerId , lineItems , unitPrice , and externalId ; stale snake_case or store aliases are rejected with a validation error. Generated api-client@1.3.0+ already uses the current shape. Historical store terminology may still appear in dashboard labels or internal database migrations, but it is not exposed on the public wire. Money: integer minor units Money amounts are integers in the currency's minor unit , in requests and in responses. 2999 in USD is $29.99. Never send a decimal such as 29.99 . An amount is only meaningful next to its currency , a three-letter ISO 4217 code. The number of decimals comes from the currency, not from an assumption of 100: 1999 is ¥1,999 in JPY , which has no minor unit, and 1.999 in KWD , which has three decimals. Do not divide by 100 to display an amount unless you know the currency has two. See Multi-currency for the table and the formatting helpers. Percentages and rates are not money and are not in minor units: a percentage discount of 25% is 25 . Errors Every non-2xx response follows the same envelope: error.code is the contract — use it for programmatic handling. Reach for error.message only for surfacing a human-readable string in your UI. Field-level details identify unrecognized keys and may include a suggestion when the server can identify the intended canonical camelCase field: Typed errors in the SDK The envelope is published as a named ErrorEnvelope model, so @usethrottle/api-client exposes it as a type rather than leaving you to re-parse the body: ApiError extends ThrottleError , so one catch covers every Throttle SDK. err.message is the message the server sent; if a response carries no message, it falls back to a description of what that status means on this API, and the raw description stays available as err.statusDescription . Request IDs API responses carry an x-request-id response header, and it s readable cross-origin (it s in Access-Control-Expose-Headers ) — hijacked and streamed replies are the exception. Where the response body is a JSON envelope, meta.requestId is the same value, where present: If your own request already carries an x-request-id header matching ^[A-Za-z0-9_-] 8,128 $ , Throttle honours it and echoes it back unchanged — useful for correlating a request across your own systems. Anything that doesn t match (too short, too long, or containing characters outside A-Za-z0-9_- ) is ignored, and a fresh req_<uuid> is generated instead. ThrottleError s requestId field — available in @usethrottle/errors 1.1.0 and later — exposes the same value across every Throttle SDK: quote it when contacting support, since it s the fastest way for us to find the exact request in our logs. It s read from meta.requestId when the response body carries one; for a hand-built error body without a meta envelope (a 401, 403, or 500), it falls back to the x-request-id response header instead, so it s populated either way. On earlier versions, read x-request-id or meta.requestId directly from the response. Rate limits Each credential gets its own allowance: 200 requests per 60 seconds for an API key . The limit is counted per key, not per workspace and not per IP address, so two keys in the same workspace do not use up each other's requests. sk_ or pk_ ) , Key , 200 , ], [ OAuth connection, such as a connected AI assistant , Connection , 200 ], [ Dashboard session , Signed-in user, per workspace , 600 ], [ html: Payment-method client token ( X-Throttle-PM-Token ) , Subscription or customer the token was minted for , 200 , ], [ No credential (public routes) , Network address , 200 ], ] /> The window is fixed. It opens with the first request and resets 60 seconds later, when the full allowance comes back at once. Dashboard traffic is counted apart from your keys, so a bulk job running on a key does not slow the dashboard down for your team, and the reverse. Callers without a credential that share a network address share one allowance. Headers Every response that was counted reports where you stand: A request rejected before it is counted carries none of these headers. A 401 for a missing or invalid key is one example. The headers are also not listed in Access-Control-Expose-Headers , so browser code calling the API cross-origin cannot read them. Read them on your server. When you go over The request is not processed and the response is 429 rate_limit_exceeded in the standard error envelope: Wait the number of seconds in retry-after , then send the request again. Branch on the status or on error.code ; the message is for people and its wording is not part of the contract. Retrying sooner only returns another 429 . For imports and backfills, pace the work under the limit instead of sending as fast as you can and reacting to 429 s. Watching x-ratelimit-remaining is enough. Give each integration its own API key. Allowances are per key, so a batch job on one key cannot starve checkout traffic on another. A few routes, mostly public ones that take no API key, set a lower limit and count it separately from the general allowance. The headers on a response alway"},{"title":"Customer Groups","route":"/developers/customer-groups","headings":["Customer Groups","Concepts and limits","The group object","Routes","Members: use the customers routes","What buyers see","Look up groups for many customers","Import column","Events","Group-limited promotion codes","Identity proof","Group data for extensions","Tax exemption","What each tax mode does","Where the exemption shows up","Errors","201","200","List the members of one group, or the customers in no group:","200: customers in no group and unknown ids are left out","must present the buyer's own storefront customer token."],"text":"Customers Customer Groups A customer group is a named set of customers. A group is either fixed (the product catalog stores its own prices per variant and currency) or percent (a percentage off the regular price). Groups also decide who may use a promotion code. Manage them in the dashboard under Customers › Groups , or with the API below. In the dashboard dialog, the Pricing field lists Percent off first (the default), then Fixed prices set in the catalog . Without Product Catalog installed in the environment, Pricing is disabled and groups only control who can use group-only discount codes. Concepts and limits Scope. A group belongs to one application and one environment (production or a sandbox). Another environment's group id answers 404 not_found . One group per customer. Adding a customer to a group moves them out of any other group. Membership lives in its own table, so the group never appears on a customer unless the call below adds it on purpose. At most 50 groups per application and environment. The 51st create answers 409 customer_group_limit_reached ( details.limit: 50 ). Names are 1 to 100 characters, trimmed, and unique ignoring case ( 409 customer_group_name_taken ). Names are labels, not identifiers: use the group id everywhere in code. Percent groups carry percentBps , 1 to 10000 basis points off the regular price (1500 = 15%, 10000 = free). A fixed group has percentBps: null . Disabled groups count as no group. Their members get regular prices and are not eligible for codes limited to that group. Memberships stay, so enabling the group restores everything. The kind can change. The catalog keeps the fixed prices of a group whatever its current kind and reads them only while the group is fixed . Deleting removes the group and its memberships. A group that a discount names cannot be deleted: 409 customer_group_in_use with details.discounts listing each discount's id, code and name. The group object Routes Every route is camelCase only and rejects unknown fields with 400 naming the field (for example percent_bps ). lower(name) then id . No pagination. ], [ code: POST /api/v1/customer-groups , code: customer_groups:write , html: Body name , kind , percentBps (required for percent), enabled (default true), taxExempt with taxExemptReason (required together). ], [ code: GET /api/v1/customer-groups/ id , code: customer_groups:read , One group. ], [ code: PATCH /api/v1/customer-groups/ id , code: customer_groups:write , Switching to percent needs percentBps; switching to fixed clears it. A PATCH that changes nothing writes nothing and emits no event. ], [ code: DELETE /api/v1/customer-groups/ id , code: customer_groups:write , html: Answers removedMemberCount . ], [ code: POST /api/v1/customer-groups/ id /members , code: customer_groups:write , html: 1 to 100 customerIds . All or nothing: an id that is not a customer of this environment answers 422 customer_not_found and nothing changes. ], [ code: POST /api/v1/customer-groups/ id /members/remove , code: customer_groups:write , Same body. Non-members count as unchanged. ], [ code: POST /api/v1/customer-groups/lookup , code: customer_groups:read , Up to 100 customer ids to their groups in one call (below). ], ] /> Dashboard users need the matching permission, application:customer-groups:read or application:customer-groups:write (see Permissions ). Publishable keys cannot call these routes, and extensions may request customer_groups:read but not customer_groups:write (see Scopes ). Members: use the customers routes A customer's group is a field on the customers API for callers who hold the group scopes. POST and PATCH /api/v1/customers accept customerGroupId (a group id, or null for no group). It needs customer_groups:write as well as customers:write . An unknown or other-environment group is 422 customer_group_not_found before anything is written. Customer responses carry customerGroupId (nullable) only for callers holding customer_groups:read . They then also carry taxExemption : the customer's effective exemption as the merchant sees it ( { v, source, entityUseCode, exemptionNumber, groupId, groupName } , source customer or group ), or null when none applies. Buyer proof is not applied here. Line resolvers and quote lookups are not sent the exemption: their customerGroup field is { id, kind, percentBps, version } . GET /api/v1/customers?customerGroupId=<id> lists the members of a group; customerGroupId=none lists customers in no group. It needs customer_groups:read . What buyers see A signed-in buyer can read the groups they belong to: the name and id of each, in groups on their own profile . A disabled group is hidden from them, as if they were not in it. Pick group names you are happy for the buyer to see. The Builder's Show when can use groups to show or hide content on the storefront. Look up groups for many customers POST /api/v1/customer-groups/lookup answers the group of up to 100 customers in one call. Customers in no group, unknown customers and other-environment ids are left out. It has its own rate-limit bucket per key and environment and answers Cache-Control: no-store . Import column A customer import can map a Customer Group column (field customer.customerGroup ). Cells name a group, matched ignoring case in the import's application and environment; none clears the group. A name that matches no group fails that row with customer_group_not_found . Mapping the column needs customer_groups:write . See Bulk imports . Events Four webhook events, readable with customer_groups:read : customer_group.created , customer_group.updated (carries previous values), customer_group.deleted (carries removedMemberCount ) and customer_group.members_changed (up to 100 changes of customerId , groupId , previousGroupId , and a source such as api , dashboard or import ). The other three carry the group, including its version . See Webhooks . Group-limited promotion codes A dis"},{"title":"Discounts for Cart-Backed Checkout","route":"/developers/discounts","headings":["Discounts for Cart-Backed Checkout","Supported types","Percentage off","Fixed amount off","Free shipping","Free-shipping codes","On the cart, the session and the order","Use the SDK","Preview without mutation","Customer limits","Limit a code to customer groups","Exclude products from a code","List and search codes","Cart and order records","Payment flow","Metadata","Apply to checkout","Pre-applying at session create","Discounts in more than one currency","Current boundaries"],"text":"Promotion codes Discounts for Cart-Backed Checkout Throttle supports percentage, fixed amount and free-shipping promotion codes. The payment processor does not validate or calculate codes; Throttle computes the discounted cart total before checkout hands the final amount to payment. Supported types Percentage off type: "percentage" , with value: 25 for 25% off. Fixed amount off type: "fixed_amount" , with value: 500 for $5.00 off in minor units. Free shipping type: "free_shipping" . It has no value ; it takes the delivery price off. See Free-shipping codes . A code applies after each line s own discountAmount (a manual discount the merchant set on the line or spread from an order discount). A 10% code on a $500 cart with $50 already off its lines takes $45, not $50, and a fixed-amount code is capped at what the lines come to after their discounts. Buy-X-get-Y is no longer an active product surface. Existing historical rows may remain inactive, but new code should only create percentage, fixed amount or free-shipping discounts. Free-shipping codes A free-shipping code makes delivery free for the orders it fits, by region and by shipping option, and can be limited to customer groups like any other code. It never changes a goods line's discount or the tax on goods. conditions.shipping.zoneIds lists the shipping zones the code applies to, matched against the ship-to address. null means all regions. conditions.shipping.targets lists the options the code makes free: kind: method , methodId for a native method, or kind: carrier_service , provider, carrier, serviceCode for a live carrier service. null means any option. An empty list is refused in both fields; send null . The API still accepts the legacy kind: method , methodId: flat_rate target, but it cannot apply end to end: a cart on the flat-rate fallback has no selected shipping method, so the code reads pending_shipping and charges full shipping. The dashboard does not offer it; use a native method or carrier service target, or null . The cap and the minimum are per currency. amounts[CUR].value is an optional cap on the reduction (no cap means free in full) and amounts[CUR].minOrder is the minimum goods subtotal. A code with caps is offered only in the currencies that have one. value itself is 0. The type is immutable. An update that changes it answers discount_type_immutable . Custom shipping is never touched. A typed amount (the dashboard's custom shipping) and a quote's flat or free shipping stay as set. A store that does not charge shipping refuses the code with 422 discount_not_applicable . Subscription renewals are out. The code applies to the order it is used on. Bring-your-own shipping records the code only if you send the reduction. When shipping is in bring-your-own mode, your checkout prices the shipping, so Throttle cannot see what the code took off. Send shippingDiscountAmount (minor units) on POST /api/v1/shipping-tax/external-snapshots for any cart that holds a free-shipping code, with selectedShipping.rateAmount as the original price ( rateAmount = totals.shippingTotal + shippingDiscountAmount ). Without it the order records no shipping code and the code's use is not counted against its limits. A value above the shipping price, or on a cart with no free-shipping code, answers 400 invalid_shipping_discount . On the cart, the session and the order Every cart, cart session and checkout session carries shippingDiscountTotal (0 without a code) and appliedShippingDiscount ( null without one). shippingTotal is the shipping the buyer pays, already net of the code, so the price before the code is shippingTotal + shippingDiscountTotal . appliedDiscount is the goods code only; its freeShipping flag is gone. Orders and invoices carry shippingDiscountTotal and shippingDiscountCode . applied : the code reduces shipping now. amount is the reduction. pending_address and pending_shipping : the code is on the cart but there is no ship-to address or no selected shipping option to judge yet. not_eligible with a reason of zone , shipping_option or minimum_order (with amountToMinimum ): the code stays on the cart with a reduction of 0 and works again once the cart qualifies. Use zoneIds , targets and cap to explain the rule ( US only , Add $12 more ). merchant_applies : your store prices shipping itself, so Throttle cannot; your checkout honours the rule. The shipping methods a shipping-tax calculation offers carry discountedAmount when the code would apply to them, so a custom checkout can show the price with the code beside the full price. The amount stays the full price. Usage is counted only when the order's shippingDiscountTotal is above 0, so a code that sat on a cart that never qualified is not used up. Group, date and usage-limit failures remove the code from the cart, as they do for goods codes; a group-limited code a buyer is not eligible for answers exactly like an unknown code. Use the SDK @usethrottle/discounts is a server-side, headless SDK. It does not ship a coupon input UI; your checkout owns that field. Preview without mutation Use preview when the buyer types a code in your order summary. It returns the discount amount and total without creating or changing a cart. Include a customer ID when you want the preview to check the customer redemption limit. When a code has a minimum order total and the order is under it, the validate and preview responses add minimum (the code's minimum in the order's currency) and shortfall (how much more the order needs to reach it). Both are money values: amount, currency, display , where amount is in minor units and display is the formatted string, for example €12.50 . They are absent when the order meets the minimum. A cart that applies such a code answers discount_invalid with the same minimum and shortfall in details . Format amount and currency with formatMoney from @usethrottle/money ; see Showing money . Customer limits New d"},{"title":"Embed Throttle Without Owning Payment UI","route":"/developers/embedded-checkout","headings":["Embed Throttle Without Owning Payment UI","PaymentEmbed","CheckoutEmbed","Raw iframe","Origin allowlist","Preview origins","Choosing the right surface","Session lifecycle","Sequence: postMessage handshake","Query parameter reference","postMessage event reference","Complete-session payloads","Completion errors","Payment-method filtering","Pay button text"],"text":"Checkout surfaces Embed Throttle Without Owning Payment UI Use an iframe-backed surface for payment capture while your backend controls session creation and your webhook endpoint controls durable state. PaymentEmbed Use PaymentEmbed when your storefront already owns cart, address, shipping, and order summary UI. Throttle renders the payment form and posts lifecycle events to the parent page. If you show a promotion-code field in that order summary, preview it on your server and apply it to the Throttle cart before creating the session. Both components build their own iframe URL and load the /c page by default. Pass route="s" to load the unified /s page instead — for example to match the route you give buildCheckoutEmbedUrl on your server. The component does not see a URL you built yourself. Card-vault (add-a-card) sessions are only served by /c . CheckoutEmbed Use CheckoutEmbed when you want a fuller hosted checkout flow inside your page. It supports the same terminal events plus checkout step changes. Raw iframe If you are not using React, render the hosted checkout iframe directly and validate the postMessage envelope before trusting events. Origin allowlist Embedded checkout refuses to render unless the parent origin is allowlisted. Configure production and staging origins before mounting the iframe. Preview origins Preview deployments get a new hostname per branch, so they cannot be listed one by one. In a non-production environment, an entry may use one wildcard as its leftmost label: https://*.preview.example.com matches https://pr-42.preview.example.com and any deeper subdomain. It does not match https://preview.example.com itself; list that separately if you need it. The wildcard must sit under a domain you own. One over a shared or public suffix ( https://*.vercel.app , https://*.pages.dev , https://*.co.uk ) is refused with 400 invalid_origin , because anyone can obtain a hostname there and could then host your checkout. Point a subdomain of your own at the preview host instead. Production takes exact origins only. A wildcard sent to the production environment is refused, and creating an application never accepts one, since that seeds every environment at once. For a domain cutover, list the old and the new origin side by side and remove the old one afterwards. A wildcard entry applies to embedded checkout, cart sessions, storefront sign-in and the script manifest. One exception: the sandbox that runs extension scripts only ever lets exact origins frame it, so sandboxed scripts do not run on a preview origin matched by a wildcard. A wildcard is also never used to build a link. If your allowlist holds only wildcards, set storefrontBaseUrl so buyer emails and relative image paths have a real host to point at. Throttle sends iframe events with a specific target origin. Your parent page should also verify event.origin , source: "throttle" , and version: 1 . Choosing the right surface The hosted checkout app exposes two route shapes. Both honour the same origin allowlist and emit the same postMessage events; they differ in who owns the buyer-data form (Throttle vs. the payment provider) and which payment methods can co-exist. /c/[sessionId] Provider proxy mode , The provider embed collects email, address, and card inside its own iframe. Throttle wraps it with merchant branding and a Pay button. , Card (provider) , code: PaymentEmbed , ], [ html: /s/[sessionId] Unified flow , Throttle renders the cart, address form, and a payment-method picker. Card and Net 30 can appear side-by-side as tiles in the same iframe. , Card (provider) and/or Net 30 , code: CheckoutEmbed , ] ] /> Session lifecycle Every embedded checkout follows the same four-step rhythm. Sessions are server-side state; embed tokens are short-lived JWTs that the iframe re-mints on demand. The session id ( sess_xxx ) is the durable handle stored in checkout_sessions . The embed JWT ( embedToken ) is a provider-signed credential the iframe needs to mount the card capture widget. The iframe re-mints it every render, so the JWT's ~30 minute TTL is rarely user-facing. The underlying cart stays open for the whole life of a session. The cart only becomes converted (terminal) when the session completes and the order is created — not when the session is created. So a buyer can return to an in-flight session and keep mutating the cart. If a later cart operation returns 409 cart_not_open , the cart was converted by a previously completed order; start a new cart for the new purchase. Completing a session whose cart was retired also answers 409 cart_not_open , with details.reason merged (a sign-in claim moved the buyer to their account's cart) or expired (the cart sat idle or its checkout expired). Nothing is ordered; start a new checkout session for the cart the buyer now has. checkout.getSession(sessionId) ( GET /api/v1/checkout/sessions/ id ) returns the session with its current status : open or processing while the buyer is in it, then completed , cancelled or expired . Use it to decide whether a session can be resumed or needs cancelling, instead of tracking that on your side. To tear down an in-flight session, call checkout.cancelSession(sessionId) ( DELETE /api/v1/checkout/sessions/ id ). It is idempotent, marks the session cancelled , and re-opens an associated cart still sitting in checkout . A completed session cannot be cancelled ( 422 already_completed ). GET /api/v1/checkout-sessions/ id returns currency : the session s currency, which is its cart s. Every amount the checkout page shows is in minor units of it, so a custom checkout formats its totals with it (for example formatMoney(total, session.currency) from @usethrottle/money ) without waiting for a card token. It is null only when the cart can no longer be read. GET /api/v1/checkout-sessions/ id — unauthenticated, what the iframe itself reads to render — returns recurringTerms when the session carries a recurring intent, otherwise null ."},{"title":"Collection Flags","route":"/developers/embedded-checkout/collection-flags","headings":["Collection Flags","The collect block","Worked combinations","Shipping only (default — physical goods, no separate billing)","Billing only (digital goods + invoicing)","Both (shipping + separate billing)","Neither (replaces ?mode=payment-only)","Flow: which steps render","Complete-session billing fields","Validation errors","Iframe behaviour","Migration: ?mode=payment-only","Next"],"text":"Embedded Checkout Collection Flags Tell Throttle which buyer addresses to collect during the embedded flow. Each session opts into shipping and billing capture independently — useful for digital-only carts, B2B Net 30 invoicing, and storefronts that already collected the address upstream. The collect block POST /api/v1/checkout/sessions accepts an optional collect object on the request body: true , except with subscriptions (below) , html: When true , the iframe renders the shipping address step and /complete requires shippingAddress . , ], [ code: collect.billingAddress , code: boolean , html: false , with two exceptions (below) , html: When true , the iframe emits a step: 'billing' postMessage and /complete requires billingAddress (or billingSameAsShipping: true ). , ] ] /> Omitting collect on a one-off checkout is equivalent to shippingAddress: true, billingAddress: false . Existing integrations that don't opt in keep the old shape. On a checkout with subscriptions, an omitted collect turns the shipping step on only when the cart holds a shippable one-time line or a physical subscription line ( deliveryMethod: shipment ); other subscription lines never ship. A collect object that leaves shippingAddress out still sets it to true . See Mixed Carts . An omitted collect.billingAddress defaults to true in two cases, because otherwise the checkout has no address to tax: the application taxes from the billing address (tax trigger billing_address ); the session shows no shipping step ( collect.shippingAddress resolves to false , for example a subscriptions-only cart), and the application uses a tax provider (tax mode app_based ) with an address trigger and the strict fallback policy, which refuses to complete a checkout it could not tax. In that second case, with the shipping_address trigger, tax is calculated from the billing address, and the order records metadata.taxTrigger: 'billing_address' so the filed tax document uses the same address. It also records metadata.taxTriggerSource: 'checkout' to mark that value as Throttle's: if the buyer retries a declined payment, the order's trigger is worked out again for the new attempt, and a stamp with that mark is replaced or removed. A metadata.taxTrigger you set on the cart or the session (the session's wins, as it does on the order) is never overwritten, and it also replaces a value already on an order that a retry reuses. The quote and the filed document both follow it, so shipping_address on a session with no shipping step is refused with tax_address_missing under the strict policy. An explicit billingAddress: false always wins. Worked combinations Pick the combo that matches your storefront. Every example below is the request body for POST /api/v1/checkout/sessions . Shipping only (default — physical goods, no separate billing) Billing only (digital goods + invoicing) Common for B2B Net 30 flows where shipping is irrelevant but the AR system needs a billing address. Both (shipping + separate billing) The buyer fills shipping, then is asked whether billing matches. If they uncheck "billing same as shipping", a billing form appears. Neither (replaces ?mode=payment-only) Use when your storefront has already collected the buyer's addresses. Send them as customer.shippingAddress and customer.billingAddress : they are stored on the session, returned when you read it, and carried onto the order when the session completes. An address submitted on /complete always wins over the one sent here. Flow: which steps render The two boolean flags fan out into four distinct iframe step machines. Use this to confirm the buyer journey before you ship — especially when a connector requires a billing address regardless of shipping. Complete-session billing fields When collect.billingAddress is true, the iframe POSTs the billing details on /complete . Two new request-body fields: billingAddress — same shape as shippingAddress : firstName , lastName , company? , addressLine1 , addressLine2? , city , stateProvince , postalCode , countryCode (ISO-3166-1 alpha-2), phone? . billingSameAsShipping — boolean, defaults to false . When true , the server copies the shipping address into the order's billing slot and you can omit billingAddress . Validation errors When a required address is missing, the server returns 422 address_required with a field extra so the iframe can highlight the right step. No card is authorised without the address. The card-form token mint ( GET /api/v1/checkout-sessions/:id/embed-token ) answers the same 422 address_required while a required address is on neither the session, its cart, nor the customer prefill, so the card form cannot authorise before the address step. The compact route ( /c ) has no address step: a session that still needs an address is sent to the full checkout ( /s ), which asks for it first. A refused completion voids the card hold. When POST /api/v1/checkout-sessions/:id/complete refuses an embed payment ( paymentMethod: "embedded" ) after the card was authorised — address_required or any other refusal that creates no order — Throttle voids that authorisation, so the buyer is not left with a hold. The transaction id cannot be completed on again ( 409 transaction_already_used ); start a new payment. Refusals the client is told to retry ( payment_unverified , checkout_in_progress ) keep the authorisation. Iframe behaviour The Pay button auto-disables until every collect-flagged field is complete. Parent-set submitDisabled still composes additively — see Parent Controls . With collect.billingAddress: true , the iframe emits an additional throttle.step.changed event with step: 'billing' . With collect.shippingAddress: false and collect.billingAddress: false , the buyer lands directly on the payment step (this combo replaces the legacy ?mode=payment-only URL flag). Migration: ?mode=payment-only The ?mode=payment-only URL query parameter is sti"},{"title":"Parent Controls","route":"/developers/embedded-checkout/parent-controls","headings":["Parent Controls","The submitDisabled prop","Defaults","Composes with collect-flag auto-disable","Without React","Message contract","Security","What does it actually do inside the iframe?","Common uses","Next"],"text":"Embedded Checkout Parent Controls Gate buyer interaction with the embedded checkout from the parent page. Useful when your storefront has fields that must be filled (shipping address, terms acceptance, plan selector) before the buyer should be able to submit the embedded payment. Is: a way for the parent to render an overlay over the entire embed area that swallows clicks until the parent says otherwise. The overlay is light-grey + cursor not-allowed so the buyer sees the form behind but can't interact with it. Isn't: a way to validate the buyer's data from the parent. Field-level validity is up to your form. The parent signals ready or not ready — Throttle just enforces the gate. The submitDisabled prop Both <PaymentEmbed /> and <CheckoutEmbed /> in @usethrottle/checkout-react accept a controlled submitDisabled?: boolean prop. When it flips to true , the SDK posts a parent → iframe command and the iframe renders a full-area overlay. When it flips back to false , the overlay disappears. Defaults Omitting submitDisabled entirely keeps the embed enabled (backward compatible). The SDK never posts a parent command in this case. submitDisabled= false and omitting the prop are equivalent at runtime, but passing false explicitly opts your embed into the parent-control protocol — useful when your form starts valid (e.g., everything pre-filled). The first parent command is sent after the iframe posts throttle.ready . You don't need to wait for this in your component code — the SDK buffers and re-sends. Composes with collect-flag auto-disable The iframe also auto-disables the Pay button until every field required by the session's collect flags (shipping address, billing address) is complete. Parent-set submitDisabled composes additively with that validation gate: the button stays disabled while either the parent says "not ready" or the iframe's own validation hasn't passed. Practically: you don't need to mirror the iframe's address validation in your parent form. Only gate on parent-controlled state (terms checkbox, plan selection, out-of-band eligibility checks). Throttle handles the rest. Without React The SDK is a thin wrapper over postMessage. Vanilla JS, Vue, Svelte, Angular — anything that mounts an iframe can post the same shape. Message contract The parent → iframe channel uses source: 'throttle-parent' to disambiguate from the iframe → parent events (which use source: 'throttle' ). The iframe ignores anything that doesn't match. Future commands will extend the same envelope; the protocol is additive. Security The iframe verifies event.origin matches the merchant-allowed parent origin before reading the message. A different page can't steal control. Setting disabled: false from an attacker doesn't bypass anything — it simply removes the overlay. The buyer still has to actually submit the form, and Throttle still has its own server-side validation on the /complete route. The overlay is cosmetic , not a security boundary. It blocks the buyer's clicks but doesn't prevent scripts. Treat submitDisabled as a UX gate, not a server-side enforcement primitive. What does it actually do inside the iframe? The iframe's EmbedShell listens for the parent command and renders a positioned overlay (semi-transparent white + cursor not-allowed) covering the embed content when disabled. The overlay sits at z-index 50 so it covers both Throttle's native UI and any nested provider iframe (the card form). The buyer sees what they've typed but can't click anything. We chose "overlay over the iframe" instead of "disable the submit button only" because the provider embed renders its own submit button inside a nested iframe we don't control. Greying the entire interaction surface gives the same UX outcome with stable semantics. Common uses Address before pay. Your parent page renders a shipping address form. Pass submitDisabled= !addressValid . Terms acceptance. A "I agree to terms" checkbox above the embed. Pass submitDisabled= !checked . Plan selection. Buyer must pick a plan before paying. Pass submitDisabled= !selectedPlan . Async eligibility. You're waiting on a backend check (e.g., calling subscriptions/eligibility-check ). Disable until the result returns. Next Embedded Checkout — full embed lifecycle and event reference."},{"title":"Workspace Environments","route":"/developers/environments","headings":["Workspace Environments","Environment-scoped keys","Dashboard environment selector","Manage environments","API keys are environment-scoped","Payment provider environments","Webhook environment routing","Cheat sheet","Production is immutable; non-production environments can be named for your flow.","Production:","Include archived environments for settings/audit screens","Create a non-production sandbox-provider environment","Archive a custom non-production environment"],"text":"Reliability Workspace Environments Throttle isolates production from every sandbox-provider environment inside the same workspace. Each workspace has one immutable production environment and can have multiple non-production environments such as test, UAT, and staging. Environment-scoped keys API keys are minted for a workspace environment. The raw key includes the environment slug, and every request is scoped to the key's environment end-to-end: sk_<environment-slug>_* — secret key for server-side requests. pk_<environment-slug>_* — publishable key for browser/frontend code. Publishable keys may hold only stateless compute scopes such as shipping_quotes:write and tax_calculations:write . Carts, discounts/promotions, orders, payments, subscriptions, shipping/tax settings, invoices, Net-N customer terms, dashboard views, webhooks, API keys, and connector state all carry an environmentId . A UAT cart never becomes a production order, and a production webhook endpoint never receives UAT events. Dashboard environment selector The dashboard topbar selector chooses the active workspace environment for reads and setup writes. Production workspaces can switch between production and any active non-production environment. Workspaces that have not completed go-live can work in non-production environments until production is available. Create and archive custom environments from Workspace Settings → Environments . Manage environments Every workspace starts with one immutable production environment. Create additional environments for UAT, staging, or QA; each custom environment is non-production and routes to sandbox-provider credentials. Production cannot be created, archived, or deleted. Archiving a custom environment removes it from normal selectors and prevents new work in that environment; historical rows keep their environment id for audit and reporting. API keys are environment-scoped GET , POST , and DELETE /api/v1/api-keys act only on the request's selected environment. Create separate keys for production, UAT, staging, or any other non-production environment you run. An API key whose environment contradicts an explicit X-Throttle-Environment-Id header is rejected outright with 403 environment_mismatch . Fetching a specific resource (an order, a subscription, and so on) by id from another environment answers 404 not_found instead — the lookup is already scoped to your environment, so a resource that belongs to a different one simply doesn't match, the same as an id that doesn't exist at all. Either way, use a key for the correct environment, or select the matching X-Throttle-Environment-Id for dashboard-session setup calls. Payment provider environments Throttle uses the workspace environment to choose the provider environment. Production routes to production processors; non-production environments route to sandbox-provider wiring such as the Card Simulator or sandbox payment processor. Production payment paths require production entitlement. Non-production environments are available for integration work before go-live. Webhook environment routing Outbound webhook endpoints are scoped to a workspace environment. Events carry environmentId in the delivered envelope and are delivered only to endpoints in the same environment. Cheat sheet Use non-production environment keys such as sk_uat_* for development and UAT. Use environmentId to choose dashboard-session setup scope; API keys already carry their environment. Going live makes the immutable production environment usable for production payment paths without changing the structure of your integration code."},{"title":"Bootstrapping Extension Credentials","route":"/developers/extensions/bootstrap","headings":["Bootstrapping Extension Credentials","The handshake, end to end","1. Issue client credentials","2. Where the client secret goes","3. Receive the install callback","4. Pull your credentials — read the secret, mint the key","Read the signing secret","Mint a fresh API key","Rotate a leaked signing secret","Error codes to distinguish in your handler","5. Recover: enumerate your own installs","The three credentials, and why they rotate differently","Next steps","secret API key holding extensions:write — an extension can never mint this","for itself (not on the extension_client allow-list).","→ { data: {","\"clientId\": \"extc_...\",","\"clientSecret\": \"...\", ← shown once, never again","\"installCallbackUrl\": \"https://your-worker.example.com/throttle/install-callback\"","} }","Calling this again ROTATES the pair — the previous secret stops verifying immediately.`;","public identifiers, wrong for the client secret.","The client secret goes in the deploy's secret store instead, never in a file","that gets committed:","(Vercel: vercel env add · Fly: fly secrets set · Render: dashboard env group)`;","you need the secret in order to verify a delivery in the first place.","\"installationId\": \"inst_01HZX...\",","\"installSequence\": 2,","\"endpointId\": \"we_01HZY...\",","\"url\": \"https://your-worker.example.com/webhooks/throttle\",","\"enabledEvents\": [\"order.created\"],","\"signingSecret\": \"whsec_...\",","\"previousSecretExpiresAt\": null","} }`;","keeps the outgoing one verifying for graceSeconds (default 86400 = 24h), so","deliveries in flight do not start failing before you have stored the new one.","\"signingSecret\": \"whsec_...\", ← the new one","\"previousSecretExpiresAt\": \"2026-09-15T10:00:00.000Z\"","replaces. Call this only after a delivery's signature has verified, and only","when you actually need to write back to Throttle."],"text":"Extensions Bootstrapping Extension Credentials Every credential Throttle mints by default belongs to one install and is shown to the installing merchant, once. That works for an iframe extension a human eventually opens, but it leaves a webhook-only extension with no machine route to its own secrets at all — every delivery fails signature verification until someone copy-pastes a secret out of the dashboard. Client credentials close that gap: a developer issues one pair for their catalog extension, and every install after that bootstraps itself. The handshake, end to end Four exchanges, only the first of which involves a person. The thing to hold on to is which way each arrow points and what it carries: Throttle pushes the fact of an install, and your extension pulls the secret — the push is deliberately worthless to anyone who intercepts it. 1. Issue client credentials From your extension's catalog settings in the dashboard, generate a clientId / clientSecret pair. This is a one-time, developer-facing action — it is never shown to a merchant. The route accepts a dashboard user holding the application:extensions:write permission, or a secret ( sk_ ) API key holding the extensions:write scope — but never the extension's own client credentials, which are deliberately not on the allow-list that reaches this route. An extension cannot mint its own credentials. installCallbackUrl must be https:// — a plain http:// URL is rejected with 422 invalid_callback_url . Calling this route again rotates the pair immediately — the previous secret stops verifying the moment the new one is issued. That is deliberate: a developer rotating their own deploy s secret picks up the new value from their own secret store in the same step, unlike the per-install rotations below, which do carry a grace window because a merchant is not redeploying anything. 2. Where the client secret goes A typical extension worker already keeps a wrangler.jsonc (or equivalent) with a vars block for public values like THROTTLE_EXTENSION_ID . That block is committed to git and readable by anyone with repo access — correct for an identifier, wrong for a secret. The client id is fine alongside it; the client secret is not. Put the client secret in your deploy's secret store — wrangler secret put for a Cloudflare Worker, or the equivalent for whatever you deploy to. Nothing about the existing vars block tells you where the line is; this is that line. 3. Receive the install callback Once you have client credentials and an installCallbackUrl on file, every future install of your extension POSTs a signed notice to that URL — the only human action anywhere in this flow is the merchant clicking Install. The payload carries identifiers only, never secrets : it tells you an install happened and who it belongs to, not how to authenticate as it. The request carries an X-Throttle-Install-Token header — an RS256 JWT signed with the same extension JWKS keypair your bridge already verifies session tokens against. aud is your extension id, sub is the installation id. The JSON body repeats the token's claims for convenience, but a receiver must verify the JWT against https://api.usethrottle.dev/.well-known/extension-jwks.json and trust its claims — never the body. A body is just JSON anyone could send; the signature is what makes workspaceId , applicationId , and the rest trustworthy. An install can never fail because your endpoint was unreachable. Throttle attempts the callback 3 times total (two retries) with backoff, then gives up silently — the merchant's install always succeeds regardless. Retries are status-driven, not blanket: any response below 500 ends delivery immediately — a 4xx is treated as a permanent rejection and is never retried. Respond 5xx for a transient failure you want Throttle to retry, and reserve 4xx for a failure that retrying would never fix (a bad or missing token). If the callback never arrives (dropped, never configured, all 3 attempts exhausted, or you lost your own datastore), enumerate your installs instead of waiting for it. 4. Pull your credentials — read the secret, mint the key Every route below authenticates with the same header: Authorization: Basic base64(clientId:clientSecret) . Nothing else accepts that scheme, and a client credential can reach only these three routes plus the enumeration route below — anything else is 403 before the handler runs, and so is the wrong verb on a route it can reach. But the read and the mint are not interchangeable , and treating them as one call is the mistake this section exists to prevent. A client id/secret pair base64-encodes to well over 76 characters, so GNU coreutils base64 (the default on Linux and most CI images) inserts a newline into the header value — BSD/macOS base64 does not, which is exactly why this ships unnoticed from a Mac. The wrapped header fails validation and comes back as 401 unauthorized , which reads as a wrong secret rather than a formatting bug. Pipe through tr -d \\n (portable) or pass base64 -w 0 on GNU systems. Fetching the signing secret is a read — idempotent, and safe to call before you have verified a request, which you must, because you need the secret in order to verify it in the first place. Minting the API key is not a read: it issues a brand-new key and expires the old one. Call it only after a delivery's signature has verified, and only when you actually need to write back to Throttle. Collapsing both into one ensureCredentials() call hands anyone who can guess an installation id a way to churn your keys from outside — the read is harmless to run on unauthenticated input, the mint is not. Read the signing secret Genuinely readable: the secret lives in cleartext on the installation's webhook endpoint row, so re-reading it changes nothing. Call this as soon as you learn an installation id — before you have verified anything with it — because it is what lets you verify. Mint a fresh API key API keys are hashe"},{"title":"Build an Extension","route":"/developers/extensions/build","headings":["Build an Extension","Design for each installation","Choose where code runs","Browser iframe","Publisher backend","1. Create the extension","2. Create and publish a version","3. Install into an application","4. Wire the iframe bridge","Option A — hosted script (no build step)","Option B — npm package","Sandbox flags and the full-width layout","React pattern","Deep links","Runtime model","Next steps","→ { data: { id: \"ext_...\", name: \"Inventory Sidebar\", lifecycle: \"draft\", ... } }`;","→ { data: { id: \"ver_...\", version: \"1.0.0\", status: \"draft\", ... } }","3. Publish the version (marks it installable)","→ { data: { id: \"ver_...\", status: \"published\", ... } }`;","Response (store the API key immediately — shown once. The signing secret can be read back later.):","\"data\": {","\"id\": \"inst_...\",","\"extensionId\": \"ext_xxx\",","\"versionId\": \"ver_xxx\",","\"status\": \"active\",","\"environmentId\": \"8a5f2d1e-3d2a-4d24-93a1-fd3f9e1f37f0\",","\"environmentSlug\": \"uat\",","\"environmentKind\": \"non_production\",","\"providerEnvironment\": \"sandbox\",","\"apiKey\": \"sk_uat_...\", ← store this securely; shown once","}","}`;"],"text":"Extensions Build an Extension This guide walks you from creating an extension catalog entry to having a working iframe panel with authenticated API access and live event delivery. Start with the Get Started tutorial . This page explains architecture and API mechanics after your first private install. Design for each installation Treat every installation as an independent tenant connection. Store a server-side record keyed by installation ID with the workspace, application, environment, pinned extension version, provider account reference, encrypted credential reference, status, last successful sync cursor, timestamps, and uninstall state. Throttle is the authority for whether an installation is active and which version and scopes it has. Your backend is the authority for provider credentials, mapping state, cursors, retries, and reconciliation. Never infer tenant identity from a provider account alone; validate the signed installation context. Stop queued and scheduled work when an installation is suspended or uninstalled. Choose where code runs Browser iframe Use for safe display settings and operator actions. Verify bridge identity and assume users can inspect all browser-delivered data. Publisher backend Use for provider secrets, event processing, scheduled synchronization, reconciliation, and privileged provider calls. 1. Create the extension The extension manifest declares what surfaces your extension exposes, which scopes it needs, and which events it wants to receive. You can declare an iframeUrl , a webhookUrl with eventSubscriptions , or both. Every scope listed must be extensionAllowed — see the Scopes reference . Every scope in the manifest is validated against the extensionAllowed flag when the extension is created or updated. Human and admin scopes ( team_members:* , billing:* , admin:* , * ) are never grantable to extensions and return 400 invalid_scope . 2. Create and publish a version Versions are immutable snapshots of the manifest. Create a version when you're ready to make an installable release, then publish it. A version must be published before it can be referenced in an install call. 3. Install into an application Installs are application-scoped and environment-scoped. The install response contains a one-time API key and, if a webhook URL is declared, the signing secret. Copy the API key immediately — it is shown exactly once. The signing secret is stable and readable at any time, so losing it is recoverable. The apiKey and webhookSigningSecret are unique to each install. Store them in your secrets manager. The API key is shown exactly once — losing it means uninstalling and reinstalling. The signing secret is stable and readable at GET /api/v1/installations/:id/webhook-secret . Copying either value into your extension by hand is deprecated and will be removed in a future release; use automatic setup . 4. Wire the iframe bridge For UI (iframe) extensions, call createBridge() once at page load. The bridge sends a ready message to the dashboard, which responds with a signed session token and context. The token is automatically refreshed before it expires (10-minute TTL). Option A — hosted script (no build step) Option B — npm package Sandbox flags and the full-width layout The dashboard renders your iframe with allow-scripts allow-forms allow-same-origin allow-popups . A version can request more with sandboxFlags , chosen from allow-modals (native confirm() and alert() ) and allow-downloads . Any other value is a validation error on the sandboxFlags field. The flags are part of the version: the merchant sees them in the install wizard next to the scopes, staff see them at review, and the iframe uses the flags of the version the installation is pinned to. An editor-style extension can also ask for the whole viewport. The dashboard hides its side navigation and page padding for that iframe, and restores them when you send default , when the merchant navigates away, or when the iframe loads a new document with the bridge (a reload starts from the default layout, so ask again after bridge.ready ). If your iframe navigates to a page that does not load the bridge, the full layout stays until the merchant navigates away or you ask for default first. The message needs @usethrottle/extension-bridge 1.2.0 or later. A dashboard without this feature ignores the message, so setLayout resolves 'unsupported' after one second. Both additions are optional: nothing changes for an extension that uses neither. React pattern Always pass targetOrigin: 'https://app.usethrottle.dev' to createBridge() . Without it the bridge falls back to document.referrer or '*' as the postMessage target, which can leak the session token to other origins if the referrer is spoofed. The bridge does not pass configSchema or installed config values automatically. The dashboard consumes configSchema to collect settings during install and stores the resulting config on the installation record. See the configuration schema guide for the full lifecycle. Deep links A link to the launch page can open your iframe at a specific page. Add a page query parameter, and the dashboard loads your iframeUrl with that value as its URL fragment, so ?page=/products?x=1 opens <iframeUrl>#/products?x=1 . Read location.hash in your iframe to route. The value must be URL-encoded in the query string. The dashboard accepts it only when it is a string that starts with / , does not start with // , contains no \ , no # and no control characters, and is at most 512 characters. Anything else is ignored and the iframe opens at its configured URL. An existing fragment on your iframeUrl is replaced. The page is applied when the iframe first loads; changing it later does not reload an open session. Runtime model A UI extension is loaded only after it is installed into an application. The dashboard opens the installed version's iframeUrl , creates a bridge host for that iframe origin, and mints "},{"title":"Extension Events","route":"/developers/extensions/events","headings":["Extension Events","Payload envelope","Verify signatures","Rotate the signing secret","Process idempotently","Delivery inspection and replay","You are told when your endpoint stops accepting deliveries","Auto-suspend on repeated failures","Event catalog","→ { \"data\": { \"installationId\": \"…\", \"endpointId\": \"…\",","\"signingSecret\": \"whsec_…\", # shown once","\"previousSecretExpiresAt\": \"2026-09-11T09:15:02.101Z\" } }`;","Replay a dead-lettered delivery","Send a verification ping to the installation's webhook URL.","The ping is signed with the installation's signing secret, like every delivery."],"text":"Extensions Extension Events Extensions can subscribe to Throttle events by declaring a webhookUrl and an eventSubscriptions list in their manifest. Throttle creates a managed webhook endpoint for each install and delivers signed events to your URL with the same retry and dead-letter mechanics as standard webhooks. Use this reference for backend and hybrid applications after your first private install , then validate retries and replays with the testing guide . Payload envelope Every delivery is a JSON POST with a stable top-level envelope. The event-specific payload lives under data . Headers: X-Throttle-Signature , X-Throttle-Event-Id , X-Throttle-Event-Type , Content-Type: application/json . Envelope fields: id (unique event ID), type , version (payload-schema version, currently "1" ), workspaceId , environmentId , environmentKind ( production or non_production ; omitted only when the environment could not be resolved, so treat absent as unknown rather than as production), createdAt , data . Additive fields are not a version bump. Throttle adds envelope fields and data fields without changing version , announced in the changelog but not ahead of the first delivery that carries them. Parse the envelope with a schema that strips unknown keys. A .strict() envelope schema rejects every delivery the moment a field is added, and if your handler reports that with the same 401 as a bad signature, the failure is indistinguishable from a rotated secret. Extension starter versions before PR #11 shipped exactly that schema; update and redeploy. Amounts: all money fields are integer minor units (e.g. cents for USD). Environment isolation: an install only receives events from the same workspace environment. The same event is never delivered across environments. The data shape for every event type is typed in @usethrottle/webhook-types . Import the ThrottleEvent discriminated union or ThrottleEventEnvelope generic and narrow on type to get the exact shape per event. Customer contact fields need customer_pii:read Events that involve a buyer carry a customer object under data : cart.* , order.* , payment.* , fulfillment.* , subscription.* and customer.* , where the customer is the subject of the event. The buyer s contact fields are delivered only to extensions granted customer_pii:read . Without the scope, email , phone , firstName , lastName and name arrive as null . The keys are still present, so the payload shape does not change. What stays: the customer id , externalId , externalCustomerId , company and every address, including the order s shipping address, which a fulfilment extension needs to ship. Which scopes count: the scopes of the version the installation is pinned to. customer_pii:read , or the legacy customers:read , which includes it. To start receiving the fields, publish a version that requests the scope and have merchants upgrade to it. Signatures: the fields are removed before the body is signed, so the signature verifies against exactly the body you receive. Replays follow the same rule. Verify signatures Each delivery includes X-Throttle-Signature in the format t=<unix-seconds>,v1=<hex-hmac-sha256> . The signed payload is <t>.<rawBody> — identical to the standard webhook signature scheme. The signing secret is the per-install webhookSigningSecret returned at install time. Signature verification fails if your framework parses and re-serializes JSON before you verify. Capture the raw request body string first, verify, then parse. verifyWebhook rejects deliveries whose t timestamp is more than 300 seconds (5 minutes) from the current clock. Pass toleranceSeconds to override. For 24 hours after the secret is rotated the header reads t=…,v1=<outgoing>,v1=<new> . Check every v1 against the secret you hold and accept if any matches — @usethrottle/extension-bridge 1.1.1+ and the starter's verifier do. A parser that keeps only the last v1 verifies once it holds the new secret, and not before. Rotate the signing secret Either side can rotate: your extension, authenticated as the installation, or the merchant from the dashboard. The old secret keeps verifying for graceSeconds (default 86400, max 604800) while every delivery is signed with both; 0 revokes it now — the leaked-secret case. When the merchant rotates, you are told: a signed extension.webhook_secret_rotated is delivered to the endpoint — dual-signed, so it verifies with the secret you still hold. It never carries a secret. On receipt, fetch the new one with GET /api/v1/installations/:id/webhook-secret and store it before previousSecretExpiresAt ; that read also reports the deadline while a window is open. Like extension.uninstalled , it is delivered to the installation's own endpoint without a subscription and cannot be listed in eventSubscriptions . previousSecretExpiresAt is null when the old secret was revoked immediately — fetch the new secret at once; deliveries in between will have failed and will be retried. Rotating again inside a window replaces the outgoing secret: only two are ever live. Process idempotently Extension event delivery is at-least-once. Retries use the same backoff schedule as standard webhooks: [5m, 15m, 1h, 6h, 24h] (max five attempts). After the fifth attempt, the delivery is marked dead_letter . Always store each event.id before applying side effects. Delivery inspection and replay Use the installation delivery routes to inspect past attempts and replay dead-lettered events. The delivery list and replay require the extensions:read and extensions:install scopes respectively. The delivery list and replays return payments and saved cards in their public shape , so a stored payload that was projected or cleaned no longer matches its original signature. A replay is signed again over the body it sends. The list shows a payload s customer contact fields only to a caller holding customer_pii:read ; for any other key they read as null . The dashboard pings "},{"title":"Get Started with Extensions","route":"/developers/extensions/get-started","headings":["Get Started with Extensions","Before you begin","Your first private install","You are done when"],"text":"Extensions Get Started with Extensions Build and privately install a third-party app using only Throttle's public dashboard, APIs, packages, and documentation. Before you begin A Throttle workspace and application Developer or Admin access to that application Node.js 20 or newer for the recommended starter A publicly reachable HTTPS URL during iframe or webhook development The list of scopes an extension may request — extensions can only hold scopes marked extensionAllowed , which is a subset of the full API scope catalog. Naming any other scope in your manifest is rejected at publish time. You can create, version, install, and test a private extension in your own workspace. Paid-plan or partner eligibility matters when you submit a public marketplace listing. Your first private install You are done when The iframe displays the verified workspace, application, environment, installation, and user context. The webhook returns 2xx only after verifying the signature against the unmodified raw body. Replaying the same event does not create duplicate provider work. Uninstalling stops scheduled work and removes or disables the installation's provider connection. Next, learn how to design the application , test failure cases , and prepare a marketplace submission ."},{"title":"Extension Identity JWT","route":"/developers/extensions/identity","headings":["Extension Identity JWT","Full claim set","How the dashboard delivers the token","TTL and auto-refresh","Verify tokens in your backend","Using the token as an API bearer","Key rotation","Verifying a shopper's customer token","200, Cache-Control: no-store","{ \"data\": { \"active\": true,","\"customerId\": \"c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f\",","\"emailVerified\": true,","\"expiresAt\": \"2026-10-20T12:15:00.000Z\" } }","# Any token that is not live for this application and environment:","{ \"data\": { \"active\": false, \"customerId\": null, \"emailVerified\": false, \"expiresAt\": null } }`;"],"text":"Extensions Extension Identity JWT When the dashboard opens an extension's iframe, it mints a short-lived RS256-signed JWT that identifies the installation, the acting user, and the current workspace and application context. The iframe receives this token through the bridge handshake and uses it as a bearer on every API call. Use this reference after completing the Get Started tutorial . Identity establishes who launched the iframe; scopes establish what it may do. Full claim set The JWT carries both standard claims ( iss , sub , aud , iat , exp ) and the full ExtensionSessionClaims object as top-level custom claims. The claim set is additive: Throttle adds claims without a version bump and without notice, and never removes or retypes one without a changelog entry. Parse the claims you use and ignore the rest. A strict parser that rejects unknown top-level claims will take every one of your panels dark the moment a claim is added, on our deploy, with no change on your side. iss is always "throttle" . Reject tokens with any other issuer. sub is the installationId . aud is the extensionId . environment reflects the install's workspace environment and matches the API key environment. role is the acting user's application-level role ( admin | developer | finance | viewer ). scopes are the scopes from the pinned version — a ceiling on what the token may do. user.name is currently set to the same value as user.email (workspace members do not have a separate display name column today). How the dashboard delivers the token The dashboard creates a BridgeHost (from @usethrottle/extension-bridge ) that wraps the iframe. When the iframe loads and calls createBridge() , the bridge immediately posts a ready message to the parent. The dashboard calls POST /api/v1/installations/:id/launch-token and replies with a session message carrying token , expiresAt , and a context object. The iframe bridge resolves bridge.ready with that context. POST /api/v1/installations/:id/launch-token is Clerk-JWT only — it requires an authenticated dashboard session. API keys cannot mint launch tokens because tokens embed a human user identity. Attempts with an API key return 400 launch_token_requires_dashboard_session . TTL and auto-refresh Tokens have a 10-minute TTL . The bridge tracks the expiry time and proactively sends a refresh message to the host when the token is within 60 seconds of expiry, or immediately on receiving a 401 from the API. The host mints a fresh token and sends a new session message. All pending and in-flight bridge.api.* calls wait for the refresh before proceeding. Verify tokens in your backend If your extension calls your own backend, pass the bridge token in the Authorization: Bearer header and verify it against the public JWKS. The JWKS endpoint is unauthenticated — no key needed. Always return null / reject on any verification failure — expired tokens, unknown key ID, wrong issuer, bad signature. Never attempt to use a partially-validated payload. The Throttle SDK's verifyExtensionSessionToken follows this contract: it returns null on any error and never throws. Using the token as an API bearer The extension-session JWT is also accepted by the Throttle API as a Bearer token on /api/v1/* routes. The token's scopes claim is used as the caller's granted scope set, exactly as with an API key. This means the iframe can call the API directly without the extension's dedicated API key being present in the browser. The token's scopes are the pinned version's scopes, which are themselves a subset of the extensionAllowed scopes. Calling a route that requires a scope not in the token's list returns 403 insufficient_scopes . Key rotation The JWKS endpoint may publish multiple keys (identified by their kid header). Your verification library (e.g. jose 's createRemoteJWKSet ) automatically selects the right key by kid and caches the JWKS response. Key rotation adds new key(s) to the set before retiring old ones — in-flight tokens remain valid through their TTL, and the JWKS cache handles the transition. Create your createRemoteJWKSet instance once at module initialization and reuse it. The jose library caches the JWKS and re-fetches on unknown kid . Recreating it per-request makes an unnecessary HTTP call on every token verification. See also: Security model for the full threat model around JWT issuance and iframe isolation. Verifying a shopper's customer token The JWT above identifies a dashboard user. A shopper signed in to a storefront holds a different credential: the accessToken from storefront customer accounts . When your extension's backend receives one (for example to show a signed-in shopper their own prices), ask Throttle whether it is live and whose it is. Never trust a customer id the browser sends on its own. Scope. Call it with your installation's secret API key holding customer_tokens:read ; list that scope in your extension's scopes . customers:read does not grant it, and you do not need it: introspection is its own narrow scope so an app that only checks sign-ins never holds customer PII, addresses or stored cards. Publishable pk_ keys cannot hold it ( 403 ). Answer. active: true only for a live access token of the calling key's own workspace, application and environment. Then customerId is the shopper, emailVerified is read from their account now (not from the token), and expiresAt is when the token expires. Inactive. An invalid, expired or revoked token, a signed-out session, or a token of another application or environment all get the same answer, { active: false, customerId: null, emailVerified: false, expiresAt: null } , so the answer tells you nothing more about the token. Treat the shopper as signed out. No caching by Throttle. Responses carry Cache-Control: no-store . Rate limit. The route has its own budget, 600 calls a minute per API key and environment, separate from the rest of yo"},{"title":"Installing Extensions","route":"/developers/extensions/install","headings":["Installing Extensions","Install an extension","Read your signing secret","Scope and event consent","Configuration","Configuration schema","Environment-scoped installs","List and inspect installs","Uninstall","Both the dashboard session token (Clerk JWT) and the Application ID header","are required — installs are application-scoped.","─── Response (apiKey is shown once — store it immediately) ──────────────────","Authenticate with the installation's own API key.","─── Response ─────────────────────────────────────────────────────────","The extension catalog entry and other applications' installs are unaffected.","→ 204 No Content`;","→ { data: { id: \"inst_xxx\", config: { ... }, ... } }`;","Response shape: paginated list","\"data\": [ { \"id\": \"inst_...\", \"extensionId\": \"ext_...\", \"status\": \"active\", ... } ],","\"meta\": { \"requestId\": \"...\", \"pagination\": { \"cursor\": null, \"hasMore\": false } }","One installation by id, scoped the same way. 404 not_found when this","application + environment has no installation with that id."],"text":"Extensions Installing Extensions An install pins a specific published version of an extension to an application, mints a dedicated API key (and optionally a webhook signing secret), and begins event delivery if a webhookUrl was declared. Install an extension Pass the versionId of the published version you want to install, or omit it to install the default version. For another workspace's public extension only the approved version may be named; see Versioning . Optionally pass config — a free-form JSON object that your extension reads at runtime. The install's environment is derived from the caller's API key or dashboard-selected X-Throttle-Environment-Id and cannot be overridden by the request body. apiKey is shown exactly once in the install response. If you lose it, the only recovery is to uninstall and reinstall — a new key is minted. The webhookSigningSecret is different: it is returned once on first install, but it is stable and your extension can read it back at any time (see below), so losing it is recoverable without a reinstall. Having a merchant copy the API key and signing secret out of the install wizard and paste them into your extension is manual setup. It still works, but it is deprecated and will be removed in a future release. Use automatic setup instead: your extension fetches both itself when it is installed. Read your signing secret Your extension can fetch the signing secret for its own installation, so it never has to depend on a human copying the value out of the dashboard at install time: Authenticate with the installation's own API key (or its extension session token, which reads the secret only while the installation is active — once a merchant suspends or uninstalls it, a session minted moments earlier gets 404 for the rest of its ten minutes). A dashboard user holding application:extensions:install can also read it, for a suspended or uninstalled installation too. Any other credential gets a 404 . The route needs no particular scope — the credential itself is the authorisation. Do not attach this response to an error. The natural failure handler — wrap the fetch error with the response body — puts a live signing secret into every error log you keep. Raise an error that carries the HTTP status and nothing else, and read the secret only on the success path. Uninstalling and reinstalling reuses the same installation row, and deliberately keeps the signing secret so verification does not silently start failing. Use installSequence — which increments on every (re)install while id stays put — to tell a reinstall from a restart, and to know when to discard credentials you cached against the install. Scope and event consent When you install an extension, you implicitly consent to its declared scopes and event subscriptions. The installer must hold the extensions:install scope (API key) or the application:extensions:install RBAC permission (dashboard user). The issued API key is scoped exactly to the version's declared scopes. If the extension later publishes a new version with additional scopes , upgrading to that version requires re-consent. The upgrade endpoint returns 409 new_scopes_require_consent listing the new scopes, and the caller must retry with acknowledgedNewScopes: true . See the Versioning guide . Configuration The config field is a free-form JSON object passed at install time and updateable any time thereafter. Use it for extension-specific settings such as API keys for third-party services, feature flags, or integration identifiers. Your extension reads it from the installation record; it is not embedded in the iframe URL or automatically included in the bridge session. Do not place ShipStation keys or other provider secrets in installation config when an iframe can read that config. Collect credentials through an authenticated setup flow, encrypt them in publisher-controlled storage, and retain only a non-secret connection status or provider account label in display configuration. bridge.ready resolves with user, workspace, application, environment, installation id, version, role, and scopes. It intentionally does not include config or configSchema . If a browser iframe needs config, give the extension an explicit read scope and fetch the installation record. Keep secrets that should never reach browser JavaScript on your extension backend instead. Do not store the webhookSigningSecret in config — the config object may be readable by anyone with extensions:read scope. Store the signing secret in your own secrets manager. Configuration schema Extension authors can publish a configSchema to describe the settings an installer should provide. The dashboard authoring flow includes a field builder for simple string, number, and boolean settings plus an advanced JSON editor for custom JSON Schema. During install and on the management page, Throttle uses this schema to render the configuration form. Empty schemas are treated as “no configurable options.” The builder emits a JSON Schema object with type: "object" , properties , and optional required . Use the advanced JSON mode for nested objects, arrays, enums, or provider-specific validation. configSchema lives on the workspace catalog extension while you are editing it. Creating a version snapshots that schema into the immutable version record. Installs use the pinned version's schema to collect per-install config values. Publishing a new schema does not rewrite existing installs until they upgrade to a version that carries it. Environment-scoped installs Installs are per environment. A UAT install receives only UAT events and gets an API key for that environment; a production install receives only production events and gets a production-environment API key. The installs are completely independent — each has its own config, its own API key, and its own event delivery endpoint. List and inspect installs Install status values: active , suspended . Suspended installs sto"},{"title":"Line Resolvers","route":"/developers/extensions/line-resolvers","headings":["Line Resolvers","What a line resolver is","Which installation is called","The request","Verify the signature","Test vector","The answer","Refusal codes and what the buyer gets","Timeouts, retries and fail closed","What Throttle stores","Shipping measures","Sign-in merges","Checkout","The completion guard","Shipping on resolved carts","Error reference","Related","Remove the resolver from the draft later (allowed only with PATCH):"],"text":"Extensions Line Resolvers A line resolver lets an installed extension own cart lines. Throttle never takes a price from the browser for a line your extension owns: it asks your resolver for the name, price, stock and limits on every add, quantity change, sign-in merge and checkout. What a line resolver is Your extension declares an HTTPS endpoint, lineResolverUrl . A storefront (or a merchant server) creates a cart with lineResolver: { extensionId } , which makes it a resolved cart . Lines added to it by referenceId are owned by your installation, and Throttle calls your resolver to price them. Opt in, per cart. Only a cart created with lineResolver is resolved. Every other cart behaves exactly as before: same status codes, same error envelopes, same response bodies, same webhooks. The one exception is an environment that turns on resolved lines only : there, unresolved cart-session carts are locked too. One owner per line. Each owned line records the installation that priced it, so a cart can hold lines from two resolvers after a sign-in merge, and each line is re-priced by its own resolver. Fail closed. If your resolver cannot answer, the operation is refused and nothing on the cart changes. Throttle never falls back to a browser price. Shoppers create resolved carts through cart sessions ; servers through the Cart API . This page is the contract for the resolver itself. Declare a resolver: lineResolverUrl lineResolverUrl is a manifest field on the extension, accepted by POST /api/v1/extensions and PATCH /api/v1/extensions/:id . A version snapshots it like any other manifest field, and an installation uses the URL of the version it is pinned to. https: URL on the default port (443). An explicit :443 is fine; any other port is not. , html: 400 validation_error : lineResolverUrl must be an https URL on the default port (443) . ], [ A DNS host name: no IP address (IPv4 or IPv6, in any notation), no localhost or *.localhost, no trailing dot. , html: Same 400 validation_error . ], [ No user name or password in the URL. , html: Same 400 validation_error . ], [ html: Requires webhookUrl and at least one entry in eventSubscriptions . Resolver calls are signed with the managed webhook endpoint's signing secret, which only exists for an extension that receives events. , html: 422 line_resolver_requires_webhook . The check runs on the stored extension merged with the PATCH, so a PATCH cannot drop the webhook side and strand a resolver. ], [ html: PATCH with lineResolverUrl : null removes the resolver. After that, eventSubscriptions: [] is allowed again. , — ], ] /> Domain-verified at review. Marketplace review checks the resolver URL's registrable domain against your workspace's verified domains, exactly as it does for iframeUrl and webhookUrl ( domain_not_verified otherwise). A new domain forces review. A version whose resolver domain differs from the approved one is flagged changed_line_resolver_domain and needs review again. Adding a resolver to an approved extension is a domain change too. See Publishing . Signing secret. The resolver is signed with the same secret your installation receives for webhooks. Rotate it with the webhook secret rotation ; resolver calls follow the same grace window. Throttle reads the signing secret from the managed webhook endpoint linked to the installation. An older installation whose managed endpoint does not carry that link is treated as having no secret: creating a resolved cart answers 422 line_resolver_not_available and an existing resolved cart answers 503 line_resolver_unavailable , both with reason: no_signing_secret . It is never called unsigned. Which installation is called lineResolver.extensionId on cart creation names your extension. Throttle maps it to that extension's installation in the cart's application and environment, and stores the installation on the cart. Creation is refused with 422 line_resolver_not_available and details.reason : A resolved cart's currency must be the environment's currency or one of the merchant's extra cart currencies (case-insensitive), or creation answers 422 currency_not_enabled with details: { currency, enabledCurrencies } , where enabledCurrencies lists the environment's currency and the extra ones. Your resolver is asked for prices in the cart's currency, so it may be called in any of them. On a cart in an extra currency a fixed_amount discount is refused with 422 discount_currency_unsupported , and a non-zero shipping rate from a shipping configuration in another currency with 422 shipping_currency_unsupported , so such a cart checks out with no shipping or a zero-rate method. A cart never changes currency: to sell in another one, start a new resolved cart. If the installation later goes away, is suspended, or loses its URL or secret, calls on its existing carts fail closed with 503 line_resolver_unavailable and the same details.reason . The request Throttle sends one POST per resolver per operation, with a JSON body of type cart.lines.resolve . cart.lines.resolve . ], [ code: id , A UUID for this request. The checkout retry sends the same body, so the same id. ], [ code: installationId , Your installation. Use it to find the merchant catalog to price from. ], [ code: applicationId / environmentId , The cart s application and workspace environment. ], [ code: cartId , The Throttle cart. On a create it is the id the new cart will get. ], [ code: intent , html: Why Throttle is asking: add , update , refresh or checkout (below). ], [ code: currency , The cart currency. Every ok line must answer in it. ], [ code: customerId , The signed-in customer of the cart, or null for a guest cart. ], [ code: customerEmailVerified , True when a live verified credential exists for that customer in this application and environment. It does not prove who attached the customer; see identityQualified below. ], [ code: customerGroup , html: Only sent when your pinn"},{"title":"Operating Your Extension","route":"/developers/extensions/operations","headings":["Operating Your Extension","Responsibility boundary","Throttle operates","The publisher operates","Baseline telemetry","Incident and lifecycle procedures"],"text":"Extensions Operating Your Extension Marketplace publication starts an operational commitment: monitor the integration, support installations, and release compatible upgrades. Responsibility boundary Throttle operates Catalog, versions, installations, and review systems Scoped extension credentials and identity tokens Signed event delivery and delivery logs Marketplace availability and platform status The publisher operates Application hosting, queues, and persistence Third-party credentials and provider API use Mapping, reconciliation, monitoring, and alerting Customer support, privacy obligations, and incident response Baseline telemetry Record the Throttle request ID, installation ID, event ID and type, extension version, provider account reference, attempt number, duration, result class, and environment. Use structured logs so one installation can be traced without searching payload contents. Do not log API keys, webhook signing secrets, access tokens, authorization headers, or customer-sensitive request bodies. Redact provider responses before attaching them to support cases. Incident and lifecycle procedures Back off and reconcile after provider outages or rate limiting. Surface expired credentials as an actionable installation state. Quarantine poison events and provide a replay procedure. Pause new installs or move the listing private during a material incident. Keep upgrades backward compatible; document and review new scopes. Publish deprecation notice and data export/deletion instructions before retirement. On uninstall, revoke provider access and stop scheduled or queued work safely. To show merchants what your extension did to a record (a sync, a label, a message sent), post a history entry with activity:write instead of an internal note. Use the Versioning guide for releases and the marketplace guide for listing changes or re-review."},{"title":"Extensions Overview","route":"/developers/extensions/overview","headings":["Extensions Overview","Choose your extension shape","Backend integration","Embedded application","Hybrid application","What Throttle provides—and what you provide","Throttle","Publisher","Two-level model: catalog vs installs","Catalog (workspace-level)","Installs (application-level)","Surfaces","UI iframe","Event webhooks","Lifecycle: draft → private → public","Versioning and pinned installs","Environment isolation"],"text":"Extensions Extensions Overview Extensions let you embed custom UI panels, receive live event webhooks, or do both — all from inside the Throttle dashboard and API surface, with an authenticated identity token, scoped API access, and signed event delivery. Choose your extension shape Backend integration Subscribe to events and process them on your server. Use this for connectors, synchronization, and work that must continue when nobody has the dashboard open. Embedded application Render an iframe and use the bridge for verified identity and scoped API access. Use this for configuration, reports, and operator workflows. Hybrid application Combine a background event processor with an embedded management UI. Most full-service provider connectors eventually use this model. A ShipStation-style connector should synchronize orders, fulfillment, tracking, cancellations, and returns on its backend. An iframe can configure and monitor the connector, but synchronization cannot depend on the iframe being open. What Throttle provides—and what you provide Throttle Catalog, version, installation, and marketplace workflows Scoped credentials and signed iframe identity Signed event delivery and installation configuration forms Publisher Hosting, persistence, queues, retries, and monitoring Third-party credentials and provider-specific behavior Support, privacy terms, incident response, and data lifecycle External developers use public APIs, packages, the dashboard, and these docs. You do not need access to Throttle's private repository. Build your first private install . Two-level model: catalog vs installs Extensions live at two levels. The catalog is workspace-scoped: one extension definition per workspace, with a name, surfaces (iframe URL and/or webhook URL + events), and a list of requested scopes. An extension can be authored by your workspace and used only internally, or promoted to public for any Throttle workspace to install. Installs are per-application. When a dashboard user installs an extension into an application, a single-use API key and (if a webhook URL is declared) a per-install signing secret are issued. Both are shown exactly once at install time; an extension should fetch its own with automatic setup , because having the merchant paste them in is deprecated. Multiple applications in the same workspace can each have their own independent installation of the same extension, with separate API keys, signing secrets, and configuration values. Catalog browsing supports cursor pagination and search. Use q to search extension name, slug, author, and description, and installable=true to return only private/public extensions with a published version before pagination is applied. Catalog (workspace-level) POST /api/v1/extensions — create GET /api/v1/extensions — list PATCH /api/v1/extensions/:id — update manifest POST /api/v1/extensions/:id/versions — create version POST /api/v1/extensions/:id/versions/:vid/publish — publish POST /api/v1/extensions/:id/lifecycle — promote/demote Installs (application-level) POST /api/v1/extensions/:id/install — install (pinned to a version) GET /api/v1/installations — list for this app POST /api/v1/installations/:id/upgrade — upgrade to new version PATCH /api/v1/installations/:id/config — update config POST /api/v1/extensions/:id/uninstall — uninstall Surfaces An extension manifest declares one or both surfaces. You can mix them freely. UI iframe Declare an iframeUrl in the manifest. The dashboard renders a sandboxed <iframe> at that URL when the extension panel is open. Your page calls createBridge() from @usethrottle/extension-bridge (or the hosted script tag) to handshake with the dashboard, obtain a signed identity token, and make authenticated API calls. See the Build guide and the Identity JWT reference . Event webhooks Declare a webhookUrl plus the list of eventSubscriptions your extension wants to receive. Throttle creates a managed webhook endpoint for the install and delivers signed events to that URL automatically. The per-install webhookSigningSecret is returned in the install response, and — unlike the API key — it is not lost if you miss it: GET /api/v1/installations/:id/webhook-secret reads the current value back at any time. See the Events reference . An extension can declare both iframeUrl and webhookUrl . The iframe bridge and the webhook delivery pipeline are independent — the bridge token gives the iframe REST access, while the webhook pipeline delivers async events to your server. Use both when you need a live UI panel and background event processing. Lifecycle: draft → private → public Every extension starts as draft . You iterate freely — create versions, update the manifest — before promoting it. draft — visible only within your workspace; can only be installed by your own workspace's applications; no published version required. private — still workspace-private but signifies the extension is production-ready. Installs within your workspace are in this state during internal testing. public — listed in the global marketplace; any Throttle workspace can install it. Requires the application:extensions:admin permission. Throttle must enable the public marketplace for your workspace. Versioning and pinned installs Installs are always pinned to a specific published version. Publishing a new version does not automatically upgrade existing installs — each install retains the version it was pinned to until explicitly upgraded via POST /api/v1/installations/:id/upgrade . If the new version declares additional scopes, the installer must acknowledge them; Throttle returns 409 new_scopes_require_consent listing the delta. See the Versioning guide . Environment isolation Installs carry the workspace environmentId selected by the installing caller. A UAT install issues a UAT API key and receives only UAT events; a production install issues a production API key and receives only production events. The catalog itself (the extension definit"},{"title":"Publishing to the Marketplace","route":"/developers/extensions/publishing","headings":["Publishing to the Marketplace","Before you submit","Eligibility","Paid plan or partner status","Publisher Agreement accepted","Listing requirements","Review lifecycle","What “Approved” unlocks","Future versions and re-review","Auto-publish (no re-review)","Requires re-review","Launch and rollback","Webhook events","Related guides","Requires: an accepted Publisher Agreement + a completed Listing.","Response:","\"data\": {","\"id\": \"rev_01HZX...\",","\"extensionId\": \"ext_xxx\",","\"status\": \"pending\",","\"versionId\": \"ver_xxx\",","\"createdAt\": \"2026-06-06T10:00:00.000Z\"","}","}`;","(a dashboard session works too). Field name is \"file\"; the response carries the","public URL to put on the extension / listing.","→ { \"iconUrl\": \"https://.../extensions/icons/01J....png\", \"key\": \"...\" }","→ { \"screenshotUrl\": \"https://.../extensions/screenshots/01J....png\", \"key\": \"...\" }","Then reference them: iconUrl on PATCH /api/v1/extensions/:id, and the","screenshot URLs in the listing's \"screenshots\" array on PUT /api/v1/extensions/:id/listing.`;","→ { data: { id: \"ext_xxx\", lifecycle: \"public\", ... } }`;"],"text":"Extensions Publishing to the Marketplace The Throttle marketplace lets any workspace discover and install your extension. Getting there requires meeting eligibility requirements, completing a listing, and passing a staff review. You control when the extension goes live after approval. Before you submit Confirm workspace eligibility and accept the Publisher Agreement. Publish the exact version you tested and document its functionality and upgrade behavior. Complete the listing, support contact, privacy policy, and terms of service. Demonstrate why every requested scope and event subscription is necessary. Complete the testing preflight and security review . Name an operational owner who will monitor errors and respond to customer and Throttle review messages. Review status and feedback are visible in the dashboard. Throttle does not promise a review turnaround in this guide; plan your launch around approval rather than a speculative date. Eligibility Your workspace must meet both of the following conditions before you can submit an extension for review: Paid plan or partner status Your workspace must be on an active paid Throttle plan, or have partner status granted by Throttle. Sandbox (trial) workspaces cannot submit extensions for public marketplace review. If you are on a trial and want to publish, upgrade your workspace first or apply for the partner program . Publisher Agreement accepted A workspace owner or admin must accept the Throttle Publisher Agreement in the dashboard under Extensions → Catalog → [your extension] → Review → Publisher Agreement . Acceptance is recorded once per workspace and covers all extensions you publish. The Submit button is disabled until acceptance is on record. Approval records that a specific version passed review; it does not list you. A workspace admin still has to set the extension's lifecycle to public , and that is only permitted while the approved version is still the one you are serving. Publishing any change afterwards moves you off the approved version and requires a new review before you can go public again. Listing requirements Before submitting for review you must complete your extension's public listing. The preflight check validates all of the following fields. Missing or invalid fields are returned as an array of specific errors with a 422 response. Public name — a human-readable display name for the marketplace listing, separate from the internal extension slug. Tagline — a single sentence (≤ 80 characters) that describes what the extension does. Category — one of the marketplace taxonomy categories (e.g. analytics , fulfillment , finance ). Displayed as a filter on the browse page. Icon — a square PNG, JPEG, WebP or SVG (≤ 2 MB) uploaded via POST /api/v1/extensions/icon-upload . Stored as a public object and referenced by its public URL. At least one screenshot — a minimum of one screenshot or promotional image (PNG, JPEG or WebP, ≤ 5 MB, 1280 × 800 recommended) uploaded via POST /api/v1/extensions/screenshot-upload . Used in the detail page carousel. Support URL — an HTTPS URL to a support page or ticketing system. Privacy policy URL — an HTTPS URL to your privacy policy. Required by the Publisher Agreement. Terms of service URL — an HTTPS URL to your extension's terms of service. The preflight check rejects any support, privacy, or terms URL that does not begin with https:// . Plain HTTP URLs are not accepted. Both image uploads are multipart/form-data and accept a secret API key with extensions:write as well as a dashboard session, so a release script can complete the whole listing without the dashboard. Review lifecycle Submitting for review kicks off an automated preflight followed by a manual staff review. The full state machine is: Submit — call POST /api/v1/extensions/:id/reviews (or use the dashboard Review tab). Throttle runs automated preflight checks (listing completeness, eligibility, scope diff against the previous approved version) and creates a review with status pending . A confirmation notification and email are sent to workspace members with the extensions:write scope. In review — a Throttle staff member claims the review. The review moves to in_review . Staff can see the automated check results and the scope delta relative to the previously approved version. Decision — staff selects one of three outcomes: Approved — the extension passes review. The developer receives a notification and email and can now publish the extension. Changes requested — staff adds feedback in a threaded conversation. The developer receives a notification with the feedback, addresses the issues, and resubmits. Rejected — the extension will not be published to the public marketplace. Staff includes a reason. The developer may fix the underlying issues and submit a new version for review. The review has a comment thread. Staff can add comments at any point during the review and the developer receives notifications for each message. Use the dashboard Review tab or POST /api/v1/extensions/:id/reviews/:rid/comments to reply. What “Approved” unlocks An approved review does not automatically make your extension public. Approval unlocks the Publish to marketplace button in the dashboard Lifecycle tab and the POST /api/v1/extensions/:id/lifecycle endpoint with lifecycle: "public" . You choose when to go live. Once public , the extension appears in GET /api/v1/extensions?installable=true and is browsable in the marketplace at /w/:ws/a/:app/marketplace . You can revert to private at any time via the lifecycle endpoint. Existing installs are not affected by a lifecycle change. Setting the lifecycle to private automatically publishes a version snapshotting the current configuration when no published version matches it, so a private extension is always immediately installable. Installing an extension that somehow has no published version fails with 409 no_published_version . Throttle retains the ability to revert a pu"},{"title":"Extension Scopes","route":"/developers/extensions/scopes","headings":["Extension Scopes","How scopes flow","Scope implication rules","Management scopes for extensions","Management scope summary","Team RBAC for extension management","Extension-allowed scope catalog","{group}","Name a page of known customers: up to 50 ids, comma-separated","200, Cache-Control: no-store","{ \"data\": [ { \"id\": \"c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f\",","\"name\": \"Jane Doe\",","\"email\": \"jane@example.com\" } ],","\"nextCursor\": null }`;","{ \"data\": { \"installed\": true, \"version\": \"1.4.0\" } }","Not installed here: { \"data\": { \"installed\": false, \"version\": null } }`;"],"text":"Extensions Extension Scopes Extensions operate within a strict scope ceiling. Only scopes marked extensionAllowed may appear in an extension manifest. Human, admin, and management scopes are never grantable to extensions. Choose the smallest scope set that supports demonstrated behavior. Once selected, continue to installation and configuration . How scopes flow Scopes are declared in the extension manifest, snapshotted into a published version, and issued to an install. At each stage Throttle enforces the extensionAllowed ceiling: Manifest declaration. You list the scopes your extension needs in POST /api/v1/extensions or PATCH /api/v1/extensions/:id . validateScopesForExtension runs immediately — any scope with extensionAllowed: false (or an unknown scope) returns 400 invalid_scope . Version snapshot. When you publish a version, the manifest scopes are frozen into the version record. Subsequent manifest edits do not change the published version. Install. POST /api/v1/extensions/:id/install pins the install to a version. The install's API key is granted exactly the version's scopes — no more, no less. Iframe JWT. The launch-token endpoint mints a JWT whose scopes claim is the pinned version's scope list. Every bridge.api.* call is authorized against those scopes. Scope implication rules The same implication rules that apply to API keys apply to extension scopes: * covers all scopes — but * is never extensionAllowed and cannot appear in an extension manifest. resource:write implies resource:read on the same resource . For example, orders:write covers orders:read . Read never implies write. orders:read does NOT grant orders:write . No cross-resource implication. orders:read does not grant customers:read . The buyer s email, name and phone in event payloads need customer_pii:read . Without it they arrive as null ; addresses are still delivered. See customer contact fields . Finding customers: customer_directory:read An extension that shows or picks customers (for example a customer-group member list) needs their names, not their records. customer_directory:read answers only id , name and email , without customers:read and the PII, addresses and stored cards it carries. Scope. List customer_directory:read in your extension's scopes and call with the installation's secret key. The merchant sees it at install as "Find customers by name or email", among the other requested scopes. It is sensitive , so no OAuth connection can hold it. No other scope grants it except full access ( * ), customers:read included; a key without it gets 403 insufficient_scopes . Parameters. Send exactly one of q or ids . q is 2–100 characters, matched as a case-insensitive prefix of the full name, the last name or the email, and answers up to limit customers (1–20, default 10) ordered by email. ids is up to 50 comma-separated customer ids; every id found is answered, in the order given, and an integer limit is ignored. Unknown ids are skipped. A search never lists an erased (anonymized) customer; ids still names one, with name: null . Anything else is 400 validation_error . Answer. Only customers of the calling key's own workspace, application and environment. name is the first and last name joined by a space, or null when there is neither. nextCursor is always null : the directory answers one page. Responses carry Cache-Control: no-store ; do not store the answer either. Rate limit. Its own budget, 300 calls a minute per API key (per installation for calls from your iframe session) and environment. Over it you get 429 rate_limit_exceeded . Checking another extension: extension_presence:read An extension that adds features when a companion extension is present (for example a page builder that shows catalog widgets only when the Product Catalog is installed) asks one narrow question: is extension X installed here? Scope. List extension_presence:read in your extension's scopes and call with the installation's secret key. It is not sensitive and is never allowed on a publishable key; a key without it gets 403 insufficient_scopes . Parameter. extensionId is required and must be an extension id (a uuid). Anything else is 400 validation_error . Answer. Only for the calling key's own workspace, application and environment. installed is true only for an active installation (suspended and uninstalled answer false). version is the pinned version label, or null when not installed. Nothing else is exposed: no installation id, configuration, scopes or other extensions. Responses carry Cache-Control: no-store ; cache the answer yourself for a few minutes if you ask often. Management scopes for extensions The management scopes ( extensions:read , extensions:write , extensions:install ) control who can author and install extensions. These are Taxonomy B (human) scopes — they are not extensionAllowed . Extensions cannot manage other extensions. Management scope summary extensions:read — view the extension catalog and installation list. Required for GET /api/v1/extensions , GET /api/v1/extensions/:id , GET /api/v1/extensions/:id/versions , GET /api/v1/installations , GET /api/v1/installations/:id/deliveries . extensions:write — author, version, and publish extensions. Required for POST /api/v1/extensions , PATCH /api/v1/extensions/:id , POST /api/v1/extensions/:id/versions , POST /api/v1/extensions/:id/versions/:vid/publish , POST /api/v1/extensions/:id/lifecycle (draft/private). extensions:install — install, configure, and manage installs. Required for POST /api/v1/extensions/:id/install , POST /api/v1/extensions/:id/uninstall , PATCH /api/v1/installations/:id/config , POST /api/v1/installations/:id/upgrade , POST /api/v1/installations/:id/launch-token , POST /api/v1/installations/:id/deliveries/:deliveryId/replay , POST /api/v1/installations/:id/test . The extensions:install scope is a custom action — it is independent of extensions:write and extensions:read . Granting only exte"},{"title":"Scripts an Extension Ships","route":"/developers/extensions/scripts","headings":["Scripts an Extension Ships","The two tiers","Declaring a script","Shipping an update","Writing the script","Settings — one script, different merchants","Buyer data","Loading a vendor library","Cookies and storage","Review","Install lifecycle — when your scripts start and stop","Limits","then attach source to it."],"text":"Extensions Scripts an Extension Ships An extension can ship JavaScript that runs on the merchant's buyer-facing pages — hosted checkout, quote pages, and the merchant's own storefront. This is how a pixel, an analytics relay, a fraud signal or an announcement bar reaches real buyers without the merchant pasting code into a theme. Read this after your first private install . For the merchant's view of the same feature — and for a merchant writing their own script rather than installing an app — see Your Own Scripts . The two tiers Pick the tier when you declare the script. It decides where the code can run and how hard it is to get approved. sandbox — runs inside a null-origin sandboxed iframe with no access to the host page, its cookies or its storage. Allowed on every surface, including checkout. This is the default and what almost every app should use. dom — runs directly on the merchant's storefront page with full access to it. Restricted to the storefront surface, refused on checkout by the API, the manifest schema and a database constraint, and it requires a staff review of the source for every change. DOM-tier code is unsandboxed third-party JavaScript on every installed merchant's storefront. Nothing contains it, so it never auto-approves — a human reads the source. Use sandbox unless you genuinely need the page, and expect longer review turnaround when you do not. Declaring a script A script has two halves: a declaration , one per (extension, key) , carrying what the script is allowed to do; and source , which is per extension version. Source is attached to a draft version and frozen when you publish it. key — a stable lowercase handle. It identifies the script forever; merchants see it in their script inventory. surfaces — any of storefront , checkout , quote . consentCategory — essential , functional , analytics or marketing . The script does not mount at all until the buyer has granted that category. protectedData — none or hashed . See Buyer data . externalDomains — hostnames the script may reach. Enforced as a Content Security Policy, which matches hosts exactly : google-analytics.com does not cover www.google-analytics.com . One leading wildcard label is allowed — *.klaviyo.com — for a vendor SDK whose host set is the vendor's to change; it covers every subdomain and not the bare domain. A request the CSP refuses is reported as a blocked outcome with reason: csp , so it is diagnosable from the merchant's script health view. The list is frozen once a version containing the script is published. Shipping an update Pushing a key that already exists replaces its source on the target draft version — that is how you ship a new build. The response is 201 for a key that was new and 200 when an existing one was replaced. Capabilities freeze once the script has shipped. After any version containing the script is published, a push that changes tier , surfaces , consentCategory , protectedData or externalDomains is refused with 409 script_published_capabilities_frozen . Those fields live on the declaration and take effect immediately on every install already pinned to an approved version, so changing one would bypass review. Ship the new behaviour under a new key. Source-only pushes are always fine while the target version is a draft. Bug fixes do not need a new key. A published version is frozen. Attaching to one returns 409 extension_version_published — a sha256 in a merchant's inventory has to be the sha256 that actually ran. A new version inherits the previous version's scripts. Creating a version copies every non-deleted script forward byte-for-byte, so a version that changes nothing keeps shipping what you already shipped. Push only what changed. Deleting the declaration is how you stop shipping a script. A version that adds a script key the merchant does not already run requires them to re-consent, with acknowledgedNewScripts on the upgrade call. A version that drops one does not re-prompt: the merchant ends up running less, which needs no permission. Writing the script A sandbox-tier script runs inside a null-origin iframe. Four bindings exist at the top level: register , analytics , browser and settings . document , window , parent , top , opener , localStorage and sessionStorage are undefined . api.browser at the top level of your file throws api is not defined , and the merchant sees an error in their health panel with no other clue. Use the bare bindings at the top level, or api.* inside the register callback. Settings — one script, different merchants Every install can carry its own values for your script. A merchant sets them on the installed app's Scripts tab, and they arrive as settings in a sandbox script or as a data- attribute on a dom-tier tag. Missing settings are an empty object, never an error. Handle the empty case by doing nothing rather than throwing. The same tab lets a merchant switch one of your scripts off without uninstalling your app. Treat that as normal. They are handed to code running on a public page, and on the dom tier they are an attribute in the page's own DOM. Never ask a merchant to put a secret in them — use your install-time API key and your own backend for anything privileged. Buyer data What a script receives on checkout.completed depends entirely on the protectedData grade it declared. none — no buyer identifiers at all. The default, and correct for most scripts. hashed — emailSha256 and phoneSha256 , each a SHA-256 of the lowercased, trimmed value. This is the form GA4 and Meta's advanced matching want. A third grade, raw , used to be accepted and stored — and delivered exactly what none delivers. An app could declare it, pass review, and then receive no identifiers at all with nothing explaining why. It is now refused with a message pointing at hashed . If your integration genuinely needs plaintext, it needs a grade that does not exist yet, and that is a consent and data-protecti"},{"title":"Security Model","route":"/developers/extensions/security","headings":["Security Model","RS256 + JWKS","Iframe sandboxing and origin pinning","Short-lived tokens with auto-refresh","Scope ceilings","Webhook signature verification","Summary"],"text":"Extensions Security Model The extension security model is built on four pillars: RS256 asymmetric JWT signing with a public JWKS, iframe sandboxing and origin pinning via the bridge protocol, short-lived tokens with auto-refresh, and strict scope ceilings that block human and admin access. Apply these controls from the first private install. Before public submission, complete the testing preflight and the marketplace checklist . RS256 + JWKS Extension-session JWTs are signed with an RSA private key (RS256) held server-side. Throttle publishes the corresponding public key(s) at GET /.well-known/extension-jwks.json in standard JWK Set format. Any out-of-process verifier — your extension backend, a middleware layer, a Cloudflare Worker — can verify tokens without a Throttle-specific SDK or a symmetric shared secret. The protected header always carries alg: "RS256" and a kid . Reject tokens with any other algorithm. The issuer is always "throttle" . Reject tokens with a different issuer even if the signature verifies. The JWKS endpoint may publish multiple keys (key rotation). Your verification library selects the right key by kid automatically. Old keys remain in the set through their last token's TTL. The endpoint is unauthenticated — no API key required. Cache it at module init via createRemoteJWKSet . If token verification fails for any reason — expired, bad signature, wrong issuer, unknown kid , malformed structure — return null and reject the request. Never attempt to use a partially-validated payload. Iframe sandboxing and origin pinning The dashboard renders extension iframes with a restrictive sandbox attribute. All communication between the iframe and the dashboard host goes through the bridge's typed postMessage protocol — the iframe cannot access the parent's DOM or navigate the parent directly (those requests go through the bridge's navigate helper, which the host controls). An extension version may request extra sandbox flags, but only from a closed list: allow-modals and allow-downloads . Anything else, including allow-top-navigation and allow-popups-to-escape-sandbox (with allow-popups it opens unsandboxed windows that keep an opener, which allows tab-nabbing of the dashboard), is rejected when the extension is registered and ignored by the dashboard. The flags are shown to staff reviewers and to the merchant in the install wizard, like scopes, and adding one to a public extension requires a fresh review. The iframe always uses the flags of the pinned version, never those of a newer one. Origin pinning works on both sides of the bridge: Iframe side — the targetOrigin option passed to createBridge() restricts outgoing postMessage calls to the dashboard origin. Set this to 'https://app.usethrottle.dev' in production. Host side — the bridge host validates that inbound messages come from iframe.contentWindow at the declared targetOrigin . Messages from any other window or origin are silently ignored. Without targetOrigin , the bridge falls back to document.referrer and ultimately to '*' . A wildcard target sends the session token — including the signed JWT — to all windows in the frame stack. Always set targetOrigin to the exact dashboard origin. Short-lived tokens with auto-refresh Extension-session JWTs have a 10-minute TTL . Short TTLs limit the exposure window if a token is intercepted. The bridge handles renewal automatically: When the current token is within 60 seconds of expiry, the bridge proactively sends a refresh message to the host. When a bridge.api.* call receives a 401 , the bridge requests a refresh and retries the call once. The host calls POST /api/v1/installations/:id/launch-token and sends a fresh session message with the new token. All bridge.api.* calls in flight during a refresh wait for the new token before proceeding. Launch tokens can only be minted for active Clerk (dashboard) sessions — API keys cannot mint them. This ensures the token always embeds a real human identity and can be revoked by ending the Clerk session. Scope ceilings Extensions operate under a two-level scope ceiling. First, only extensionAllowed scopes may appear in a manifest — human scopes (team, billing, email, admin) are blocked at registration time. Second, the issued JWT and API key are scoped exactly to the pinned version's declared scopes — even if the workspace's API key holds broader access, the extension never inherits it. See the Scopes reference for the full extensionAllowed catalog and the management scope details. Webhook signature verification Extension webhook deliveries are signed with HMAC-SHA256 using a per-install signing secret. The signature covers the delivery timestamp and the raw body, preventing replay attacks older than 5 minutes (configurable). The signing secret is unique per install and stable — reinstalling does not rotate it, so verification keeps working across an uninstall/reinstall cycle. Read the current value any time with GET /api/v1/installations/:id/webhook-secret . The verifyWebhook helper uses constant-time comparison to prevent timing attacks. Never verify signatures with string equality ( === ) — use the provided helper. Capture the raw body before any JSON parsing. Parsing and re-serializing changes whitespace and key ordering and will break verification. Each installation has its own signing secret. A compromised secret for one install does not affect other installs or other applications. The secret survives an uninstall and reinstall — the installation row is reused — so a merchant reinstalling your extension will not break signature verification. See the Events reference for the full verification workflow and event catalog. Summary RS256 + public JWKS — no shared secret needed to verify tokens; key rotation is transparent to verifiers. Iframe sandboxing — restricts iframe capabilities; no direct DOM access to the parent. Origin pinning — postMessage is locked to the da"},{"title":"Extension Starter Repository","route":"/developers/extensions/starter-repository","headings":["Extension Starter Repository","Clone and run","What the starter includes","Extension surfaces","Safe integration foundations","Repository strategy","Required customization"],"text":"Extensions Extension Starter Repository The public starter will provide a production-shaped baseline for iframe, webhook, and hybrid extensions without depending on Throttle's private monorepo. The starter is published at github.com/Epic-Design-Labs/throttle-extension-starter . It implements the hybrid shape (embedded React iframe UI + a Cloudflare Worker backend) and is a template to copy, not a dependency. No private repository access is required. Clone and run The five-minute quickstart runs against a mocked bridge — no Throttle account or Cloudflare deploy needed. When you are ready to build your own integration, customize the template with pnpm run setup and follow the starter README through Test-mode registration, real webhook delivery, and Cloudflare deployment. What the starter includes Extension surfaces Iframe route and bridge handshake Backend identity-token verification Raw-body webhook signature verification Health endpoint and structured logging Safe integration foundations Install-aware persistence Idempotent event processing Environment-variable template Unit tests and deployment guidance Repository strategy Use one repository per provider integration by default. ShipStation, ERP, tax, analytics, and messaging connectors have independent credentials, data models, release schedules, incidents, and support ownership. A monorepo is reasonable only when one team deliberately shares their runtime and deployment lifecycle. The starter is a template, not a hosted runtime dependency. Your publisher workspace owns the catalog entry; your repository and infrastructure own the application code and provider synchronization. Required customization Declare the minimum scopes and event subscriptions, chosen from the scopes an extension may request . Define installation configuration without exposing provider secrets to browser JavaScript. Replace example handlers with provider-specific mapping and reconciliation. Add the provider's rate limits, retry policy, credential rotation, and support runbook. Validate clean installation and uninstall in Test mode. Pair the starter with the Build guide and use the security requirements as the implementation baseline."},{"title":"Testing Extensions","route":"/developers/extensions/testing","headings":["Testing Extensions","Testing ladder","Required scenarios","Delivery and recovery","Lifecycle and data","Marketplace preflight"],"text":"Extensions Testing Extensions Test mapping, delivery, isolation, recovery, installation, and removal before asking another workspace to trust your app. Testing ladder Unit tests — mapping, signature verification, idempotency, and conflict rules. Contract tests — current public Throttle request, response, and event shapes. Local HTTPS tests — iframe handshake and signed webhook delivery through a tunnel. Private install — full setup in a Test-mode application with realistic fixtures. Failure injection — timeouts, rate limits, expired credentials, retries, and provider outages. Production smoke test — a small, non-destructive live test after launch approval. Required scenarios Delivery and recovery Valid, missing, stale, and invalid signatures Duplicate and out-of-order events Timeout, 429, and 5xx retry behavior Poison event and dead-letter recovery Uninstall while work is queued Lifecycle and data Pagination and missing optional fields Version upgrade and new-scope consent Strict Test/Live separation Provider credential expiration Cancellation and return races for fulfillment apps Marketplace preflight All public endpoints use HTTPS and expose a useful health check. Scopes and event subscriptions are limited to demonstrated functionality. A clean install, configuration update, upgrade, replay, and uninstall all succeed. Logs and screenshots contain no credentials or customer-sensitive data. Support, privacy, and terms URLs are public and accurate. Use Test mode throughout development. Verify production behavior deliberately with live credentials only after the extension passes security and marketplace preflight. Review the Security Model before following the publishing procedure ."},{"title":"Extension Versioning","route":"/developers/extensions/versioning","headings":["Extension Versioning","Version lifecycle","Which versions can be pinned","Installs are pinned","Upgrading","Rollback","Versioning strategy","Response:","\"data\": {","\"id\": \"ver_new...\",","\"version\": \"1.1.0\",","\"status\": \"draft\",","\"scopes\": [\"orders:read\", \"customers:read\"],","\"notes\": \"...\",","\"createdAt\": \"...\"","}","}`;","Response: { data: { versions: [ { id, version, status, scopes, ... }, ... ] } }`;","If the new version requests scopes not in the current install:","HTTP 409","\"error\": {","\"code\": \"new_scopes_require_consent\",","\"newScopes\": [\"customers:read\"]","Retry with explicit consent:","→ { data: { id: \"inst_xxx\", versionId: \"ver_new...\", ... } }`;","\"Rollback\" and \"upgrade\" use the same endpoint — just target an earlier versionId.","No consent required if the older version's scopes are a subset of the current scopes."],"text":"Extensions Extension Versioning Extension versions are immutable snapshots of a manifest. Published versions cannot be changed. Installs are always pinned to a specific version, so rolling out a change requires publishing a new version and upgrading each install explicitly. After publishing an upgrade, follow the operations guide to monitor adoption, compatibility, and incidents. Version lifecycle A version starts as draft and becomes published when you publish it. Once published, the version record is frozen — its scopes , iframeUrl , webhookUrl , and eventSubscriptions never change. In the dashboard you never number a version by hand. Once an extension is private or public, Publish a new version on its Publish tab snapshots the saved settings as the next patch version (for example 1.0.3 after 1.0.2 ) and publishes it. The Versions tab lists every version and marks the one new installs get as Live . The API calls below do the same thing. Which versions can be pinned An install that names a versionId and an upgrade or rollback that names a targetVersionId follow the same rule: The version must belong to the extension. Any other id, including a version of a different extension, returns 404 not_found . A draft version is never pinned in production, which returns 422 draft_not_installable_in_live . Outside production, only the workspace that owns the extension may pin a draft. The workspace that owns the extension may pin any of its other versions, including published versions still awaiting marketplace review and older versions. Any other workspace may pin only the version a fresh install would get: the approved version of a public extension, or its latest published version if it has never been approved. Anything else returns 422 version_not_approved . An install with no versionId pins that same default version. Installs are pinned When an extension is installed, the install row records the exact versionId . Publishing a new version has no effect on existing installs — they continue running on the pinned version indefinitely. This provides stability: a breaking manifest change cannot affect installs that have not opted in to the upgrade. The dashboard may surface an "upgrade available" indicator when a newer published version exists for an installed extension. The installer decides when and whether to upgrade. Upgrading Use POST /api/v1/installations/:id/upgrade to move an install to a different published version. The install's API key is updated to reflect the new version's scopes; the config is preserved. Only an active installation can be upgraded or rolled back. A suspended or uninstalled installation returns 409 installation_not_active and is left unchanged. If the new version's scopes are a subset of the current version's scopes (scope reduction), no consent is required and the upgrade proceeds immediately. If the new version requests additional scopes, the endpoint returns 409 new_scopes_require_consent with the delta. Retry with acknowledgedNewScopes: true to confirm. The target must be a version this workspace may pin (see Which versions can be pinned ). Installers of another workspace's public extension can move to a new version once it is approved. The consent requirement protects against a malicious extension publisher silently acquiring new scopes. The installer must explicitly acknowledge each new scope — the 409 lists exactly which scopes are being added so the operator can make an informed decision. Rollback Rolling back to an older version uses the same upgrade endpoint — just target an earlier versionId . Because older versions have fewer or equal scopes, rollback typically does not require consent. After rollback, the install runs the older version's manifest (including its iframeUrl and event subscriptions). Rollback follows the same pinning rule as an upgrade: the owning workspace can roll back to any of its versions, while installers of another workspace's public extension can only target its approved version. The installation's config object is not changed by an upgrade or rollback. If the new version requires different config keys, update config separately via PATCH /api/v1/installations/:id/config . Versioning strategy Use semantic versioning (e.g. 1.0.0 ) — it is stored as a string, not parsed. Additive changes (new UI features within the same scopes, bug fixes, updated iframeUrl ) can be shipped as a new version without requiring install consent. New scopes always require explicit upgrader consent. Removing scopes does not require consent — it is a reduction. Keep at least the previous published version available to allow rollback without republishing. See also: Security model for how scope ceilings are enforced at the version level, and Installing extensions for the full install lifecycle."},{"title":"Idempotency-Key","route":"/developers/idempotency","headings":["Idempotency-Key","When to use it","Usage","How replay works","Scope","first response byte-for-byte. The header below tells you it's a replay."],"text":"Reliability Idempotency-Key Make every mutating Throttle request safe to retry by attaching an Idempotency-Key header. Throttle will replay the original response if you retry within 24 hours, even if the network blew up midway through the first attempt. When to use it Always, on every POST , PATCH , and DELETE from a server you can't fully trust the network between (i.e. all of them). It costs nothing when the request succeeds first try, and saves you from double- charging, double-creating, or double-cancelling on retry. Generate a fresh key per logical operation. A UUID v4 is the canonical choice. Reuse the same key when retrying the same operation (timeout, 5xx, connection reset). Do not reuse a key for a different operation. Throttle will reject the second call with 409 idempotency_key_reused . Usage How replay works Throttle hashes the canonicalised request body (SHA-256, key-sorted) alongside the key. On the second arrival within 24 hours: Same key + same body → original response replayed byte-for-byte with an extra Idempotency-Replay: true response header. The handler does NOT run again. Same key + different body → 409 idempotency_key_reused . Surfaces the integrator bug instead of double-charging. Scope Per workspace, per (method, path). The same key can be reused across endpoints without colliding — Throttle scopes the cache by tuple (workspaceId, key, method, path) . The path is the concrete request path with its ids filled in (the query string is ignored), so the same key sent to /subscriptions/A/pause and /subscriptions/B/pause is two separate operations. TTL: 24 hours. After 24h, the same key can be used again without replay. GET / HEAD requests ignore the header. They're already idempotent. 5xx responses are not cached. A transient server error doesn't pin a failure response to your key. The whole point is that the SAME key is reused. Generating a new UUID on every retry defeats the cache and risks double-charging. Persist the key in your job queue / outbox alongside the request payload."},{"title":"Bulk imports","route":"/developers/imports","headings":["Bulk imports","Before you start","1. Create and upload","2. Inspect, then map","3. Validate before you commit","What a committed order import writes","Runs are queued, so poll for the outcome","The error report round trip","Undo: what it removes, and what it does not","Full endpoint reference","201","that header, so a different one fails with SignatureDoesNotMatch.","PRE-run status. The run itself happens on a worker — poll for the outcome.","202 — queued. The outcome lands on the import row as undoResult."],"text":"Data migration Bulk imports Move a merchant's historical customers or orders into Throttle from a file their old platform exported. Four steps: upload, map, dry run , commit. The dry run is not optional — a commit rewrites order and customer history, so Throttle refuses to run one until you have been shown what it would do. Before you start CSV and TSV up to 500 MB and 500,000 rows. The extension on fileName selects the parser, so it has to be accurate — it is chosen before a single byte is uploaded. Excel up to 10 MB and 65,536 rows ( .xlsx , .xlsm ; .xls up to 25 MB). The lower ceiling is not arbitrary: a .xlsx is a ZIP whose directory sits at the END of the file, so a sheet cannot be decoded until the workbook, shared-strings and styles entries have all been read — it is parsed whole rather than streamed a row at a time. 65,536 is the .xls format's own ceiling, reused for both so there is one number rather than two. Past it, a sheet is refused with a message naming the cap; save it as CSV, which handles 500,000 rows. Spreadsheet dates cannot be misread. A date cell is a number plus a format, not text, so it is imported as ISO-8601 and the dateOrder choice cannot move it. That ambiguity is real only for CSV, where 03/04/2024 is two different days. A workbook with several sheets reads the first by default. POST /api/v1/imports/ id /inspect returns every sheet in sheets , and re-POSTing with sheetName : Orders reads that one instead. Changing the sheet re-saves the dialect, which retracts any dry run — the preview described a different grid. Naming a provider pre-fills the mapping. bigcommerce and shopify both ship export templates; omit it and the header-name matcher runs alone. The provider also selects the status vocabulary, which is not cosmetic: BigCommerce exports one status column that implies both position and payment, while Shopify splits it across Fulfillment Status and Financial Status and needs both read together — an order can be fulfilled but unpaid, or paid but unfulfilled. A status column may also hold Throttle's own status values, as a Throttle export writes them: the current names are taken as they are, and the names retired on 2026-11-23 are translated (an old closed becomes completed ; an old fulfilled becomes shipped for an order with a shipment line and completed otherwise). Only current names are written. A Throttle status says nothing about money, so payment comes from the payment column. Shopify blanks its order columns on continuation rows. Where BigCommerce repeats the order-level values on every line of a multi-item order, Shopify writes them on the first line only. The Shopify template declares that shape, so the blanks are read as the format rather than as an inconsistent export. Its single Billing Name column is split into first and last on the last space. One entity per file. entityType is customer or order . Scopes. Reads need imports:read ; every verb that creates, maps, runs or undoes an import needs imports:write . Publishable ( pk_ ) keys cannot hold either, and extensions are not granted them. Imports are scoped to one workspace environment. An import belongs to the application and environment its credential resolves to, and reading one from a different environment is 403 environment_mismatch . POST /api/v1/imports hands back a presigned PUT valid for one hour and you upload straight to storage. That is why the size ceiling is checked twice: once against the fileBytes you declare (before the URL is issued) and again against the object's real size at inspect time, because a presigned PUT signs the key and the content type — never the body length. 1. Create and upload A PUT that never happened, or one that stored zero bytes, is caught at the next step as 409 file_not_uploaded rather than becoming an empty mapping screen. 2. Inspect, then map POST /api/v1/imports/ id /inspect reads at most the first 1 MB of the file however large it is, so it answers immediately. It returns the sniffed dialect, the headers, a 20-row sample, the platform template it matched, a suggested target field per header, and detectedDateOrder . Those are suggestions — you confirm them. A customer import can map customer.customerGroup (header synonyms such as "group" or "price group"). Each cell names a group of the import's application and environment, matched ignoring case; none clears the group. An unknown name fails that row with customer_group_not_found . Mapping the column needs customer_groups:write . See Customer groups . A column you leave out of columns is ignored. That is how you skip one. Two columns mapped to one field is rejected , with both headers named. The mapper takes the first match and would discard the second silently, which is data loss, not a harmless duplicate. The one exception is customer.metadata — see below. A customer may carry up to five addresses. The first group s targets are customer.address.* ; the rest are customer.address2.* through customer.address5.* , with the same ten suffixes ( firstName , lastName , company , addressLine1 , addressLine2 , city , stateProvince , postalCode , countryCode , phone ). A group whose columns are all blank for a row produces no address for that row. The first address becomes the customer s default only if they had none; a customer who already has a default keeps it. A header s trailing group index is parsed, not matched. Address City - 2 , Address City #2 and Address City (2) all suggest customer.address2.city . An index above 5 is left unmapped rather than folded into an existing group. A digit that is part of the field s own name — Address Line 1 — is untouched. An order s products may arrive in ONE column. BigCommerce s control-panel order export gives an order a single Product Details cell holding every product, pipe-separated between products and Key: value within — so there are no per-line-item columns to map. Point that column at order.lineItems.packed and each p"},{"title":"Customer Invoices","route":"/developers/invoices","headings":["Customer Invoices","One list, three payment types","Auth and trust model","Pagination","Per-application branding","Order fees","Refund behavior","Net 0 and invoice terms","Net-N invoice status","Amount due","Deposit receipts","Invoice numbers","When tax is filed on invoice terms","REST routes quick reference","Pages in this section","Merchant API: list invoices for a specific customer","Redirect directly to PDF (default)"],"text":"Finance Customer Invoices Every payment Throttle processes — a one-time card capture, a Net-N issuance, or a recurring subscription charge — lands in one unified, cursor-paginated invoice list. Your buyers see a single consistent view regardless of how they originally paid. Customers never hold an API key. Your backend mounts the @usethrottle/invoices/server proxy which resolves the authenticated buyer's identity and forwards only their own invoices. See React Package for the setup. One list, three payment types Throttle invoices are payment-source agnostic. The same GET /api/v1/invoices endpoint returns all three payment types in a single paginated response, ordered by creation time (newest first by default). Single-time card captures ( sourceType: "order" ) — generated when a buyer completes a one-time checkout session with a card. The invoice is marked paid immediately on capture. Net-N issuances ( sourceType: "net30" ) — issued at checkout time with a future dueAt timestamp (N days out). Status starts as open and transitions to paid once the merchant marks it paid or a payment is received. Subscription charges ( sourceType: "subscription" ) — generated on the initial subscribe and on every renewal. The invoice carries periodStart and periodEnd so buyers can see exactly which billing period each charge covers. A checkout that sells several subscriptions, or subscriptions and goods together, produces one order invoice ( sourceType: "order" ) listing every line, each subscription line with its period label (for example "Oct 1 – Nov 1, 2026", or "Oct 1 – Nov 1, 2026 · Payment 1 of 3" on an installment plan), plus shipping and tax; its total equals the capture. No separate first-period subscription invoice is issued for it. Renewals invoice as subscription charges. A single-plan checkout keeps its subscription invoice. Use the type query parameter to filter by source type if your UI needs to show a subset. Every invoice carries subscriptionId : the subscription a subscription charge bills, null on order and Net-N invoices. ( sourceId on a subscription charge is the subscription invoice id, not the subscription id.) To list one subscription's invoices, pass ?subscriptionId= to GET /api/v1/invoices or GET /api/v1/customers/:customerId/invoices : it returns its signup charge, renewals and plan-change charges. A checkout that sold several subscriptions (or subscriptions and goods together) bills its first charge on one order invoice, so that invoice has subscriptionId: null and is not in the filtered list; the renewals are. Auth and trust model The Throttle invoice API is a merchant-facing API: every call requires an sk_* secret key. Buyers cannot authenticate directly. The recommended pattern is a thin backend proxy: Your backend authenticates the buyer (Clerk, NextAuth, session cookie, etc.) and resolves their internal user id. The proxy calls GET /api/v1/customers/by-external/:externalId with your secret key to resolve the Throttle customerId . All reads are forwarded as GET /api/v1/customers/:customerId/invoices so the buyer only ever sees their own invoices. The @usethrottle/invoices/server package ships this proxy handler ready to mount in any framework that accepts a standard Request / Response interface (Next.js App Router, Hono, Remix, etc.). Pagination Invoice list endpoints return a cursor-paginated envelope. Pass the returned meta.pagination.cursor as the cursor query parameter to fetch the next page. When meta.pagination.hasMore is false there are no further pages. Per-application branding Every invoice PDF is rendered with the application's configured logo and brand color. Set these on your application via the dashboard Settings → Branding panel or via PUT /api/v1/embed-config . The PDF renderer reads logoUrl and brandColor from application_env_settings at render time, so changes apply to invoices downloaded after the update (not retroactively). Order fees An invoice prints one row per order fee between shipping and tax. The merchant invoice routes ( GET /api/v1/invoices , GET /api/v1/invoices/:id and the per-customer list) return feeTotal and fees ( label, amount ), read from the billing snapshot frozen at issue: 0 and [] when the order had no fees. See Order fees . Refund behavior When a payment is refunded via the dashboard or API, the corresponding invoice status transitions automatically: Full refund — status becomes refunded ; the amountRefunded field reflects the full invoice total. Partial refund — status becomes partially_refunded ; the amountRefunded field shows the refunded portion. The re-rendered PDF shows the refunded amount and updated status. Buyers who download after a refund automatically see the current state. Net 0 and invoice terms netN is an integer from 0 to 365, or null , on a customer ( POST / PATCH /api/v1/customers ), a cart ( paymentTerms.netN ) and a quote. 0 means due on issue. null is not the same instruction: it falls through to the next source (negotiated quote term, customer, cart, then your default of 30). Who may be invoiced on terms is the Invoice Terms connection s eligibility ( PATCH /api/v1/net30/connection/{id} , or Configure on the dashboard): all_customers (the default) — anyone, guests included. approved_customers — only a customer whose profile has netN set (any value, 0 included), or an order whose terms were negotiated on an accepted quote. Setting netN approves the customer; clearing it to null removes approval. Checkout stops offering terms to anyone else, and creating a terms payment for them answers 422 terms_not_approved — at checkout completion, on POST /api/v1/orders/{id}/invoice-on-terms , and anywhere else a net30 payment is created. Net-N invoice status An invoice raised on Net-N terms ( sourceType: net30 ) starts open and follows the payment behind it: Paid — when the payment is captured (the merchan"},{"title":"React Package · @usethrottle/invoices","route":"/developers/invoices/react-package","headings":["{invoice.number}","React Package · @usethrottle/invoices","Install","Provider","Hooks","useInvoices(params?, options?)","useInvoice(id, options?)","useDownloadInvoice()","Cursor pagination","Cache invalidation","REST routes","Invoice object fields","Boundaries"],"text":"Customer Invoices React Package · @usethrottle/invoices React hooks and a server proxy helper for surfacing a buyer's unified invoice list — card captures, Net-N issuances, and subscription charges — inside your storefront portal. Browser hooks never call Throttle directly. They call your backend proxy, which holds the sk_* key and resolves the authenticated buyer's identity before forwarding the read. Install Backend proxy · /server entrypoint Mount createInvoiceProxyHandler from @usethrottle/invoices/server on a catch-all route. The handler accepts any framework that exposes a standard Request object (Next.js App Router, Hono, Remix, etc.). createInvoiceProxyHandler(options) apiKey: string — your sk_* secret key. getCustomerId(request): string | null | Promise<string | null> — called on every request. Return the buyer's external id (e.g. your auth framework's user id). Returning null causes the proxy to reply 401 unauthorized . baseUrl?: string — defaults to https://api.usethrottle.dev . The proxy allows three read-only paths: /api/v1/invoices (list), /api/v1/invoices/:id (get), and /api/v1/invoices/:id/download (PDF URL). All other paths and non-GET methods return an error. List requests are transparently rewritten to /api/v1/customers/:customerId/invoices so the buyer can only read their own invoices. Provider Mount InvoiceProvider above any component tree that uses invoice hooks. The fetcher prop is the bridge to your backend proxy — every hook routes through it. Hooks useInvoices(params?, options?) Lists invoices for the authenticated buyer. Returns a QueryState<PaginatedInvoices> with data, isLoading, isFetching, error, refetch . params : status? ( paid | open | refunded | partially_refunded | void ), type? ( order | net30 | subscription ), cursor? , limit? , sort? ( asc | desc ). Note: The SDK normalizes the REST meta.pagination envelope into a top-level pagination on the hook result — so with the hooks you read result.data.pagination.cursor / .hasMore , whereas raw REST responses carry it under meta.pagination . useInvoice(id, options?) Fetches a single invoice by id. Skips the fetch when id is null or undefined . useDownloadInvoice() Returns an async function (id: string) => Promise<string> that fetches the signed PDF URL and opens it in a new tab. Returns the raw URL so your UI can also use it as an anchor href . To capture the returned URL for custom usage (e.g., render as an anchor href): Cursor pagination Responses carry a pagination object inside data.pagination . When hasMore is true, pass the opaque cursor string in the next useInvoices call. Cache invalidation All hooks share a cache version. Call useInvoiceInvalidation() to bump the version and cause every mounted hook to re-fetch. Use this after a refund or a payment action that changes invoice state. REST routes The following merchant-facing routes require an invoices:read API key scope. GET /api/v1/invoices — list invoices for the application (all customers, all source types). GET /api/v1/invoices/:id — fetch a single invoice. GET /api/v1/invoices/:id/download — 302 redirect to a 10-minute signed PDF URL; append ?format=json to get data : url : ... instead. GET /api/v1/customers/:customerId/invoices — list invoices scoped to a specific customer (used internally by the proxy). All list endpoints accept cursor , limit , sort (asc | desc), status , and type query parameters. Invoice object fields id — Throttle invoice id. number — human-readable invoice number (e.g. INV-sprinter-001 ). status — paid | open | refunded | partially_refunded | void . sourceType — order | net30 | subscription . currency — ISO-4217 currency code. subtotal, taxTotal, shippingTotal, discountTotal, total — integer minor units. amountRefunded — integer minor units refunded (0 when not refunded). issuedAt — ISO-8601 invoice date. dueAt — ISO-8601 due date for Net-N invoices; null for card captures and subscriptions. periodStart, periodEnd — billing period for subscription invoices; null otherwise. createdAt — ISO-8601 record creation timestamp. Boundaries The package is read-only — it surfaces invoices and PDFs but does not create or mutate payment records. Payment collection stays in @usethrottle/checkout-react . This package renders the resulting invoices. Merchant-wide views (all customers) are available via the REST routes with a secret key; the React hooks are scoped to the authenticated buyer's invoices through the proxy."},{"title":"MCP server","route":"/developers/mcp","headings":["MCP server","Install","Hosted / remote server","What it can do","Catching field-name mistakes before they 400","Writes","Connect by URL alone","Throttle Builder (OAuth)","Options"],"text":"Tools MCP server @usethrottle/mcp connects Throttle to AI assistants that speak the Model Context Protocol — Claude Code, Claude Desktop, Cursor, and anything else with an MCP client. It reads your commerce data, diagnoses failing checkouts, searches these docs, and checks request bodies against the published contract before you write code against it. Install The server runs locally over stdio and authenticates with a secret sk_ API key, exactly like the CLI. For Claude Desktop or any client that reads an mcpServers config: The key pins the workspace, application and environment — there is no way to switch from inside a tool call. Create a key that holds only the scopes the assistant needs, and start with a non-production environment. Publishable ( pk_ ) keys are rejected: they carry only browser-safe compute scopes and cannot read data. Hosted / remote server For clients that speak MCP over HTTP instead of stdio — n8n's MCP Client Tool node, for example — connect directly to https://mcp.usethrottle.dev/mcp (Streamable HTTP) instead of running @usethrottle/mcp locally. Send the same secret key as an Authorization: Bearer sk_... header — no separate provisioning, no OAuth. The tool surface and scopes are the same as the local server's read-only toolset, with two differences besides transport: the hosted server is strictly read-only, so seed_test_data is not registered there even on a non-production credential (seed from the local CLI instead), and api_get is not registered there either, because a tool that can read any path cannot declare in advance which scopes it uses. A session is created on your first call and reused for the rest of the connection; it is torn down after 30 minutes of inactivity or an explicit client disconnect. Claude's custom-connector static_headers auth type (Bearer token, no OAuth) works with this endpoint but is currently rolled out selectively by Anthropic. ChatGPT's Developer Mode does not support API-key auth for custom connectors at all — only OAuth or no auth — so it cannot use this endpoint yet. As of this change, the server also supports real OAuth 2.1 ( authorization_code + PKCE + refresh) for both platforms' native connector/directory flows, once each platform's OAuth client is registered. This is in addition to, not instead of — the static_headers path above still works too. customers:read and payments:read are OAuth-grantable, so search_customers , get_customer , search_payments and get_payment register on hosted/OAuth sessions too, not only on sk_ API keys. An OAuth connection never sees a shopper's personal data, because an OAuth grant cannot hold customer_pii:read . On every response to an OAuth token, email, phone and first/last name are withheld wherever they appear (orders, subscriptions, carts, invoices, quotes, events, webhook deliveries, the audit log): null in REST responses, and absent from MCP tool results, which drop null fields. Company and the merchant's external ids ( externalId , externalCustomerId ) are withheld too, since a merchant may key customers by email or name. REST addresses keep city, state, postal code and country and lose the street lines. Free-form fields are withheld whole, because a name or email can sit anywhere inside them: metadata , notes, hold and comp reasons, quote comment bodies, acceptance records, client context (IP address, user agent), tax ids and a payment's raw processorResponse . File downloads and exports (orders CSV, invoice PDFs, exemption certificates) return 403 oauth_file_download_forbidden . Nothing can be looked up by a withheld value either: GET /customers/by-external/:externalId and the externalCustomerId filter on subscriptions return 403 oauth_external_id_forbidden , a customer text search answers with no matches ( search_customers refuses q and lists by date instead), and search_orders matches only order ids, numbers and statuses. On top of that, each tool on an OAuth session returns a fixed list of fields chosen for its purpose, so a field the API adds later does not reach the assistant until it is added to that list. A field a buyer can type is not on any list: line-item and quote-item names, SKUs and reference ids (a quote request form takes them from the buyer), company, and every address line but the country. For the same reason get_top_products , which ranks by item name or reference id, is not offered over OAuth. API keys and the dashboard are unaffected. On every credential, API key or OAuth, a tool result never includes the payment processor's raw record: a payment's or transaction's processorResponse , or a saved card's metadata.gr4vy_payment_method . This covers get_payment , search_payments , get_order and api_get . The REST API still returns processorResponse on payments and payment transactions, but the field is deprecated: read the payment's own fields ( status , amount , capturedAmount , cardBrand , cardLastFour , errorCode ) instead. Those lists only hold if the token cannot go around them. An OAuth access token is issued for the MCP server (its aud is https://mcp.usethrottle.dev/mcp ) and works only there: sent straight to the REST API, it is refused with 401 oauth_token_wrong_audience . To call REST yourself, use an API key. (Automation connectors such as Zapier are registered for the REST API instead; see scopes .) get_integration_status reports each webhook endpoint's id, events and health but not its URL, since a destination URL often carries a secret in its path. What it can do Tools are registered per session based on what your key is actually allowed to do, so a read-only key produces a read-only toolset rather than tools that fail when called. whoami — which workspace, application and environment this key is pinned to, and whether it is production. search_docs — full-text search over these docs, with canonical links. describe_endpoint and validate_payload — the request shape of any endpoint, a"},{"title":"Media library","route":"/developers/media","headings":["Media library","Scopes","Upload an image","Add an image from a URL","List, read, rename and delete","Errors","201","200, newest first","Next page: pass nextCursor back as ?cursor=. The last page has \"nextCursor\": null.`;"],"text":"Media Media library Each store (an application in one environment) has one library of images. Upload a file or give Throttle a URL, and you get back a public URL for the original plus WebP copies at fixed widths, ready for srcset . A sandbox environment has its own library, separate from production. Scopes media:read lists and reads images. media:write uploads, renames and deletes them, and includes media:read . Extensions may request both. A publishable key ( pk_ ) cannot hold either. A dashboard session needs the Settings permission on the application to write. See scopes . Upload an image POST /api/v1/media takes multipart/form-data with a file part and an optional alt field (up to 500 characters). It answers 201 with the image. Types: PNG, JPEG, WebP, GIF, AVIF and SVG. Throttle reads the type from the file's own bytes and ignores the declared content type: a PNG sent as image/jpeg is stored as a PNG, and an HTML file sent as image/png is refused. Size: at most 10 MB and 40 megapixels (a 9000 by 9000 image is too big). An SVG is at most 20 KB. Privacy: a JPEG original is stored without its EXIF data (GPS position, camera, editing software). Its pixels, quality and orientation are unchanged. Other formats are stored exactly as uploaded, and variants are WebP files with no metadata. SVG is sanitised before it is stored, and the sanitised copy is what Throttle serves, so the stored bytes can differ from your file. Throttle keeps only shapes, text, gradients, clip paths, masks and local use references. It removes scripts, foreignObject , style elements, event attributes, animation, image and any link or reference that leaves the file. A DOCTYPE or ENTITY refuses the file. An SVG has no variants ; its size comes from its viewBox , or width and height , or is 300 by 150. Animated GIFs keep their animation in the original. Variants use the first frame. Variants: WebP copies at 320, 640, 1024, 1600 and 2400 pixels wide, listed in variants . A variant is never larger than the original, so a 1100 pixel wide image has variants at 320, 640 and 1024. Store limits: 60 uploads a minute, 10,000 images and 5 GB of originals. Deleted images stop counting toward the 10,000 right away, but their size counts toward the 5 GB until their files are removed (see below). Add an image from a URL POST /api/v1/media/from-url with { url, alt? } makes Throttle download the image and add it, with the same rules and the same 201 answer as an upload. The URL must be http or https and public. Private, loopback, link-local and cloud-metadata addresses (IPv4 and IPv6) are refused with 400 url_not_allowed , whether they are in the URL, behind a host name, or reached by a redirect. At most 3 redirects, each checked again ( 422 too_many_redirects ). The download stops at 10 MB ( 413 file_too_large ). The bytes must be one of the image types above ( 415 unsupported_media_type ). An SVG is sanitised like an upload. A download that fails or times out is 422 fetch_failed . List, read, rename and delete GET /api/v1/media : images, newest first, without deleted ones. limit is 1 to 200 (default 50), q matches alt text ignoring case, and mime filters on an exact type such as image/png . Page with nextCursor . GET /api/v1/media/{id} : one image. A deleted image is still returned, with deletedAt set, so a page that uses it can be flagged. PATCH /api/v1/media/{id} with { alt } : change the alt text. DELETE /api/v1/media/{id} : soft delete. The image leaves the list and stops counting toward the 10,000 images. Its files stay in storage and keep their URLs for 30 days, so a page that still uses the image keeps working. After that Throttle removes the files and the URLs stop working. Deleting twice is safe. An image belongs to one application and environment. Asking for it with a key from another environment answers 404 not_found . The url and every variant url are public and cached for a year, so a changed picture needs a new upload. They sit under /api/v1/assets/workspaces/{workspace}/applications/{application}/environments/{environment}/media/ . Errors 400 no_file : the multipart body had no file part. 413 file_too_large : over 10 MB (an SVG: over 20 KB). 415 unsupported_media_type : not a PNG, JPEG, WebP, GIF, AVIF or SVG image. 422 image_too_large : over 40 megapixels. 422 invalid_image : the file is damaged. 422 invalid_svg : the SVG is not well-formed XML, has a DOCTYPE or ENTITY, or has nothing safe to draw left after sanitising. 429 rate_limited : more than 60 uploads in a minute for this store. 409 media_quota_exceeded : the store holds 10,000 images or 5 GB of originals (deleted images count toward the 5 GB until their files are removed). 404 not_found : no such image in this environment."},{"title":"Metadata","route":"/developers/metadata","headings":["Metadata","Resources that accept metadata","Customers","Subscriptions","Carts and line items","Fulfillment hints on line items","Tax keys","How the keys travel from a quote to an order","Shipping keys","Orders and payments","Checkout sessions","On checkout sessions","On webhooks","Conventions","Dashboard exposure","Next","Matches the line link (lineItems[].subscriptionId), the order's subscriptionId,","or the legacy metadata.subscription_id pointer. Prefer it over q=$SUB_ID, which","substring-matches the whole metadata blob and can return unrelated orders.`;"],"text":"Cross-cutting Metadata Every major resource accepts a free-form metadata field — a JSON object you attach to capture your own business state. Throttle stores it as jsonb , returns it on every read, and emits it in webhook payloads. Outside documented automation keys, Throttle treats it as opaque storage. Metadata comes back out unchanged. A small set of documented line-item keys also drives fulfillment automation, such as fulfillmentType for digital delivery or access grants. Use the rest to bridge Throttle's data model with your own — sales rep IDs, campaign codes, contract numbers, feature flags, merchant notes. Resources that accept metadata Update support is missing on payments and checkout sessions because those are short-lived single-use records — payments capture once, sessions expire in 30 minutes. If you need to mutate metadata on them, do it at create time. Customers Subscriptions Carts and line items Fulfillment hints on line items When an order is paid and in awaiting_fulfillment , Throttle reads line-item fulfillment hints. Digital and access-grant items are fulfilled automatically; shipment and service items stay manual in the dashboard. Net30 invoices wait for capture before delivery. Cart items and order line items accept an explicit deliveryMethod field: shipment , digital , access_grant , service , in_person , custom , or none . This is the preferred way to say what an item needs — set it directly and skip the metadata hints below entirely. Omit deliveryMethod and Throttle resolves it once, at insert time, from type and the metadata hints below — then freezes the result on the row. It is not re-resolved on later updates, so changing an item s metadata after creation does not change its delivery method. Every order read returns the resolved value on each line item, so you never have to re-derive it: an order whose items are all digital , access_grant or none has nothing to ship and reaches completed without a fulfillment of your making. Defaults are conservative: unmarked products are shipments, subscriptions and tickets are access grants, services stay manual, and donations are not applicable. Metadata never makes a subscription line ship: only an explicit deliveryMethod: shipment does, which makes a physical subscription. For older integrations, requiresShipping: false is treated as digital unless requiresFulfillment: false is set. Tax keys A handful of metadata keys feed tax calculation and, with Avalara connected, the document Throttle files. They have no typed field of their own: the SDKs type metadata as Record<string, unknown> and the API does not validate them. A misspelled key or a value of the wrong type is silently ignored, and the line is taxed as if you had not sent it. Copy the names exactly. taxCategory means two different things. With the native engine it is matched against the categories on your tax rules: an exempt line is never taxed, and a value no rule lists — including a different case, such as Digital — is taxed only by a rule covering all categories, otherwise not at all. With Avalara it is sent as the line's AvaTax tax code. Native category names are never sent to Avalara, regardless of case: a line carrying standard or exempt falls back to the application's default item tax code. So exempt does not exempt a line under Avalara — send the AvaTax code for the treatment you mean. How codes resolve, and why an item in your AvaTax catalogue beats them, is in the Avalara AvaTax setup guide . taxIncluded must be a JSON boolean. The string "true" is ignored, and the line follows the application setting. transport is case-sensitive. A value outside the five above is never sent to AvaTax, because AvaTax rejects the whole transaction on one. Both the estimate and the filed document use the application default in its place, so a misspelling silently becomes the default. Set it on the cart or the checkout session, not only on the order: the estimate is calculated before the order exists and reads the cart with the session's metadata over it, and the order copies that same metadata for the filed document. The native engine ignores it. Use the camelCase key. Tax calculation and the filed document also accept tax_category and tax_included , but these are kept for older integrations; new code should send taxCategory and taxIncluded . The item identifier is referenceId , not sku AvaTax files each line under an item code, and Throttle sends the line's referenceId as that code. Carts and orders have no sku field: their line schemas are strict, so a top-level sku is rejected with a validation error. When a line has no referenceId , the estimate and the filed document both fall back to metadata.sku , but send referenceId : it is the field the order page shows and the one every integration reads. Quote lines are the exception: they take both sku and referenceId . How the keys travel from a quote to an order Quote → cart, on acceptance. Each line's metadata is copied whole, so taxCategory and taxIncluded come with it. The cart line's referenceId is the quote line's referenceId , or its sku when it has none. The quote's buyerReference lands on cart.metadata.buyerReference — a value given at acceptance wins. Of the quote's own metadata, only transport is carried; any other key, including purchaseOrderNo , stays on the quote. Cart → order. The order's metadata starts from the cart's (the merge order is under On checkout sessions, below), and each line keeps its metadata and referenceId . Estimate and filing. Tax is estimated from the cart and filed from the order. Because the order inherits the cart's keys, the buyer is charged on the same answers the document records. Avalara reads more per-order keys than these — shippingTaxCode and taxTrigger among them. They are covered in Overriding an application default on one order . Shipping keys Line-item metadata keys that size a shipment for a conn"},{"title":"Multi-currency","route":"/developers/multi-currency","headings":["Multi-currency","Enabled currencies","Payment coverage","Reading coverage","One rule for every create path","Amounts are per currency","Shipping","Net 30 and payment methods","Routing","Orders, payments and saved cards","Quotes","Minor units","The money package","Showing money","Reports","Order and presence","Example","What stays in USD","A currency the store has not enabled.","A carrier markup with one amount per currency.","above 100.00 USD or 90.00 EUR.","Enabling such a currency (PUT /api/v1/embed-config): details is an array,","and several refused codes share one message.","Payment coverage could not be read while enabling a currency"],"text":"Money Multi-currency A store has one main currency and may enable more. Every record is created in one currency, and every amount that depends on a currency (a discount, a shipping rate, a Net 30 cap, a routing threshold) is stored per currency. Throttle never converts an amount for you. Enabled currencies The main currency belongs to the application and is shared by its sandbox and production environments. The extra currencies are cartCurrencies , set per environment in the dashboard (a searchable multi-select under Cart pricing → Extra cart currencies ) or with PUT /api/v1/embed-config . An application reports both as enabledCurrencies , with the main currency first. PATCH an application or store currency to change the main currency. After the store's first production sale it answers 409 currency_locked and the response shows currencyLocked: true . A code that cannot be a main currency is 422 currency_not_supported . A currency can be enabled when it is an ISO 4217 currency with 0, 2 or 3 decimal places, is not a fund or test code, and its decimal places are confirmed by payment processors. Four-decimal currencies and codes whose processor handling is unconfirmed (HUF, TWD, ISK, UGX, COP and IDR among them) are refused: the embed-config PUT answers 400 validation_error with the reason in details[] , and an application main currency answers 422 currency_not_supported . Disabling a currency stops new carts, quotes and subscriptions in it. Existing records keep working in their own currency: sent quotes, renewals, invoices and refunds. Until multi-currency opens in production, a production environment accepts USD only. Adding a code to a production cartCurrencies , or creating a record in a non-USD currency there, answers 422 currency_not_available_in_production . An unchanged or shorter cartCurrencies list is still accepted, and sandbox is not restricted. Payment coverage A currency is payable when at least one active payment service on your connection accepts it. A service with an empty accepted-currency list inherits the list of its definition. Invoice Terms (Net 30) never makes a currency payable. The enable rule. Adding a code to cartCurrencies with PUT /api/v1/embed-config is refused with 422 currency_not_payable when no connected service accepts it ( details is an array of currency, payableCurrencies , several codes joined in one message). When coverage cannot be read the answer is 503 currency_coverage_unavailable and nothing changes. Not payable. A currency that is already enabled stays enabled when it stops being covered, and the dashboard shows it as "Not payable" (in Cart pricing and in the New order picker). In the Cart pricing multi-select, a currency that is not payable ("no payment provider accepts it") can't be added, and removing a currency asks for confirmation. Carts, quotes and orders can still be built in it. Only starting a payment is refused: 422 currency_not_payable with details as currency, payableCurrencies . This applies to cart finalize and checkout, cart-session checkout, order authorize, order and payment-link payments, quote accept and quote-link checkout, and the embed tokens and card sessions. If the coverage lookup fails on a payment path, the payment proceeds; only the enable gate fails closed. No connection. With no payment connection, the coverage route answers 200 with connection: "missing" , and the embed token keeps 402 connect_processor . Freshness. Payment paths use a coverage read cached for 60 seconds. The coverage route and the enable gate always read fresh. Reading coverage GET /api/v1/connectors/currency-coverage needs connectors:read for an API key, or the application:settings permission in the dashboard. It returns one row per enabled currency plus every currency an active service accepts: the main currency first, then the other enabled codes ascending, then the covered-but-not-enabled ones. usage (open carts and active subscriptions) appears only on enabled currencies, and only when the key holds both carts:read and subscriptions:read . valuation is ecb , fallback or none : how Throttle values a payment in that currency for its own billing. unknownServices lists services Throttle could not match to a definition. The MCP tool get_currency_coverage returns the same data. The production rule is unchanged: non-USD stays closed in production until the production gate opens. Coverage is read the same way in every environment. Both embed-token responses ( POST /api/v1/checkout-sessions/embed-token and GET /api/v1/checkout-sessions/{id}/embed-token ) carry originCountry , a nullable string: the buyer address country, else the store origin country, else US . One rule for every create path Carts, cart sessions, quotes, orders, subscriptions, the checkout embed token, the add-card embed token and imports all follow the same rule: A missing currency means the store's main currency. A given currency is matched case-insensitively and stored upper case ( eur becomes EUR ). It must be enabled, else 422 currency_not_enabled with details.enabledCurrencies . An unknown code ( XXX , ABC ) is 422 currency_not_supported . An integration that omitted currency used to get USD on orders, payments, subscriptions and quotes. It now gets the store's main currency. A USD-main store sees no difference. The old 422 currency_mismatch on an unresolved cart is replaced by the codes above. Amounts are per currency Throttle does not convert prices, so a currency with no entry is not offered . The legacy single-value field ( value , a method's rate, a flat markup's amount , maxOrderTotal ) mirrors the main-currency entry. 422 discount_currency_unsupported . See Discounts . , ], [ Shipping methods , code: currencyAmounts , html: The method is not offered. Selecting it is 422 shipping_method_unavailable . , ], [ Carrier markup , code: markup.amounts , A flat markup with no entry for the cart currency drops t"},{"title":"Order fees","route":"/developers/order-fees","headings":["Order fees","Concepts","Manage fee definitions","Fields on documents","Fees on one document","Fees on a direct order","Subscriptions and renewals","Quotes","Tax","Webhooks and types","MCP","Error codes","Related","201","Fees charge only while they are switched on for the environment:","Change one fee on this order only (rate for a percentage fee, amount for a flat one)","Remove a fee, and bring it back","Add a global fee that applies to subscriptions (from the next renewal), or stop charging one"],"text":"Orders Order fees An order fee is an extra charge on top of goods, shipping and tax: an insurance fee, a handling fee, a membership fee. You define fees once for an application and environment. They apply to new orders automatically, and you can remove, change or add a fee on one document. Each fee is its own row on every surface that shows money, placed after shipping and before tax. Concepts Global definitions. A fee is percentage ( rateBps , 1 to 10000, so 250 is 2.5%) or flat (an amount per currency in flatAmounts ). A percentage fee can carry a minimum and a maximum charge per currency. A fee can also have a minimum order amount, be limited to customer groups, be taxable (with an optional tax code), and apply to one-time orders, subscriptions or both. Archiving a fee does not touch documents that already froze it. The percentage base is the items after discounts. Shipping, tax and other fees are not in it, so fees never compound, and a discount code never reduces a fee. A flat fee stays even when the items are free. Each fee is rounded half-up to the minor unit, then the minimum and maximum apply. A flat fee with no amount for the document currency does not apply. Auto-apply. Storefront and hosted checkout carts, dashboard orders and quotes get the fees that are in force when they are created. Bulk imports and POST /api/v1/orders never get automatic fees: pass fees yourself (below). Per-document overrides. On a cart, an order or a quote revision you can add a global fee, add a one-off custom fee, change one fee's rate or amount for this document only, remove a fee (it stays as a removed row, so an automatic fee does not come back), or restore it. The source of a row is auto , override or custom . Frozen. Fee settings are copied onto the document when the fee attaches. Later edits to the global fee reach only open storefront carts and documents created afterwards. Fees stop being editable once money is on the document ( 409 fees_locked ). The one exception: when you edit the lines of a paid order, percentage fees are recalculated from their frozen settings and the difference goes through the normal charge or refund. Kill switch. Order fees are off by default per environment: PUT /api/v1/fees/settings with enabled : true . While it is off nothing is charged, and new orders, carts and quotes read fees: [] and feeTotal: 0 (a subscription still lists its stored snapshot), and totals are exactly what they were without fees. Turning it off also stops fees on quotes that were issued with fees and on subscription renewals. Orders, payment links and invoices already created keep their fees. Order fees are rolling out per application: GET /api/v1/fees/settings answers available , and while it is false turning fees on answers 403 fees_not_available . Refunds. Returns never refund fees by themselves. A full refund refunds everything; include fee money in a manual partial refund. Manage fee definitions GET|POST /api/v1/fees , PATCH|DELETE /api/v1/fees/:id , POST /api/v1/fees/reorder and GET|PUT /api/v1/fees/settings . Reads need applications:read , writes applications:write . DELETE archives the fee. reorder takes ids : [...] listing every current fee exactly once; fees are priced and shown in that order, with custom fees after global ones. Fields on documents Orders, carts, quote revisions (merchant and buyer reads), subscriptions ( fees only) and invoices carry feeTotal and fees . Rows you have removed are not listed. The change is additive: no existing field changed meaning. label is the text to print: the name, plus the rate for a percentage fee. Buyer-facing reads never list a fee whose amount is 0. Invoices read feeTotal and fees ( label, amount ) from the billing snapshot frozen at issue: 0 and [] on an invoice with no fees. The orders CSV export appends two columns at the end: fee_total and fees ( Label: 25.00; Label2: 18.00 , charged fees only). Fees on one document Fee edits are an admin action, including on carts. They need the scope above plus the matching dashboard permission: application:orders:write for carts, orders and subscriptions, application:quotes:write for quote revisions. A publishable key, an extension session or a payment-method token gets 403 permission_denied , so a buyer can never change what they are charged. Every route returns the document with its totals recomputed. An order made from a cart edits the cart's rows and re-quotes tax. A direct order re-prices over its own lines; a taxable fee is refused there ( 422 fee_invalid , details.field: taxable ) because a direct order carries the tax you send. On a quote only the working revision is editable. Order changes send order.updated . Fees on a direct order POST /api/v1/orders accepts fees (up to 20, stored as custom ) and feeCharge ( order , off_cycle or trial_signup ; default order ). Each fee takes name , kind , rateBps or flatAmount , taxable (default false; true is refused), taxCode , appliesToOneTime and appliesToSubscription . Unknown fields answer 400. A non-empty fees list answers 409 fees_disabled while order fees are off. Subscriptions and renewals A fee that applies to subscriptions is charged on the signup order and on every renewal. When a subscription is created, the signup order's fee rows that apply to subscriptions, with any overrides and removals, are copied onto the subscription as its snapshot. A renewal prices that snapshot: a percentage fee is a percentage of the renewal's plan amount, and a flat fee is charged once per renewal per subscription. Changing or turning off a global fee does not change existing subscriptions; add a fee to, or remove one from, a single subscription with the routes above. An added fee starts at the next renewal. A $0 trial signup charges no fees. The snapshot is still stored, and the first paid renewal charges it. Plan-change, proration and installment charges get percentage fees only, never a flat fee. In a mixed cart, a percentage fee's base"},{"title":"Authorize and Capture","route":"/developers/orders/capture","headings":["Authorize and Capture","The routes","Partial capture","amount vs capturedAmount","Full capture","Authorizing","Charge a saved card","Closing an order","Webhooks","Error codes"],"text":"Orders Authorize and Capture Most Throttle checkouts authorize and capture in one step. Splitting them lets you hold funds at order time and take the money when you actually ship — and take less than you held if the final total came in lower. The routes The order-scoped and payment-scoped routes do the same underlying work. Use the order-scoped pair when you are holding an order id and want Throttle to keep the order status in step; use the payment-scoped pair when you are working from a payment. Partial capture Only POST /api/v1/payments/{id}/capture accepts an amount . Omit it and Throttle captures the full authorized amount; pass one and it captures exactly that, in minor units. Capturing less than you authorized finalizes the payment at the captured amount — the uncaptured remainder is released back to the buyer by the processor, and there is no second capture against that authorization. Decide the final figure before you call this. If you need to bill more later, create a new payment on the order. Over-capturing is rejected with 400 capture_amount_exceeds_authorized . Its details are the authorized amount as a money value, amount, currency, display (minor units), plus requested , the amount you asked for in the same shape. A zero or fractional amount is refused with 400 invalid_capture_amount . Capturing a payment that is already captured is 409 payment_already_captured — a second capture moves no money, so a success there would be a lie. For network retries, send the original call again with an Idempotency-Key , which replays the first response. amount vs capturedAmount After a partial capture the payment keeps two figures, and they mean different things: amount — what was authorized . It does not shrink to match the capture. capturedAmount — what was actually taken, and what the buyer is charged. Anything that sums money — payouts, revenue reports, refund ceilings — must read capturedAmount . Reading amount overstates revenue on every partially captured order. Full capture The order-scoped route captures the whole authorization and keeps the order status aligned. The order must be past checkout and not cancelled: awaiting_payment , awaiting_fulfillment , awaiting_shipment , partially_shipped , shipped or completed . POST /orders/{id}/capture and /authorize check the payment first and treat an already-captured or already-authorized payment as a no-op, so a duplicated webhook or a retried job is harmless. The payment-scoped routes do not. Calling POST /payments/{id}/capture on a payment that is already captured , or /authorize on one that is no longer pending , fails. If you are driving these from a queue or a webhook handler, prefer the order-scoped pair or send an Idempotency-Key . Authorizing POST /api/v1/orders/{id}/authorize requires the order to be awaiting_payment — authorization is the first money step, so anything further along is a 400 invalid_order_state . On this route, re-authorizing an already-authorized payment is a no-op; on the payment-scoped route it is not (see above). Cancelling an order voids any open authorization, and any unpaid Net-N invoice ( authorized or pending ), automatically, so you do not need to release a hold or cancel the invoice by hand. See Order states . Charge a saved card POST /api/v1/orders/{id}/charge-saved-card charges a card the order s customer already has on file, for up to the order s outstanding balance: the total, less any comp, less what has been captured. Use it to retry a failed payment. The payment is created captured and the order advances as a processor capture would; a decline records nothing. Scope payments:write . paymentMethodId is the saved card s id from GET /api/v1/customers/{customerId}/payment-methods . Send an Idempotency-Key : a replay returns the first response, and the processor charge is keyed on it too. Closing an order POST /api/v1/orders/{id}/close moves a shipped order to completed , the terminal status, and moves no money. On an order that is already completed it changes nothing; from any other status it is 409 invalid_order_state . POST /orders/{id}/status with completed does the same from any status. Webhooks A successful capture emits payment.captured carrying both figures, so a consumer can tell a partial capture from a full one without re-fetching: A processor decline emits both payment.capture_failed and payment.failed . Handle whichever suits you, but expect both to arrive for a single failure. Error codes Full list and envelope shape on Error codes , and payment status meanings on Payment states ."},{"title":"Disputes and Chargebacks","route":"/developers/orders/disputes","headings":["Disputes and Chargebacks","Two ways a payment gets flagged","Flagging a payment","Clearing a dispute","How processor events are classified","Webhooks","Error codes"],"text":"Orders Disputes and Chargebacks A disputed payment is money you booked that is now contested — a card chargeback, or a B2B buyer refusing a Net-N invoice. Throttle surfaces both through the same three fields on the payment, written either by your own call or by the processor. If you are coming from a processor with a first-class Dispute resource, calibrate expectations: Throttle stores disputed , disputeReason , and disputeOpenedAt on the payment, plus disputeOutcome and disputeClosedAt once a card chargeback is decided. There is no evidence submission, no due date, and no dispute id on the payment. The fields exist so a contested payment stops looking like clean revenue in your reporting and your AR views — contest the chargeback in your processor s dashboard. Two ways a payment gets flagged You flag it. POST /api/v1/payments/{id}/dispute — mainly for Net-N receivables, where the dispute arrives as an email from a buyer rather than a processor event. The processor flags it. Inbound dispute.* and chargeback.* webhooks are matched to the payment by processor transaction id and write the same three fields. No configuration needed. Because both paths converge on the same columns, a consumer of payment.disputed does not need to care which one fired. Flagging a payment Scope payment_disputes:write . reason is required, 1–500 characters. disputeOpenedAt is stamped server-side. Flagging an already-flagged payment is a 409 already_disputed rather than a silent overwrite, so you cannot lose the original reason by retrying. Clearing a dispute Clearing sets disputed: false but deliberately leaves disputeReason and disputeOpenedAt in place, so the history of the dispute survives on the payment. It takes no body, and clearing a payment that was never disputed succeeds without emitting an event. How processor events are classified Inbound dispute events are classified from the event suffix and the target s status: disputed: true means a dispute is open right now — build your worklist from it. Once the processor decides a card chargeback, disputed goes back to false and disputeOutcome records won or lost , with disputeClosedAt . A lost chargeback rolls the order s paymentStatus up to charged_back . Net-N invoice disputes you clear by hand don t set an outcome. A resolution event for a payment that is not currently flagged is a no-op, and redeliveries of an open event will not re-fire payment.disputed — it is emitted only on the first transition into the disputed state. Webhooks payment.dispute_cleared carries only paymentId . payment.dispute_lost carries paymentId , reason , amount (minor units), currency , and closedAt , and fires once per loss. Subscribing to any of the three requires payment_disputes:read . Both are worth routing to a human — a chargeback is one of the few events where nobody finds out until a payout is short. See Webhooks . Error codes"},{"title":"Build an order from a cart","route":"/developers/orders/from-cart","headings":["Build an order from a cart","Create the draft order","Send a payment link","Collect a balance on a placed order","Take a card payment (phone orders)","Invoice on terms","Cancelling a builder order"],"text":"Orders Build an order from a cart The dashboard s order builder makes an order without a checkout: it fills a cart, turns it into a draft order, and then collects payment from the order. The same three routes are available to a secret key. Currency: an order without currency takes the store's main currency, and its payments follow the order's currency. See Multi-currency . Create the draft order POST /api/v1/orders/from-cart takes the id of an open cart in the credential s application and environment. Build the cart first with the cart API (line items, customer, addresses, shipping). Scope orders:write . The order is always created in draft and stamped metadata.createdVia: dashboard . Nothing is charged: a draft is an order waiting for a way to be paid. Its line items are locked to the cart s total, so PATCH /orders/{id}/line-items answers 409 order_edit_in_builder . Cancel the order and build a new one instead. See Order line-item edit codes . Converting a cart twice does not create a second order. The 409 names the first one: Send a payment link POST /api/v1/orders/{id}/payment-link opens a hosted checkout session on the order s cart that stays payable for seven days, and emails it to the order s customer. Send send : false to create the link without emailing it; emailedTo is then null , as it is when the order has no customer email. The body is optional. The route both changes the order and creates a checkout session, so an API key needs orders:write and checkout_sessions:write . Calling it again replaces the link: the previous session is cancelled first, so only the newest link can be paid. When the customer pays, the order leaves draft as any checkout does. The link pays the order exactly as built. Its page re-quotes tax only, on the cart s lines and shipping, and the buyer cannot change the email, addresses or VAT number: a /calculate that sends values other than the cart s answers 409 payment_link_details_locked . To change them, cancel the draft and build a new order. DELETE /api/v1/orders/{id}/payment-link cancels the link and answers 204 . It answers 204 when the order has no link, too. DELETE returns the same 403, 404, payment_in_progress , payment_link_conflict and payment_link_cancel_failed codes. Collect a balance on a placed order A captured payment cannot be increased. When an order s total goes up after it was paid (a line edit on an order whose customer has no saved card to charge, such as a guest checkout or a PayPal payment), the difference is left owing and the order reads partially_paid . GET /api/v1/orders returns each order s amountDue : its total, less any comp, less what has been captured. POST /api/v1/orders/{id}/balance-link opens a payment-only page for exactly that balance, payable for seven days, and emails it to the customer (the order s customer, else the email the order was placed with). Send send : false to create it without emailing it. The customer pays by card or any other method enabled for the application, and the payment is recorded on this order as a second payment. No new order is created. It works on any placed order, not only one built in the dashboard, and needs orders:write and checkout_sessions:write . Calling it again replaces the link and cancels the previous one. The balance is checked again when the customer pays: if it went down or was paid (a recorded payment, a saved-card charge), or the order was cancelled or put on hold, the payment is released, nothing is charged, and the page answers 409 balance_link_closed . The order then needs a new link for whatever is still owed. The emailed template is customer.order_balance_request . Cancelling the order from the dashboard or the orders API closes an open balance link first. If the customer is paying it right then, the cancel answers 409 payment_in_progress and the order is not cancelled. Take a card payment (phone orders) POST /api/v1/orders/{id}/card-entry starts a card payment the merchant types in for the customer: a mail or telephone order. It answers 201 with a sessionId , an embedUrl that is valid for 30 minutes, expiresAt and saveCard . The Throttle dashboard shows the embedUrl in a dialog under Take card payment (the order page s Card payment button); no other page may embed it, and its URL does not work as a page of its own. The card is typed into the payment processor s secure form, never into Throttle, and is charged as a MOTO transaction, so the bank does not ask the merchant for a 3-D Secure check meant for the cardholder. Send saveCard : true to save the card to the order s customer for future orders. It is always saved when the order has a subscription line, because renewals charge it. Saving needs a customer on the order: 422 customer_required otherwise. A card that is not saved is never stored. It takes the same orders as a payment link: a draft built in the dashboard from a cart. An open payment link, or an earlier card form, is cancelled first, so the order can only be paid once. It needs orders:write and checkout_sessions:write . A completed payment moves the order out of draft exactly as a checkout does, captured, with any subscriptions created on the saved card. Your payment processor must accept MOTO transactions on your account. Some, Stripe among them, enable it on request; until then a card whose bank wants a 3-D Secure check is declined. Invoice on terms POST /api/v1/orders/{id}/invoice-on-terms issues a Net-N invoice for the draft and moves the order to awaiting_fulfillment , the way a buyer choosing Invoice Terms at checkout does. The merchant accepts the terms on the buyer s behalf: companyName and billingEmail are recorded on the acceptance, and the payment s metadata records termsAcceptedBy: merchant . It requires an active Invoice Terms connector. An API key needs payments:write and orders:write . netDays (0 to 365, 0 is due on issue) sets the terms for this invoice. Omit it and the usua"},{"title":"Returns and Exchanges","route":"/developers/orders/returns","headings":["Returns and Exchanges","Lifecycle","Open a return","How refundAmount is computed","Transitions","The refund on completion","Exchanges","Webhooks","Error codes"],"text":"Orders Returns and Exchanges A return is an RMA against a subset of an order s line items. It moves through an explicit state machine, and the money only moves at the end — either as a refund on complete , or as the price difference on an exchange. Lifecycle Only requested , approved , received , and completed hold a returned quantity against the order. Rejecting or cancelling releases it, so the buyer can open a fresh return for the same line later. Open a return POST /api/v1/orders/{id}/returns — scope order_returns:write . Pass the line items and quantities coming back. reason (max 1000 chars) and restock are optional. Throttle computes refundAmount at creation time and returns it on the object, so you can show the buyer the exact figure before anyone approves anything. List an order s returns with GET /api/v1/orders/{id}/returns and fetch one with GET /api/v1/returns/{id} — both scope order_returns:read . How refundAmount is computed Throttle refunds what the buyer actually paid for those units, not the list price. Per line that is: the line subtotal, plus the tax charged on it, minus any discount applied directly to that line, minus that line s proportional share of any order-level discount. The result is prorated across the returned quantity and telescopes exactly across repeated partial returns — returning 1 unit three times refunds the same total as returning 3 units at once, with no rounding drift. Transitions POST /api/v1/returns/{id}/transition with an action . Anything not listed here is a 409 invalid_return_state . The refund on completion Completing a return resolves the order s payment in captured or partially_refunded status and refunds refundAmount against it, stamping refundPaymentId on the return. The refund carries the reason return:{returnId} . If the order has no captured payment — an unpaid Net-N invoice, say, or an order captured outside Throttle — the return still moves to completed and no refund is issued. The server logs a warning, but the API returns 200. If you rely on a return implying money moved, assert on refundPaymentId being non-null rather than on the status. If the processor declines the refund, the transition fails with 402 refund_failed and the return stays in received , so you can retry. Exchanges POST /api/v1/returns/{id}/exchange swaps the returned goods for replacements instead of refunding. The return must be in approved or received ; it is an alternative route to completed that settles a difference rather than issuing the standard refund. Throttle then: creates a replacement order carrying metadata.exchange_for_return pointing back at the return, computes delta = replacementTotal − refundAmount , charges the customer s stored card when delta > 0 , or refunds the difference when it is negative, marks the return completed and stamps the replacement order id. Replacements are charged at list price — this path has no address-aware tax quote yet. Because delta compares against the return s paid value (which does include tax), an even-swap exchange produces a small refund roughly equal to the returned line s tax. The difference favours the buyer, never the merchant, but budget for it if you run high exchange volume. A delta > 0 needs someone to bill: if the original order has no customer attached you get 409 no_customer , and a declined card is 402 payment_failed . In both cases no replacement order is left half-settled. Webhooks Opening a return emits return.created . Every transition and every exchange emits return.updated , carrying status and previousStatus so you can react to a specific edge rather than polling. Subscribing requires order_returns:read . See Webhooks . Error codes Full list and envelope shape on Error codes ."},{"title":"Pick the Smallest Package That Does the Job","route":"/developers/packages","headings":["Pick the Smallest Package That Does the Job","Package Boundary"],"text":"SDKs and CLI Pick the Smallest Package That Does the Job Throttle publishes focused packages for checkout embeds, native cart orchestration, discounts, generated REST calls, and command-line setup. Each package card calls out where it is safe to run and whether it is production-ready today. Server SDKs do not take a separate environment option for normal API calls. Generate separate keys for Production, Test, UAT, or any custom non-production environment; the raw key is pinned to exactly one workspace environment. Every non-production environment routes to sandbox provider credentials. Clerk-authenticated dashboard calls that are not using an API key send X-Throttle-Environment-Id instead. packages.map((item) => ( )) Package Boundary For public integrations, use the @usethrottle/* packages above. If a package is not listed here, it is not public API."},{"title":"Upgrading api-client from 2.x to 4.x","route":"/developers/packages/api-client-2-to-4","headings":["Upgrading api-client from 2.x to 4.x","Breaking changes that stop compiling","Breaking changes that still compile","order.completed became order.fulfilled","What you gain","Upgrade checklist"],"text":"Packages Upgrading api-client from 2.x to 4.x Two major versions shipped a day apart in August 2026: 3.0.0 (one order status instead of two) and 4.0.0 (payments that are still in flight). This page lists every breaking change between 2.18.0 and 4.3.0 , taken from a diff of the two published packages. This page records the August 2026 changes and is kept as history. Since 2026-11-23 orders use ecom-standard statuses ( awaiting_payment , awaiting_fulfillment , awaiting_shipment , partially_shipped , shipped , completed ) and the events below were retired in turn: order.fulfilled is now order.shipped or order.completed , and order.closed is order.completed . That change is a new major of @usethrottle/api-client . For the mapping and the window in which the old values are still accepted, see Renamed statuses . Throttle serves one API version. Staying on 2.x does not keep the old behaviour — it keeps types that describe it. Three things are already true for a 2.x client today: postApiV1OrdersComplete returns 404, an order is never completed (it is fulfilled ), and order responses carry no fulfillmentStatus . Everything else in 2.x keeps working. Breaking changes that stop compiling OrdersService.postApiV1OrdersComplete is gone. The endpoint ( POST /orders/ id /complete ) was removed with the status it set. Use postApiV1OrdersStatus , which moves an order to any lifecycle status. Order status : completed became fulfilled . The full set is now draft , pending , processing , partially_fulfilled , fulfilled , cancelled , closed . Stored orders were migrated; you will not receive completed from any client version. fulfillmentStatus was removed from order responses and filters. Delivery progress is in status itself, with per-item counts in fulfillmentSummary . See Order states . Status unions grew. Order paymentStatus gained processing , disputed and expired ; payment status gained processing and expired . An exhaustive switch over either stops type-checking until it handles them. The delivery-log eventType filter no longer accepts order.completed . See the event rename below. Before 4.0.0 a payment the processor had not yet decided — a 3DS challenge in progress, a redirect the buyer had not returned from, a bank debit still settling — was reported as failed . If your code retries or re-charges on failed , make sure it does nothing on processing . Breaking changes that still compile The generated client takes positional arguments. Two list methods gained filters in the middle of their argument lists, so an existing positional call shifts by one or two places. TypeScript catches the shift where the types differ and misses it where both sides are string . OrdersService.getApiV1Orders — delivery was inserted before source , and subscriptionId before createdAfter . A call that filtered by customerId now passes that id as the free-text search q , and its createdAfter as customerId . Neither is a type error. WebhooksOutboundService.getApiV1WebhookDeliveries — status and eventType were inserted before limit and offset . TypeScript rejects a number where status is expected; plain JavaScript does not. Every other method kept its argument order. Re-check these two by hand; a green build does not prove them. order.completed became order.fulfilled order.completed was renamed to order.fulfilled on 2026-08-22 and is no longer delivered. Stored webhook and extension subscriptions were rewritten to the new name. order.completed is still accepted in enabledEvents when you create or update an endpoint, in 4.x as in 2.x, and is dropped from the saved list. That is deliberate: it keeps a read-modify-write of an old subscription list from failing. It is not a sign the event still fires. order.fulfilled is not in the 2.x enabledEvents type, but the API accepts it from any client. On 2.x, cast the value; on 4.x it is in the union. order.fulfilled and fulfillment.completed are different events — the first is about the order, the second about one fulfillment. Subscribe to whichever your handler is really about. What you gain Orders: postApiV1OrdersStatus , postApiV1OrdersHold / postApiV1OrdersHoldRelease , postApiV1OrdersComp / postApiV1OrdersCompReverse , getApiV1OrdersTimeline , getApiV1OrdersStatusHistory ; a delivery filter ( in_transit , delivered , returned ) and a subscriptionId filter; the same filters on the CSV export. Payments: postApiV1OrdersPaymentsRecord (record a payment taken outside Throttle, including cheque ) and postApiV1PaymentsMarkFailed ; payment responses declare errorCode and errorMessage . Fulfillments: postApiV1FulfillmentsDelivered . Subscriptions: postApiV1SubscriptionsRetryCharge and postApiV1SubscriptionsWaivePeriod . Webhooks: order.fulfilled , order.held , order.hold_released , order.comped , order.comp_reversed , payment.processing , payment.expired , payment.recorded ; the delivery log filters by status and eventType . Customers carry company ; embed config carries checkoutLinkBaseUrl . Upgrade checklist Search for postApiV1OrdersComplete , 'completed' and fulfillmentStatus . These are already wrong on 2.x, so fix them first — before or without the upgrade. Install 4.x and fix what the compiler reports: the removed method, the removed field, and any exhaustive switch over a payment status. Find every call to getApiV1Orders and getApiV1WebhookDeliveries and re-count the arguments against the lists above. The compiler will not find all of these for you. Replace order.completed with order.fulfilled in the event list you send, and in the handler that switches on the delivered type . Make sure nothing treats a processing payment as a failure."},{"title":"Payment Methods","route":"/developers/payment-methods","headings":["Payment Methods","Two-step auth flow","Endpoint reference","Subscription self-service","The SavedCard shape","Error reference","Security notes","Cards must be attached through the embed","React package","Step 1 — backend: mint a client token","Step 2 — frontend: render the component"],"text":"Buyer wallet Payment Methods Let buyers view, manage, and add payment methods in your storefront without exposing your secret key to the browser. A short-lived customer-scoped token gates all buyer-facing card operations; your backend mints it, the browser uses it. The add-card token takes an optional currency for the verification hold; see Multi-currency . @usethrottle/payment-methods wraps the flow below as a headless core, React hooks, and a pre-built component. See the React package section at the bottom of this page, or use the HTTP routes directly if you prefer. Only cards vaulted through the add-card embed — the flow on this page, which finishes at POST /api/v1/me/payment-methods/confirm — can be charged later for subscription renewals, plan changes, or any other merchant-initiated payment. That step is what records the processor buyer reference those charges require. Attaching a card directly with POST /api/v1/customers/ id /payment-methods stores it and lists it correctly, but it cannot establish that reference, so every later charge fails with 402 payment_failed: payment_method_not_chargeable . Use that endpoint only for record-keeping, never as a card wallet. Two-step auth flow The payment-methods API uses a client token pattern that mirrors how Throttle's embedded checkout protects your secret key. Your backend mints a short-lived token scoped to one customer; the browser uses that token for all card management calls. The secret key never leaves your server. Backend mints a client token. Call POST /api/v1/payment-methods/client-token with your sk_* secret key and the customer's Throttle customerId . Throttle returns a short-lived JWT. Browser calls the /me routes. All /api/v1/me/payment-methods* routes accept the token in the X-Throttle-PM-Token header. The token authorizes ONLY that one customer's payment methods — no cross-customer reads are possible. Endpoint reference POST /api/v1/payment-methods/client-token Mints a customer-scoped payment-method client token. Call this from your backend; never expose your secret key to the browser. Field Type Required Description customerId string Yes The Throttle customer ID ( cus_* ) for the authenticated buyer. subscriptionId string No Mint an update-card link for this subscription instead of a portal token. The token carries the subscription, lives 14 days instead of 30 minutes, and the response adds updateCardUrl — the hosted /billing/{token} page. Send it to the buyer yourself, or use it when the renewal-failed email is not enough. The subscription must belong to customerId ; otherwise 404 . Auth: X-API-Key (secret key, sk_* ). The key must have the customer_payment_methods:write scope. The returned token is a signed JWT. Pass it to the browser as a session value or a short-lived cookie; do not persist it long-term. The expiresAt timestamp (ISO 8601) tells the browser when to request a fresh token. GET /api/v1/me/payment-methods Returns the list of saved cards for the customer identified by the PM token. Auth: X-Throttle-PM-Token header (browser-safe) PATCH /api/v1/me/payment-methods/:id Sets a saved card as the default. Currently the only writable field is isDefault: true — you cannot unset a default directly; set another card as default instead. Auth: X-Throttle-PM-Token header Field Type Required Description isDefault boolean Yes Must be true . Promotes this card to the default; the previously-default card is demoted automatically. The customer's subscriptions that renewed on the previous default move to the new default, and each one emits subscription.updated . Subscriptions deliberately on another card stay where they are. The merchant set-default route behaves the same way. To move a single subscription, use PATCH /api/v1/me/subscriptions/:id/payment-method instead. DELETE /api/v1/me/payment-methods/:id Removes a saved card. Returns 200 with data: id , meta on success. Auth: X-Throttle-PM-Token header If the card being deleted is the default payment method and the customer has at least one active subscription, Throttle returns 409 cannot_remove_default . Prompt the buyer to set a different card as the default first, then retry the delete. Deleting a card that a subscription renews on, but that is not the default, is allowed: that subscription falls back to the customer's default card at its next charge. No subscription.updated is emitted for the change. POST /api/v1/me/payment-methods/embed-token Returns an add-only vault embed payload so the buyer can add a new card without going through a full checkout flow. The embed is configured to vault-only (zero-amount); it will not capture a charge. Auth: X-Throttle-PM-Token header The React component (see React package below) calls this endpoint and mounts the embed for you — you never handle the raw payload. Reach for the endpoint below only if you are building a fully custom embed; the provider-specific fields it returns are consumed by the widget, not by your code. Subscription self-service The same X-Throttle-PM-Token also reaches the customer's own subscriptions, so a buyer who has just saved a card can settle a past-due renewal without leaving the page. This is what Throttle's hosted “update your card” link uses; a portal you build can call it the same way. A token minted for a dunning link carries a subscriptionId claim naming the subscription it is about; a token minted through the client-token route does not, and can read any subscription the customer owns. Throttle's own hosted page for this flow is https://checkout.usethrottle.dev/billing/{token} : it shows the plan and the amount due, saves the card through the add-only embed, makes it the card for that subscription only (the customer's default card and their other subscriptions are left alone), and charges a past-due subscription while the buyer is still on the page. GET /api/v1/me/subscriptions/:id One of the authenticated customer&apos"},{"title":"Permissions Reference","route":"/developers/permissions","headings":["Permissions Reference","How permission checks work","Permission catalog","Permission scope notes","Workspace-only permissions","Read vs write split","Check permissions at runtime"],"text":"Workspace Permissions Reference Every dashboard action maps to a named permission. A permission is granted when the caller's workspace role or their application role on the target application satisfies the rule — whichever axis applies first wins. See Team management for how roles are assigned. This page describes role-based permissions (RBAC) — the rules that gate human users authenticating with a Clerk session in the dashboard. They are a separate system from API key scopes , which gate machine-to-machine calls made with an sk_ / pk_ key. A Clerk caller carries the wildcard scope and is gated purely by these permissions; an API-key caller is gated purely by its scopes and never by RBAC. The two systems compose; neither replaces the other. How permission checks work For each request Throttle resolves two values from the auth context: the caller's workspace-level role ( owner | workspace_admin | none) and their application-level role on the specific application being acted on ( admin | developer | finance | viewer | none). A permission is granted if either role set contains the caller. owner and workspace_admin satisfy most application-level permissions without needing an explicit per-application role. They act as supersets of any application role on any application in the workspace. Roles answer “can this person perform the action?” Environment grants answer “can this person use the selected workspace environment?” A caller must pass both checks. Requests outside the member's environment grant return 403 member_env_forbidden . The permission check is exposed at GET /api/v1/auth/permissions . The response lists every permission key and whether it resolves to true for the authenticated caller, optionally scoped to a specific application via the x-application-id header. Permission catalog The table below lists every permission string, which workspace roles satisfy it, and which application roles satisfy it. A dash (—) means that role axis is not checked for that permission. Permission Workspace roles Application roles workspace:delete owner — workspace:transfer owner — workspace:billing owner — workspace:invite-admin owner — workspace:settings owner, workspace_admin — workspace:invite owner, workspace_admin admin workspace:edit-member owner, workspace_admin — workspace:remove-member owner, workspace_admin — workspace:read-team owner, workspace_admin, member — workspace:audit-log owner, workspace_admin — application:settings owner, workspace_admin admin application:api-keys owner, workspace_admin admin, developer application:webhooks owner, workspace_admin admin, developer application:customers:write owner, workspace_admin admin, developer application:customers:read owner, workspace_admin admin, developer, finance, viewer application:customer-groups:write owner, workspace_admin admin, developer application:customer-groups:read owner, workspace_admin admin, developer, finance, viewer application:orders:write owner, workspace_admin admin, developer application:orders:read owner, workspace_admin admin, developer, finance, viewer application:imports:write owner, workspace_admin admin, developer application:imports:read owner, workspace_admin admin, developer, finance, viewer application:quotes:write owner, workspace_admin admin, developer application:quotes:read owner, workspace_admin admin, developer, finance, viewer application:forms:write owner, workspace_admin admin, developer application:forms:read owner, workspace_admin admin, developer, finance, viewer application:invoices:read owner, workspace_admin admin, developer, finance, viewer application:refunds:issue owner, workspace_admin admin, developer, finance application:payments:read owner, workspace_admin admin, developer, finance, viewer application:payments:record owner, workspace_admin admin, finance application:orders:comp owner, workspace_admin admin, finance application:orders:hold owner, workspace_admin admin, finance application:finance:read owner, workspace_admin admin, finance, viewer application:edit-app-member owner, workspace_admin admin application:extensions:read owner, workspace_admin admin, developer, finance, viewer application:extensions:write owner, workspace_admin admin, developer application:extensions:install owner, workspace_admin admin, developer application:extensions:admin owner, workspace_admin admin support:read owner, workspace_admin, member — support:write owner, workspace_admin, member — Permission scope notes Workspace-only permissions workspace:delete , workspace:transfer , workspace:billing , and workspace:invite-admin are exclusively for the owner. No application role satisfies these. workspace:settings covers workspace branding, sender domains, and workspace-scoped email settings. workspace:edit-member and workspace:remove-member require workspace_admin or above; no application role grants them. Read vs write split The finance role sees customers, orders, and payments but cannot write to customers or orders. It can issue refunds. The viewer role is fully read-only. It cannot issue refunds or perform any write action. The developer role is the same as finance plus write access to customers and orders, and access to API keys and webhooks. Check permissions at runtime Call GET /api/v1/auth/permissions with a Clerk JWT. Pass x-application-id to resolve application-level role flags for a specific application. The response shape is: workspaceRole : workspace_admin , appRole : developer , permissions : workspace:delete : false, workspace:invite : true, application:api-keys : true, application:customers:write : true, ... The dashboard uses this response to show or hide actions in the UI. Call it once on page load and cache client-side for the session duration."},{"title":"Accept Your First Payment","route":"/developers/quickstart","headings":["Accept Your First Payment","1. Configure your application","2. Create an API key","3. Create a checkout session","4. Render the React embed","5. Subscribe to webhooks"],"text":"Quickstart Accept Your First Payment This flow uses a server-created checkout session and the React payment embed. It is the fastest native Throttle integration path. The dashboard can run a test checkout for you: open App , then the Checkout tab, and click Run test checkout . If that completes, the application is configured correctly and any later failure is in your own integration. See Testing . 1. Configure your application Before any SDK call works, you need two values from the dashboard: the Application ID and at least one allowed origin . Both ship empty on a fresh signup, which is why following the snippets below verbatim returns applicationId is required or renders Embed not authorized . Sign in to the dashboard . A default application is created for your workspace on first login. If you have more than one, switch between them with the app switcher in the top bar. Open App Settings → General and copy the Application ID (the field has a Copy button; it also appears on the API keys page). Stash it as THROTTLE_APPLICATION_ID . Still in App Settings , add your storefront origin to Allowed origins (e.g. http://localhost:3000 in dev, https://shop.example.com in prod). Origins are scheme + host + optional port — no paths, no trailing slash. http://localhost and http://127.0.0.1 are accepted in every environment for local development. In a non-production environment you can also list one wildcard per entry for preview deployments, such as https://*.preview.example.com — see preview origins . Production takes exact origins only. Install the CLI with npm install -g @usethrottle/cli and set your allowlist without opening the dashboard: throttle embed-config set --origins http://localhost:3000 . It reads your secret key from $THROTTLE_API_KEY (or prompts for it); throttle embed-config show prints the current config. See the packages & SDKs page for everything the CLI and libraries expose. The embed enforces an origin allowlist server-side, and the cart/checkout endpoints reject requests without a valid applicationId . Both checks happen before any SDK error path — you'll see the failure as a 400 or an unauthorized embed instead of a hint that you need to set these. Every new application is automatically wired to a dedicated sandbox sub-account during signup, so PaymentEmbed renders (with the Card Simulator method) the first time you mint a checkout session in a non-production environment — no provider setup required. To accept real cards in production you still have to subscribe and add Throttle's production payment connection from Connectors ; details on Workspace environments . 2. Create an API key In the dashboard, open API keys (under Developers in the left nav), click Create key , and choose a secret ( sk_ ) key with the scopes you need. The raw key is shown once — copy it immediately; only the prefix is stored afterward. Keys are minted to one workspace environment, so the prefix carries that environment s segment — sk_live_* for production, or the environment s own slug otherwise, e.g. sk_test_* or sk_uat_* . Switch environments with the selector in the top bar before creating a key. Use a pk_ publishable key for browser-side shipping/tax quotes only; everything else uses the secret key from your backend. Never put an sk_ key in browser code, mobile apps, or public repositories. The browser should only receive a checkout session id or hosted URL from your backend. For everything beyond checkout — orders, customers, subscriptions, discounts, and webhooks — use @usethrottle/api-client instead of raw fetch . It's generated from the OpenAPI spec, so endpoints, event names, and request/response shapes are all typed (no guessing /webhooks vs /webhook-endpoints , or checkout.* vs cart.* event names). 3. Create a checkout session From your backend, create a native Throttle cart, add your line items, then mint a session for that cartId . This two-step native flow is the default — reach for externalCartId only when you’ve connected an external cart provider. The checkout SDK keeps your secret key server-side and returns sessionId , hostedUrl , and embedUrl . 4. Render the React embed Install the checkout SDK for your backend route and the React embed for your checkout page, then mount PaymentEmbed . In a non-production environment the embed shows the Card Simulator's card form. Enter 4111 1111 1111 1111 with any future expiry date and any security code, then submit: the simulator approves it and onSucceeded fires. No real card is charged. Testing covers causing a decline and checking the webhooks the payment produces. 5. Subscribe to webhooks Browser callbacks are immediate UI signals. Webhooks are your durable source of truth for fulfillment, receipts, and order state. Read the webhooks guide to verify signatures and handle retries idempotently."},{"title":"Quotes","route":"/developers/quotes","headings":["Quotes","Status","Core concepts","Create and issue a quote","Request a quote from a cart","Add to Quote on your storefront","Hosted request forms","The buyer link","Subscription lines","Catalog lines","SKU-only lines","Generated plan IDs","Missing prices","Changing the currency","Shipping address","Buyer view","Catalog line errors","Quote catalog routes","Accept a quote","Shipping at checkout","Tax on a quote","Which addresses the checkout asks for","Payment terms are enforced, not advisory","Errors","Reopen an accepted quote","Order fees","Emails, expiry, and PDF","Webhooks","The response includes quote.shareToken — the buyer link is","https://checkout.usethrottle.dev/q/{shareToken} (hosted page ships with the","public-link release).`;","The cart itself is unchanged.","No API key: the qrf_ form token is the authority, so this is safe from a browser.","Every line lands on the quote's working revision UNPRICED. targetUnitPrice is","recorded as the buyer's ask and shown to your rep; it never sets what you quote.`;","items[0] to items[2] have no name, so the Product Catalog fills them, priced","in USD for this customer (here a customer in no price group). The unitPrice","on items[1] overrides the catalog price. items[3] is an ordinary line.`;","Without an installed, active Product Catalog: { \"data\": { \"rows\": [], \"available\": false } }`;","Response: { \"data\": { \"quote\": {...}, \"checkoutUrl\": \"https://checkout.usethrottle.dev/s/...\" } }"],"text":"Guides Quotes B2B sales quotes: a buyer requests pricing, a rep builds and issues a revisioned proposal, and acceptance converts directly into a Throttle order with card, Net-N, or deposit + balance payment terms. Status Build and issue quotes from the dashboard (Quotes in the app sidebar) or the API, and buyers view their quote at https://checkout.usethrottle.dev/q/{shareToken} — toggle optional lines, comment, request changes, decline, or accept. Accepting materializes a checkout session and converting it into a Throttle order happens automatically once payment succeeds. Lifecycle emails, expiry reminders + auto-expiration, a downloadable PDF, deposit-and-balance terms, and hosted RFQ intake forms are all live. Sales quotes are unrelated to shipping/tax quote tokens. Core concepts Quote — the negotiation record. Carries a Q-{seq} number, customer linkage, an optional buyer-supplied reference number ( buyerReference ), and one share token that will be the buyer's permanent link. Revision — an immutable commercial snapshot. Exactly one working revision is editable at a time; issuing freezes it ( issued ) and supersedes the previous offer. Line items support optional upsells and per-line quantity locks ( qtyEditable ). Payment terms — pay_in_full , net_terms (Net-1..365), or deposit_balance (deposit due at acceptance, the balance becomes a receivable). Deposit amounts are computed and frozen at issue time. Lifecycle — draft → requested → under_review → proposed → accepted → converted , with revision_requested , declined , expired (re-issuable), and archived branches. Transitions are service-enforced. A buyer declines an issued quote from the link; a merchant declines a request it will not price with PATCH /api/v1/quotes/ id status: declined , declinedReason , which emails the buyer the reason. An accepted quote the buyer has not paid can be reopened back to proposed . Create and issue a quote Requires an API key with the quotes:write scope (dashboard roles map to application:quotes:* permissions). Prices are integers in minor units. Editing after issue is explicit: POST /api/v1/quotes/{id}/revisions clones the issued revision into a new working revision; PATCH /api/v1/quotes/{id}/revisions/{revId} edits it; issuing again supersedes the prior offer at the same buyer link. Request a quote from a cart Add to Quote on your storefront For buyers who want to browse and collect several products before asking, @usethrottle/quotes ships a quote cart: a persisted list the buyer builds while moving around your site, submitted as one request. It needs no API key — the qrf_ form token is the authority, so it is safe in the browser. Throttle stores no product catalog, so lines come from your own product data, the same way the shopping cart works. Quantities merge when the same SKU is added twice, and the cart survives page navigation. A buyer who already filled a normal cart can ask for a quote on it instead: pass cartId to POST /api/v1/quote-requests and its lines join the request. The cart is resolved inside the form's own application and environment, so an id from anywhere else is simply not found. Cart prices are recorded as the buyer's target, not as the quoted price — a cart is assembled in the browser, and this endpoint authenticates no one but the form. Hosted request forms For inbound RFQs without any integration, create a hosted intake form from the dashboard (Quotes → Request forms) or via POST /api/v1/quote-request-forms . The response reveals a qrf_ form token exactly once (hash-only stored — rotate to mint a new one); the buyer-facing form lives at https://checkout.usethrottle.dev/q/request/{formToken} . Submissions create-or-find the customer by email, open a requested quote (source request_form ) with the buyer's free-text need as the first shared comment, and fire the same quote.requested webhook + rep notifications as every other intake path. A request can carry line items, a written need, or both — at least one of the two. Items land on the quote's working revision unpriced , carrying the name, SKU, quantity, and per-line note the buyer supplied, so your rep prices an itemised sheet instead of transcribing prose. The hosted page renders item rows by default; set fields.lineItems: false for a prose-only form, or fields.targetPrice: true to let buyers name the price they are after. The public form read ( GET /api/v1/quote-request-forms/{token}/public ) carries currency : the currency the quote will be created in, from the form or request, else the store's main currency. The hosted page shows the target-price input with that currency's symbol and decimals, and hides it when the response has no currency . It also carries tracking , the application's public analytics block (IDs and toggles, never secrets, null when it cannot be read), which the hosted page uses to load your GA4 tag and send generate_lead on submit. targetUnitPrice is recorded against the line and shown to your rep while they price it, but it never becomes the quoted price. Everything on this endpoint arrives from a browser holding only a public form token, so treating any of it as pricing would let a buyer set what you charge. Shipping address (optional). Set fields.shippingAddress: true to show an optional address section on the hosted form. The submission takes shippingAddress with addressLine1 , addressLine2 , city , stateProvince , postalCode and countryCode (ISO 3166-1 alpha-2). An all-blank address is ignored; a partly filled one without addressLine1 , city and countryCode is 400 invalid_request , and retired names such as line1 are rejected with the canonical name. The address is stored on the quote as shippingAddress (your team can correct it, see “Shipping address” below) and prefilled into the checkout shipping step when the buyer accepts (they can still change it). It is added to the custome"},{"title":"React Package · @usethrottle/quotes","route":"/developers/quotes/react-package","headings":["React Package · @usethrottle/quotes","Install","The buyer quote page","Errors","RFQ request form","Payment terms"],"text":"Quotes React Package · @usethrottle/quotes Buyer-facing components, hooks, and a same-origin proxy for the hosted quote link and the RFQ request form — so you can serve the buyer experience from your own storefront instead of sending people to Throttle's hosted page. Everything here is authorized by the qtl_ capability token in the buyer's URL — there is no API key, because this runs in the browser. Merchant operations (create, price, issue, revise, record acceptance) need an sk_* key and live in @usethrottle/api-client 's QuotesService , which must stay server-side. Install React 18+ is a peer dependency. The package ships ESM and CJS builds with type declarations, and exposes two entrypoints: the root (browser) and /server (the optional proxy). The buyer quote page Mount QuoteView on a route that receives the token from the buyer's emailed link. It renders line items with optional toggles and editable quantities, live totals, revision history, the comment thread, a PDF link, and the accept / request-changes / decline actions. On acceptance it sends the buyer to Throttle hosted checkout. QuoteItem.recurring carries a line's subscription terms. lineDueAtAcceptance(item, quantity) and computeSelectionTotal count a free-trial line as 0, the rule the server charges by, and QuoteView prints each subscription line's terms and the split totals (Due at acceptance, Recurring after). The default markup is deliberately plain — it is meant to be restyled or replaced. For your own presentation, use the hook directly. useQuote(token, options?) The hook owns the behaviour that is easy to get wrong: Fires the view beacon once per mount, so the merchant sees first viewed telemetry. The API throttles the resulting quote.viewed webhook to one per revision per 6 hours. Seeds selections from the revision, so a re-issue that adds or locks lines resets the buyer to the new offer. Refetches automatically on revision_superseded — the rep re-issued while the buyer was reading. Sends only the selections the rep actually allows: locked lines and non-optional lines are never included in the acceptance payload. total is computed with the same rule the server applies at acceptance , including scaling a line's tax and discount pro-rata when the buyer changes its quantity. Rolling your own sum risks showing the buyer one number and charging another. Errors Everything throws ThrottleQuotesError , which extends the shared ThrottleError and carries the API's own code . code meaning revision_superseded A newer revision was issued. currentRevisionId names it; useQuote auto-refreshes. quote_expired The offer lapsed (410). Prompt the buyer to request updated pricing. invalid_item_selection A locked line's quantity was changed, a required line deselected, an unknown item sent, or (for deposit terms) the selection fell to or below the deposit. accept_in_progress A concurrent acceptance won the race. Retry shortly. not_found Unknown or rotated token, or a draft/archived quote. RFQ request form Bot protection is wired in: the honeypot field and the mount-time anchor that feeds the API's minimum-fill-time check. A honeypot hit returns a success-shaped response and creates nothing — by design, so a bot cannot learn it was caught. Treat submission success as accepted , not created . If the form requires Cloudflare Turnstile, render the widget yourself and pass its token as turnstileToken — this package pulls in no third-party script. A form that requires Turnstile on a store where it is not configured is refused with turnstile_not_configured rather than silently accepted. Same-origin proxy · /server entrypoint Quote links work fine calling Throttle directly — the token is the credential. Proxy through your own origin if you would rather not have a third-party host in the address bar or CSP. The proxy forwards no API key . It allow-lists the public quote paths, so it cannot be pointed at a merchant endpoint; rejects traversal and any method other than GET/POST; passes the PDF 302 straight through instead of buffering the file; and forwards x-forwarded-for so acceptance evidence and per-IP limits attribute to the real buyer. Payment terms A quote carries one of three modes on currentRevision.paymentTerms : pay_in_full — card at checkout. net_terms — invoice due in netN days. deposit_balance — depositAmount charged today by card, the remainder invoiced balanceNetN days out. depositAmount is frozen when the rep issues the quote, so it does not move when the buyer edits quantities. Selections that would drop the total to or below the deposit are rejected with invalid_item_selection ."},{"title":"Cart states","route":"/developers/reference/cart-states","headings":["Cart states","State machine","States","Mutation rules","Abandoned-cart recovery","Where the recovery link points"],"text":"State reference Cart states A cart s status field is the single source of truth for whether it can still accept mutations. Only open carts are writable. State machine States open — initial state. Accepts items, discount apply/remove, shipping select, tax recompute, and checkout conversion. checkout — cart has been converted to a draft order (POST /carts/ id /checkout ). The cart is frozen; further mutations return 409 cart_already_checked_out . converted — the linked draft order was paid and an order row was finalised ( payment.captured fired). Read- only; archived. abandoned — no activity for 24 hours (or past the cart s expiresAt ), OR the linked draft order was cancelled before payment. An hourly background sweep performs the idle transition and emits cart.abandoned . Read-only. See Abandoned-cart recovery below. Mutation rules Every mutation increments sequence on the cart. Webhook payloads include sequence so subscribers can detect out-of-order delivery. POST /carts/ id /checkout transitions open → checkout . Idempotent within the 24h Idempotency-Key window — same key replays the same draft order id. Direct transitions out of checkout / converted / abandoned via the cart API are not allowed. Cancel the linked order to roll the cart back to abandoned . Mutating a non-open cart returns one of: cart_already_checked_out (409), cart_already_converted (409), or cart_abandoned (410). Abandoned-cart recovery An hourly background sweep marks idle carts as abandoned and emits cart.abandoned . A cart is idle when it has had no mutation for 24 hours — every item, shipping, discount, or tax change resets the clock — or when its expiresAt has passed. Empty carts and externally-managed carts are never swept. Webhook (always): every swept cart emits cart.abandoned to your subscribed webhook endpoints, so you can drive recovery from your own systems — including for anonymous carts you track by your own session. The payload carries the line items, totals, customer (a linked customer, or a guest with id: null when only the cart’s customerEmail was captured; null if neither), shippingAddress / billingAddress (if set), and the recoveryUrl . Recovery email: Throttle sends the customer.cart_abandoned email automatically whenever the cart has a known customer email. The email respects customer opt-out / unsubscribe; in non-production environments it carries a [TEST] subject banner. Cart sessions: a backend-less storefront using cart sessions has no server-side customer record to attach an email to. Set customerEmail with PATCH /api/v1/cart-sessions/ id as soon as the buyer gives it — that alone is what makes the guest cart eligible for the sweep above. Where the recovery link points The link in the recovery email resolves through three tiers, first match wins: cartRecoveryUrlTemplate — a URL on your own site containing a cartId placeholder, e.g. https://shop.example.com/cart?c= cartId . Use this when you want the buyer to land on a specific page you control. checkoutLinkBaseUrl — your own host, e.g. https://shop.example.com . Throttle appends /r/<cartSessionToken> , so serve that route yourself with the cart SDK. Throttle-hosted — when neither is set, the link points at Throttle’s own checkout. Nothing to configure. Both settings live on the application, per environment, and are editable from the dashboard’s Abandoned carts page. checkoutLinkBaseUrl also governs where quote links point, so a merchant hosting their own buyer-facing pages sets it once. A recovery link is single-use . Opening it converts the underlying cart session into a checkout session; a second click lands on the expired page rather than reopening a checkout the buyer may already have paid. Throttle can only recover carts it knows about. To get abandoned-cart recovery, create the Throttle cart (POST /carts ) when the buyer first adds an item and mutate it on every change — the mirror pattern . If you only create the cart at checkout, abandonment happens before Throttle ever sees it and there is nothing to recover."},{"title":"Error codes","route":"/developers/reference/errors","headings":["Error codes","Envelope","Common codes","Subscription and recurring-checkout codes","Currency codes","Order builder collect codes","Saved-card charge codes","Resolved cart codes","Order line-item edit codes","Validation errors","SDK errors","HTTP code conventions"],"text":"Reference Error codes Every 4xx / 5xx response carries a stable error.code . Reach for it (not the prose message ) when branching in your handler — codes are versioned with the wire contract; messages are not. Envelope Common codes The list below covers the ~20 codes you'll see most often when integrating cart, checkout, payments, and embed flows. The full set is generated from the OpenAPI spec at api.usethrottle.dev/openapi.json . [ code: code , http, cause, ]) /> Subscription and recurring-checkout codes Codes returned by the subscription routes and by checkout sessions that carry a plan. See Managing Subscriptions and Starting checkout from an existing cart for the behavior behind them. [ code: code , http, cause]) /> Currency codes Codes returned by the one currency rule on every create path, by per-currency amounts (discounts, shipping, routing thresholds) and by the main-currency lock. See Multi-currency for the rules behind them. [ code: code , http, cause]) /> Order builder collect codes Codes returned when collecting payment for a draft order built in the dashboard: the payment-link and invoice-on-terms routes, and the payment-link checkout page. See Build an order from a cart . [ code: code , http, cause]) /> Saved-card charge codes Codes returned by POST /api/v1/orders/{id}/charge-saved-card . See Charge a saved card . [ code: code , http, cause]) /> Resolved cart codes Codes returned for carts whose lines an installed app prices, and for cart sessions of an environment that only allows prices from installed apps. Each code, its details shape and the SDK error class are on Line Resolvers . [ code: code , http, cause]) /> The two cart pricing settings on PUT /api/v1/embed-config , resolvedLinesOnly and cartCurrencies , answer 403 permission_denied to any caller other than the merchant (an installed app's key, an extension session, an OAuth token). An invalid cartCurrencies answers 400 validation_error with details[].path naming the field or the entry, for example cartCurrencies.1 for a duplicate, the environment's own currency, or a code that cannot be enabled (a fund or test code such as XTS, or one whose processor decimal places are unconfirmed, such as HUF or IDR). Extra cart currencies Order line-item edit codes Codes returned by PATCH /api/v1/orders/:id/line-items , which adds, updates or removes line items and settles the change on an order with a captured payment: an increase is charged to the customer's saved card, or, with no card to charge, saved and left owing ( data.adjustment.leftOutstanding , and the order reads partially_paid ); a decrease comes off any balance still owed first and the rest is refunded. On an order whose balance is on an outstanding Net-N invoice the invoice takes the change instead — its amount rises or falls, no card is charged — and the response reports it in data.adjustment.invoice . Every code below refuses the edit before anything is written, charged or refunded. [ code: code , http, cause]) /> When the application calculates tax with a provider, the edit re-quotes tax with it. Under the lenient fallback policy a failure the strict policy refuses goes through instead, and the 200 response carries data.warnings: [ code, message ] : provider_fallback (the provider could not answer, so your native tax rules priced the edit), tax_address_missing (no address to tax from, so no tax was charged), or tax_zero_from_provider (the provider returned no tax for the address). The field is absent when there is nothing to report. A refund that fails after the items changed does not error either: it comes back in data.adjustment.refundError , and the refund can be retried from the order. Likewise, a Net-N invoice the edit leaves owing nothing is voided, and a void that fails comes back in data.adjustment.invoice.voidError . Validation errors When a zod body validator fails, the envelope carries code: "validation_error" and a per-field details[] array. Strict-input endpoints return only the canonical camelCase contract. Field-level details identify unrecognized keys and may include a suggestion string when the server can identify the intended field: When in doubt about a field name, send the request, then read error.details[].path . The validator names the canonical key it expected. A malformed id (for example undefined or tmp_123 where a UUID is expected) also answers 400 validation_error , not a 5xx. When the route's path schema declares the UUID format, details[] names the parameter; otherwise the envelope has no details . Treat it as a client bug and do not retry. SDK errors Every Throttle SDK throws the same error class — ThrottleError from @usethrottle/errors , re-exported from each SDK. It carries code , statusCode , message , and optional details . The historical per-SDK names still work and are subclasses, so instanceof ThrottleApiError (cart) and instanceof ThrottleCheckoutError (checkout) keep working — and a single instanceof ThrottleError catches errors from all of them. The cart SDK additionally throws typed subclasses for the two lifecycle failures worth branching on, so you don't have to sniff error.code strings. Both extend ThrottleApiError (and therefore ThrottleError ): CartNotOpenError (409 cart_not_open ) and CartNotFoundError (404). HTTP code conventions 400 — request was malformed (validation, missing required field, invalid value). 401 — authentication missing or invalid (key, signature, JWT). 402 — request requires a paid subscription that isn't active (production entitlement). 403 — authenticated but not authorized for this workspace / application / role. 404 — resource doesn't exist (or exists in a different workspace). 409 — request conflicts with current state (cart already checked out, Idempotency-Key reused, slug taken). 410 — resource was permanently removed (revoked invitation, abandoned cart). 422 — semantic validation failed (e.g. payment amount exceeds"},{"title":"Fulfillment states","route":"/developers/reference/fulfillment-states","headings":["Fulfillment states","State machine","States","Type-specific details","When the order is considered shipped or completed"],"text":"State reference Fulfillment states Fulfillment lifecycles are shared across all 5 fulfillment type s (shipment, digital, access, service, in_person). The terminal definition varies by type. State machine States pending — fulfillment row created, no provider activity yet. in_progress — provider has acknowledged the work (label printed, digital file prepared, access pending). Fires fulfillment.shipment.shipped for shipment type — on the first tracking number, whether it arrives with POST /orders/ orderId /fulfillments ( shipment.trackingNumber ) or a later PATCH .../fulfillments/ id /shipment . fulfilled — terminal. Per type: shipment — carrier marks delivered ( fulfillment.delivered ). digital — file generated and a presigned URL was returned at least once. access — access grant row inserted and active. service / in_person — merchant marks complete via API. cancelled — terminal. Reachable from pending or in_progress . For shipment, cancelling after label creation requires merchant void via the carrier. Type-specific details Each fulfillment carries exactly one detail record, decided by its type , and each detail endpoint only accepts a fulfillment of its own type: shipment → PATCH /api/v1/orders/ orderId /fulfillments/ id /shipment digital → …/digital access_grant → …/access service → …/service Pointing one at a fulfillment of another type returns 409 fulfillment_type_mismatch and writes nothing. digital and access_grant line items are fulfilled automatically when the payment captures, so their fulfillment already exists — creating a second one returns 400 over_fulfillment . Patch the existing one instead. When the order is considered shipped or completed The parent order reaches shipped when every shipment line item s quantity is covered by completed fulfillments — not when every fulfillment row happens to be terminal. An order with no shipment line reaches completed instead, once every deliverable line is covered. Line items with nothing to deliver (a donation, a fee) are excluded from the count, so an order made entirely of them is completed as soon as it is paid. A shipped order is marked completed by hand; see Order states . Progress is readable on the order as fulfillmentSummary ."},{"title":"Order states","route":"/developers/reference/order-states","headings":["Order states","Why two fields and not one","What each field owns","Buyer and source fields","State machine","The eight statuses","When it happened","effectiveStatus","Renamed statuses","The compatibility window","The twelve payment statuses","Setting a status by hand","The whole story, not just the status changes","Internal notes","History","Adding your own history entries","Emails sent to the customer","Money moved by hand","How much, not just whether","Where the goods are","Holds","What a hold blocks","What a hold does not block","Placing and releasing","Endpoint per transition","Deleting a draft","What you cannot do","Outbound events","Mapping to other platforms","Shopify import"],"text":"State reference Order states An order has one lifecycle status and one payment status. The lifecycle status answers how far along is this order? ; the payment status answers how much of the money has arrived? . For tools that read a single field, effectiveStatus folds the two into one. The lifecycle now uses the names BigCommerce, ShipStation and most order tools use: awaiting_payment , awaiting_fulfillment , shipped , completed and so on. The old names are still accepted as input for a while. See Renamed statuses for the mapping and the end date. Why two fields and not one Delivery only moves forwards: once an item ships, it has shipped. Money moves both ways — a captured payment can be refunded, and a refund is not a step backwards through the lifecycle, it is a separate fact about the same order. Folding the two into a single field would mean either losing the refund or corrupting the sequence. So status is a single ordered sequence, and paymentStatus sits alongside it. Read them together and you have the whole picture; that combination is exactly what displayStatus gives you. An order used to carry a third field, fulfillmentStatus , alongside status . It was removed: the two encoded one fact, had to be kept in sync by hand, and drifted. Delivery progress now lives in status itself, with per-item counts in fulfillmentSummary . What each field owns status — the lifecycle. Moved automatically by payments and fulfillments, and settable by hand via POST /orders/ id /status . paymentStatus — how much of the money has arrived. Rolled up across every payment on the order. Never set directly. displayStatus — a human-readable label combining the two, e.g. Shipped · Refunded . Derived on every read, never stored, not filterable. Display it; branch on status . effectiveStatus — one machine-readable status for tools that only read one: the lifecycle value, unless the order is cancelled, on hold, refunded or disputed. Derived on every read, never stored, but filterable. See effectiveStatus . fulfillmentSummary — itemsTotal, itemsFulfilled, itemsRemaining . Items with nothing to deliver (a donation, a fee) are excluded from the total. payments[].status — what happened on one transaction. Never a summary of the order. Buyer and source fields Every order read ( GET /orders/ id , the list, and the order every order mutation returns) also carries the stored order row's identity and provenance columns: ipAddress and userAgent — the buyer's IP address and browser user agent recorded at checkout. Null on orders that did not come through a checkout (created by API, imported, or renewals). This is personal data about your buyer: treat it as you would their email address. clientContext — the attribution snapshot copied from the checkout session when the order was created (for example UTM parameters and the referring page). Free-form; null when the checkout recorded none. applicationId , environmentId and cartId — the application and environment the order belongs to, and the cart it was converted from (null when it was not). externalId , externalCustomerId and importId — for an order that arrived by import, the source platform's order and customer ids and the import that created it; null otherwise. Line items on an order read carry their row columns too: orderId , position , cartId , workspaceId , applicationId , createdAt and updatedAt . State machine A failed payment does not move the order. paymentStatus becomes failed ; status stays where it was. The goods side of the order has not changed, and the merchant may retry on another card. PAYMENT_FAILED therefore appears in no row of the automatic-transition table. The eight statuses POST /orders/ id /status or /close ). , ], [ code: cancelled , Cancelled , The order was called off before it completed. , html: POST /orders/ id /cancel , or set by hand. , ], ] /> completed and cancelled are terminal: the engine never moves an order out of them on its own. A cancelled order s authorized payments are voided; captured money is refunded only on explicit opt-in. Physical means the order has at least one line with deliveryMethod: shipment . Awaiting Shipment, Partially Shipped and Shipped are computed from those lines only. A line has shipped once a shipment fulfillment covering it has been handed to the carrier (giving it a tracking number stamps shippedAt ) or marked completed, and was not cancelled; the fulfillment itself stays pending until it is completed or delivered. An order with no shipment line (digital goods, access grants, services) only ever moves automatically to completed . An order rests at shipped until a person or an integration marks it completed . Once an order is shipped, a carrier delivered scan does not move it further: arrival shows as the Delivered qualifier on displayStatus . Marking a shipped fulfillment complete or delivered later does not send a second order.shipped . If your process treats delivery as the end, complete the order from your own tracking integration. Cancelling a shipment fulfillment after it shipped does not move the order back automatically. The order page shows a status notice when the status and the fulfillments disagree, and the merchant sets the status. When it happened shipped , or on reaching completed from any status other than shipped (an order with nothing to ship, or a manual move). Moving shipped to completed keeps it. , ], [ code: closedAt , html: The order was marked completed . , ], [ code: cancelledAt , html: The order was cancelled. , ], ] /> completedAt may be null on a historical completed order. Orders that were closed before the rename often had no handover time recorded, and the migration does not invent one. effectiveStatus Some tools only read one status: a warehouse system, a ShipStation-style order manager, a list pill. effectiveStatus is that one status. It is the eight lifecycle values plus four overrides, checked in this order, first match wins: cancelled — a cancelled order alwa"},{"title":"Payment states","route":"/developers/reference/payment-states","headings":["Payment states","State machine","States","Refunds","Net30 special cases","Disputes & chargebacks"],"text":"State reference Payment states Payment states mirror the underlying provider (card processor, Net30 for invoice). Throttle normalises them so your handler is provider- agnostic. State machine States pending — payment row created, no provider response yet. UI shows a spinner; back-end has the row id but no auth/capture proof. processing — the provider has neither approved nor declined yet: the buyer is mid-3DS challenge, away on a redirect method, or the debit is still settling. Nothing has failed, so there is no error.code — treat this as keep waiting , not as a decline. Fires payment.processing , and a resolution event ( payment.authorized , payment.captured or payment.failed ) always follows. authorized — provider authorised the amount (funds reserved). Most card flows auto-capture so this is brief; manual-capture flows stay here until the merchant explicitly captures. captured — funds moved. Triggers payment.captured outbound event. Order can now transition to paid . Capture may be partial : pass an amount below the authorized total to POST /v1/payments/ id /capture . The captured value is tracked on capturedAmount (the event carries both capturedAmount and authorizedAmount ); the uncaptured remainder is released by the processor, and refunds are capped at the captured amount. failed — provider declined OR a network/timeout error during processing. Carries error.code + error.message . Terminal. A merchant can also declare it by hand with POST /payments/ id /mark-failed — the promised bank transfer that never arrived, the cheque that bounced — which writes error.code: manually_marked_failed and the supplied reason. Only a pending , processing or already- failed payment is failable by hand; anything resolved returns 422 payment_not_failable . voided — authorisation released before capture. Funds never moved. Terminal. expired — the authorization outlived its usable life and was never captured, so the hold has lapsed at the provider. Throttle sweeps these itself because providers do not reliably notify on expiry, and fires payment.expired when it does. To collect this money you must charge again; capture will not work. Terminal. partially_refunded — at least one refund processed but total refunded is less than captured amount. Still accepts further refunds. refunded — total refunded equals captured amount. Terminal. Refunds POST /v1/payments/ id /refund returns money from one payment; omit amount to return everything still refundable on it, including the rest of a payment that was already partly refunded. POST /v1/orders/ id /refund works on the order: when an order was paid more than once — a deposit and a balance, an instalment plan, a retried charge that settled on a second row — the refund is spread across its captured payments, newest capture first, and amount may exceed any single one of them. Omit amount to return everything still refundable on the order. Asking for more than remains returns 400 refund_amount_exceeds_balance , whose message names the amount that is still refundable (formatted in the payment's currency) and whose details carry it as a money value, amount, currency, display , with amount in minor units. The check runs before any money moves, so a refund that cannot be completed in full sends none of it. A refund claims its amount before the provider is called, so a second refund of the same payment arriving at the same moment gets 409 refund_already_in_progress rather than passing a stale balance check and returning the money twice. Wait for the first to resolve, then re-read what is refundable. If the money already went back outside Throttle (a refund issued in the PayPal or processor dashboard, for example), send recordOnly: true with POST /v1/payments/ id /refund . Throttle records the refund and sends nothing to the processor. Every other part of a refund still applies: the balance cap, the payment and order statuses, the payment.refunded / payment.partially_refunded events and the refund email. The refund row in the ledger carries metadata.recordedOnly: true . Record the amount the buyer actually got back: if the provider kept a fee, that is less than the charge, and the payment ends partially_refunded . recordOnly is not accepted on the order refund route. A payment recorded with POST /v1/orders/ id /payments/record (cash, bank transfer, cheque, or external ) never went through a processor, so refunding it only records the refund and no money moves, with or without recordOnly . Return the money where it was taken first, for example in PayPal. That route's receivedAt must fall between 2000-01-01 and today; anything else returns 400 validation_error . POST /v1/payments/ id /refund takes an optional reference (up to 120 characters), such as the PayPal transaction id the money went back under. It is stored as metadata.reference on the refund transaction, which GET /v1/payments/ id /transactions now returns along with metadata.recordedOnly . Net30 special cases Net30 payments go through pending → authorized on invoice issue, then → captured when the buyer pays the invoice (manual mark-paid OR ACH webhook). invoice.overdue fires when an authorized Net30 payment passes its dueDate ; the payment row stays authorized until paid or voided. Disputes & chargebacks Disputes are tracked out-of-band from the status machine, on the disputed boolean plus disputeReason / disputeOpenedAt , and — once a card chargeback is decided — disputeOutcome ( won / lost ) and disputeClosedAt , all exposed on the payment object. A payment keeps its underlying status (usually captured ) throughout. Card chargebacks are ingested automatically from the payment provider: an inbound dispute.* / chargeback.* webhook sets disputed = true and fires payment.disputed . A merchant-favourable resolution (won / reversed) clears the flag, records disputeOutcome: won , and fires payment.dispute_cleared . A loss clears the flag, records disputeOutcome: lost , rolls the order to charged_back , "},{"title":"API Key Scopes Reference","route":"/developers/scopes","headings":["API Key Scopes Reference","Secret vs publishable keys","How scope checks work","Implication","The wildcard","Key types & grantable scopes","The buyer plane: a publishable key is not a permission","Customer PII: redacted, not rejected","Customer directory: names without the record","Scope catalog","{group}","Migration from coarse scopes","Machine-readable catalog"],"text":"Workspace API Key Scopes Reference Every Throttle API route declares a single required scope — a resource:action string such as orders:read or payment_refunds:write . API keys are gated purely by the scopes they hold; dashboard (Clerk) users are gated by role-based permissions instead. The two systems compose — they never replace one another. Secret vs publishable keys API keys come in two prefixes. Secret keys ( sk_ ) are full-power, server-side credentials — keep them on your backend and never expose them. Publishable keys ( pk_ ) are safe to embed in browser or frontend code. Because a publishable key is application-scoped and exposed in the browser, it is restricted to a small, curated set of publishable-allowed scopes — five today: shipping_quotes:write , tax_calculations:write , storefront_scripts:read , storefront_scripts:write , and customer_accounts:write — and can never read carts, orders, customers, payment methods, or PII directly. That last scope is a deliberate exception to "publishable means stateless compute"; see the buyer plane below. (Listing available payment methods needs no key: GET /v1/payment-methods is public.) Create either type from Developers → API keys in the dashboard. How scope checks work On every API-key request Throttle reads the matched route's required scope and checks it against the key's granted scopes using these rules: Implication Exact match grants the scope. resource:write implies resource:read on the same resource — holding a write scope lets you read it too. There is no cross-resource implication : orders:write does not grant order_returns:write or payment_refunds:write . Each financial or destructive action is its own scope. read never implies write . The wildcard * grants full access to every scope. It is only grantable to secret ( sk_ ) keys. Publishable ( pk_ ) keys can never hold * . Prefer the smallest set of explicit scopes; reserve * for trusted server-side keys. A request whose key lacks the route's scope returns 403 with error.code = "insufficient_scopes" and a details.required field naming the missing scope. Key types & grantable scopes Secret keys ( sk_ ) May hold any non–staff-only scope, or the wildcard. Staff-only scopes (the admin:* family) are not grantable to workspace-minted keys — those routes are gated by Throttle Staff org membership in Clerk, never by an API key. Requesting one returns 400 invalid_scope . Publishable keys ( pk_ ) Browser-safe. May hold only the publishable-allowed subset (marked pk_ ok below) — five scopes today: the two stateless compute scopes shipping_quotes:write and tax_calculations:write ; the storefront-script loader s storefront_scripts:read and storefront_scripts:write ; and customer_accounts:write , which gates the buyer-auth plane rather than granting a data-reading permission — see the buyer plane below. A publishable key can never read carts, orders, customers, payment methods, or PII — those scopes are not publishable. (Listing the eligible payment methods for a session needs no key at all: GET /v1/payment-methods is public.) Any non-publishable scope — or the wildcard — returns 400 invalid_scope . The buyer plane: a publishable key is not a permission A publishable key identifies an application. On the buyer plane it is not a permission. Storefront customer-account endpoints are authorised by the shopper's session, not by the key's scopes — the key only selects which application the shopper is signing in to. The one scope that gates that plane is customer_accounts:write : without it, a publishable key cannot reach customer accounts at all. Every other publishable scope ( shipping_quotes:write , tax_calculations:write , storefront_scripts:read , storefront_scripts:write ) authorises a stateless compute or a public read directly off the key itself. customer_accounts:write works differently: holding it only unlocks the /v1/storefront/* route family (see Storefront Customer Auth ). Every action a buyer actually takes there — reading their orders, changing an address, removing a saved card — is authorised by their own Authorization: Bearer session token, never by the key. Two different applications' publishable keys can both hold customer_accounts:write and still never see each other's buyers; the key only decides which application a login or register request lands on. Customer PII: redacted, not rejected customer_pii:read gates personal fields on a customer record — email , phone , firstName , lastName , and the combined name some endpoints return. A credential that can read (or write) customers but lacks this scope does not get a 403 : the request succeeds and those fields come back null , with every other field (id, externalId, company, addresses, order/subscription linkage) intact — the same "redact, not reject" pattern the picker warning on ⚠ sensitive exists to flag. This applies whether the customer came back from a read, or is the record echoed back by a create/update call. Because customer_pii:read is sensitive, an OAuth connection to an AI assistant (the MCP integration flow) can never hold it — see the MCP docs for which tools therefore always return redacted customer data. It is the one sensitive scope an automation connector (Zapier, Make — an OAuth client registered for the REST API) may be granted, and the consent screen names it. A connector without it gets the same redaction, and creating, changing or replaying a webhook endpoint returns 403 oauth_customer_pii_required , because deliveries carry the full record. Customer directory: names without the record customer_directory:read gates GET /api/v1/customer-directory , which finds customers by a name or email prefix, or names up to 50 customer ids, and answers only their id , name and email . It exists so an extension can show customers in a picker without holding customers:read . It is ⚠ sensitive , so no OAuth connection can hold it, and no other scope grants "},{"title":"Your Own Scripts on Hosted Checkout","route":"/developers/scripts","headings":["Your Own Scripts on Hosted Checkout","What this is","What a script can and cannot do","Loading a vendor tag","Event catalog","Consent","External domains","Scripts shipped by an installed app","Declaring them","The two tiers","Automated review gates","What a script declares is frozen once it ships","Consent on upgrade","Your controls over an app's scripts","Authoring from the CLI","Your own storefront","One script tag","Or from npm","React","Events you publish","The manifest, directly","Managing scripts","API","Create a script","List scripts","Update a script","Delete a script","Kill switch","Health","Limits","What is not in this release"],"text":"Analytics Your Own Scripts on Hosted Checkout Add your own JavaScript to Throttle s hosted checkout page — a pixel, a cookie-based attribution stitcher, a custom analytics relay. It runs in an isolated sandbox with no access to the page, the payment form, or anything Throttle does not explicitly hand it. This page documents exactly what ships today: your own scripts, sandbox-tier only, on the hosted checkout page ( /c and /s ), and never in embed mode. See What is not in this release before you build against this. What this is Throttle mounts every enabled script for a surface inside its own <iframe sandbox= allow-scripts > — no allow-same-origin , so the frame s origin is opaque and it cannot reach the parent document under any circumstance. Your script talks to the host only through postMessage , wrapped by the small API surface described below. checkout , html: Hosted checkout — /c/<sessionId> and /s/<sessionId> , Nothing. Mounted for you. , ], [ html: quote , html: The hosted quote page, /q/<token> , html: Nothing. Consent fails closed here — a quote link carries no consent decision, so an environment that requires consent runs essential scripts only. , ], [ html: storefront , Your own pages, on your own domain , html: Install @usethrottle/scripts and allow-list your origin — see Your own storefront . , ], [ html: Embedded checkout ( ?embed=1 ) , html: Runs no scripts of its own. It forwards its events to your page instead. , html: Install the loader on the page doing the embedding. Without it, checkout-surface scripts never run — the dashboard warns when it has never seen your loader call in. , ], ] /> Embedded checkout runs nothing itself on purpose: a sandbox inside that iframe would write cookies like _ga to Throttle s checkout domain, splitting them from the storefront half of the same shop. Forwarding the events to your own loader keeps every cookie first-party on your domain. What a script can and cannot do checkout.started , .step_changed , .shipping_submitted , .payment_submitted , .completed , .failed ) and publish its own events over analytics.subscribe / analytics.publish — see the event catalog below. , html: Touch the checkout page — no document , window , or parent . Reachable identifiers are shadowed to undefined ; the real containment is the iframe s opaque origin. , ], [ html: Read/write cookies (real names — _ga , _fbp , etc. — with a small reserved list blocked) and namespaced local/session storage, all proxied async through the host. A read settles as null when refused; a write rejects , so a refused write cannot read as a successful one. , Read the payment form, card fields, or anything else rendered on the page. , ], [ html: Call fetch / sendBeacon to hostnames it declared in externalDomains . , html: Make a network request ( fetch , sendBeacon , XHR, images) to any other domain — blocked by the sandbox document s CSP connect-src , with no error the script itself can see; Throttle reports it as a blocked outcome with reason: csp . A script can still navigate its own frame (e.g. location.href = ... ) to any URL — that is not a network request CSP governs. Throttle detects this: a navigated frame is torn down and reported as an error outcome, so it is observable in the script health view even though it is not prevented. , ], [ Read the page context it booted with (URL, referrer, title, user agent) once, at load. , See anything about the buyer or the order that was not explicitly included in an event payload — no PII grading is wired yet, so no event carries customer data in this release regardless. , ], ] /> The register() contract Your source is compiled as a function body and run, so plain JavaScript works — top-level statements execute, and a script that never calls register() is perfectly valid. Use it when you want to subscribe to events; skip it when you just want code to run. At the top level you are handed four bindings: register , analytics , browser and settings . There is no api at the top level — api is the single object passed into the register callback, so api.browser.cookie.set(…) outside register() is a ReferenceError . Write browser.cookie.set(…) instead. What actually constrains you is not the convention. document , window , parent , top , opener , localStorage and sessionStorage are undefined inside a sandbox-tier script, and the network is governed by the CSP built from your externalDomains . Use browser.* for storage and browser.loadScript() for vendor tags. Your script s whole body is one call to the global register() function, which Throttle invokes once per load with analytics, browser, init, settings . The shape below — subscribing to a named event and publishing a derived one — is copied from a real, currently-passing test in packages/scripts-runtime/src/sandbox/bootstrap.test.ts , not invented for this page: This actually fires: the hosted checkout page bridges its own checkout lifecycle onto this bus (a script never sees the underlying postMessage events — only the projected checkout.* names below). Loading a vendor tag browser.loadScript(url) pulls a remote script into the sandbox and resolves when it has run. The host must be in your externalDomains , exactly — declaring example.com does not cover cdn.example.com , because the CSP matches hosts rather than parent domains. It rejects with a real error you can catch, rather than leaving you with a CSP refusal the page cannot see. A vendor tag mutates whenever the vendor redeploys — that is the point of one — so subresource integrity cannot pin it and no review can vouch for what runs tomorrow. What contains it is the sandbox: the code lands in an opaque origin with no cookies, no access to the merchant s DOM, no parent, and no network beyond the same declared list. Judge a vendor on whether you are willing to run their code under those limits, not on having read it once. Event catalog throttle_session_id, ecommerce? — ecommerce is a GA4-shaped object (below), pr"},{"title":"Mount Card Fields On Your Own Page","route":"/developers/secure-fields","headings":["Mount Card Fields On Your Own Page","How it works","Mint the session","Content Security Policy","React example","Status","3-D Secure","Analytics","Saved cards","Testing failures","Declines","The rest","Error reference","Field mounting and vaulting (the hook, in the browser)","3-D Secure (the hook)","Fallback codes","Routing -> Decline rules in the dashboard does the same thing.","Remove it again when you are done."],"text":"Checkout surfaces Mount Card Fields On Your Own Page Secure Fields gives you individually mountable, provider-hosted inputs — card number, expiry, security code, postal code — that you place in your own form and style yourself. Raw card data never touches your page or ours; your server never sees it either. Secure Fields has no PayPal, Apple Pay, or Google Pay. It is a card-capture surface, full stop — that is a property of the product, not a v1 gap. A merchant who needs those payment methods keeps using Embedded Checkout or hosted checkout alongside Secure Fields for the card-only case. How it works Four steps, and the only server-to-server call is the mint. Everything after that is either a mount inside the buyer's browser or the same public completion route the Embed and hosted checkout already use. Mint the session Call this from your backend, with your sk_* secret key. Never call it from the browser — there is no publishable-key variant. Field Notes POST /api/v1/checkout-sessions/:id/card-session :id is an existing Throttle checkout session (create one first with the cart/checkout APIs, exactly as you would for the Embed). Auth X-API-Key secret key with the checkout_sessions:write scope. Response sessionId, providerId, environment — pass this object straight into unchanged. Throttle records every card session it mints on the checkout session it was minted for (the newest 20 are kept). /complete authorises only against one of those; a card session minted for another checkout session, or one Throttle did not mint for it, answers 409 transaction_not_for_session before any order or authorisation, with details.retryable: false . Mint a new card session for this checkout session and mount the fields again. A card session minted before 2026-10-05 is refused once in the same way. Content Security Policy The card inputs are iframes served from Throttle's payment provider, not from your own domain. If your checkout sends a Content-Security-Policy header, the fields render as blank boxes until you allow that origin — usually with no error in the page, only a CSP violation in the browser console. frame-src lets the iframes mount; connect-src covers the calls they make. If you also send frame-ancestors elsewhere, it does not apply here — that directive governs who may frame you , not whom you may frame. React example @usethrottle/checkout-react ships a headless provider, a hook, and four unstyled field primitives. Style everything yourself — the whole point of choosing Secure Fields is that you own the pixels around the fields. session.sessionId (from the mint response) is the payment provider's checkout session id. It is what constructs the SecureFields instance and mounts the field iframes. checkoutSessionId (the prop you pass to separately) is Throttle's checkout session id — the same :id you minted against in the step above. It is what pay() uses to call POST /checkout-sessions/:id/complete . Swap them and every payment breaks: the fields will mount and take input fine (they only need the payment provider's id), but complete() will call /checkout-sessions/ provider id /complete , which does not exist on Throttle's side, and every payment 404s at the very last step. Status useSecureCard() exposes an explicit state machine. Render any of it — there is no need to infer state from side effects. Status What it means What to render idle Provider mounted; fields not yet registered. A loading state over the field area. mounting The Secure Fields instance exists; individual fields are registering. Same loading state — fields are not yet interactive. ready All required fields (number, expiry, CVV) are registered. Enable the Pay button. ready is also exposed as its own boolean. vaulting pay() / vault() called; waiting on the payment provider to accept or reject the card. Disable the button: “Saving card…” authorizing The card vaulted; Throttle's /complete call is in flight. Disable the button: “Processing payment…” challenging /complete returned requires_action ; the payment provider's own 3-D Secure iframe is mounted at your registered element and running. Make the registered mount element visible to the buyer: “Confirming with your bank…” complete The order was created. onSuccess already fired. Navigate away, or show a confirmation. error Vaulting, the challenge, or completion failed. Read error.code / error.message (see below) and let the buyer retry. 3-D Secure A payment that needs step-up authentication does not fail — complete() resolves with status: 'requires_action' instead of an order. pay() handles this for you. When that happens, the hook moves to challenging and drives the payment provider's own 3DS iframe (mounted at the element you passed to registerThreeDSecure ) to a result, then re-calls /complete for the authoritative outcome. Register the mount element alongside your card fields — it only actually mounts a challenge when one is needed, so it costs nothing to always include it. If the buyer never resolves the challenge, challengeTimeoutMs (5 minutes by default, overridable via the same-named prop) settles complete() to error.code: 'three_ds_timeout' on its own. Calling cancelChallenge() (also from useSecureCard() ) abandons an in-progress challenge with error.code: 'three_ds_abandoned' . If the challenge resolves but the payment still needs authentication, or if the buyer keeps retrying without ever clearing it, Throttle caps re-entry at 5 attempts and returns 409 three_ds_unresolved . Treat this as terminal: tell the buyer to start a new checkout rather than retrying the same session again. Analytics With GA4 set up, Throttle s server sends purchase and refund for Secure Fields orders. To join the purchase to the buyer s visit, pay() and complete() read your page s _ga cookies, UTMs and click id"},{"title":"Failures with no error","route":"/developers/silent-failures","headings":["Failures with no error","At a glance","Your tenant id is not where you expect","Cancellation fires two different events","A handler for an event you never subscribed to","The gate that never runs","Creation paths without a subscription","Changing a plan through checkout","Cards that save but cannot be charged","Test doubles kinder than production","Start with the delivery log"],"text":"Integration Failures with no error Every trap on this page shares one property: it produces no error. No exception, no 4xx, nothing in your logs. Several of them look actively healthy — a delivery log full of 200 s while nothing at all is happening. This is the single most useful habit for a billing integration. After every step, assert against your own database — not the API response, and not the absence of an exception. Most of what follows was found in production by someone who had green tests. At a glance Your tenant id is not where you expect Subscription and payment payloads carry Throttle s internal customerId — a UUID that means nothing in your system. Your identifier is on the sibling customer object, as externalId . Both appear on the same customer object. externalId is the id you set when you created the customer. externalCustomerId is a per-connection mapping and is null for direct API integrations — so reading it returns nothing, forever, without erroring. The failure mode is total and invisible: every subscription webhook is received, resolves to nothing, and returns 200. Throttle s delivery log shows delivered / 200 for all of them. If your checkout return path also syncs state, the user-present flow keeps working and hides it — until the first renewal, a month later, with no user present. Cancellation fires two different events Handle only subscription.cancelled and a scheduled cancellation is invisible to you: no confirmation email, and your Cancel button stays live because the subscription is still active . The buyer cancels, sees nothing change, and cancels again. A handler for an event you never subscribed to You can write a flawless handler for an event your endpoint does not receive, and nothing will ever tell you. There is an endpoint for exactly this: it reports event types your application emitted that no active endpoint subscribes to. Run it after every integration change — it is cheap enough to put in CI and fail the build on a non-empty unsubscribed array. An endpoint subscribed to * always reports clean. The gate that never runs An entitlement check registered in the wrong place — before tenant context exists, on a router that does not cover your API, behind a condition that is never true — returns early on every request. Both the expiry lockout and all plan gating become dead code, and nothing distinguishes that from no one is over their limit . Reading the code is not evidence. Put a tenant into a blocked state and confirm you get a 403. This is a two-minute test that no amount of code review substitutes for. Creation paths without a subscription Count the ways a tenant can come into existence: signup, invite, admin creation, seed script, import, test fixture. Each one that does not create a subscription row produces an account with permanent free access that never expires and is never asked to pay. Nothing surfaces this. The accounts work perfectly. Enumerate the paths by grepping for your create call and check each one individually. Changing a plan through checkout Checkout always creates a new recurring subscription. Run an existing subscriber through it and they now have two, and are billed for both. Use POST /subscriptions/{id}/change-plan instead, and fall back to checkout only when there is no live subscription to change. Cards that save but cannot be charged Card entry must go through the hosted embed. A card attached by any other route saves successfully, lists successfully, and then fails at charge time with payment_method_not_chargeable — which you discover at the first renewal, not at integration time. Use the embed via @usethrottle/payment-methods or hosted checkout. It is also what keeps card data out of your DOM and your PCI scope. Test doubles kinder than production A mock that returns a friendlier shape than the real API produces passing tests and a broken integration. This is the failure behind more than one bug on this page, on both sides of the boundary. For anything crossing into Throttle, assert against a real captured payload . The delivery log gives you exactly what was sent; replay one as a fixture rather than writing what you think the shape is. Start with the delivery log GET /api/v1/webhook-deliveries?endpointId= shows the exact payload sent and the status your endpoint returned. When something is not happening and nothing is erroring, this is the first place to look — it distinguishes never sent from sent and your handler swallowed it , which are completely different bugs. Next: the build and test checklist turns this page into something you can tick through."},{"title":"Site Forms","route":"/developers/site-forms","headings":["Site Forms","Add a form to your site","What gets stored","Spam and abuse protection","Submission errors","Get submissions by webhook","Manage forms with the API","201","200, newest first","Next page: pass meta.pagination.cursor back as ?cursor=`;"],"text":"Forms Site Forms A site form is a form on your own website (a contact form, a lead form, a get a quote form) that posts straight to Throttle. Throttle keeps every submission and can email it to the addresses you set. Create forms in the dashboard under Forms , or with the API below. Add a form to your site Each form has a publicKey starting with frm_ . Post your form to POST /api/v1/form-submissions/{publicKey} . No API key is needed, and none should ever go in a web page. A plain HTML post is answered with a 303 redirect to the form's redirectUrl , or a simple thank-you page when none is set. To submit from your own code, post JSON instead and you get JSON back. What gets stored Any field names. You don't declare fields in advance; every field posted is saved as sent. Values may be text, numbers, true/false, or a list of those (up to 50 items). Nested objects are refused. Limits: at most 50 fields, field names up to 100 characters, values up to 10,000 characters, and a 64 KB body. Reserved names. Fields starting with _ are never stored. _gotcha is the spam trap. Repeated names in a plain HTML post (for example a group of checkboxes sharing one name) keep only the last value. Give each checkbox its own name, or post JSON with a list. Spam and abuse protection Emails go only to the form's own addresses. They are set on the form and can never come from a submission, so the endpoint cannot be used to send mail to anyone else. Addresses outside your team confirm first. Your workspace members' own addresses are notified straight away. Any other address (a shared sales@ inbox, say) is sent a confirmation email and receives nothing until someone clicks Confirm on the page it links to. One confirmation covers every form in the workspace. Saving the form again re-sends an unconfirmed address its link, at most once a day and three times in all. A workspace can send at most 20 confirmation emails a day ( 429 too_many_confirmations on the create or update that would pass it, before anything is saved). The form's pendingEmails lists the addresses still waiting. Spam trap. A submission with _gotcha filled in gets the normal success answer, but nothing is stored or sent. Rate limit: 10 submissions a minute from one IP address, answered with 429 rate_limit_exceeded . Allowed sites (optional). With allowedOrigins set, a browser post from any other site is refused with 403 origin_not_allowed . This stops other websites using your form; it cannot stop a script, which can claim any origin. Anyone can read the publicKey in your page, and that is expected. Turn a form off ( isActive: false ) to stop it accepting submissions. Submission errors 404 form_not_found : unknown key, or the form is turned off. 403 origin_not_allowed : the post came from a site not on the list. 400 empty_submission : no fields were posted. 400 invalid_submission : a value or the field count broke a limit above, or a filled email field is not an email address (an empty one is accepted). 429 rate_limit_exceeded : too many submissions from one address. A plain HTML post gets these as a short page instead of JSON, with the same status code. Get submissions by webhook Subscribe a webhook endpoint to form.submitted (it needs forms:read ) to receive every submission, alongside or instead of email. It fires for each stored submission; spam-trap hits are not delivered. See webhooks for signing and retries. The event log ( GET /api/v1/events ) records only the ids. Reading a stored delivery back shows submission.data and origin only to a caller holding both forms:read and customer_pii:read . Manage forms with the API These routes take a secret key ( sk_ ) and act in the key's environment. They need forms:write to create or change a form and forms:read to read forms and submissions. Both are marked sensitive, because submissions hold whatever visitors typed. See scopes . POST /api/v1/forms : create a form. GET /api/v1/forms : list the environment's forms. GET /api/v1/forms/{id} : read one form. PATCH /api/v1/forms/{id} : change name , isActive , notifyEmails (up to 10), allowedOrigins (up to 20, each like https://www.example.com ) or redirectUrl or notifyAppOwner ( true also emails the application owner's current Throttle account address, with no confirmation; the address is never returned, and in a submission's emails it shows as app_owner ). GET /api/v1/forms/{id}/submissions : submissions, newest first. limit is 1 to 200 (default 50); page with cursor . A secret key or the dashboard reads it with forms:read . An extension installation's key, an extension session and an OAuth or AI-agent token also need an explicit customer_pii:read ( * does not count; a legacy customers:read key does, because it expands to it), or the answer is 403 insufficient_scopes . Use the metadata route below when no visitor data is needed. GET /api/v1/forms/{id}/submissions/metadata : the same pages without any visitor data, as { totalCount, items: [{ id, submittedAt, subject, status }] } . subject is the visitor-supplied value of the subject field (at most 100 characters, null if it looks like contact details); no other visitor data is returned. emails lists each notification email with its recipient and status, and emailStatus sums them up. A status is one of: queued : waiting to go out. sent : handed to the mail provider, not yet accepted by the recipient's mail server. delivered : accepted by the recipient's mail server. If it isn't in the inbox after that, look in spam, other tabs and any mail filters. bounced : the recipient's mail server refused it. failed : it could not be sent. skipped : nothing was sent (no address on the form is confirmed yet, or notification emails are turned off). emailStatus reports a failure or bounce first; otherwise it shows the recipient that is furthest behind, so one "},{"title":"Storefront Customer Auth","route":"/developers/storefront-auth","headings":["Storefront Customer Auth","Two planes, not two auth options on one plane","Turning it on","Tokens and sessions","Session lifecycle","Step-up: proving the password again for destructive actions","Email verification and the claim cutoff","Endpoint reference","No session required","Session required","Buyer groups on the profile","Cart claim and the retirement of X-Customer-Id","Deprecation timeline","Finding the buyer's cart on another device","Error reference","Webhook events","Carts, claims and reorder","Theming","Checkout interruption","React and react-dom are peer dependencies of this entry point`;"],"text":"Buyer identity Storefront Customer Auth Throttle can authenticate a merchant's end buyers — the shoppers on their storefront — as a plane entirely separate from the merchant API you already use for orders, payments, and webhooks. Buyers register, log in, verify their email, reset passwords, manage addresses and saved cards, view their own orders, invoices and subscriptions, and bind an anonymous cart to their account at checkout. Every application has auth.enabled: false until a merchant turns it on. Guest checkout is completely unaffected either way — a customer with no credentials is a guest by definition, and nothing about existing carts, orders, or subscriptions changes when this feature is off. Two planes, not two auth options on one plane A buyer session is not a weaker version of a merchant API key, and it can never be used as one. The two are isolated structurally, not by convention: , so a page that imports only the provider and guards no longer ships account or sign-in code (the CJS build is one bundle per entry and inlines the modals). Measured on the demo store's /shop : 195,876 B to 184,633 B gzip, 11,243 B lighter. Import paths are unchanged. Drop-in components: @usethrottle/auth/components The hooks above are headless — you build the UI. The ./components entry point is the other option: prebuilt, restylable React components that render inside your own storefront, so a buyer never leaves your site to sign in or read their order history. Same package, same session, same routes underneath. as const, Sign-in card. Also SignUp, ForgotPassword, ResetPassword, VerifyEmail. ], [ code: as const, The five cards with navigation between them — one component for a whole auth surface. ], [ code: as const, A button that opens the auth flow in a modal. Also SignUpButton, SignOutButton. ], [ code: as const, Full-viewport centred shell for a dedicated /sign-in route. Also SignUpPage. ], [ code: as const, Navbar avatar with a menu: identity, account, sign out. ], [ code: as const, Profile, addresses, saved cards, orders, invoices, subscriptions and security, in a sidebar or tab layout. ], [ code: / as const, Render children only in that state. additionally gates on email verification. ], ] /> Every panel is also exported individually ( OrdersPanel , AddressesPanel , …) if you want your own shell around them. Theming Three levels, from least to most invasive: CSS custom properties via appearance.variables , your own classNames on any part via appearance.elements , and whole-component replacement via appearance.components . Every shipped rule is a single-class selector, so a className you pass wins on source order rather than losing to specificity. colorPrimaryForeground is the text drawn on top of colorPrimary . Overriding only the first leaves the theme s own foreground in place, and the pair is not always readable — a terracotta primary on its own measures 3.65:1 against the dark theme s foreground, below the 4.5:1 WCAG asks for button text. Development builds measure the pair and warn once in the console when it falls short. They also warn when your brand colour is too close to the destructive colour to tell apart: Delete and Edit sit side by side in the account panels and a buyer distinguishes them by colour alone, so a warm brand landing on the danger red removes the only signal that one of them is irreversible. Nothing is logged in production builds. appearance.theme accepts light , dark or auto , and defaults to light. It is deliberately not auto : that resolves against prefers-color-scheme , which describes the shopper s machine and has no relationship to your storefront — so a light site would render a dark widget for every shopper with dark mode enabled. Opt into auto explicitly if your own site follows the OS too. Checkout interruption The case these components exist for is a buyer stopped mid-purchase. Render the auth flow inline where they already are, rather than sending them to a separate page — and pair it with cart claim so the cart they built anonymously follows them into the session. An unverified buyer s orders, invoices, subscriptions and saved cards are withheld by the server (see the claim cutoff above). The panels render that as an actionable gate — Verify your email to see your order history , with a resend action — never as a failure. You do not need to special-case it."},{"title":"Subscriptions","route":"/developers/subscriptions","headings":["Subscriptions","What ships in v1","What is intentionally out of v1","How the pieces fit","Order fees on renewals","Tax on renewals","Physical subscriptions","Sequence: auto-subscribe on card capture","Pages in this section"],"text":"Recurring billing Subscriptions Throttle subscriptions turn a one-time embed payment into a recurring billing relationship. The card vaulted during checkout is reused on a 5-minute renewal cron, with built-in dunning and a webhook stream that lets your backend stay in sync. What ships in v1 Recurring on the embed. Pass a recurring block on a checkout session, the embed vaults the card, and (when create: auto is set) Throttle creates the subscription on your behalf. Lifecycle API. Cancel, pause, resume, change plan, list, and fetch subscriptions through @usethrottle/subscriptions/server from your backend, or through the React hooks routed via your backend proxy. Mid-period proration. A plan or seat change sent with effective: now credits the unused portion of the period the buyer already paid for, then charges the net — and skips the charge entirely when the credit covers it. The response carries a proration breakdown ( creditCents , chargedCents , fullAmount ). Send effective: period_end to schedule the change for the next renewal instead, with no charge now. React management package. @usethrottle/subscriptions exposes hooks and primitive components so your buyer-facing portal does not have to re-derive the API plumbing. Any cadence, and installment plans. Send interval for the five named intervals, or intervalUnit + intervalCount for any cadence from 1 hour to 1 year. Add totalPayments (2–60) to make it an installment plan that completes itself after N payments and emits subscription.completed . See Lifecycle and States . Built-in dunning. Retry n waits min(n × cadence, [1, 3, 7][n − 1]) days — weekly and longer cadences always land on the original [1, 3, 7] days; shorter custom cadences retry proportionally faster. The first failed attempt moves the subscription to past_due ; if all three retries also fail it auto-cancels with a dunning_exhausted reason. Trial-fraud protection. Auto-create checks the card fingerprint against prior subscriptions on this merchant; same card already used for a trial → new subscription is created without a trial and a subscription.trial_blocked webhook fires. Pre-flight via POST /api/v1/subscriptions/eligibility-check . See Trial Fraud Protection . Webhook stream. subscription.created , .updated , .activated , .renewed , .past_due , .payment_failed , .paused , .resumed , .cancelled , .completed . What is intentionally out of v1 No-card free trials. Trials always require a vaulted card up front; the embed does not yet support a subscribe now, add card later flow. Trials with a card behave the way you expect — Throttle delays the first charge until trialEnd . Net30 recurring. Renewals charge a stored card via the payment provider. Net30 is supported for one-time orders today; Net30 recurring (invoice every period) is not part of the current subscription package surface. Customer-scoped JWTs. The React package authenticates by proxying through your backend. Direct browser → Throttle calls require a customer token system that is not yet built. See Buyer Portal for the proxy pattern documented for v1. Throttle-sent emails. All notifications flow through your webhook endpoint; you decide which emails to send. Subscribing to subscription.payment_failed is enough to wire the standard your card was declined copy. Recurring discounts. Promotion codes apply to cart-backed checkout totals today. Ongoing subscription-cycle discounts are deferred. Configurable dunning curve. The retry schedule scales down automatically for cadences shorter than a week, but merchants cannot configure their own multipliers or caps. Per-merchant or per-subscription overrides are deferred. Subscriptions touch checkout, customer identity, the renewal cron, and a buyer-facing surface. Start with the Quickstart for the end-to-end flow, then read Customer Identity before you wire your buyer portal. How the pieces fit Subscribe. Your backend creates a checkout session with a recurring block, or puts recurring on cart lines, one subscription per line, up to ten. Buyer pays through <PaymentEmbed /> . Card is vaulted. Throttle auto-creates the subscriptions. onSucceeded returns subscriptionIds . Renew. A cron runs every 5 minutes. For any subscription whose currentPeriodEnd has passed, it charges the stored card with an idempotent chargeStored call and advances the period. On failure it follows the cadence-scaled [1, 3, 7] -day retry curve. Manage. Your buyer portal calls your backend, which proxies to the Throttle API. The React package gives you hooks for the common flows. React. Your webhook handler stays in sync — record renewals, send dunning emails, gate access on past_due . Order fees on renewals A fee that applies to subscriptions is charged on signup and on every renewal. Each subscription stores a snapshot of its fees ( fees on every subscription response); a renewal prices the snapshot, so changing a global fee never changes an existing subscription. Add or remove a fee on one subscription with POST /api/v1/subscriptions/:id/fees and DELETE /api/v1/subscriptions/:id/fees/:feeId (merchant credentials, subscriptions:write ). See Order fees . Tax on renewals A renewal has no cart and no shipping address, so there is nothing for a tax provider to quote against. Throttle solves that by freezing an address on the subscription at signup and reusing it on every renewal. taxAddressSnapshot — the address renewals are quoted against. A subscription created through checkout inherits the address the buyer was taxed on: the billing address when the checkout had no shipping step. Each renewal is quoted with it as both the shipping and the billing address, whichever one your tax trigger reads. The renewal order carries it as its shipping address, and also as its billing address when your trigger is billing_address , so the filed document uses it too. taxAddressSource — checkout when it came from the buyer's session, manual once a merchant has edited it. A later checkout never overwrites a man"},{"title":"Buyer Portal","route":"/developers/subscriptions/buyer-portal","headings":["Buyer Portal","Architecture","Next.js App Router template","Express template","Authorization","Wiring the React provider","What buyers can do","Next"],"text":"Subscriptions Buyer Portal Let buyers manage their own subscriptions. v1 uses a proxy pattern: your backend forwards requests from the browser to Throttle, holding the secret key on your side and enforcing ownership. A proxy keeps your sk_* key off the wire and lets you reuse your existing user authentication. The hook API in @usethrottle/subscriptions is designed around this production path. Architecture Buyer s browser calls /api/throttle/api/v1/subscriptions on your domain. Your backend authenticates the user, verifies they own the resource being mutated, and forwards the call to Throttle with the secret key. @usethrottle/subscriptions s SubscriptionProvider uses a custom fetcher that targets the proxy. Next.js App Router template A single catch-all route handler proxies the relevant subscription endpoints. The helper pins externalCustomerId server-side on every read, rewrites checkout-session creates to the authenticated buyer, resolves payment-method reads from the buyer's customer row, and verifies ownership before reading one subscription or changing it. Since @usethrottle/subscriptions 4.0.0 it also limits what a buyer may send, because it forwards on your secret key: Cancel takes only atPeriodEnd . A refund is refused: a buyer cannot refund themselves. PATCH on a subscription takes only shippingAddress . Plan, cadence and amount need your authorizeUpdate({ request, subscription, body, externalCustomerId }) to return true after checking them against your price list. A direct POST /api/v1/subscriptions is refused unless your authorizeCreate({ request, body, externalCustomerId }) returns true. It names its own price and charges nothing, so prefer a checkout session. Anything else a buyer sends answers 403 field_not_allowed naming the fields; it is never silently dropped. Reading another buyer's subscription answers 404 . Express template Per-route variant. Slightly more code, but easier to reason about route-by-route authorization. Authorization Throttle s API key authorizes your account to act on any subscription you own. It does not know which buyer owns which subscription. That mapping lives in your DB (or you derive it via customer.externalId === user.id ). Without ownership checks on mutations, any logged-in user could cancel any subscription by guessing IDs. Always verify ownership server-side before forwarding a mutating request. Wiring the React provider Every hook in @usethrottle/subscriptions calls through this fetcher. Your proxy is the only thing that talks to Throttle. What buyers can do List their subscriptions and see status, plan, next billing date. Pause an active subscription and resume later. Pause is not offered on a trialing subscription (the API refuses it with 400 invalid_subscription_state ); @usethrottle/auth 0.6.1 and later hide the button there. Cancel at period end (or immediately, if you allow it). Change plan, when your proxy passes authorizeUpdate and it checks the new plan and amount against your own price list (your UI decides which plans are offered, but the browser is not trusted to name the price). Move one subscription to another of the buyer's saved cards: the proxy forwards PATCH /api/v1/subscriptions/:id/payment-method for the buyer's own subscriptions ( setPaymentMethod() on the server client). See Change the card . Change where a physical subscription ships. On the storefront plane that is PATCH /v1/storefront/me/subscriptions/:id/shipping-address (step-up gated), updateSubscriptionShippingAddress() in @usethrottle/auth , and a Change address button in its <SubscriptionsPanel /> . Surface a past_due subscription with an update-card action. The <DunningBanner /> primitive gives you the UI hook; your backend owns the actual card-refresh flow. An installment plan ( totalPayments set) shows its cadence and payment progress — installmentProgress() from @usethrottle/subscriptions gives you paymentsMade , totalPayments , and the remaining amount — but your proxy must hide Cancel, Pause, and Resume for it and refuse to forward those calls. Throttle's subscription API does not itself refuse a pause/resume/cancel called with your merchant secret key. The @usethrottle/subscriptions proxy now refuses every buyer mutation of an installment plan by default ( 403 installment_plan_merchant_only ), except changing its card ( PATCH …/payment-method ), which is not one of the plan's locked terms; if you pass your own authorizeMutation , the default is replaced and your function must check totalPayments != null itself. (Throttle's separate customer-session storefront endpoints, documented under Storefront Auth , enforce this server-side and return 403 installment_plan_merchant_only for a buyer session.) Next React Package — full hook reference."},{"title":"Creating Subscriptions","route":"/developers/subscriptions/creating-subscriptions","headings":["Creating Subscriptions","Pattern A — Server auto-creates (default)","Pattern B — Merchant backend creates explicitly","Pattern C — Webhook-driven creation","Choosing","Direct creation (no embed)","Free and usage-only plans (amount 0)","Linking the order that paid for the first period","Custom cadence and installment plans","Next"],"text":"Subscriptions Creating Subscriptions Three patterns map to three integration trade-offs. Pick the one that fits how much control you want over the create call. currency is optional and defaults to the store's main currency; see Multi-currency for the rule and its error codes. The plan , planName , amount , and interval values you pass on the recurring block come from your application — not from Throttle. We treat planReference as opaque text scoped to your merchant and never validate it against any list. Two workspaces can both have a pro_monthly reference without collision. Most teams keep plans in their own database (a plans table or a static config in the repo). That source-of-truth is what your storefront pulls from to render the plan picker, and what your backend forwards into the recurring block. A managed plan catalog inside Throttle is not part of v1. Pattern A — Server auto-creates (default) Set recurring.create: auto (the default) and Throttle creates the subscription atomically when the card is vaulted. Your onSucceeded callback fires with subscriptionIds (and subscriptionId when exactly one was created). Use this when you want the path of least resistance. The merchant writes zero code on the success path — vault, sub create, and notification all happen on Throttle s side. Throttle treats sub-create-after-vault as a single transactional unit. If the sub create fails, the vault row is still written (the buyer s card is on file), but no subscription exists. Throttle emits subscription.create_failed with a reason code. Listen for it and decide your fallback: retry from your own backend, contact support, or surface the error to the buyer. A checkout creates all of its subscriptions together or none of them. If any create fails, none exist, the order still stands (the money was captured), and one subscription.create_failed fires per subscription line, carrying its lineItemId . Pattern B — Merchant backend creates explicitly Set recurring.create: manual when you want full control. The embed only vaults; you call subscriptions.create yourself. Use this when you need to look up plan details from your own DB, run business logic before subscribing, or attach merchant-specific metadata that the embed cannot know about. Pattern C — Webhook-driven creation Use the payment.vaulted webhook. Survives a buyer closing their tab between vault and create. Recommended when reliability matters more than latency. Combine with create: manual on the embed: auto-mode and webhook-driven creation both racing to call create would double-bill (Throttle de-dupes, but it s still cleaner to pick one). Choosing subscriptions.create with a pre-vaulted payment method ID , ] ] /> Direct creation (no embed) For B2B flows where you ve already collected a card via another mechanism (a sales rep enters it through your admin tool), call subscriptions.create directly. A subscription created this way has no card of its own ( paymentMethodId: null ), so it renews on the customer's default card. Pre-condition: a customerPaymentMethods row already exists with isDefault: true for the customer — otherwise the renewal cron has nothing to charge. Subscriptions Throttle creates from a checkout store the card the buyer paid with instead; see Which card a renewal charges . Free and usage-only plans (amount 0) A subscription at amount: 0 renews every period for nothing, so Throttle treats 0 as a mistake unless you say otherwise. POST /api/v1/subscriptions , PATCH /api/v1/subscriptions/:id and POST /api/v1/subscriptions/:id/change-plan refuse amount: 0 with 400 invalid_amount unless the same request sends allowZeroAmount: true . Send it for a free tier or a plan billed only through usage. The flag applies to that one request and is not stored; subscriptions already at 0 keep renewing. A $0 subscription created without an orderId gets no invoice for its first period, the same as a $0 renewal : GET /api/v1/subscriptions/:id/invoices stays empty until a period costs money. With an orderId the first period keeps its $0 invoice, linked to that order. subscription.created fires either way. Checkout cannot start a $0 subscription. A session recurring.amount is the renewal price and must be above 0 when sent ( 400 invalid_amount ), and so must a cart subscription line's unitPrice ( 400 invalid_line_item ). For a free trial, send the price the plan renews at and set trialDays . Linking the order that paid for the first period When Throttle creates the subscription (Pattern A) it links the signup order itself. When you charge the first period and then create the subscription (Pattern B, Pattern C, or a proxy checkout you completed yourself), nothing connects the two — so that order shows no subscription, and the subscription's Orders tab is missing its own signup charge. Pass orderId to fix it: Throttle writes the link both ways: the order gets a subscriptionId of its own (and keeps carrying the legacy metadata.subscription_id pointer), and the subscription's first invoice records the orderId that collected it. So the order links to the subscription and GET /v1/orders?subscriptionId=... returns it. The order must exist in the same application and environment; if it does not, the call returns 404 and no subscription is created. Renewals need no orderId : the renewal cron creates those orders and stamps them itself. An order Throttle created with several subscriptions lists them in subscriptionIds ; subscriptionId is set only when there is exactly one. Passing such an order as orderId — one whose lines already link other subscriptions — creates the subscription but leaves the order's links unchanged, so the order never appears to have only the new one. Custom cadence and installment plans Every create path above accepts a cadence beyond the five named intervals, and an optional fixed number of payments: interval (named), or intervalUnit + intervalCount for any cadence from 1 hour to 1 year, or both together (they"},{"title":"Custom Cadence","route":"/developers/subscriptions/custom-cadence","headings":["Custom Cadence","Named and custom cadences","Validation","Labels","How renewal dates are computed","Month-end clamping","Hour and day cadences","When the renewal job falls behind","Pause and resume","Trials","Changing the cadence","End to end","Checkout: every 10 days","Direct: every 6 hours","Reading custom cadences","TypeScript SDK","React","Errors","Edge cases","Is "every 4 weeks" the same as monthly?","How is a custom cadence valued for MRR?","What time of day does a plan renew?","My Jan 31 subscription bills on the 3rd. Why?","Does a slow renewal-job run shift an hourly plan?","Can a buyer choose the cadence at checkout?","Next","→ { \"data\": { \"id\": \"c4a8e2f1-7b3d-4e9a-8c1f-0d6e5b4a3c21\", ... }, \"meta\": { ... } }","2. A checkout session that bills 49.00 USD every 10 days.","Then create the session with no \"recurring\" block: the line carries it.`;","it records the period you pass as already paid, and the renewal job bills","every period after it. The customer needs a default vaulted card.","→ data.pendingInterval \"biweekly\", pendingIntervalUnit \"week\", pendingIntervalCount 2,","pendingAmount 9900. subscription.plan_change_scheduled fires.`;"],"text":"Subscriptions Custom Cadence A subscription can bill every N hours, days, weeks, or months — every 6 hours, every 10 days, every 3 weeks, every 2 months — not only on the five named intervals. This page covers what you can send, what Throttle stores, how it labels a cadence, and how it computes each renewal date. Named and custom cadences Every subscription stores its cadence as a unit and a count: intervalUnit ( hour , day , week , or month ) and intervalCount (how many). The interval field names the cadence when it is one of the five named intervals, and is "custom" for everything else. The named intervals are shorthand: You send one of three shapes, and every response carries all three fields: The server reduces what you send to its largest exact unit, then names it when a named interval matches. Hours become days when the count is a multiple of 24, and days become weeks when it is a multiple of 7. Weeks never become months and months never become anything else, because a month is not a fixed length. So every 24 hours is stored as custom / day / 1 , every 14 days as biweekly , and every 4 weeks as custom / week / 4 (28 days — never monthly ). Each cadence has exactly one stored form, so filtering by interval=biweekly also finds a subscription you created as "every 14 days". A cadence is accepted in five places, with the same rules in each: POST /api/v1/subscriptions — required: send a named interval or a unit and count. recurring on POST /api/v1/checkout/sessions — checked when the session is created, so a bad cadence fails for you, not for a buyer at the end of checkout. recurring on a cart line ( POST /api/v1/carts/{id}/items ) or a quote line — checked when the line is added. Each such line becomes its own subscription; see Mixed Carts . POST /api/v1/subscriptions/{id}/change-plan — required, as on create. PATCH /api/v1/subscriptions/{id} — optional; a term-only edit (see Changing the cadence ). Validation The shortest cadence is 1 hour and the longest is one year, measured in the unit you sent: at most 8,760 hours, 365 days, 52 weeks, or 12 months. The bound is checked before the reduction, so 8,784 hours (366 days) is refused even though it would reduce to days. Every message below is the exact error.message . invalid_interval — A cadence can be at most one year: 8760 hours ], [ code: intervalUnit: day , intervalCount: 366 , html: 400 invalid_interval — A cadence can be at most one year: 365 days ], [ code: intervalUnit: week , intervalCount: 53 , html: 400 invalid_interval — A cadence can be at most one year: 52 weeks ], [ code: intervalUnit: month , intervalCount: 13 , html: 400 invalid_interval — A cadence can be at most one year: 12 months ], [ code: intervalCount: 0, -1, or 1.5 , html: 400 invalid_interval — intervalCount must be a whole number of at least 1 ], [ code: intervalUnit: minute or year , html: 400 invalid_interval — intervalUnit must be one of hour, day, week, month ], [ code: interval: daily or fortnightly , html: 400 invalid_interval — Unknown interval "daily" . There is no named daily interval; send day × 1 . ], [ code: intervalUnit without intervalCount, or the reverse , html: 400 invalid_interval — intervalUnit and intervalCount must be sent together ], [ code: interval: custom alone , html: 400 invalid_interval — A custom interval needs intervalUnit and intervalCount ], [ No cadence field at all (create, change-plan) , html: 400 invalid_interval — Send an interval, or intervalUnit and intervalCount ], [ code: interval: monthly , intervalUnit: week , intervalCount: 4 , html: 400 interval_conflict — interval "monthly" does not match every 4 weeks ], [ code: intervalCount: 3 (a string) , html: 400 validation_error — the body schema requires a JSON number ], ] /> Errors use the standard envelope: Labels @usethrottle/subscriptions exports two helpers so every surface words a cadence the same way. cadenceLabel is a standalone label for an Interval column; cadenceNoun is the period that reads correctly after a slash, as in $49.00 / 10 days . The table shows what the server stores for each input and what the helpers return for that stored row. The helpers read the fields as given; they do not reduce them. Called on a Throttle response they always match the table above. Called on raw input, cadenceLabel({ interval: custom , intervalUnit: day , intervalCount: 14 }) returns "Every 14 days", while the server stores and returns that cadence as biweekly . A value the helpers do not recognise is returned unchanged rather than dropped. How renewal dates are computed Renewal dates sit on a grid measured from billingAnchorAt , which every subscription response carries. Each period end is computed from the anchor, never chained from the previous period, so a rounding or clamping step can never compound. Hour, day, and week cadences advance by exact UTC durations: 3,600 s, 86,400 s, or 604,800 s times the count. Every 10 days is always exactly 240 hours. Month cadences land on the anchor's day of month and UTC time of day, in the month anchor month + k × count , with the day clamped to that month's last day. See Month-end clamping . The first period. A subscription created by checkout starts when the buyer pays and its first period is exactly one cadence long. On POST /api/v1/subscriptions you pass currentPeriodStart and currentPeriodEnd ; billingAnchorAt is set to currentPeriodStart (or to trialEnd when there is a trial). currentPeriodEnd must be after currentPeriodStart and in the future, or the create is 400 validation_error . The renewal job picks up a subscription once its currentPeriodEnd has passed and decides which period the charge opens: Billing restarts when a trial converts, when a failed payment is recovered, and when a scheduled change of cadence applies. Everything else is an ordinary renewal. The anchor stays where it is except in these cases: effective: now ) , "},{"title":"Customer Identity","route":"/developers/subscriptions/customer-identity","headings":["Customer Identity","Pattern A — externalCustomerId (recommended)","Pattern B — store Throttle's customerId","Pattern C — email-only","Keeping your DB in sync via webhooks","Looking up a customer by your own ID","What changes in v1","Next"],"text":"Subscriptions Customer Identity Subscriptions are scoped to customers. Throttle gives you three patterns for identifying a customer; the recommended one means you never store Throttle s IDs. Use Pattern A — externalCustomerId . Pass your own user ID everywhere. Throttle resolves it on every call. No new column on your users table. Pattern A — externalCustomerId (recommended) You give Throttle your own user ID at checkout time. Throttle upserts a customer record keyed on (workspaceId, externalId) . Subsequent checkouts and API calls reuse the same record automatically. No schema change in your DB. Idempotent — calling create twice for the same external ID does not duplicate. Your code reads naturally; user.id is the identifier everywhere. Pattern B — store Throttle s customerId Create the Throttle customer explicitly and persist the returned cus_xyz ID in your user table. Slightly faster on hot paths because Throttle skips the upsert lookup, but you own a new column. Best when you call subscription endpoints often and want to skip the resolve step. Adds one column to your DB ( users.throttleCustomerId ). Requires you to handle the user exists in your DB but not yet in Throttle case at signup time. Pattern C — email-only If your storefront accepts guest subscriptions (no merchant-side user account yet), you can pass customer: email alone. Throttle upserts on (workspaceId, email) . Works for the create flow, but management is awkward — you need to look up by email to act on the subscription later, and the buyer cannot easily prove their identity from a self-service portal. Migrate guests to Pattern A as soon as they create an account. Any checkout with a subscription line needs a customer: customer.email , customer.externalCustomerId , customer.customerId or customerEmail on the session, or session creation answers 422 recurring_customer_required . An accepted quote uses the email of the buyer who accepted it. Keeping your DB in sync via webhooks The customer.created event fires whenever a new customer record is created — directly via API, indirectly via checkout resolution, or anywhere else. If you want to mirror Throttle s customer IDs into your DB without explicit creation calls (Pattern A → Pattern B without extra round trips), subscribe to the event. Looking up a customer by your own ID New endpoint: GET /api/v1/customers/by-external/:externalId returns the canonical customer record (or 404). Use this when you need to fetch the Throttle row but only have your own user ID. What changes in v1 GET /api/v1/subscriptions accepts an externalCustomerId query parameter (mutually exclusive with customerId ). GET /api/v1/customers/by-external/:externalId is new. Pass your own ID, get the Throttle record back. The @usethrottle/subscriptions hooks accept either customerId or externalCustomerId as a scope. Next Buyer Portal — how the proxy pattern uses externalCustomerId end-to-end. React Package — hooks accept both ID forms."},{"title":"Installment Plans","route":"/developers/subscriptions/installment-plans","headings":["Installment Plans","How it works","Lifecycle","A 4-payment plan, start to finish","Counting payments","Creating one","Hosted or embedded checkout","A cart with goods and an installment plan","Directly, with the API","Quotes","Custom schedules","Gap units","When each payment is due","Tax, shipping, orders","Discount codes","What is locked","Reading the schedule","Schedule errors","Reading them","What you can change","Merchant API (secret key)","Creation rules","Buyer surfaces","After completion","Failed installments","Cancelling and refunding","Webhooks and emails","SDK and React","Errors","FAQ","Can a buyer pay the rest early?","Can I turn an ongoing subscription into an installment plan, or the reverse?","What if the renewal job was down for several periods?","Is each installment taxed?","Does pausing extend the plan?","Can a custom schedule have a free trial or an equal-payment count?","Can I show "Payment 2 of 4" myself?","What does an older SDK do with a completed plan?","Next","→ { \"data\": { \"id\": \"c4a8e2f1-7b3d-4e9a-8c1f-0d6e5b4a3c21\", ... }, \"meta\": { ... } }"],"text":"Subscriptions Installment Plans An installment plan is a subscription with a fixed number of payments — "4 payments of $100 every 15 days". It bills like any subscription, then stops by itself: the moment the last payment succeeds it becomes completed and is never charged again. How it works Set totalPayments (a whole number from 2 to 60) when you create the subscription. It cannot be added, changed, or removed later. The plan uses any cadence, named or custom — see Custom Cadence . The signup charge is payment 1 of N. paymentsMade counts the payments collected so far. When payment N succeeds the status becomes completed , completedAt is set, no further renewal is scheduled, subscription.completed fires, and the buyer gets a paid-in-full email. completed is terminal. The amount, cadence, quantity, and plan are fixed. There is no trial and no metered usage. Only you can pause, resume, or cancel it. The buyer cannot, from Throttle's buyer portal or its storefront API. If your app grants access while status === active , add completed . A completed plan's currentPeriodEnd is the end of the period the final payment covered; whether access continues after it is your decision. Lifecycle A merchant can cancel from active , paused , or past_due . A past-due installment is recovered by a retry, a buyer card update, or a waive; the fourth failed attempt cancels the plan. A plan created by a session intent on a quote or deposit-split cart starts without payment 1: see Counting payments . Everything else about active , past_due , paused , and cancelled is the same as for an ongoing subscription; see Lifecycle and States . A 4-payment plan, start to finish Four payments of 100.00 USD every 15 days, bought on October 1 at 09:00 UTC: The plan completes on November 15, when payment 4 succeeds — not on November 30, when the period it pays for ends. Nothing is charged on November 30. Counting payments POST /api/v1/subscriptions , html: Starts at 1 — the route books period 1 as paid ], [ Checkout with a session recurring intent on a quote or deposit-split cart, whose charge does not include the plan , Starts at 0; the first renewal is payment 1, so all N payments come from renewals ], [ A renewal charge succeeds (the renewal job, a merchant retry, or the buyer paying a past-due installment) , +1 ], [ A past-due period is waived , +1 — a waived installment counts, and a waived final installment completes the plan ], [ A charge is declined , Unchanged ], [ An installment is refunded , Unchanged ], [ Periods skipped because the renewal job fell behind , Never counted ], [ The plan is paused , Waits — nothing is charged or counted while paused ], ] /> installmentProgress in @usethrottle/subscriptions turns those fields into progress. remainingCents is remainingPayments × amount × quantity on an equal plan. Pass the subscription itself (it carries paymentSchedule ) and on a custom schedule it is the sum of the unpaid payments' net amounts instead. Both are before tax. The buyer sees the schedule before paying. The hosted checkout page reads "Pay 100.00 USD today, then 3 more payments of 100.00 USD every 15 days. Total: 400.00 USD." — with "plus applicable tax" added when the application taxes renewals, and without "Cancel anytime". With a discount code, only the first charge is discounted: "Pay 80.00 USD today, then 3 more payments of 100.00 USD every 15 days. Total: 380.00 USD." When the charge today does not include the plan it reads "Then 4 payments of 100.00 USD every 15 days, starting at the next billing date. Total: 400.00 USD." Creating one Hosted or embedded checkout Put totalPayments on the session's recurring block. With the default create: auto , Throttle charges payment 1 and creates the plan when the buyer pays; the embed's onSucceeded receives subscriptionIds (and subscriptionId , set when exactly one subscription was created). The session is validated when you create it: a bad totalPayments or a trial fails then, not at the end of checkout. With create: manual , checkout takes payment 1 and vaults the card, and your backend creates the plan. Pass the checkout's orderId so the order and the plan point at each other: A cart with goods and an installment plan Put the plan on a cart line: recurring with totalPayments on POST /api/v1/carts/{id}/items , with the installment amount as the line's unitPrice . Leave recurring off the session. The first charge covers the goods plus installment 1 ( paymentsMade: 1 ); renewals charge the installment only. Each such line becomes its own subscription, so one checkout can sell several plans, up to ten. See Mixed Carts for pricing, shipping, and refunds on that shape. The session recurring block still works for a single plan on a cart of goods. It needs amount whenever the cart holds other lines ( 422 recurring_amount_required ), and it cannot be combined with subscription lines on the same cart ( 422 recurring_source_conflict ). A cart or order line item's recurring.count is read-only display data ("· 4 payments"): it mirrors the line's totalPayments , and the cart item endpoints do not accept it on input. On a line, recurring.totalPayments is the installment count. To cap the number of charges, send totalPayments in a cart or quote line's recurring block, on the session's recurring block, or on POST /api/v1/subscriptions . Directly, with the API The route records period 1 as a paid invoice and sets paymentsMade: 1 , on the basis that you already collected it. If you did not, the buyer is charged only N − 1 times. Charge the signup first, pass its orderId when an order records it, and make sure the customer has a default vaulted card — the renewal job charges that card. Quotes A quote line can carry the same recurring block, with totalPayments . Paying the accepted quote takes installment 1 in the same capture as the rest of the q"},{"title":"Lifecycle and States","route":"/developers/subscriptions/lifecycle-and-states","headings":["Lifecycle and States","Billing intervals","Installment plans","States","State diagram","Trial behavior","Renewal","Which card a renewal charges","Dunning","When a renewal can't complete","Renewal reminder","Grace period — your call, not Throttle's","Plan changes","Upgrades — effective: "now"","Downgrades — effective: "period_end"","Cancelling a pending change","Precedence vs. cancel-at-period-end","Credits and refunds","Next"],"text":"Subscriptions Lifecycle and States How a subscription moves through its life. Understand the state machine, the renewal cron, and the dunning policy before you wire your webhook handlers. Billing intervals Throttle bills on any cadence from 1 hour to 1 year, not only the five named intervals ( weekly , biweekly , monthly , quarterly , yearly ). Send a named interval , or intervalUnit ( hour , day , week , or month ) + intervalCount , on the checkout session's recurring block, on a cart or quote line's recurring block, on POST /api/v1/subscriptions , or on change-plan . The server stores one canonical form — every 14 days comes back as biweekly , every 24 hours as custom / day / 1 — and every response carries interval (the name or "custom" ), intervalUnit , and intervalCount . An invalid cadence is 400 invalid_interval ; a named interval that disagrees with the unit and count is 400 interval_conflict . Periods are anchored, not chained. Each period end is computed from billingAnchorAt . Month cadences keep the anchor's day of month, clamped to short months: a Jan-31 monthly subscription renews Feb 28 (29 in a leap year), then Mar 31. Hour, day, and week cadences advance by exact durations. The anchor moves when billing restarts — trial conversion, a recovered payment, an immediate plan change or a scheduled cadence change, or a resume, which shifts it by the time spent paused. biweekly means every 14 days — 26 charges a year, not twice a month. Mixed-interval pricing (e.g., Pro Monthly + Pro Yearly with a 20% discount on yearly) is your job — you store the two plans in your own catalog and pass the right amount / interval to Throttle. We don't model plan tiers; see Creating Subscriptions for why. Plan changes can swap the cadence via POST /api/v1/subscriptions/:id/change-plan (rejected on an installment plan). An outage or a stalled retry can leave a subscription more than one period behind. Throttle charges it once, for whichever grid period contains the moment of the charge — the periods it missed are skipped, never billed back-to-back, and never counted toward an installment plan's totalPayments . Full guide: Custom Cadence → — every validation rule, the label helpers, the renewal-date algorithm, month-end clamping, hour cadences, trials, and cadence changes. Installment plans Set totalPayments (2–60) on the checkout session's recurring block, on a cart or quote line's recurring block, or on POST /api/v1/subscriptions to make a subscription an installment plan — a fixed number of payments that ends itself. The paid signup is payment 1 of N, and the plan becomes completed the moment payment N succeeds, emitting subscription.completed and a paid-in-full email. Merchants who gate access on status = active must treat completed as paid in full. totalPayments is set at creation only ( 400 total_payments_immutable ), an installment plan cannot have a trial ( 400 invalid_combination ), and its amount, cadence, quantity, and plan are fixed ( 409 installment_plan_locked ). Only the merchant can pause, resume, or cancel it; buyer storefront sessions get 403 installment_plan_merchant_only . Payments can also differ: a custom schedule gives each payment its own amount and gap. Its later due dates are estimates: a late payment that succeeds, a pause, or a waive moves them, and nothing is skipped. A manual period renew of a scheduled plan is refused ( 409 installment_plan_locked ). Full guide: Installment Plans → — how payments are counted, the lock and completed-state matrices, failed installments, cancelling and refunding, webhooks, and SDK examples. States trialing — Created with trialEnd in the future. No charge has been attempted. Card is already vaulted. active — Most subscriptions live here. Renews on the period boundary. paused — Manually paused. Skipped by the renewal cron. Can resume back to active. past_due — A renewal charge failed. The subscription moves here on the first failed attempt and stays while Throttle retries (up to three retries; see Dunning below). While it is past due, currentPeriodEnd holds the time of the next scheduled retry, not the date the period was due. The buyer's renewal-failed email carries an Update your card button to a Throttle-hosted page ( checkout.usethrottle.dev/billing/{token} ) where they save a new card and the past-due period is charged on the spot; a successful charge returns the subscription to active and emits subscription.renewed like any other renewal. The link is signed for that customer and subscription and valid for 14 days. See Payment Methods → Subscription self-service for the routes behind it. cancelled — Terminal. Reached via explicit cancel, dunning exhaustion, or merchant action. Renewals stop. completed — Terminal. Reached only from active , when an installment plan's final payment succeeds. Renewals stop; pause, resume, cancel, and plan changes are rejected like cancelled . See Installment plans above. unpaid — Accepted by the status schema and the published SDKs for forward compatibility. The customer-facing renewal engine documented on this page does not transition a subscription to it today. State diagram Trial behavior Trials always require a vaulted card. The embed collects and vaults the card at signup; the cron simply waits until trialEnd passes before attempting the first charge. On trialEnd , the cron flips the row from trialing to active and emits subscription.activated . The first paid period begins immediately after — no second tick is needed. If the buyer cancels during the trial, the subscription transitions directly to cancelled with no charge. Throttle does not yet support trials with no card on file. The card-up-front model is simpler and avoids a second flow to attach a card before trial end. Throttle automatically blocks the same physical card from claiming multiple trials on a single merchant. Checkout checks the card's fingerprint against prior su"},{"title":"Managing Subscriptions","route":"/developers/subscriptions/managing-subscriptions","headings":["Managing Subscriptions","List and filter","Cancel","Immediate cancellation","Cancel at period end","Refund a billing cycle","Pause and resume","Change the card","Change where a physical subscription ships","Move or end a trial","Email more people than the customer","Change plan","Immediate change","How the credit is worked out","Scheduled change","Cancelling a pending change","Seats and quantity","From the React package","Audit log","Never change a plan through checkout","Handle the 402","Next"],"text":"Subscriptions Managing Subscriptions Pause, resume, cancel, change plans, and change the card. Same primitives whether you re calling from your backend, the dashboard, or the React package. List and filter GET /api/v1/subscriptions returns cursor-paginated results. Filter by status , interval , customerId , or externalCustomerId . Use q to search subscription ids, customer ids, plan fields, status, interval, or metadata. Cancel Two flavors. Pick based on your buyer experience. The backend examples use @usethrottle/subscriptions/server with your secret key. Immediate cancellation Use when the buyer wants to stop right now. Because this takes away access the buyer may have already paid for, it is the one cancellation that can also move money: refund accepts none (default), prorated , or last_cycle . The refund is issued before the subscription is cancelled, so a payment failure leaves the subscription untouched rather than cancelling it with the money stranded. refund is rejected together with atPeriodEnd: true ( 400 validation_error ): at period end the buyer keeps the period they paid for, so there is nothing to give back. A prorated cancel on a period nothing was paid for (a waived period, say) still cancels, with a refund of 0 . A paused or past-due subscription is refunded the unused paid time from when it was paused (paused) or from now (past due). The refund is always capped at the cash paid for the period; if a period was paid but no unused time is left, the call is 422 invalid_state and nothing is cancelled. Asking for a refund on a subscription that is already cancelled or completed returns 409 invalid_state and refunds nothing. Cancel at period end Common pattern: the buyer keeps access until the end of what they paid for. Throttle sets cancelAtPeriodEnd: true . The renewal cron sees it on the next tick after the period ends and finalizes the cancellation. To restore a subscription that was scheduled to cancel, call POST /api/v1/subscriptions/:id/resume (it clears cancelAtPeriodEnd ; PATCH does not accept that field). (Calling cancel again with atPeriodEnd: false does not undo it — that cancels immediately.) After actual cancellation the subscription is terminal — create a new one. Cancelling, either way, also clears any pending plan or seat change on the subscription. Refund a billing cycle Every subscription charge produces a subscription invoice , and each one can be refunded on its own — the signup cycle, a renewal, or a plan-change charge. Refunding a cycle is a money operation only: it does not stop billing unless you say so. intent is required and has two values: money_only — the money goes back and the subscription keeps running. The next renewal charges as normal. refund_and_cancel — the money goes back and the subscription is cancelled immediately, in that order. Omit amount to refund everything still refundable on the cycle. Partial refunds accumulate: the invoice moves to partially_refunded , then refunded once the whole amount is back. A cycle that is already fully refunded, unpaid, failed, or $0 (waived or free) is rejected with 422 . A refund with money_only leaves an active subscription active — the renewal cron will charge again on schedule. If the buyer is leaving, use refund_and_cancel (or cancel separately). The same is true of refunding the cycle s order from the Orders API: the money goes back and the cycle is marked refunded, but the subscription keeps billing. The same holds for a checkout that created several subscriptions: no refund cancels the order or any of them, and an order refund that names no cycle comes out of the goods and shipping first, then across the cycles in proportion to what each still has refundable. Refunds are placed in the order they happened, each against what was left at that moment. Refunding through either surface reaches the same numbers. The amount refunded on a cycle is derived from the payment s own transaction ledger, so a refund taken on the order that collected the cycle updates the cycle and its invoice too — and the refundable amount the next call is offered already has it subtracted. When the order billed more than the cycle — a one-time setup fee charged alongside the first period — a refund pays down the non-recurring part first, and only what is left over reaches the cycle. Refunding a $40 setup fee on a $65 order that also carried a $25 first period leaves the cycle fully refundable; refunding the remaining $25 then closes it. Refunds carry no line-item attribution, so this is the direction that keeps a one-time refund from locking you out of refunding the subscription itself. Both intents emit subscription.invoice_refunded , whose payload carries the intent so your systems can tell a goodwill refund from a cancellation. refund_and_cancel additionally emits subscription.cancelled . Requires the payment_refunds:write scope. Pause and resume Pausing an active subscription transitions it to paused . The renewal cron skips paused rows entirely — no charge attempt, no dunning. Resuming returns it to active and pushes currentPeriodEnd forward by however long the subscription was paused, so the buyer gets back the days billing was stopped instead of being charged for them. Guards: pause requires status active . Any other status (including trialing , which has nothing billed to pause) is 400 invalid_subscription_state . resume on a paused subscription always unpauses it, whether or not it also has cancelAtPeriodEnd: true — the scheduled cancellation is left exactly as it was. On a subscription that is not paused, resume clears a scheduled cancellation ( cancelAtPeriodEnd: true ) in any non-cancelled status ( active , trialing , past_due ) and leaves the status alone; on an active subscription with nothing scheduled it is a no-op that returns the subscription. For cancelled and completed it is 400 invalid_subscription_state . A paused subscription that also has cancelAtPeriodEnd: true is still cancelled at its stored curren"},{"title":"Mixed Carts","route":"/developers/subscriptions/mixed-carts","headings":["Mixed Carts","Selling one","Starting checkout from an existing cart","What the buyer is charged","What you get back","The same plan twice, and seats","Shipping and the address step","Trials","Discounts","Invoices and emails","Refunds never stop billing","Cancelling","The session intent, for one plan","Errors","Limits","Next","2. Each line with a recurring block becomes ONE subscription.","3. The one-time goods, as usual."],"text":"Subscriptions Mixed Carts One cart can hold any number of one-time lines and up to ten subscriptions — the same plan or different ones, each on its own cadence, installment plan or trial. The buyer pays once, shipping is charged once, and the checkout lands on one order linked to every subscription it created. Selling one Put a recurring block on each cart line that should become a subscription. Leave recurring off the checkout session: the lines carry it. Throttle validates every subscription line when the session is created, so the total on the hosted page, the amount authorized in the embed and the amount settled are the same number. The same recurring block works on the Cart API , the browser cart session (whose hosted cart page shows each line s terms) and quotes . Starting checkout from an existing cart A checkout session can also be created from a cart that already exists — Throttle's hosted cart page ( /cart/<id> ), an abandoned-cart recovery link, or a plain cartId hand-off. These hand-offs carry no recurring block of their own, so Throttle recovers the plan's recurring intent from the cart before anything is charged: It reuses the intent of an earlier session on the same cart for the same plan, keeping the merchant's exact fields and create mode; or, if there is none, it rebuilds the intent from the cart's plan line (its plan reference, cadence, amount, and trial days). If the earlier session's cadence disagrees with the plan line the buyer sees and pays, the plan line wins. The shipping step is kept. The session inherits the earlier session's address collection; with none to inherit, it collects a shipping address whenever the cart holds any line besides the plan line. The cart-based default described in Shipping and the address step does not apply to a hand-off. A recurring session needs a buyer identity. A hand-off that supplies no email inherits the earlier session's. If there is none to inherit and the request names no customer.email , customer.customerId , customer.externalCustomerId , or customerEmail , it is refused with 422 recurring_customer_required ("Recurring checkout sessions require a customer email or customer identifier"). If the terms cannot be determined (the plan line has no plan reference or no valid cadence), the session is refused with 422 subscription_terms_undeterminable before the buyer is charged, so a buyer is never charged for a plan whose subscription would not be created. Fix the cart's plan line, or create the session with an explicit recurring block. This applies to native Throttle carts only, and only to the plan line Throttle writes for a recurring checkout ( type: "subscription" with metadata.subscriptionLineItem: true ). A line that carries its own recurring.plan brings its own terms and needs no session intent. A cart that holds both kinds (a legacy plan line and lines with their own recurring.plan ) is refused with 422 recurring_source_conflict , whatever the line order. What the buyer is charged What you get back subscriptionIds lists every subscription on the order, in line order, and each line s subscriptionId names the one it created. subscriptionId is kept for integrations written before this: it is set when the order has exactly one subscription and is null otherwise, so read subscriptionIds . The completion response, the embed s onSucceeded , and the order and payment webhooks carry the same pair. The ?subscriptionId= filter matches an order through any of its lines. The same plan twice, and seats Every subscription line is its own subscription. Two lines with the same plan make two independent subscriptions, which cancel, refund and renew separately. Nothing is merged, not even when a guest cart is merged into a signed-in buyer s cart. For several seats on one subscription, send one line with a higher quantity : quantity is seats, and each renewal bills unit price × seats. Shipping and the address step Subscription lines are never charged shipping. They are left out of weight, item-count and subtotal rules, so a free-shipping threshold is measured on the goods alone, and requiresShipping: true on a subscription line is rejected. A subscription line ships only when it says so with deliveryMethod: shipment : a physical subscription that ships a box every cycle, still with no shipping charge. A type: subscription line with no recurring never becomes a subscription, so it ships by the usual rules. Omit collect and Throttle decides from the cart: on a checkout with subscriptions, the address step is on when the cart holds at least one shippable one-time line or a physical subscription line, and off otherwise; any other checkout keeps asking. A physical subscription line refuses an explicit collect.shippingAddress: false with 400 shipping_address_required . A collect object that leaves out shippingAddress sets it to true . An explicit value always wins. A checkout with no shipping step still needs an address to tax when your application uses a tax provider on the strict fallback policy. In that case an omitted collect.billingAddress defaults to true , and tax is calculated from the billing address. See collection flags . Trials A free-trial line is charged nothing today. Throttle stores it at a unit price of 0 and keeps your price on recurring.amount for the renewals, the same way it stores the plan line for a trial on the session intent. A free-trial line cannot carry taxAmount or discountAmount . Trial eligibility is checked once per checkout, against the card s history before this checkout, and the answer applies to every trial line in it. When it is blocked, the whole checkout is refused with 409 trial_not_available before any order exists: no subscription gets a free first period, nothing is charged, and one subscription.trial_blocked fires with subscriptionId: null . The buyer can pay with another card, or you can offer the plan without a trial. Discounts A discount "},{"title":"Subscribe a Buyer in Five Minutes","route":"/developers/subscriptions/quickstart","headings":["Subscribe a Buyer in Five Minutes","Flow","1. Backend route — create the session","2. Frontend — render the embed","3. Webhook handler — react to lifecycle events","Next"],"text":"Subscriptions · Quickstart Subscribe a Buyer in Five Minutes End-to-end recurring billing with the Throttle embed. Three files: backend session route, frontend embed, webhook handler. You have a Throttle workspace, a secret key for your backend, a configured application, and an allowed checkout origin. If you don't, run through the payment quickstart first. Flow 1. Backend route — create the session The recurring block is the only difference from a one-time payment session. Throttle stores it on the session metadata and uses it to create the subscription when the embed reports a successful vault. 2. Frontend — render the embed The recurring prop on the embed is optional; when omitted, the session s recurring metadata still drives the backend. Pass it explicitly only if you want type-safe disambiguation in your client code. 3. Webhook handler — react to lifecycle events Webhooks are the source of truth for state. The embed callback is convenient but not durable — a buyer who closes their tab still triggers webhooks. Set recurring.create: manual if you d rather call subscriptions.create from your own backend after vault success. See Creating Subscriptions for the three patterns. recurring.interval: monthly above is the common case. Send intervalUnit + intervalCount instead (or as well) for any cadence from 1 hour to 1 year, and totalPayments (2–60) to make it an installment plan that ends itself after N payments — no trial allowed together with it. See Lifecycle and States for the bounds and Creating Subscriptions for the installment rules. Next Customer Identity — why externalCustomerId beats storing Throttle s customer ID. Lifecycle and States — what happens between renewals and what dunning looks like. Buyer Portal — give buyers a way to cancel without emailing support."},{"title":"React Package · @usethrottle/subscriptions","route":"/developers/subscriptions/react-package","headings":["{sub.planName}","React Package · @usethrottle/subscriptions","Install","Backend proxy","Provider","Server-side client","Hooks · queries","useSubscriptions(filters)","useSubscription(id)","useCustomerPaymentMethods(customerId)","Hooks · mutations","useCancelSubscription()","usePauseSubscription() / useResumeSubscription()","useChangePlan()","useCreateCheckoutSession()","useTrialEligibility()","Custom cadence and installment plans","Primitive components","Boundaries"],"text":"Subscriptions React Package · @usethrottle/subscriptions Production React hooks, server proxy helpers, and primitive components for managing Throttle subscriptions end-to-end from your buyer portal. Browser code should use the provider and hooks through your backend proxy. Backend code can import createSubscriptionsClient from the server entrypoint and use it with your secret key. The package never requires putting an sk_* key in browser code. Install Backend proxy The package ships a Next.js-compatible proxy helper at @usethrottle/subscriptions/server . It allowlists the subscription, customer-by-external, trial eligibility, and checkout-session paths, pins subscription reads, customer lookups, direct subscription creates, and checkout-session creates to the authenticated buyer's externalCustomerId , and verifies ownership before forwarding subscription mutations. Provider Mount a SubscriptionProvider high in your tree. The fetcher prop is the contract with your backend proxy — every hook routes through it. Server-side client Backend routes can use the server entrypoint as a typed subscription client without bundling React provider code. Use this for admin tooling, webhook handlers, or custom business logic that should run server-side. Subscription confirmation pages and account portals can also fetch vaulted payment-method summaries without reaching around the package. Hooks · queries useSubscriptions(filters) Lists subscriptions for a customer. Filters: customerId or externalCustomerId (one is required), plus optional status (now including unpaid and completed ), interval ( custom matches every non-named cadence), installment ( true for installment plans only, false for ongoing subscriptions only), cursor , limit . useSubscription(id) Fetches a single subscription. useCustomerPaymentMethods(customerId) Fetches saved payment-method summaries. When routed through the backend proxy, payment method reads are pinned to the authenticated buyer's customer row. Hooks · mutations All mutation hooks return a mutate, mutateAsync, isPending, error, data shape. On success they invalidate the relevant useSubscription / useSubscriptions caches. useCancelSubscription() usePauseSubscription() / useResumeSubscription() useChangePlan() A real plan change — prorated and charged immediately when effective: now , or scheduled for period end with no charge today. For a term-only edit with no proration and no charge (rename a plan, correct the amount on the row), call the client s update(id, input) instead. useCreateCheckoutSession() Bridge from the management package to @usethrottle/checkout-react s <PaymentEmbed /> . Wraps the /api/v1/checkout/sessions POST with recurring metadata. recurring is optional: omit it when the cart s lines carry recurring . useTrialEligibility() Calls POST /api/v1/subscriptions/eligibility-check through your proxy. Use it when your UI needs to decide whether to offer a trial after a payment method has already been vaulted. Custom cadence and installment plans Subscription carries the fields a custom cadence and an installment plan need: intervalUnit ( hour | day | week | month ) and intervalCount alongside interval (which now also accepts "custom" ), plus totalPayments , paymentsMade , and completedAt for installment plans (on an ongoing subscription totalPayments and completedAt are null and paymentsMade is 0 ). SubscriptionStatus adds unpaid and completed . Three helpers turn those fields into copy instead of every app re-deriving its own label map — the exact bug custom cadences were built to retire: cadenceNoun(sub) — the period noun after a slash: "10 days" , "2 weeks" , "month" . cadenceLabel(sub) — a standalone label: "Monthly" , "Every 10 days" . installmentProgress(sub) — null for an ongoing subscription, or paymentsMade, totalPayments, remainingPayments, remainingCents for an installment plan. create() and useCreateSubscription() accept intervalUnit + intervalCount alongside interval , and totalPayments (2–60) to create an installment plan. Full guide: Custom Cadence → — bounds, the label table, and renewal dates. Full guide: Installment Plans → — counting, locks, completion, and a progress component. Primitive components Three presentational components. They take a subscription (or a single field) as a prop and render appropriately. No secret-key API calls. <SubscriptionStatusBadge status= status /> — chip with state-specific colour. Accepts className . <TrialCountdown endDate= date /> — Trial ends in N days . Pass the trial end date. <DunningBanner subscription= sub onUpdateCard= fn /> — shown when status is past_due . Includes an action that calls your update-card flow. Boundaries Payment collection stays in @usethrottle/checkout-react . This package creates recurring sessions and manages the subscription lifecycle around the embed. Direct browser auth via customer-scoped tokens is not exposed yet. Use the proxy helper so your backend owns authorization and secret-key storage. Composite portal layouts are application code. Components here are primitives and accept className / style for your design system."},{"title":"Testing","route":"/developers/subscriptions/testing","headings":["Testing","Sandbox checklist","Manual smoke test","Trial-abuse replay","Webhook assertions","Automated test boundaries","Common gotchas","Prove webhooks before go-live","Next"],"text":"Subscriptions Testing Verify subscription integrations against Throttle's hosted sandbox surfaces and your own staging storefront. Treat Throttle as an external API: configure keys, origins, webhooks, and assertions the same way you will in production. Keep secret keys on your backend, use a non-production workspace/application for test runs, and never put a secret key in browser code. Browser code should only receive session identifiers and embed data returned by your backend. Sandbox checklist Before exercising a subscription flow, confirm the environment pieces below. The exact values come from your Throttle dashboard or onboarding handoff. Testing and test cards . , ] ] /> Manual smoke test A passing smoke test proves that your backend can create the session, the browser can mount the hosted payment surface, and your webhook endpoint can process durable subscription events. Open your staging pricing or subscribe page. Select a plan that creates a recurring checkout session. Confirm your backend creates the session with a recurring block. Mount the Throttle payment or checkout embed from the returned session. Complete the payment with sandbox payment details for your account. Confirm your storefront receives the success callback and renders the subscription confirmation state. Confirm your webhook endpoint receives subscription.created and any payment events needed by your ledger. Trial-abuse replay To validate trial-abuse protection, repeat the subscription flow with the same physical card fingerprint and a different customer identity. The expected result is a subscription without the requested trial and a subscription.trial_blocked webhook. subscription.trial_blocked with a reason such as card_already_used_for_trial . , ], [ Customer experience , Your storefront should explain that the buyer is subscribed without a new trial. , ] ] /> Webhook assertions Subscription state is durable only after your webhook handler processes signed events idempotently. Store event ids before applying side effects and treat delivery as at-least-once. subscription.created plus the payment event your ledger expects. , ], [ Trial ends , code: subscription.activated , ], [ Renewal succeeds , code: subscription.renewed , ], [ Renewal fails , html: subscription.payment_failed and, on the first failed attempt, subscription.past_due . , ], [ Cancellation , html: subscription.cancelled with the expected data.reason . , ] ] /> Automated test boundaries Automated browser tests should validate your application's behavior around the embed: session creation, iframe mounting, event listeners, success routing, and webhook-driven state updates. They should not reach into the hosted payment iframe or depend on private Throttle implementation details. Common gotchas Origin not allowlisted. The iframe refuses to render until the parent storefront origin is configured for the merchant. Webhook signature mismatch. Verify against the webhook secret for the same merchant environment that sent the event. Duplicate webhook side effects. Throttle retries delivery; store event ids and make every handler idempotent. Expired checkout session. Create a fresh session for every buyer attempt instead of reusing old session ids. Testing inside the iframe. The payment surface is hosted and isolated. Assert the events it emits and the state your app persists. Prove webhooks before go-live A broken tenant lookup returns 200 on every delivery. Throttle s log shows delivered / 200 , your endpoint reports no errors, and nothing happens. If your checkout return path also syncs state, the user-present flow keeps working and hides it — until the first renewal, with nobody watching. Do not wait for a real customer to find out. Use a dedicated test tenant: Give it a subscription row and record the baseline. Create a Throttle customer whose externalId is that tenant s real id. Create or modify a subscription through the API. Assert your own database changed. Restore the tenant. Everything except a renewal can be driven headlessly this way — a browser is only needed for card entry. Renewal is the one path you cannot trigger on demand, so diarise the first one for about a month after cutover. Next Quickstart — create the first recurring checkout session. Subscription Webhooks — understand event payloads and delivery behavior. Trial Fraud Protection — see how trial eligibility is evaluated."},{"title":"Trial Fraud Protection","route":"/developers/subscriptions/trial-fraud-protection","headings":["Trial Fraud Protection","How it works","Scope is per-merchant","Pre-flight API","POST /api/v1/subscriptions/eligibility-check","Using it from your backend","The trial_blocked webhook","What this does NOT protect against","Disabling the check","Next"],"text":"Subscriptions Trial Fraud Protection Throttle ships a card-fingerprint check that detects the same physical card being reused across fresh customer accounts. The check runs automatically inside the auto-create flow and is also exposed as a pre-flight API endpoint for explicit gating. How it works Every payment vault writes the processor's stable payment_method.fingerprint onto the customer_payment_methods row. When a checkout grants a trial, Throttle reads the card's fingerprint from the payment before any order exists and checks whether a customer on this merchant with the same fingerprint already had a subscription with trialEnd set. The check runs once per checkout, and its answer covers every trial line. If a match exists, the checkout is refused with 409 trial_not_available ( details.reason: "card_already_used_for_trial" ). No order, no subscription and no saved card are created, and nothing is charged. The hosted checkout says "This card has already been used for a free trial." and shows the card form again, since another card may be eligible; your storefront can offer a plan without a trial. A subscription.trial_blocked event still fires, with subscriptionId: null . On the server-authorize rail (Secure Fields) the check runs after the authorisation and before capture; a non-zero authorisation is voided, and the pending order that rail creates first is reused if the buyer retries. A refused trial never gives a free first period. Before 2026-10-05 a blocked trial created the subscription active with its first period unpaid. If two checkouts with the same card race past the first check, the check after payment catches it: the subscription is created trialing with trialEnd set to now, the renewal job charges the first period on its next run (with tax, invoice, emails and dunning as for any trial conversion), and subscription.trial_blocked fires with the subscription id. For those few minutes subscription.created reports status: trialing . If the engine can't check (no fingerprint on the row, or the card was vaulted before the v1 schema migration), the trial is allowed . We surface this in the eligibility-check response as reason: 'no_fingerprint_available' so you can layer your own checks on top. Failing-closed would be catastrophic during the rollout — many legitimate cards in your existing customer base have no fingerprint yet. Scope is per-merchant A fingerprint that's been on Merchant A's trial does not block the same card from getting a trial on Merchant B. Different businesses, different fraud surfaces. Throttle deliberately scopes the check to (workspaceId, fingerprint) so we don't leak fraud signals across workspaces. Pre-flight API POST /api/v1/subscriptions/eligibility-check Server-to-server endpoint, secured with your API key. Useful when you want to render different UI before subscribing (e.g., hide the "Start free trial" button when the buyer is ineligible). Response: Using it from your backend The trial_blocked webhook When checkout refuses a trial (without you calling the eligibility endpoint), Throttle still emits a webhook so you have a hook point to react. On a refusal no subscription exists, so subscriptionId is null and the event carries the checkout instead: cartId , checkoutSessionId and planReference . Only the race backstop above sends it with a subscription id, in addition to subscription.created . @usethrottle/webhook-types 6.3.0 types subscriptionId and paymentMethodId as nullable. What this does NOT protect against Different cards from the same buyer. The fingerprint changes when the card changes. A buyer with three different cards can claim three trials. Disposable email signups. Block disposable email domains in your signup flow if your business cares; Throttle doesn't. IP / device velocity. Throttle doesn't see the buyer's IP. Add rate-limiting or a CAPTCHA at your edge if needed. Stolen cards. That's a payment-processor concern (provider auth-decline rules) — not a subscription concern. Disabling the check The check runs automatically when customerPaymentMethods schema is wired into the subscription service (default in production). There's no per-merchant toggle in v1 — if your business model wants unlimited trials per card, contact support and we'll discuss the right primitive. Next Lifecycle and States — trial timing semantics + dunning curve. Subscription Webhooks — full event reference (now includes subscription.trial_blocked )."},{"title":"Usage Reporting","route":"/developers/subscriptions/usage-reporting","headings":["Usage Reporting","How it works","Required scopes","Report usage","List usage","Multiple usage kinds","Billing at renewal","Next"],"text":"Subscriptions Usage Reporting Report metered usage against a subscription's current billing period. Usage items are billed on top of the base subscription amount at the next renewal. How it works Each usage item is identified by a kind string (e.g. api_calls , storage_gb ). There is exactly one row per (subscription, current period, kind) combination. Reporting the same kind twice replaces the previous value — it is an absolute upsert, not an increment. The engine computes totalCents = unitCount × unitPriceCents and stores it on the row. At renewal the cron sums all usage rows for the period and adds them to the base subscription charge. The base amount and total usage overage appear as separate line items in the renewal invoice. An immediate plan or seat change ( effective: "now" ) resets the current period to the moment of the change, so any usage already reported for the period it closes out moves forward to the new period start and is billed at the next renewal instead. A waived period forgives everything due for it, usage included — that usage is never billed later. See Lifecycle & states for both. Required scopes subscription_usage:write — report (upsert) a usage item. subscription_usage:read — list usage items. subscription_usage:write also grants read access. Report usage POST /api/v1/subscriptions/{id}/usage Body fields: kind (string, 1–64 chars, required) — usage category identifier. Use a stable, lowercase slug you control. unitCount (integer ≥ 0, required) — the absolute number of units consumed this period. unitPriceCents (integer ≥ 0, required) — per-unit price in the smallest currency unit (cents for USD). Set unitCount to the total consumed so far this period, not the delta. If you called this endpoint earlier with unitCount: 1000 and 500 more units were used, report unitCount: 1500 — not 500 . Usage can't be recorded on an installment plan (a subscription with totalPayments ): it has a fixed total, so the call returns 400 invalid_state and stores nothing. Usage is likewise refused on a cancelled or completed subscription ( 422 invalid_state ), and an unknown or cross-environment subscription id is 404 not_found . List usage GET /api/v1/subscriptions/{id}/usage Returns all usage items recorded for the subscription's current billing period. Response shape per item: id — UUID of the usage row. subscriptionId — parent subscription UUID. kind — usage category string. unitCount — units reported. unitPriceCents — per-unit price. totalCents — computed unitCount × unitPriceCents . periodStart / periodEnd — ISO 8601 timestamps bounding the current billing period. createdAt — when the row was first written or last upserted. Multiple usage kinds A subscription can carry any number of independently tracked usage kinds within a period. At renewal every kind's totalCents is summed and added to the renewal charge. Billing at renewal At renewal the subscription is charged its base amount plus the sum of all usage totalCents for the ending period, and each usage kind appears as its own line item on the renewal order and invoice. No prorations are applied — the full usage overage is billed in the renewal cycle it was accrued in. After a successful renewal all usage rows for that period are finalized; new usage accumulates against the next period. Each usage line item is written with type: "usage" . It needs no fulfilment ( deliveryMethod: "none" ), and its presence does not change the renewal order's own type — the order stays recurring , same as a renewal with no usage on it. usage is written by the renewal job only: it appears in order responses, never as a line item type you can send — POST /api/v1/carts/{id}/items , quotes, and manual order line-item edits all reject it. Usage recorded after the renewal cron runs for a period is attributed to the next period. Send your final tally before the periodEnd timestamp on the subscription. Next Managing Subscriptions — pause, resume, cancel, and change plan. Subscription Webhooks — event types fired at renewal and state changes. Scopes reference — subscription_usage:read / subscription_usage:write scope details."},{"title":"Subscription Webhooks","route":"/developers/subscriptions/webhooks","headings":["Subscription Webhooks","Event types","Example payload","Plan change scheduled (downgrade deferred)","Plan changed (upgrade applied or downgrade finalized)","Completed (installment plan paid in full)","Installment plans: paymentIndex and the schedule fields","The card and the payment","Reference handler","Delivery semantics","Common pitfalls"],"text":"Subscriptions Subscription Webhooks Webhooks are the source of truth for subscription state. Your DB stays in sync without polling, and you decide which events translate to buyer emails or in-app notifications. Throttle sends transactional emails to buyers automatically for the events that matter most — welcome, renewal receipt, renewal reminder, trial ending, payment-failed, cancellation, plan-changed, and paid-in-full — so you don't need to build these from webhooks. See Lifecycle and States for the full list. Webhooks are still how you drive anything beyond that: your own additional buyer-facing message, delivered by your own provider (Resend, Postmark, SES), or an in-app surface like the <DunningBanner /> component. Event types trialing subscription converts, or on the first hourly run after signup when the trial is shorter. Carries data.trialEnd (ISO 8601, when it converts and takes its first payment). Throttle emails the buyer a trial-ending notice at the same time, so you only need this webhook for your own message or app state. Sent once per trial end: moving the trial with PATCH trialEnd sends a fresh one. A cancelled or converted trial gets none. , Warn the buyer before the first charge. Remind the merchant that a trial is about to convert. , ], [ code: subscription.activated , html: A trialing subscription flips to active at trialEnd : this is the trial conversion. It fires before the first charge, so a declined card follows it with subscription.payment_failed . , Optional your trial ended, you are now subscribed email. , ], [ code: subscription.renewed , html: A renewal charge succeeded and the period advanced. Carries data.payment (the public payment ) and data.order when a charge was made. A period that cost nothing carries data.freeRenewal: true and no payment or order : none is created (see Renewal ). , Ledger entry. Receipt email (optional). , ], [ code: subscription.backup_pm_used , html: The card the renewal tried first was declined and another of the buyer's cards paid. data.backupPaymentMethod is cardBrand, cardLastFour of the card that paid. data.repinned: true when the subscription's own card hard-declined (expired, an invalid card number, lost or stolen): the subscription now renews on the card that paid, and data.subscription.paymentMethodId is that card. No separate subscription.updated is sent for that move. , Tell the buyer which card was charged; on repinned, that it is now the card for this subscription. , ], [ code: subscription.invoice_refunded , html: One billing cycle was refunded. data.intent is money_only (the subscription keeps billing) or refund_and_cancel (it was cancelled too). data.amountRefunded is what this refund moved, data.totalRefunded is the cycle s running total, and data.fullyRefunded says whether the cycle is now whole. The same event is recorded in the event feed ( GET /api/v1/events ) with entityType: "subscription" and entityId set to the subscription id, so ?entityType=subscription&entityId=<id> finds it. It is emitted for both refund routes: the dedicated cycle refund and cancel with a refund . , html: Ledger entry and refund receipt. Do not revoke access on money_only — wait for subscription.cancelled . , ], [ code: subscription.payment_failed , html: Each of the first three failed renewal attempts (the fourth cancels instead). Includes attempt , nextRetryAt , cancelsAt (when it is cancelled if every remaining retry fails), and lastError in the payload. , Payment-failed email. First failure is the most important. , ], [ code: subscription.past_due , html: The subscription moved to past_due : fires once, on the first failed renewal attempt. , Mark the account past due and show an update-card prompt. , ], [ code: subscription.updated , html: Plan, amount, interval, or metadata changed via PATCH, or a pending plan change was cleared via DELETE …/pending-change . Also fires when the card a subscription renews on changes: the merchant picks a card for it ( PATCH /api/v1/subscriptions/:id/payment-method , or Change card in the dashboard), the buyer does ( PATCH /v1/storefront/me/subscriptions/:id/payment-method , or PATCH /api/v1/me/subscriptions/:id/payment-method from the billing link), or a new default card moves the subscriptions that were on the previous default. Picking a card for one subscription fires once, for that subscription only; through the merchant or storefront route, picking the card it already has fires nothing. data.subscription.paymentMethodId is the new card. Deleting a card a subscription uses does not fire it: the subscription silently falls back to the default card. An immediate seat change ( POST …/change-quantity with effective: "now" ) also fires it, with data.proration shaped as on subscription.plan_changed . , Confirmation email if buyer-initiated. , ], [ code: subscription.plan_change_scheduled , html: A plan change was deferred to the next renewal via POST …/change-plan with effective: "period_end" . The data.pending object contains the new plan details, and data.effectiveAt is the period-end ISO timestamp. , html: Notify the buyer: "your plan change to X takes effect on [date from effectiveAt ]". Show the pending change in your billing UI. If the change is later cancelled via DELETE …/pending-change , subscription.updated fires. , ], [ code: subscription.plan_changed , html: A plan change was applied. Fires in two situations: (1) an immediate upgrade ( effective: "now" ) charged and applied right away, or (2) a scheduled downgrade applied by the renewal cron at period end. In both cases, the data.subscription payload reflects the new plan fields and all pending* fields are null. An immediate change also carries data.proration ( creditCents , chargedCents , fullAmount , taxCents and totalChargedCents : the tax on the charge and the amount the card was charged). , Update your local plan cache. Send a plan-change confirmation ema"},{"title":"Team Management","route":"/developers/team-management","headings":["Team Management","Workspaces vs applications","Workspace concepts","Application concepts","Roles","Workspace roles","Application roles","Who can invite","Environment grants","Invite lifecycle","Token properties","Invite states","Accept flow","Member management","Workspace-level actions","Application-level actions"],"text":"Workspace Team Management Throttle organises access around workspaces and applications . A workspace is the billing and membership boundary; each workspace can contain multiple applications and multiple workspace environments. Role assignments exist at the workspace and application levels, while environment grants decide which production or non-production environments a member can see. Workspaces vs applications A workspace is the top-level container. It holds subscription and billing state, and every member with a workspace-level role can act across all applications inside it. An application maps to one storefront or integration surface. A workspace environment is the isolation layer shared across applications: production is immutable, and custom environments such as test, UAT, QA, and staging are non-production sandbox-provider environments. Workspace concepts One owner — the Clerk user who created the workspace. Unlimited workspace admins — implicit admin on all applications. Members with per-application roles. Shared billing across all applications. Environment grants for production, all non-production, or selected environments. Application concepts Scoped API keys, webhooks, and checkout sessions. Per-member roles: admin , developer , finance , viewer . Reads and writes are filtered by the active workspace environment. Roles Throttle checks two role axes for every request: the caller's workspace role and, for application-scoped actions, the caller's application role on the specific application being accessed. A permission is granted if either axis satisfies the rule — see the Permissions reference for the full matrix. Workspace roles owner — assigned to the workspace creator; one per workspace; cannot be transferred via the API (use the transfer ownership flow). Holds every permission, including workspace deletion and billing management. workspace_admin — full administrative access across all applications. Can invite members, edit member roles, and manage application settings. Cannot delete the workspace or access billing. Application roles admin — manage application settings, API keys, webhooks, and all member roles within the application. Can invite new members to the workspace with an application-scoped role. developer — access API keys, webhooks, customers, and orders (read and write). Cannot change application settings or member roles. finance — read customers, orders, payments; issue refunds. No write access to orders or customers. viewer — read-only access to customers, orders, and payments. Who can invite Invite rights depend on the inviter's own role. You can never grant a role higher than your own. Inviter role Can invite as Application scope owner Any role (including workspace_admin) Any application in the workspace workspace_admin Member with any application role Any application in the workspace admin (application member) Member with developer , finance , or viewer Only the applications they are admin on Only the owner can grant the workspace_admin role. This maps to the workspace:invite-admin permission. Environment grants Environment grants are workspace-wide. They sit beside roles: a member must have the right role for the action and access to the active environment. Owners and workspace admins can set grants on invites and member edits; application admins can invite members only into their current application and those invites default to all non-production environments. grantType Meaning all All active environments, including production and future custom environments. all_non_production Every active non-production sandbox-provider environment. production_only Only the immutable production environment. selected Only the listed environment UUIDs. A dashboard or Clerk-authenticated API request for an environment outside the member's grant returns 403 member_env_forbidden . Invite lifecycle Invitations are short-lived signed tokens. The flow from creation to membership is: Create — POST to /api/v1/workspaces/ workspaceId /invites with the invitee email and target role(s). Throttle mints a 7-day JWT and emails the invite link. Email sent — the invitee receives a link to /accept-invite?token=... from Throttle. The email address on the invite must match the Clerk account used to accept. Resend — POST to /api/v1/workspaces/ workspaceId /invites/ id /resend . Throttle rotates the token (old token is immediately invalidated) and sends a fresh email with a new 7-day window. Revoke — POST to /api/v1/workspaces/ workspaceId /invites/ id /revoke . The token is killed immediately and the invitation can no longer be accepted. Accept — see the accept flow section below. Token properties Signed JWT — tamper-proof and server-verified on accept. 7-day TTL from creation or last resend. Single-use — accepting invalidates the token. Strict email match — the signing email must equal the Clerk account email. Invite states pending — awaiting acceptance, token valid. accepted — member joined, token consumed. revoked — cancelled by an admin; token dead. expired — TTL elapsed before acceptance. Accept flow Accepting an invitation binds a Clerk user to the workspace membership record. The invitee clicks the link in the email and lands on /accept-invite?token=... . If not already signed in, the invitee authenticates via Clerk. The Clerk email must exactly match the address the invite was sent to — mismatches are rejected with invite_email_mismatch . The browser POSTs the token to POST /api/v1/invites/accept with the Clerk session JWT in the Authorization header. On success the member record is created, role assignments are applied, and the invitee is redirected to the workspace dashboard. If the accepting user is already a member of the workspace, the API returns 409 already_member . Existing roles are not modified. Member management After a member joins, their roles and access can be adjusted at any time by users with sufficient permissions. Workspace-level actions List member"},{"title":"Test Your Integration","route":"/developers/testing","headings":["Test Your Integration","Fastest check: Run test checkout","Environments","The Card Simulator","What to enter at the payment step","Causing a decline","What the simulator does not reproduce","Testing against a processor sandbox","Testing webhooks","Testing other areas","Before you launch","Remove it again when you are done.","A specific event type the endpoint is subscribed to"],"text":"Testing Test Your Integration Everything on this page happens in a non-production environment, where no real card is charged. Start with the dashboard test checkout to confirm your configuration, then run the same payment from your own storefront and check the webhooks it produces. Fastest check: Run test checkout The dashboard can mint a session and show you the result without any code of your own. Use it first: if this works and your integration does not, the difference is in your code or your origin, not in the application's setup. Select a non-production environment in the top bar. The test session is created in whichever environment is selected. Open App in the left nav, then the Checkout tab. The tab is shown to team members who can manage API keys. In the Try it card, click Run test checkout , then Mint test session . Pay in the embed that appears, as described under the Card Simulator below. The session is for one unit of the application's main currency (1.00 USD on a USD application). The dialog shows three things side by side: The embed — the same payment surface your storefront mounts. postMessage events — each event the embed posts to its parent page, with its type and time, such as throttle.ready and throttle.completed . These are the events your page receives; see the embedded checkout event reference . Webhook deliveries — the event type and delivery status of webhooks sent to your endpoints, refreshed every three seconds. The list stays empty until the selected environment has a webhook endpoint. The embed only renders on an allowed origin, so minting a test session adds the dashboard's own origin to the selected environment's Allowed origins if it is not already there. Your storefront origin still has to be added separately. Environments Every workspace has one production environment and any number of non-production environments. Keys, allowed origins, payment connections, webhook endpoints, orders and customers all belong to one environment, so nothing you create while testing appears in production. A key's prefix names its environment: sk_live_* for production, the environment's slug otherwise ( sk_test_* , sk_uat_* ). See Workspace environments . The Card Simulator When an application is created, Throttle turns on a Card Simulator and a PayPal Simulator in each of the workspace's non-production environments. They are listed on the Payment methods tab under App . A simulator stands in for a processor: the payment runs through the same session, order, payment and webhook path as a real one, but no processor is contacted and no money moves. If a non-production environment shows no active payment service, add the Card Simulator there with Add payment method . What to enter at the payment step The embed shows a card form. The simulator approves the charge whatever card number you give it, so there is no list of test numbers to learn. Use: Submit the form. Your onSucceeded callback fires with the orderId and paymentId , and the order appears under Orders in the same environment. Very small amounts (under about 0.50) have left the simulator's form spinning with no event fired. Test with a session total of 1.00 or more. Causing a decline Because the simulator approves every card number and amount, no “bad” card number produces a decline. Cause one with a decline rule instead, which is the same mechanism you would use in production to refuse traffic you do not want. Rules can match amount, currency, country, card scheme, card type or metadata. Set them with a secret key that holds connectors:write , or in the Routing section of the Payment methods tab. Rules are saved per environment, so a rule set with a non-production key does not affect production. Remove it when you are finished so later tests are not declined by surprise. What the simulator does not reproduce Issuer behaviour. There are no card numbers for insufficient funds, expired cards or other specific refusals. A decline rule is the only way to get a decline. 3-D Secure by card number. A challenge is not raised by the card number alone, including the numbers other processors treat as 3-D Secure test cards. It has to be configured; see Secure Fields , which also lists the other failures worth driving (double submit, an already-paid session, a saved card on a guest checkout). A real processor's responses. Fees, settlement timing, disputes and processor-specific error detail only exist once a processor is connected. Testing against a processor sandbox Each environment has its own payment connections and credentials. Non-production environments take a processor's sandbox credentials and production takes live ones, so you can connect a processor's sandbox account to a non-production environment and test against it before you go live. Once a sandbox processor handles the payment, the card numbers, test accounts and outcomes are that processor's, not the simulator's. Use the test values from the processor's own documentation. Connection steps are in Payment connectors . Testing webhooks Webhook endpoints belong to one environment and only receive that environment's events. Create the endpoint in the environment you are testing in, then use these tools rather than waiting for a checkout to produce each event. With no body, the test event is a payment.captured sample. An endpoint subscribed to specific event types only accepts a test for one of those types; anything else is 400 validation_error , and the message lists the types it will accept. To exercise your own handler logic, send eventType with a data object. It is delivered as the event's data in place of the built-in sample. A replay sends the same payload again with a new signature, so it also proves your handler is idempotent: the second delivery of an event must not repeat its side effects. The same tools are in the dashboard under Developers → Webhooks"},{"title":"Use Webhooks as Your Source of Truth","route":"/developers/webhooks","headings":["Use Webhooks as Your Source of Truth","Create an endpoint","Verify signatures","Rotate the signing secret","Process idempotently","Recommended fields","Event families","Abandoned carts & cart lifecycle","Payload envelope","Event payload reference","{group.label}","Payments and saved cards in payloads","No longer sent","Every read surface uses the same shape","Event scope reference","Retries","Manage endpoints","Inspect deliveries","Send a test event"],"text":"Event delivery Use Webhooks as Your Source of Truth postMessage events make the browser feel instant. Signed webhooks tell your backend what actually happened, even if the buyer closes the tab. Create an endpoint Register an HTTPS endpoint and choose the events your backend can process. Store the returned signingSecret securely; it is shown once. enabledEvents must be exact event-type strings from the catalog — Throttle uses payment.captured and subscription.cancelled , not Stripe-style payment.succeeded or subscription.expired . Fetch the full list from GET /api/v1/event-types . An unknown name is rejected with 400 ; the error’s details[].allowedValues enumerates every accepted event type. /api/v1/webhook-endpoints is the canonical, signed outbound webhook system documented on this page ( enabledEvents , a whsec_ signing secret, X-Throttle-Signature , plus /deliveries , /replay , and /test ). The older /api/v1/webhooks family ( events , no signed delivery) is deprecated and no longer delivers events — its delivery worker has been decommissioned. Responses carry Deprecation + Sunset: 2026-10-11 headers; the routes will be removed after 2026-10-11 . Migrate any integration still pointing at it to /api/v1/webhook-endpoints . Verify signatures Each delivery includes X-Throttle-Signature (format t=<unix_seconds>,v1=<hex> ). Compute HMAC-SHA256 over <timestamp>.<raw body> . The verifier below also rejects deliveries whose timestamp falls outside a tolerance window (default 300s) so a captured delivery cannot be replayed indefinitely, and guards against a malformed v1 so a bad header returns false instead of throwing in your handler. Signature checks fail if your framework parses and reserializes JSON before verification. Capture the raw request body first, then parse JSON after the signature passes. Verify the signature, then parse the envelope, and report the two failures with different status codes. If a strict schema rejects a field it has not seen and your handler answers with the same 401 it uses for a bad signature, a routine additive change looks like a rotated secret from the outside. That is exactly how an extension lost every delivery for hours on 2026-09-08 when environmentKind shipped. Throttle retries a 401 on the normal ladder; a 4xx that names a schema problem is far easier to find in the delivery log. Rotate the signing secret POST /api/v1/webhook-endpoints/:id/rotate-secret mints a new whsec_ and returns it once. For graceSeconds (default 86400, max 604800) every delivery is signed with both secrets — the header reads t=…,v1=<outgoing>,v1=<new> — so you can swap the secret in your config on your own schedule without a failed delivery. Send graceSeconds : 0 to revoke the old secret immediately when it has leaked. The response carries previousSecretExpiresAt . The verifier above accepts the header if any digest matches your secret, which is what makes the window seamless. A verifier that keeps only the last v1 still works — it verifies from the moment you deploy the new secret, and rejects until then, exactly as before the window existed. Process idempotently Webhook delivery is at-least-once. Store each event id before applying side effects so retries do not double-fulfill, double-email, or double-book revenue. Deduping on event id covers retries . It does not cover a genuine repeat: order.created fires exactly once per order, but every other order lifecycle event is at-least-once by design, and a repeat carries a new event id. Moving an order backwards is a supported merchant action, so shipped → awaiting_fulfillment → shipped sends order.shipped twice. That is deliberate — a merchant who rewinds and re-ships has usually re-shipped, and suppressing the second event would be the one case where a shipping notification must not go missing. Make handlers that must not act twice idempotent on the entity and target state, not on the event id alone. If a paid order has line items marked fulfillmentType: 'digital' or fulfillmentType: 'access_grant' , Throttle creates and completes those fulfillment rows after the order enters awaiting_fulfillment . Listen for fulfillment.completed and order.completed (an order with nothing to ship completes on its own) or order.shipped (an order with something to ship) in addition to payment events when you need to mirror delivery state. fulfillment.shipment.delivered now fires when the arrival is recorded — a call to POST /fulfillments/ id /delivered — and no longer when the shipment fulfillment is completed. Completing a fulfillment is carrier handoff, so the old timing announced a delivery while the parcel was still moving. Merchants who complete a fulfillment and never call the new endpoint will not see this event at all; listen for fulfillment.completed if what you want is handover. The payload gained the shipment object, so data.shipment.actualDelivery carries the arrival timestamp. The buyer-facing customer-order-delivered email follows this event, and so moved with it. Recommended fields event_id unique identifier from the delivery envelope. event_type for routing and debugging. event_version from the delivery envelope for payload migrations. environment_id from the delivery envelope for environment-scoped processing. processed_at timestamp after side effects finish. payload raw JSON for audit and replay. Event families OUTBOUND_EVENT_GROUPS.map((group) => ( group.label ( group.events.length events) )) Abandoned carts & cart lifecycle Carts are authoritative in Throttle. When your storefront creates a native cart ( POST /api/v1/carts ), Throttle tracks its whole lifecycle and detects abandonment server-side — you don't build your own timer. cart.abandoned — a nightly sweep marks an open cart abandoned once it sits idle past the application's configured threshold (or you can react immediately on delivery). A cart built from an accepted quote, or in the dashboard order "},{"title":"Zapier","route":"/developers/zapier","headings":["Zapier","Connecting your account","Triggers","What a trigger hands the next step","Searches","Actions","When something goes wrong"],"text":"Tools Zapier The Throttle Zapier integration puts your orders, payments, subscriptions, quotes and invoices in front of every other app Zapier connects to. It authenticates with OAuth — no API key to copy, and no key to rotate when someone leaves. Zapier speaks REST and webhooks, not the Model Context Protocol. This is a separate integration over the same public API, and it needs no MCP setup. If you want Throttle inside Claude, Cursor or another AI assistant, use the MCP server instead — the two are independent and can both be connected at once. Connecting your account Add Throttle as a step in any Zap and choose Connect a new account . You'll be sent to Throttle to sign in, pick the workspace, application and environment the connection should use, and approve the permissions it asks for. A connection is pinned to the workspace, application and environment you picked at approval time, and nothing inside a Zap can move it. Connect a sandbox environment first and verify the Zap end to end there; to run the same automation against production, add a second Throttle account in Zapier. The account picker labels each one Workspace · Application · environment so the two are never confused. The permissions requested cover exactly the triggers and actions listed below — read access to orders, customers, subscriptions, quotes, invoices, payments, carts and the event log, write access to customers, quotes and carts, and permission to manage the webhook endpoints your triggers create. It also asks to read customers' personal data (names, emails, phone numbers and addresses, customer_pii:read ): that is what most Zaps move, and every trigger needs it, because a webhook delivery carries the full record. Throttle's AI-assistant connections can never be granted it; Zapier can because it is registered as an automation connector. Refunds, payment capture and other money-moving verbs are not requestable over OAuth and are deliberately absent from this integration. Triggers Every trigger is a real-time webhook, not a poll — a Zap fires within seconds of the event, and there is no polling interval to wait out. Turning a Zap on creates a webhook endpoint in your workspace subscribed to that one event type; turning it off deletes it. New order — order.created Payment captured — payment.captured Payment failed — payment.failed New subscription — subscription.created Subscription cancelled — subscription.cancelled Quote accepted — quote.accepted Cart abandoned — cart.abandoned Invoice past due — invoice.past_due You'll see these endpoints in your dashboard alongside any you made by hand. They're marked as owned by Zapier — delete the Zap rather than the endpoint, or the Zap will go quiet with no error. What a trigger hands the next step Throttle delivers this envelope: Zapier flattens it so the entity's own fields are available directly in the field mapper: id is the event id, because that is what Zapier deduplicates on and what stays stable when a delivery is retried. The order, payment or subscription's own id is resourceId — map that one when the next step needs to look the record up. Searches Search customers — by name, email or your own external id. Search orders — newest first, with status and payment-status filters. Search quotes — filter by status, e.g. to chase quotes about to expire. List invoices — issued invoices, filterable by status. Receivables aging — outstanding receivables bucketed by age. List subscriptions — filterable by customer and status. Actions Create a customer — email and external ID are each unique per application, so a buyer who already exists makes the step fail with customer_already_exists . Run Search customers first when the buyer may already exist. Update a customer — only the fields you fill in are touched; everything else is left alone. Create a quote — drafts a quote with line items and terms. It is not sent to the buyer. Create a checkout link — builds a cart from line items and returns a hosted checkout URL. Every amount is an integer in the smallest currency unit: 2500 is 25.00 in a two-decimal currency, and 25 is 0.25. A checkout link created on a production connection is buyer-facing and takes real payment. Actions carry an idempotency key derived from the Zap step and its inputs, so a retried run lands on the record the first attempt created rather than making a second one. When something goes wrong “Reconnect your Throttle account and approve this permission” — the connection was approved without a permission the step needs. A connection's permissions are fixed at approval time, so reconnecting is the only fix. “Allow access to customers' personal data” ( oauth_customer_pii_required ) — turning on a trigger creates a webhook endpoint, and deliveries include customer details, so the connection must hold that permission. Reconnect and approve it. An environment mismatch — the step is reaching for data in an environment this connection isn't pinned to. Connect the other environment as a second Throttle account. A Zap goes quiet — check whether its webhook endpoint still exists in your dashboard under Webhooks . Turning the Zap off and on again recreates it."},{"title":"Internal Support Module","route":"/internal/support","headings":["Internal Support Module","Routes","Auth","Workspace identity model","Webhook payload contract","See also"],"text":"Internal Internal Support Module Powers the in-dashboard support feature backed by dispatchtickets.com . These endpoints are not part of the public API surface for merchant integrations — only the Throttle dashboard consumes them. This page is intentionally excluded from the docs sidebar and the search index. Merchant API keys cannot call these routes and they are subject to change without a developer changelog entry. Routes All routes are mounted under /api/v1/workspaces/:wsId/support/* and require a Clerk JWT that resolves to a member of :wsId . Method Path Permission Notes GET /tickets support:read List tickets for the workspace. GET /tickets/:id support:read Ticket detail + comments. POST /tickets support:write File a ticket. Audit-logged. Idempotent. POST /tickets/:id/comments support:write Reply to a ticket. Audit-logged. Idempotent. POST /tickets/:id/read support:read Mark ticket read for the current user. GET /unread-count support:read Badge count for the current user. POST /attachments/presign support:write Issue a presigned upload URL. POST /attachments/:attachmentId/confirm support:write Finalise an upload once the PUT completes. Plus the public webhook receiver POST /api/v1/support/dispatch-webhook , which has no Clerk auth and is gated solely by the signed X-Dispatch-Signature header. Auth The workspace-scoped routes accept Clerk JWTs only . API-key callers receive 403 application_key_workspace_route because these endpoints sit under a workspace-scoped router rather than the application-scoped one. POST /tickets and POST /tickets/:id/comments require an Idempotency-Key header (UUID v4 recommended). The server falls back to a body-hash synthetic key if the header is missing, but stable client-supplied keys are required to make retries safe across browser refreshes and React strict-mode double-effects. Workspace identity model Each Throttle workspace maps to exactly one Dispatch customer record. The synthetic customer email follows the pattern workspace-<workspaceId>@support.throttle.internal . The real human filer identity is captured separately so support staff can reply to a person rather than the workspace: Ticket body footer line: Filed by: … Each comment carries authorName and authorId for the Clerk user that posted it. Ticket customFields include filer_user_id , filer_email , type , and browser_info . Webhook payload contract Dispatch posts events to /api/v1/support/dispatch-webhook with an HMAC signature header: X-Dispatch-Signature: t= ,v1= The signed payload is $ unixSeconds .$ rawBody . The server enforces a 5-minute replay window. Event types handled: comment.created — when authorType === 'STAFF' , the corresponding ticket row is marked unread for all workspace members. ticket.created — no-op locally; the filer already saw the ticket they just filed. ticket.updated / ticket.closed — propagated to the dashboard via the next list/detail read; no local caching layer needs invalidation. Other event types return 200 as a no-op. A bad signature returns 401 invalid_signature . For properly signed events, downstream errors are logged and swallowed with a 200 response to avoid Dispatch retry storms. See also Design spec: docs/superpowers/specs/2026-05-17-dispatch-support-feature-design.md Implementation plan: docs/superpowers/plans/2026-05-17-dispatch-support-feature-plan.md Runbook: docs/superpowers/runbooks/2026-05-17-support-module.md"},{"title":"Product Catalog storefront","route":"/product-catalog","headings":["Product Catalog storefront","The API","The SDK","How carts reach checkout","Pushing products in","Versioning","New in 1.2","Guides","{page.label}"],"text":"Product Catalog Product Catalog storefront The Product Catalog extension keeps a store's products in Throttle. Its storefront API serves them to the store's own website: product lists with filters and facets, product pages, categories, collections, search, prices per currency and per customer, reviews, and carts that end in Throttle's checkout. The @usethrottle/catalog SDK is a typed client for all of it, with React hooks, Next.js helpers and URL helpers for shop pages. The API Every storefront route lives under one base URL and takes a publishable key in the X-Catalog-Key header: Answers are JSON. Prices are integers in minor units (cents for USD). Only public products are ever answered: a product is public when it is active, not a draft, and has at least one active variant. No parameter widens that. The OpenAPI 3.1 document of the API is at catalog.usethrottle.dev/v1/storefront/openapi.json , and the API reference renders it. The SDK It runs on Node.js 20 or later and in evergreen browsers. Its only runtime dependency is @usethrottle/errors ; React 18.2 or 19 is an optional peer, needed only for the React entry. It has five entry points: How carts reach checkout The storefront never sends a price. Your page sends SKUs and quantities to carts.create ; the catalog prices every line itself, creates the cart in Throttle and answers cartUrl , Throttle's hosted cart page. The shopper reviews the cart there and pays on Throttle's checkout. When a line is added or changed, when the cart is refreshed and again at checkout, Throttle asks the catalog to price the lines (the line resolver ), so a cart always charges the catalog's price. To build your own cart page instead, keep the cart session the create answers and change it with carts.session(id) or React's useCart , then hand the shopper to checkout with checkout() . Optional return URLs bring the shopper back to your store after paying. Cart and checkout has the details. Publishable keys are public: they ship in your page's code and anyone can read them. A key's allowed websites protect browsers only; a script can send any Origin . Carts are protected by server-side resolution: the catalog prices every line on its side, so nothing a key holder sends can change a price. See Keys and channels . Pushing products in The storefront API reads the catalog. To write to it from a server, use the Catalog Push API : staged jobs for merchants and vendors. Start with the first feed guide , or point an AI agent at the agent reference . Versioning From 1.0.0 the package follows semantic versioning: a breaking change to an exported name, a type, an error class or code, or a hook's behaviour comes only in a major version. New answer keys, new error codes in (string & ) positions and new optional options are minor. Deprecated names keep working for at least one major. The reference store at throttle-demo-store.vercel.app runs @usethrottle/catalog 1.0.0. New in 1.2 useTags, useCollections and useReviewEligibility in @usethrottle/catalog/react/extras , and useCustomerKey in /react . keepPreviousData with dataFor and isPreviousData , and refresh errors with isStale and automatic retries of network, timeout and 5xx failures. The customer's cart on any device ( customerCart , with @usethrottle/auth 0.12.0 or later and a known currency). keyInQuery : browser reads send ?key= and need no preflight. A server key in a URL is refused with 403 KEY_NOT_ALLOWED_IN_URL . Suggestions never send the customer token , so they always show list prices, in every mode. A store that showed group prices in suggestions now shows list prices there. Product, related, suggestion, collection, category and review answers include a 640 px image size for every image at least 640 px wide; the legacy search, vehicles and lite product answers keep 400, 800 and 2048. Until that copy is stored it is served from the next larger stored copy. Guides pages.map((page) => ( page.label page.description Open guide ))"},{"title":"Storefront API Reference","route":"/product-catalog/api-reference","headings":["Storefront API Reference","Sending the key","{group.name}","Error codes"],"text":"Product Catalog Storefront API Reference Every operation of the storefront API at https://catalog.usethrottle.dev , rendered from its OpenAPI document. Every route except the document itself takes a publishable key in X-Catalog-Key . Sending the key A GET may send the key as ?key= instead of the header, so a browser read needs no preflight. A browser, app or legacy key is accepted this way, never together with the header (that is a 400 INVALID_REQUEST ): a server key in a URL answers 403 KEY_NOT_ALLOWED_IN_URL , and a POST always uses X-Catalog-Key . The customer token is never accepted in a URL; it travels in X-Customer-Token . The SDK's suggest never sends it, so suggestions from the SDK are list prices. See Keys and channels . Download the OpenAPI document groups.map((group) => ( group.name group.description group.endpoints.map((item) => ( )) )) Error codes Every error answers the same envelope, with a stable error.code . These are all the codes the API returns, with their HTTP statuses and whether a retry can succeed."},{"title":"Volume pricing","route":"/product-catalog/bulk-pricing","headings":["Volume pricing","The model","Who gets which table","The price rule","Rounding","Worked examples","Push a table","Percent","Amount off","Fixed price","All buyers, and clearing","CSV and XLSX","Blank cells and clearing","In the cart","On the product page","In the dashboard","Errors"],"text":"Product Catalog Volume pricing Volume pricing gives a buyer a lower unit price when they buy more. A tier table belongs to a customer group's price list. A buyer in that group gets the table. A table for all buyers covers everyone else. Every unit takes the tier price, not just the units above the threshold. The model A tier table belongs to one product and one target. The target is a Throttle customer group , or * for all buyers. A product has at most one table per target, and at most 50 group tables, plus the all-buyers table. A table holds up to 10 tiers . Each tier has a minQuantity (a whole number from 2 to 1,000,000), an optional maxQuantity (at least minQuantity , at most 1,000,000), and one effect. A tier with no maxQuantity ends one unit before the next tier starts. The last tier is open. Tiers may leave gaps. They may not overlap. The quantity is counted per product . Every variant of the product in the cart adds to it. Both group kinds may have tables: a fixed group and a percent group. Groups live in Throttle. The catalog stores the table under the group's id. You may name a group by name (any case) or by id when you write a table. The three tier types are the same for every target. percentBps , 1 to 9999 (100 = 1%), so a tier is always below 100%. One value for the product, used in every currency. , ], [ code: amountOff , An amount off each unit. , html: amounts[sku][CUR] , in minor units, at least 1. One value per variant and currency. , ], [ code: fixedPrice , A fixed unit price. , html: prices[sku][CUR] , in minor units, at least 1. One value per variant and currency. , ], ] /> One table may mix types. A variant or currency with no entry gets no price from that tier. The catalog never converts a currency: an amountOff or fixedPrice value works only in its own currency. A percent tier works in every currency. There are no free tiers. A fixedPrice of 0 and a percent of 100 are refused with BULK_TIERS_INVALID . A percent or amount-off tier never prices below 1 minor unit, so an amount off at or above the price gives 1, not 0. Tables saved before this rule keep working as stored. Who gets which table The catalog first works out the buyer's group, with the same proof that group prices need (see Customer prices ). Then it picks one table. * ), if any. , The list price. ], [ In an enabled group, identity proven, and the group has a table for the product , The group’s table. , The buyer’s group price. ], [ In an enabled group, identity proven, and the group has no table for the product , The all-buyers table, if any. , The list price. The tier counts only if it beats the group price. ], [ In a group, identity not proven (a publishable key with no customer token) , The all-buyers table, if any. , The list price. ], [ In a disabled group , The all-buyers table, if any. , The list price. ], [ Any buyer, when the install has no group grant (see below) , The all-buyers table, if any. , The list price. ], ] /> A buyer never gets two tables. A group table beats the all-buyers table. The legacy catalog /v1/checkout names no customer, so it applies only the all-buyers table. Throttle sends a buyer's group only to installs whose pinned version holds customer_groups:read (or :write ) explicitly. A * scope does not count. Group prices need the same grant. Without it, every buyer prices as a guest: no group price and no group tier. The all-buyers table still works. The price rule The catalog works out one unit price in four steps. List price. The variant's price in the cart's currency. A sale price is already applied. Group price. A fixed group uses its entry for the variant. A percent group takes its percent off the list price. With no group, or no entry, the price stays the list price. Tier. Add up the quantity of the product's lines. Find the tier whose range holds it. Take its effect off the group price (the list price for the all-buyers table). Guard. Use the tier price only if it is below the price from step 2. A tier never raises a price. This matters for fixedPrice tiers. When a tier applies, the compare-at price is the list price (if the tier price is below it), and the line shows the tier's minQuantity . Discount codes apply after this. Tax and multi-currency use the unit price as it comes out. Rounding Each step rounds once , to the currency's minor unit, half up. The group price is a price the buyer sees, so it rounds first. Percents never combine in basis points. A percent group with a percent tier is two steps and two roundings. The percent text turns into basis points with whole-number math. 29.75 becomes 2975 exactly. A percent may have at most two decimals. Worked examples All amounts are USD. The SKUs are made up. List price is $100.00 and the Dealer (fixed) group price is $88.00, unless the row says otherwise. Push a table Send bulkTiers on a push row. It is keyed like groupPrices : by group name (any case), by group id, or * for all buyers. The value is that target's whole table for the product. See the push reference for the merge and clear rules. Percent Amount off The values are per SKU. Each row carries its own SKU's amounts. Rows of one product combine into one table, so every row must send the same ranges and types. Fixed price All buyers, and clearing null or [] clears that target's table for the product. A key you leave out changes nothing. A key must name a group Throttle still lists, or the whole row is refused with GROUP_NOT_FOUND . Tables of deleted groups are removed by a daily sweep. CSV and XLSX The standard columns are bulk_tier:<group>:<n>:<part> . The group is a name or id, or * for all buyers. n is the tier, 1 to 10. The group may contain colons, because the column is read from the right. percent , amountOff , fixedPrice or none . Also read: fixed as fixedPrice , and price as amountOff . none on tier 1 clears the table. ], [ code: percent , html: A percent, such as 15 , 12.5 or"},{"title":"Cart and checkout","route":"/product-catalog/cart-and-checkout","headings":["Cart and checkout","Resolved carts","Volume prices on cart lines","Create a cart: carts.create","Return URLs: back to your store","Your own cart page: carts.session","In React: useCart","Signing in with a cart","Switching currency makes a new cart","“Only allow prices from installed apps”","Cart errors"],"text":"Product Catalog Cart and checkout A storefront sends SKUs and quantities; the catalog creates a Throttle cart, prices every line itself and answers the link to Throttle's hosted cart page. The shopper pays on Throttle's checkout, and the order lands in Throttle like any other. Resolved carts A cart the catalog creates is a resolved cart : Throttle asks the catalog for the name, price, image and limits of each line when it is added, when its quantity changes, when a shopper signs in and again at checkout (see Line resolvers ). Lines carry catalog prices only, including a signed-in shopper's customer prices . Publishable keys are public, and allowed websites protect browsers only. Carts are protected by server-side resolution : nothing a browser sends can set a line's price, name or image. Throttle refuses a price on a catalog line ( 400 price_locked ) and prices it again from the catalog before every checkout. Volume prices on cart lines A line the catalog prices at a volume tier carries resolution.bulk , an object { minQuantity } with the start of the tier the line is at. It is absent on a line with no tier. It is for display only: the price is the line's unit price. See Volume pricing . The tier depends on the quantity of the whole product, so adding a line or changing a quantity can change the price of the product's other lines. Throttle sends every catalog line of the cart to the catalog on each change, and the cart shows the new prices. Two changes to one cart at the same moment can answer 409 cart_changed . Nothing is written. Retry. Subscription lines count toward the quantity. They keep their signup price. <BulkPriceBadge> shows “Bulk price: 10+” on such a line, and the cart drawer and cart lines components draw it for you. See Storefront components . Create a cart: carts.create carts.create takes 1 to 50 lines with unique SKUs, an optional currency (else the client's currency option, else the store's default currency) and an optional locale for the line names. It answers 201 with cartUrl (Throttle's hosted cart page), sessionId , expiresAt and the priced lines with their subtotal in minor units. Send the shopper to cartUrl : the hosted cart page shows the lines, lets them change quantities and has the checkout button. Pass an idempotencyKey in the call options to make a retry safe: the same key answers the same cart. Return URLs: back to your store Three optional URLs bring the shopper back to your store. The catalog stores them on the hosted cart session, and Throttle's cart and checkout pages use them: /complete on Throttle's checkout). , ], [ code: cancelUrl , The cancel link on Throttle’s checkout page. , Back to the hosted cart page, which stays open. , ], [ code: storefrontUrl , The “Continue shopping” link on the hosted cart page. , No “Continue shopping” link. ], ] /> Each must be an absolute https: URL of at most 2,048 characters, with no spaces or control characters (otherwise 400 INVALID_REQUEST ). Before it sends a request, carts.create refuses a URL that is not absolute https with INVALID_REQUEST , naming the field. Its website must be on the store's Checkout settings › Allowed return websites (in the Product Catalog dashboard, Settings › General , the Allowed return origins list): an exact origin, https, with no user name or password. Otherwise the answer is 422 RETURN_URL_NOT_ALLOWED , with one issue per refused field, and no cart is created. An empty list refuses every URL. The answer then carries returnUrlApplied : true when Throttle stored all of them, false when it did not (the cart works, and the shopper ends on Throttle's pages). Without any URL the field is absent. The URLs are stored once per session; a create with other URLs gets its own hosted cart session. Throttle's abandoned-cart email links to a new hosted cart session that does not carry your return URLs. A shopper who comes back through that email and pays ends on Throttle's /complete page, not on your store. Your own cart page: carts.session To keep the cart on your site, drive Throttle's cart session yourself. catalog.carts.session(sessionId) answers get , add , update , remove , refresh and checkout . They call Throttle's cart-session routes directly, with the session id as the only credential, so your website must also be on Throttle's allowed origins (see Keys and channels ). checkout( returnUrl, cancelUrl ) needs both URLs, each absolute http or https (unlike carts.create , it accepts http ). It answers checkoutUrl and never navigates. Throttle prices every line again first; if a price changed it answers cart_prices_changed with the repriced cart, and the next checkout goes through. In React: useCart Give CatalogProvider a cartUrls prop with the same three URLs. useCart sends them on every cart it creates, and checkout() uses its returnUrl and cancelUrl unless you pass others; with either missing it rejects with INVALID_REQUEST before any request. Because cartUrls go on every cart create, they must be absolute https URLs on an allowed return website, or every add fails. On http://localhost , say, leave cartUrls out and pass the URLs to checkout(input) . A provider holds one cart. The first add creates it; changes run one at a time, in call order. A session Throttle ended is recreated once from its lines; a purchased cart is never carried into a new one. checkout() sends keepOpen: true , so a shopper who cancels finds the cart intact, and answers the URL without navigating. A guest's cart is kept when the shopper signs in and moves to the customer in cartStorage ; a guest with no cart gets the customer's saved cart, if any. On a sign-out or a switch to another customer, the outgoing customer's saved entry is removed and the incoming identity's own saved cart loads, so one customer never gets another's cart. To keep carts across reloads, give the provider a cartStora"},{"title":"Collections, categories, tags and featured","route":"/product-catalog/collections-categories-tags","headings":["Collections, categories, tags and featured","Categories","Collections","Renamed handles redirect","Tags","Featured products","Related products"],"text":"Product Catalog Collections, categories, tags and featured The ways a store groups its products, and the calls that render them. Each of these pages shows its products through products.list , so filters, facets, sorting and paging work the same everywhere (see Products, filters and sorting ). Every count is a count of public products, and a category, tag or collection with none is not listed. Categories categories.tree( depth ) answers the category tree, 1 to 10 levels deep (default 10). Each node has id , handle , name , description , seoTitle , productCount (products in the category or below it) and children . categories.get(handle) answers one category with its breadcrumbs (from the top of the tree down to it) and its children . Its products come from products.list( category ) , which includes the products of every subcategory. A product page carries breadcrumbs too: the path of the product's first category. An unknown handle answers 404 NOT_FOUND . Collections The merchant builds collections in Storefront › Collections . A manual collection is a hand-ordered list of up to 5,000 products; a rule collection holds whatever matches its conditions (brand, type, tag, category, attribute, option, price, featured, availability, how recently created), checked at the time of each request. Each has its own handle, title, description, image, SEO fields and default sort, and only published collections are answered. collections.list( limit, cursor ) pages through the published collections (50 a page by default, up to 100) with their kind , image and productCount . collections.get(handle) answers the collection page: title , description , descriptionHtml (sanitised by the catalog), image , seo , kind and defaultSort . products.list( collection ) answers its products. Without a sort they come in the collection's default sort; manual is a manual collection's own order. An unpublished or unknown collection answers 404 NOT_FOUND . A published collection with no products still answers its page, with an empty product list. Renamed handles redirect When the merchant renames a product or a collection, the old handle keeps working. Asking for it answers redirectTo with the new handle instead of the product or collection. It is a normal answer, not an error: check for it, and send the shopper (and search engines) to the new URL with a permanent redirect. TypeScript makes you handle it, because the answer type is a union: products.get , collections.get and reviews.list all answer either their content or redirectTo . Tags tags.list( q, limit ) answers tags with their product counts, most used first: all of them, or those starting with q (case-insensitive). The default is 50 tags and the most is 200. products.list( tags ) answers products carrying any of the tags. Featured products The merchant marks products as featured on the product page, or in bulk from the Products list. products.list( featured: true ) is the home page block, and featured is also a sort that puts them first (the default sort of a plain list). Related products products.related(handle, limit ) answers products to show beside a product (8 by default, up to 24) in the lite projection. The merchant can pick up to 24 related products per product, in order, and chooses how the list is filled in Storefront › Settings ; config().relatedMode tells you which: Similar products are ranked by what they share with the product: category most, then brand, product type, tags and filterable attribute values. The product itself and anything not public are never included, unavailable products come last, and the order is the same on every request."},{"title":"Customer prices","route":"/product-catalog/customer-prices","headings":["Customer prices","Customer groups","Volume pricing for a group","Send the customer token","A verified email is required","priceContext: which prices an answer carries","A refused token","In React"],"text":"Product Catalog Customer prices A merchant can give some customers their own prices: trade accounts, wholesale buyers, members. The shopper signs in with their Throttle customer account, the storefront sends their token with each request, and the catalog answers their prices. Customer groups Customer groups live in Throttle. The merchant creates them, and adds customers to them, in Throttle › Customers › Groups (or with the Customer groups API ). The catalog stores only fixed prices per variant and currency for a group. A fixed group uses those prices; a percent group takes its percent off the regular price. Each customer is in at most one group. Shoppers who are signed out, in no group, or in a disabled group, get the regular prices. In the group dialog, the Pricing field offers Percent off first, which is the default, then Fixed prices set in the catalog ; you set those per product on the catalog’s Prices card. Without Product Catalog installed in the environment, Pricing is disabled with the note “Group prices need Product Catalog. Without it, groups control who can use group-only discount codes.” and an Install link, and the Groups pages show a banner saying the same. Saving the group still works. How fresh: a change to a group's rule or members shows on the storefront within about 10 seconds at the 95th percentile (webhook latency plus one request), and within 60 seconds at most if a webhook is lost. Carts, checkout, quotes and New order read the group exactly. When a group price is below the regular price, the compare-at price carries the regular price ( compareAtMinMinor in a list's price range, compareAtPriceMinor on a variant), so you can show it struck through. Price sorts, price filters and price facet ranges use the regular price; only the prices shown change. Answers never name the group. Carts are priced the same way: the price a signed-in shopper sees on a product page is the price their cart charges. Volume pricing for a group A group can also have volume tiers : a lower unit price when the shopper buys more. The tiers are taken off the group's price , so a dealer who pays $88.00 and buys 10 at 15% off pays $74.80 each. A tier never raises a price. A fixedPrice tier that is above the group price is ignored, and the shopper keeps the group price. A shopper gets the table of their group, when their identity is proven and the group has a table for the product. Everyone else (guests, shoppers in no group, shoppers whose group has no table) gets the product's all-buyers table, if there is one. It is taken off the list price. Product answers carry bulkTiers for the table that prices this shopper. A group table needs the same proof as a group price, so it comes with the customer token. The all-buyers table needs no token. The rule, rounding and examples are on Volume pricing . Send the customer token Shoppers sign in with Throttle's customer accounts, through @usethrottle/auth (see Storefront customer auth ). Give the catalog client a customerToken function that returns the shopper's current access token. With @usethrottle/auth 0.10.1 or later, that is auth.getAccessToken() : it refreshes the token first when it is about to expire, and answers null when the shopper is signed out. The client calls the function on every request that can use the token, so a refreshed token is used at once. It sends the token only in the X-Customer-Token header, never in a URL, never stores it on the client and never logs it. getAccessToken() can throw when a refresh fails for a moment (a network error, a 5xx). The client treats a throw, or anything that is not a string, as signed out for that request: it answers regular prices instead of failing the page. The token read and the request each get the full timeoutMs (10 seconds by default), so a call that waits on a slow refresh can take up to about twice that. A token function that never answers ends in TimeoutError . Sign shoppers in in the browser. A Throttle pk_ is a browser key: Throttle checks the page's origin against your allowed origins, so a sign-in from server code is refused with origin_not_allowed . On the server, take the shopper's access token from the request (a header or cookie your app sets) and return it from customerToken . The token goes with product lists, product pages, related products, suggestions, carts.check , carts.create , review eligibility and review submission. Categories, collections, tags, filter values, review lists and config answer the same for everyone and never send it. A verified email is required Group prices need a verified email address. A signed-in shopper whose email is not verified gets the regular prices, on product pages and in the cart, until they verify it. Knowing a trade customer's email address is not enough to buy at trade prices. priceContext: which prices an answer carries An answer to a request that carried a token has priceContext . Use it to tell the shopper why they see the prices they see: A refused token A token the catalog refuses (expired, revoked, or for another store) answers 401 CUSTOMER_TOKEN_INVALID . The client then asks your function for the token once more, and retries with it if it changed. If it did not, a read (or carts.check ) is retried once without the token and answers the regular prices, with no priceContext : the page still renders. A call that cannot fall back to regular prices ( reviews.eligibility , reviews.submit , and carts.create with a token) throws CustomerTokenInvalidError instead. A call makes at most three requests. In React Keep one catalog client for the life of the app and pass customerToken as a function, as above; do not make a new client when the shopper signs in. Give CatalogProvider a customerKey : the signed-in customer's id, or null . The hooks' cache is partitioned by it, so a change empties the cache and every mounted hook fetches again, and one shopper never sees answers fetched for another. Ch"},{"title":"Mapping an ERP or IMS export","route":"/product-catalog/erp-mapping","headings":["Mapping an ERP or IMS export","Field by field","Convert units first","Send all rows of a product in one batch","One variant, every price kind","A price-list file"],"text":"Product Catalog Mapping an ERP or IMS export Your ERP or inventory system has its own names for prices and sizes. This page shows where each one goes in a push row and in a CSV file. Throttle sets the standard fields. You map your columns to them once. Field by field variant.priceMinor and variant.currency , html: variant.priceMinor , variant.currency , Push: whole minor units (cents). CSV: a decimal in major units, such as 24.99. ], [ Sale price , code: variant.salePriceMinor , code: variant.salePriceMinor , Same unit as the base price. A sale beats the regular price while it is set. ], [ Compare-at (was) price , code: variant.compareAtPriceMinor , code: variant.compareAtPriceMinor , Same unit as the base price. ], [ A price in another currency , code: prices. .priceMinor , html: price:<CUR> , sale_price:<CUR> , compare_at_price:<CUR> , Only for a currency that is not the variant’s base currency. The catalog never converts. ], [ A dealer or wholesale price , code: groupPrices. . , code: group_price: : , Only for a fixed group. A percent group has no price column. Use the group’s name or id. ], [ Volume tiers , code: bulkTiers. , code: bulk_tier: : : , html: See Volume pricing . ], [ Weight , code: variant.weightGrams , code: variant.weightGrams , A whole number of grams, 1 to 10,000,000. ], [ Length, width, height , html: variant.lengthMm , variant.widthMm , variant.heightMm , html: The same names. , Whole millimetres, 1 to 100,000. Throttle uses them only when all three are present. ], ] /> Weight and dimensions drive live shipping rates. See Weight and dimensions . Convert units first Minor units. A push sends money as a whole number of minor units: 24.99 USD is 2499 , 3200 JPY is 3200 , and 1.250 KWD is 1250 . A CSV takes the decimal and reads it with the currency's own number of decimals. A cell with too many decimals is refused. Basis points. A push sends a percent as percentBps : percent × 100. 15% is 1500 . 22.5% is 2250 . A CSV may send the percent as it is ( 22.5 ). Grams. Multiply kilograms by 1,000 and pounds by 453.592. Round to a whole number. Millimetres. Multiply centimetres by 10 and inches by 25.4. Round to a whole number. Send all rows of a product in one batch Rows of one product in a batch combine into one volume table. That is how a table gets one value per SKU, and how the catalog checks that every row agrees on the ranges and types. The combined table replaces the stored one. If you split a product over two batches, the later batch replaces the earlier table, and the first batch's SKU values are lost. Keep a product's rows together in one batch. See jobs and batches . One variant, every price kind A bolt that costs $100.00, is on sale at $90.00 (was $120.00), costs 92.00 EUR (84.00 on sale), costs a Dealer $88.00, and weighs 310 g in a 45 × 45 × 20 mm box. For volume tiers on the same variant, see the examples for each tier type . A price-list file Some systems export one customer group's whole price list: a price for each SKU and tier columns beside it. You can import that file as it is. The mapper turns it into the standard columns. You map it once and save the profile. : ], [ Tier minimum, N , code: bulk_tier: :N:min ], [ Tier maximum, N (if any) , code: bulk_tier: :N:max ], [ Tier type, N , code: bulk_tier: :N:type ], [ Tier value, N , code: bulk_tier: :N:value: ], [ List ids, product names, variant ids, sale price, retail price, minimum advertised price , Ignore ], ] /> One price list per file. A check column is compared with the one group or currency the mapped columns write to, ignoring case ( usd matches USD ). A row that names another list or currency is refused with PRICE_LIST_MISMATCH . A mapping that writes to two groups or currencies and also has a check column is refused when you save it. The type cell. It reads percent , amountOff , fixedPrice and none . It also reads fixed as a fixed price and price as an amount off. The preview shows the type each row ends with. Existing SKUs only. A price list never creates a product. A SKU the catalog does not hold is refused with UNKNOWN_SKU . A row with no SKU is refused with MISSING_SKU . The other rows apply. Import the products first. No product columns. A price list sets prices and tiers on existing variants. The file has no product handle, so a product column such as a title or a description is refused when you save the mapping. Blank tier cells do not clear. A row with blank tier cells changes nothing. To clear a table, use none as the tier 1 type. Retail and sale prices are not mapped. The public price comes from your catalog. Throttle has no group sale price. Check the name. The group name in the mapping must match a Throttle group. When a saved profile names a different group than the file's price list name, the map step warns you. The importer recognises a BigCommerce price-list export from its headers and fills in this mapping for you. You can still edit it before you import."},{"title":"Errors and rate limits","route":"/product-catalog/errors-and-rate-limits","headings":["Errors and rate limits","The error envelope","The SDK's errors","Codes the SDK makes","Every storefront error code","Rate limits","While the catalog is indexing"],"text":"Product Catalog Errors and rate limits Every storefront error answers one envelope with a stable code, and the SDK turns each into a typed error. This page lists them all, with the rate limits and what the client and the hooks do about them. The error envelope error.code is stable; branch on it, never on the message. error.requestId identifies the request when you ask for help. error.issues (at most 20) names the fields at fault, as path, message . CART_REJECTED adds error.throttleCode , and CART_ITEMS_INVALID adds a top-level items list of refused lines. Throttle's cart-session routes answer their own envelope, error: code, message, details? , with lowercase codes. The SDK's errors Everything the SDK throws is a CatalogError (which extends ThrottleError from @usethrottle/errors ), with code , message , statusCode (0 when nothing answered), source ( catalog , throttle for Throttle's cart session, or client when the SDK made it), retryable , retryAfterSeconds , issues , details and requestId . 429 . retryAfterSeconds is always set: from Retry-After , or 60 when that is missing or unusable. , ], [ code: OriginNotAllowedError , html: ORIGIN_NOT_ALLOWED , SERVER_KEY_IN_BROWSER , KEY_NOT_ALLOWED_IN_URL and Throttle's origin_not_allowed . , ], [ code: CustomerTokenInvalidError , A refused customer token on a call that cannot fall back to regular prices. ], [ code: CartLineError , html: CART_ITEMS_INVALID and Throttle's quantity_unavailable and line_not_purchasable , with lines: sku, code, maxQuantity? [] . , ], [ code: TimeoutError , html: TIMEOUT : no answer within timeoutMs . ], [ code: NetworkError , html: NETWORK_ERROR : the request never got an answer (DNS, a CORS refusal, a dropped connection). ], [ code: FeatureUnavailableError , html: FEATURE_UNAVAILABLE : the catalog does not have this route yet (below). , ], [ code: CatalogError , Everything else. ], ] /> FeatureUnavailableError. A 404 that carries the header X-Catalog-Route: unmatched means the catalog has no such route: an older catalog than the SDK. A 404 from a route that never answers a missing resource ( config , the category tree, tags , the collections list, suggest , carts/check and carts ) means the same. Any other 404 is NOT_FOUND . Your own abort rethrows your AbortSignal 's reason, never wrapped in a CatalogError . isCatalogError also recognises an error from another copy of the SDK, such as the CommonJS build in an app that loads both; instanceof on a class holds within one build only. Codes the SDK makes createCatalogClient for a key that is not pc_pk_… . The key is never in the message. ], [ code: CLIENT_ERROR , html: A cartStorage adapter (or another of your functions) threw inside a hook action. ], ] /> Timeouts. timeoutMs (10 seconds by default, per client or per call) covers one request. Reading the customer token gets its own full timeoutMs first, so a call that waits on a slow token refresh can take up to about twice as long. Every storefront error code Every code a /v1/storefront route answers, from the OpenAPI document , with the class the SDK throws for it. Retryable means the same request may succeed later. Throttle's cart-session codes ( quantity_unavailable , cart_prices_changed , cart_session_expired and the others) reach you with source: throttle ; they are listed on Cart and checkout . Throttle's cart_session_expired passes details.storefrontUrl through as it was stored, unvalidated. Never render it as a link or navigate to it without your own check: http or https only, on an origin you trust. Rate limits Review submission adds 5 attempts a minute per customer and 10 accepted reviews an hour per IP address (server keys skip the IP cap). Over a limit the answer is 429 RATE_LIMITED with Retry-After in seconds. Wait that long; the SDK exposes it as RateLimitedError.retryAfterSeconds . The client never retries a 429 itself , so a burst never turns into a retry storm. The per-visitor count is kept per Cloudflare location and is approximate: a fast burst can pass somewhat more than the limit before it is refused. The per-key limit still caps a key. In the hooks. A catalog 429 RATE_LIMITED that a read hook or a useCart change meets pauses every read of its CatalogProvider until retryAfterSeconds : The hook that met it keeps its data and shows the RateLimitedError . A hook mounted during the pause makes no request. With nothing cached for its query, it shows a RateLimitedError with the seconds left, not a loading state; with a cached answer, it shows that. useCart and useSubmitReview actions reject at once with that error, with no request. When the pause ends, each mounted query fetches once. Every other 429 goes to the caller only and pauses nothing: a 429 from Throttle's cart session, and every 429 from a review submit ( RATE_LIMITED from the per-customer limit or the per-IP review cap, and REVIEW_QUEUE_FULL ). While the catalog is indexing When a store first turns on the storefront, the catalog builds its storefront index. Until it is done, plain product browsing answers 200 with indexing: true (no filters, and a null total), and requests that need the index answer 503 STOREFRONT_INDEXING with Retry-After: 30 . See the first backfill . The client retries a read once after Retry-After when that is 30 seconds or less ( indexingRetry: maxWaitSeconds changes it, false turns it off); otherwise it throws with retryAfterSeconds . The hooks never wait inside a call. They show the 503 and fetch once more at Retry-After ; a list answered with indexing: true is fetched once more after 30 seconds."},{"title":"Keys and channels","route":"/product-catalog/keys-and-channels","headings":["Keys and channels","Publishable keys are public","Key types","Allowed websites","Server rendering and static builds use a server key","Sending the key in the URL: keyInQuery","Secret keys never reach a storefront","Carts need the same websites in Throttle","Rate limits by key type"],"text":"Product Catalog Keys and channels Every storefront call carries a publishable key ( pc_pk_… ) in X-Catalog-Key . A key has a type, its channel, that decides where it may be used. Create and revoke keys in the Product Catalog dashboard under Storefront › Keys . Publishable keys are public Publishable keys are public. A browser key ships in your page's JavaScript, and anyone can copy it. It reads only what every shopper already sees: public products, categories, collections and published reviews. Allowed websites protect browsers only. They stop another website from using your key in its visitors' browsers. They do not stop a script or a server, which can send any Origin header, or none. Carts are protected by server-side resolution. A storefront sends SKUs and quantities, never prices. The catalog prices every line on its side, when the cart is created and each time Throttle asks again, so nothing sent with a publishable key can change what a shopper pays. Key types Choose the type when you create the key. The catalog enforces it on every storefront route: 403 ORIGIN_NOT_ALLOWED , html: 403 ORIGIN_NOT_ALLOWED , Your website’s browser code. , ], [ App , html: Must be on the key's allowed websites (refused when the list is empty) , Allowed , A native app or another client that is not a web page. , ], [ Server , html: Always refused: 403 SERVER_KEY_IN_BROWSER , Allowed , Server rendering, static builds and scripts. , ], [ Legacy , Any website , Allowed , Keys made before key types existed, shown as “Legacy (any website)”. , ], ] /> A legacy key keeps working from any website until you give it a type in Storefront › Keys; the key itself does not change. A store can have up to 20 active publishable keys. Revoking a key deletes it, and the next request with it answers 401 AUTHENTICATION_FAILED . Allowed websites Browser and app keys carry a list of up to 20 allowed websites. Each is an exact origin: https, a host and an optional port, with no path, such as https://shop.example.com or https://shop.example.com:8443 . A subdomain or another port is a different origin and needs its own line. http: origins, including http://localhost , cannot be listed; during development, call the catalog from your dev server with a server key, or serve the site over https. Server rendering and static builds use a server key Pages rendered on a server (Next.js, Remix, Astro and the like), static site builds, sitemap jobs and scripts call the catalog without an Origin . Give them a server key. It is refused on any request that carries an Origin , so it cannot be lifted into a browser page, and it has the higher per-key limit with no per-visitor bucket: server traffic arrives from a few hosting addresses, which a per-visitor limit would throttle. Use the browser key in the client-side part of the same app. A server key is still a publishable key and reads only public data. Keep it in a server environment variable anyway, so its higher limit stays yours. The Next.js page shows the full setup. Sending the key in the URL: keyInQuery By default every request sends the key in the X-Catalog-Key header, which makes a browser preflight each new URL. Set keyInQuery: true (1.2.0 and later) on a browser client and a read (a GET ) sends ?key= instead, with no custom header, so a plain read needs no preflight. Reads only. A POST always sends the header. createServerCatalogClient ignores the option. A revalidation with If-None-Match , or any client headers , still preflights. Never a server key in a URL. The catalog refuses it with 403 KEY_NOT_ALLOWED_IN_URL (an OriginNotAllowedError in the SDK). Use keyInQuery with browser and app keys only. A URL is recorded wherever full URLs are kept (CDN and zone logs, analytics, browser history), so rotate any server key that was ever sent in a URL, even though it was refused. The customer token is never put in a URL , in any mode. It travels only in X-Customer-Token , so a read that carries a token still preflights. Suggestions never send the customer token and, with keyInQuery on, send no custom header at all: see Search and suggestions . Secret keys never reach a storefront The catalog also has secret keys ( pc_sk_… ) for writing products from your own systems. A secret key is never for a storefront: storefront routes refuse it with 401 AUTHENTICATION_FAILED , and the SDK refuses it before any request. createCatalogClient throws CatalogError INVALID_PUBLISHABLE_KEY for anything that is not a pc_pk_ key, and for a pc_sk_ key the message says so: “Secret keys (pc_sk_) must never be used in a storefront. Use a publishable key (pc_pk_).” The key itself is never part of an error message. Carts need the same websites in Throttle Creating a cart goes through the catalog, but changing it from the browser (adding lines, the useCart hook, the checkout hand-off) talks to Throttle's cart-session routes directly, and Throttle checks the Origin against its own list. Add the same websites to Throttle's allowed origins in your application's settings (see Cart sessions ), or cart calls from them are refused with Throttle's origin_not_allowed . Rate limits by key type Over a limit the answer is 429 RATE_LIMITED with Retry-After . Errors and rate limits covers what the SDK does with it."},{"title":"Line resolvers","route":"/product-catalog/line-resolvers","headings":["Line resolvers","When Throttle calls it","The request","The signature","The answer","Weight and dimensions on the answer","The reserved metadata namespace","Refusals and failing closed"],"text":"Product Catalog Line resolvers For extension builders. The Product Catalog is a line resolver: the catalog carts a storefront creates are resolved carts , and Throttle calls the catalog to price their lines. This page describes the catalog's resolver, POST /throttle/line-resolver , as an example of the contract. Throttle's Line resolvers page is the full contract for building your own. When Throttle calls it Throttle never takes a price from the browser for a line the catalog owns. It calls the resolver with an intent : A line's price can depend on the other lines of the same product (see Volume pricing ), so every change sends all the catalog lines together. Only a refusal of the line being added or changed fails the call. A server-side conversion ( finalize , checkout or orders/from-cart ) sends the checkout intent once before the order is made. Throttle waits at most 3 seconds and does not retry an add or update (the shopper is waiting); it retries a checkout once. The request type is always cart.lines.resolve , never a webhook event type; id is Throttle's request id. installationId , applicationId and environmentId only say which installation to look up. The signature decides: the catalog checks that the signed body names the same application and environment as that installation. customerId is the cart's customer, or null ; locale picks the language of the line names. customerGroup ( { id, kind, percentBps, version } or null ) and identityQualified are sent to installations whose pinned version holds an explicit customer_groups:read or customer_groups:write scope. Group prices apply only when identityQualified is true (a resolver reads customerEmailVerified only when that field is absent). customerEmailVerified keeps its meaning: a live verified credential exists. Throttle sends customerGroup as null unless identity qualifies. A group's volume tiers need the same field. Without it, a buyer gets only the all-buyers table. A Worker that creates or changes carts with an extension-install key must forward the buyer's storefront token in the x-customer-token header, with the token's subject equal to the customer being attached. Without it the cart has no proven identity, so list prices apply and group codes are refused. See Customer groups . 1 to 50 lines , each lineId, referenceId, quantity . referenceId is the variant SKU, matched exactly; the body is at most 64 KB. The signature Throttle signs every call with the installation's webhook signing secret, in the header X-Throttle-Resolver-Signature: t=<unix seconds>,v1=<hex> . The signed string is throttle.line-resolver.v1.<t>.<raw body> , HMAC-SHA256. The purpose label throttle.line-resolver.v1 keeps resolver and webhook signatures apart, though they share a secret: neither can be replayed as the other. The catalog verifies the raw body before it parses it as JSON, with a constant-time compare. t must be within 5 minutes; during a secret rotation the header carries one v1 per secret, and any match passes. Every verification failure is the same 401 , whatever the reason. The answer 200 , no-store , with one line per requested line, in order. A priced line carries ok: true and the name, unit price in minor units, currency, image, quantity limits, shipping flag and, when the variant has them, its shipping measures ; a refused line carries ok: false and a code . A line priced at a volume tier also carries bulk , { minQuantity } , for display only. It is left out when no tier applies. The answer has one other field, internal to Throttle's stock handling. maxQuantity is the most that can be ordered now, and can be 0. ], [ code: BELOW_MIN , Under the variant’s minimum order quantity. ], [ code: ABOVE_MAX , Over the variant’s maximum order quantity. ], [ code: NO_PRICE_IN_CURRENCY , No price in the cart’s currency. ], [ code: PRICE_SOURCE_MISMATCH , The source that set the price does not hold the cart’s currency. ], ] /> The price always comes from the catalog, never from the request. Stock quantities are never answered: maxQuantity on a priced line is the order limit, and on a refused line only what a refused quantity needs. Weight and dimensions on the answer A priced line for a shippable variant carries an optional shipping object with the variant's weightGrams , lengthMm , widthMm and heightMm . A measure the variant does not have is left out: omitted means unknown, never 0. Throttle converts them to kilograms and centimetres on the cart line ( weight and length , width , height , with their units), where live carrier rates read them. The dimensions are written only when all three are present. See Shipping measures in the contract. A variant with no weight keeps today's behaviour: the line carries no weight key and the rate is worked out as before. The reserved metadata namespace A priced line's metadata is stored on the Throttle line, and a browser can never write it. The catalog fills it with catalogInstallationId , catalogPriceMinor , sku and variantId . It is at most 2 KB of JSON; an answer over that is never sent. The catalog never trusts line metadata alone on an order: a line counts as a catalog line only when its SKU is one of the catalog's variants and its unit price is a price the catalog would have answered. Refusals and failing closed Throttle fails closed . When the resolver times out, refuses the call or answers anything malformed (a missing line, an invalid line), the cart change is refused with 503 line_resolver_unavailable and nothing on the cart changes. Throttle never falls back to a browser price or a stale one. The catalog does the same on its side: if it cannot read the catalog, or would build an answer Throttle would refuse, it answers 503 rather than guess. Storefronts never call this route; they see its results as cart errors ."},{"title":"Next.js SSR and caching","route":"/product-catalog/nextjs","headings":["Next.js SSR and caching","A server key on the server, a browser key in the client","How the server client caches","App Router","Refresh when the catalog changes: syncCatalogGeneration","A sitemap","Pages Router"],"text":"Product Catalog Next.js SSR and caching A Next.js store uses two keys: a server key for everything rendered on the server, and a browser key for the hooks in the browser. @usethrottle/catalog/server adds Next.js cache options to every catalog read, without importing Next.js. The examples target Next.js 15. A server key on the server, a browser key in the client Server Components, route handlers, getServerSideProps , static builds and sitemaps call the catalog without an Origin , from a few hosting addresses. Give them a server key: it has the higher per-key limit and no per-visitor limit, and the catalog refuses it on any request from a browser page ( 403 SERVER_KEY_IN_BROWSER ). Keep it in a variable without the NEXT_PUBLIC_ prefix. See Keys and channels . In the browser, the CatalogProvider gets a browser key, which is public, with your site's origins as its allowed websites: For customer prices, give that browser client the customer token as shown on React . Render public prices on the server and let the hooks show the signed-in shopper's prices. How the server client caches createServerCatalogClient takes the options of createCatalogClient plus next : During the catalog's first index build, a read that meets 503 STOREFRONT_INDEXING waits its Retry-After (30 seconds at most by default; indexingRetry: maxWaitSeconds changes the limit) and asks once more. Pass indexingRetry: false to fail fast inside a page render or route handler instead. Every catalog read's fetch carries next: revalidate, tags . revalidate defaults to 60 seconds; next.tags on the client are added to each route's own tags. A call can pass its own next , which replaces the derived one for that call: include the route's tags yourself, with catalogTags . Everything else is sent cache: no-store with no next : cart calls, Throttle's cart session, review eligibility, and any request that carries a customer token. A personal answer never enters Next.js's cache. , html: Every read of one route: config , products , filters , product , related , categories , category , tags , collections , collection , suggest , reviews . , ], [ code: throttle-catalog: : , A read for one handle: a product, its related products or reviews, a category or a collection. , ], ] /> catalogTags(route, handle?) builds them, for revalidateTag or a per-call next . Two catalog installations in one Next.js app share these tags, so revalidating one also refreshes the other. App Router A product page that renders each product on its first visit and caches it. It has no generateStaticParams on purpose: every prerendered page is written to the ISR cache again on every deploy. To prerender a few, return staticProductParams(catalog, limit ) , which answers up to limit (1,000 by default) public product handles, handle each, most recently updated first, and keep limit small. Refresh when the catalog changes: syncCatalogGeneration Every change to what a storefront can see moves the catalog's generation , a number config() answers. syncCatalogGeneration reads it without the cache and, when it differs from the one you saw last, awaits onChange , where you call revalidateTag . Call it from a cron job, every minute for example. On a serverless host (Vercel and the like) a cron call often lands on a fresh instance, where a module variable starts empty: that call only records the generation, and a change made since the last call is never revalidated. Store previous in KV, a database row or an edge config instead. If a change is missed anyway, the pages' time-based revalidate still bounds how stale they get. Generations are compared, never clocks. The first call only records the generation; an error (an indexing 503 included) is thrown and onChange is not called. revalidateTag( throttle-catalog ) refreshes every catalog read; a narrower tag from catalogTags refreshes less. A sitemap The paging helpers walk every public handle, following cursors, and always end: handle [] for generateStaticParams . ], ] /> Pages Router Fetch on the server with the server key, and hand the answer to the hook as initialData . The browser then refreshes it through the provider in pages/_app.tsx , with the browser key. Next.js keeps fetch answers in its data cache only in the App Router; in the Pages Router the next options change nothing. To cache pages there, use getStaticProps with revalidate , and staticProductParams for getStaticPaths , with each handle mapped to params: handle ."},{"title":"Prices, currencies and languages","route":"/product-catalog/prices-currencies-languages","headings":["Prices, currencies and languages","Price lists, one per currency","The currency option","Languages","In the SDK"],"text":"Product Catalog Prices, currencies and languages A store can sell in several currencies and answer in several languages. Both are options on the client or on a single call, and config() says which ones the store offers. Price lists, one per currency Every variant has a base price in its own currency. To sell in another currency, the merchant enables it in Storefront › Prices , which creates a price list, and enters prices in it (by hand, by import or through the API). A variant's price in a currency is: its entry in that currency's price list, when there is one; else its base price, when its base currency is that currency; else none: the variant has no price in that currency. The catalog never converts a price. A product the merchant has not priced in euros has no euro price, and is treated as not sold in euros. Each price-list entry has its own price, sale price and compare-at price. An amountOff or fixedPrice tier value applies only in its own currency. A variant with no value in the cart's currency gets no price from that tier. A percent tier applies in every currency. See Volume pricing . config() answers currencies (every base currency in use plus every enabled price list) and defaultCurrency (the catalog's default, used when a cart is created without a currency). The currency option Without currency , each variant is priced in its own base currency and a list answer's currency is null . With it: Every price in the answer is in that currency: price ranges, variants, sorts and price filters. Product lists, search, suggestions and facet counts leave out products with no public variant priced in that currency. A product page still answers such a product, with availableInCurrency: false , priceRange: null , and every variant unpriced and purchasable: false . It cannot be added to a cart in that currency: the cart refuses the line ( NO_PRICE_IN_CURRENCY ). A currency the store has not enabled answers 400 CURRENCY_NOT_ENABLED . A cart has one currency. Switching currency makes a new cart with the same lines; see Cart and checkout . Languages The merchant sets a default language and up to 19 more in Storefront › Languages , and translates products, categories, collections, options, attribute labels, filter labels and filter value labels. Ask for a language with the locale option, a BCP 47 tag such as fr or fr-CA . The locale used. The catalog tries the tag, then its language ( fr-CA → fr ), and takes the first one the store has enabled. A locale the store does not have is not an error: the answer comes in the default language. The answer's locale names the one used. Field by field. A field without a translation in that locale falls back the same way, to the language and then to the default text, so a half-translated product still shows every field. What is not translated: variant fields, and reviews, which are shown as written. Search with a locale also matches the locale's translated titles and descriptions. In the SDK Set currency and locale on createCatalogClient as defaults, and override them on any call. Each call sends only what its route takes: Prices for a signed-in shopper (customer groups, managed in Throttle › Customers › Groups; the catalog stores only their fixed prices) are on Customer prices ."},{"title":"Products, filters and sorting","route":"/product-catalog/products-filters-sorting","headings":["Products, filters and sorting","Parameters","Filters","Facets and filter values","Sorting","Paging","Fields and include","Keep the shop page in its URL","While the catalog builds its index"],"text":"Product Catalog Products, filters and sorting products.list ( GET /v1/storefront/products ) answers one page of public products for a selection, with the filters a shop page shows beside them. Shop, category, collection, search and home pages are all this one call. Parameters products.list(query, options) takes the selection first and the per-call options ( signal , timeoutMs , currency , locale ) second. (repeated) , Selected filter values, keyed by the filter key. A range is one a..b value. ], [ code: handles / skus , code: handles / skus (repeated) , A batch of up to 100 products by handle or SKU, in the order asked. ], [ code: vehicle , code: year, make, model, submodel, engine , Parts that fit a vehicle; make and model are required. ], [ code: sort , code: sort , The order. See Sorting. ], [ code: limit , code: limit , Products per page, 1 to 100. Default 24. ], [ code: page / cursor , code: page / cursor , A page number, or the previous page’s nextCursor. Not both. ], [ code: facets , code: facets , true for every filter, or a list of filter keys. ], [ code: fields , code: fields , lite (the default), full, or a list of product keys. ], [ code: include , code: include , Heavy parts to add: fitment, oemNumbers, supersessions, jsonLd, descriptionHtml. ], ] /> An unknown parameter, or a value it does not accept, answers 400 INVALID_REQUEST with an issue naming it. A category or collection that does not exist answers 404 NOT_FOUND . Batch lookups silently leave out anything that is not public: a draft, an archived product and an unknown SKU look the same. Filters The merchant sets up filters in Storefront › Filters : each has a key, a label, a source (brand, product type, tag, category, price, availability, rating, an attribute or a product option) and a display (checkbox, swatch, range, boolean or dropdown). The examples here assume filters keyed brand , color and price . Values within a filter are OR, filters are AND. brand: [ Bosch , Brembo ] with color: [ Red ] is Bosch or Brembo products that are also red. Ranges are one a..b value : 5000..12000 , or open-ended 5000.. and ..12000 . A price range is in minor units, like every price. A malformed range answers 400 . Variant filters match one variant. Filters on variant values, such as options and price, must all hold for the same variant: “red” with “under $50” finds products with a red variant under $50, not a product whose red variant costs more and whose blue one is cheaper. An unknown filter key answers 400 INVALID_REQUEST . A filter the merchant disabled, or whose source is no longer public, is skipped and named in the answer's applied.ignored . On the wire, each value is its own filter.<key> parameter; commas and .. are literal: Facets and filter values With facets , the answer carries filters : one entry per filter with its key , label , display , its values (each value , label , count , selected and an optional swatch ), a range for range filters, and more . A value's count is the number of products that match every other selected filter plus that value, so the numbers next to a checkbox are what the shopper gets by ticking it. Values with no products are left out, unless selected: a selected value that matches nothing comes back with count: 0 , so the shopper can clear it. A list answer carries up to 50 values per filter; more: true means there are others. filters.values(key, query) ( GET /v1/storefront/filters/:key/values ) answers every value of one filter, up to 1,000, counted for the same selection. Sorting Without a sort , the list uses relevance with q (or a handles / skus batch), a collection's own default sort with collection , and featured otherwise. The answer's sort names the one used, and config().sorts lists the ones the store offers. An unknown sort, or best_rated while ratings on lists are off, answers 400 INVALID_REQUEST . Ties break by product, so pages never overlap. Paging Every list answer carries page : number , limit , total (the exact count of matching products), pageCount and nextCursor . Page by number with page , or follow nextCursor with cursor for infinite scroll; sending both answers 400 . Offsets are capped. A page number, and a cursor for relevance or manual , can reach 10,000 products deep (1,000 for relevance ). Past that the page is empty and page.capped is true . Cursors on a sort with a stable key are not capped. For featured , title, price, newest , updated and best_rated , the cursor is keyset based: it walks the whole list and stays exact while products change. A cursor is opaque. Send it back as it came, with the same selection and sort. Fields and include Lists answer the lite projection by default, sized for a product grid (a 24-product page is at most about 30 KB): handle , title , brand , productType , images (the first two, with sizes), priceRange , availability , lowStock , featured , badges (sale and new), variantCount , optionSwatches , seo.title and, while ratings show on lists, rating . fields: full answers the whole product, as a product page gets it: variants with their option values, options, breadcrumbs, descriptions, purchasable and the rest. Each variant in the full product carries four nullable measures: weightGrams , lengthMm , widthMm and heightMm . null means the merchant never entered it. The Specifications section of a product page shows them, and live carrier rates use them. fields: [...keys] answers only those top-level keys ( handle is always kept). An unknown key answers 400 INVALID_REQUEST naming it. include adds the heavy parts no projection carries by default: fitment , oemNumbers , supersessions , jsonLd and descriptionHtml . products.get(handle) always answers the full product and takes include . A renamed product answers redirectTo with its new handle; see Collections, categories and tags . Keep the shop page in its URL @usethrottle/catalog/url turns a shop page's query string into a selection and ba"},{"title":"Catalog Push API","route":"/product-catalog/push","headings":["Catalog Push API","What it is","How a push works","Tax codes and quotes","In this section","Known limits"],"text":"Product Catalog · Push API Catalog Push API The push API is how a vendor's own system, or the merchant's, puts products into the Product Catalog: create, update, rename and archive them by the vendor's own product id, at any size, with a result for every row. It lives next to the storefront API, on the same host. Push keys are secret. Never put a pc_sk_ or pc_vk_ key in a browser, a mobile app or a repository. The storefront API takes publishable keys; this one does not. What it is Every route takes the key as a bearer token ( Authorization: Bearer pc_… ). Answers are JSON, and every error answers the same envelope (see Errors ). The OpenAPI document is public at GET /v1/catalog/openapi.json . Callers address a product by their own product id , externalId , which is unique per vendor. The URL handle is an ordinary field you can change. Vendors and keys covers who owns what. How a push works Pushing is async only . A push answers 202 with a job or run id and is applied in the background, so a feed of a hundred thousand products does not hold a request open. The one synchronous route is PATCH /v1/catalog/inventory , for live stock. A job is staged : nothing applies until it is closed. A job that is not closed within 24 hours expires , its staged batches are discarded and never applied, and it ends as failed ( JOB_EXPIRED ). Send the feed again in a new job. In TypeScript, jobs.run does all five steps for you ( admin SDK ): Tax codes and quotes A row's product.taxCode sets the product's tax code, such as Avalara's PF050101 . There is one per product, shared by all its variants. It must be upper case and match ^[A-Z0-9]{1,25}$ (file imports trim and upper-case it for you), and a sent null removes it. Vendor pushes and product reads carry it too. Storefront answers, feeds and JSON-LD never include it. Pushed products are what Throttle's quotes look up. When a rep picks a product for a quote line, or an API caller sends a line with only its SKU, Throttle asks the catalog through a signed, server-to-server quote lookup. The lookup answers the variant's name, description, image, price in the quote's currency (the customer's price-group price when there is one; Throttle sends the customer's group in the signed request), tax code, stock status and quantity limits. Out-of-stock variants are still returned; draft and archived products are not. No push key, publishable key or browser can call the lookup. See Catalog lines in the quotes guide. In this section First vendor feed in 10 minutes , Start here: a working feed, step by step, with expected answers. ], [ html: Concepts , Keys, the job lifecycle, merge and replace, fair turns, ownership and holds. ], [ html: Limits and throughput , Every limit, and two measured production runs. ], [ html: Troubleshooting , Symptom, cause, fix. ], [ html: Reference for AI agents , How an agent runs a full sync; links the OpenAPI document. ], [ html: Vendors and keys , Ownership, key reach, SKU clashes, adoption, holds, the vendor winning, vendor on orders. ], [ html: Jobs, batches and runs , Merge and replace, staged jobs, limits, full sync, fair turns, reports. ], [ html: Products , Read, archive, restore, rename, the 30-day purge, categories. ], [ html: Stock , Set and adjust, idempotency, per-row results, stock in a job. ], [ html: Webhooks , Completion events, signatures and the retry schedule. ], [ html: Errors , The envelope and every error code. ], [ html: Admin SDK , The experimental @usethrottle/catalog/admin entry. ], [ html: API reference , Every operation, rendered from the OpenAPI document. ], ] /> Known limits None of these is a bug; plan around them. Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer. Stock in a job applies at close. Use PATCH /v1/catalog/inventory for live stock ( Stock ). The legacy checkout records no vendor on an order line. With the Vendor on orders setting on, only carts priced by the catalog's line resolver record metadata.lineResolver.vendorId ( Vendor on orders ). Vendor batches are canonical rows. A mapping profile cannot set externalId . Job CSV reports above 900 parts answer 409 REPORT_TOO_LARGE . The admin SDK entry is experimental. A breaking change to it ships as a minor release. Categories now go up to 10 levels deep everywhere the tree is used; the storefront's categories.tree takes a depth of 1 to 10."},{"title":"Catalog Push API: reference for AI agents","route":"/product-catalog/push/agents","headings":["Catalog Push API: reference for AI agents","Base URL and auth","Endpoints","Complete call sequence with exact JSON","Required call order for a full sync","Idempotency rules","Retry decision table","Stop conditions","The loop in pseudo-code","Error handling","Never"],"text":"Product Catalog · Push API Catalog Push API: reference for AI agents Follow this page literally to run a full sync of a vendor's catalog. Machine-readable contract: https://catalog.usethrottle.dev/v1/catalog/openapi.json (public, no key). Base URL and auth Base URL: https://catalog.usethrottle.dev/v1/catalog Header on every call: Authorization: Bearer <key> , with a vendor key pc_vk_… or a store key pc_sk_… . Never send either from a browser, and never print or log it. Bodies are JSON ( Content-Type: application/json ), at most 5 MiB and 1,000 rows per batch; PATCH /inventory at most 1 MiB and 1,000 rows. Archive, restore and assign take at most 100 refs per call; GET /products takes limit 1 to 100 (default 50); externalId is at most 255 characters. An Idempotency-Key is remembered 24 hours. Endpoints Complete call sequence with exact JSON Every request and response of a full sync, in order. Replace <key> , <jobId> and <batchIndex> . Bodies are real answers from production (ids replaced); the base URL is https://catalog.usethrottle.dev/v1/catalog . Required call order for a full sync Open a job with mode: "replace", fullSync: true (or merge, if you only upsert). Keep the jobId . Send batches : split the feed into batches of at most 1,000 rows and under 5 MiB. Keep all rows of one product adjacent in the same batch (replace refuses scattered rows). Every row of a vendor needs externalId , productHandle and sku . Send at most 2,000 batches per job; keep at most 3 jobs open. Check each batch answer : if rowsRefused > 0 , read issues . A refused row counts in rowsFailed for the whole job and skips the archive pass, even if you resend a fixed row. To get the archive, open a new full-sync job with the whole corrected feed. Close the job exactly once. Nothing is applied before this. Wait : poll GET /jobs/{jobId} every 5 to 10 seconds, or use a webhook, until finishedAt is set. Do not hold requests open. Judge the result : success is failureCode === null and rowsFailed === 0 . Otherwise download errors.csv and report it. Measured on 2026-11-01 in two single runs on one store (Workers e844ed62 and e2f3c98a): 120,000 products (372,242 rows) took 55 and 62 minutes end to end, an apply rate of 7,538 and 6,713 rows per minute (end-to-end rates: about 6,700 and 6,045). Plan on about 1 hour per 120,000 products with images. Image copies run alongside the job at about 200 to 285 per minute at peak, and leftovers drain at about 20 per minute afterwards; the storefront serves the vendor's image URL until a copy lands. Updates with no image changes run faster. Split very large catalogs across jobs. Details: Limits and throughput . Idempotency rules Send Idempotency-Key (1 to 200 characters) on every batch. Use a stable key such as jobId : batchIndex . A retry must repeat the same body with the same key ; the replayed answer carries Idempotent-Replayed . A different body with a used key is 409 IDEMPOTENCY_CONFLICT . An adjust stock row requires a key ( 400 IDEMPOTENCY_KEY_REQUIRED ). One key per delivery event, not per attempt. Retry decision table 0) , Resend only the fixed rows (merge); with fullSync the archive is already skipped, so run a new full-sync job with the whole corrected feed , None , A NEW key (the body changed) , The fixed rows ], [ 409 JOB_CLOSED, JOB_FULL , No, in this job , None , New job, new keys , Continue in a new job ], [ 400, 413, 422, 404, 401, 403 , No , None , None , Fix the request first ], ] /> Stop conditions Stop and report to the user (do not retry) when: The response is 401 or 403 (key invalid, vendor paused, route not allowed). Five consecutive retries of one request have failed. A batch answers 413 or 400 after you cut it to the limits. The job finished with failureCode set, or rowsFailed > 0 : report the code and the first lines of errors.csv . You have waited more than 3 hours without finishedAt for a feed under 120,000 products (see the time guidance below), or the job state is expired . The feed would archive far more products than usual: stop before close and ask the user (a full sync archives everything the job did not send). The loop in pseudo-code Error handling Every error is { error : { code , message , requestId , issues ? } } . Branch on code , never on the message. All codes: Errors . Symptoms and fixes: Troubleshooting . Never Never set fullSync unless the feed is the vendor's complete catalog: it archives everything the job did not send. Never split a product's rows across batches in replace mode. Never put a key in a browser, URL, log or repository. Never assume stock in a job is live: it applies at close. Use PATCH /inventory for live stock. Background: Concepts , first feed guide , API reference ."},{"title":"Push API Reference","route":"/product-catalog/push/api-reference","headings":["Push API Reference","{group.name}","Error codes"],"text":"Product Catalog · Push API Push API Reference Every operation of the push API at https://catalog.usethrottle.dev/v1/catalog , rendered from its OpenAPI document. Every route except the document itself takes a secret key as a bearer token: a store key ( pc_sk_ ), or a vendor key ( pc_vk_ ) on the operations that list it. Download the OpenAPI document groups.map((group) => ( group.name group.description group.endpoints.map((item) => ( )) )) Error codes Every error answers the same envelope, with a stable error.code . These are all the codes the API returns, with their HTTP statuses and whether a retry can succeed."},{"title":"Concepts","route":"/product-catalog/push/concepts","headings":["Concepts","Store key and vendor key","The staged job lifecycle","Which calls work in which state","Merge and replace","Fair turns","Ownership, adoption and holds","A SKU clash, walked through","API archive and the 30-day purge"],"text":"Product Catalog · Push API Concepts Seven ideas explain the whole push API. Each section is short and links to the page with the details. Store key and vendor key Example. The same header name, a different reach and a different way to name a product: Both are secret and server-side only. Details: Vendors and keys . The staged job lifecycle A job is a staged, all-or-nothing push. Batches are checked on arrival and stored; nothing changes in the catalog until the job closes. open closed completed failed expired close 24 h, never closed Which calls work in which state The job view has the states open , closed and expired ; completed and failed are read from finishedAt and failureCode . A completed job can carry FULL_SYNC_ARCHIVE_SKIPPED , so consumers must check failureCode (webhook: data.failureCode ) on a catalog.run.completed event. Webhooks say catalog.run.completed or catalog.run.failed . Merge and replace Merge (default) changes only what you send. Replace treats the job as the full truth for your own data: values you did not send are dropped, and variants you supplied earlier and did not send are archived. Replace needs a product's rows together in one batch. Full sync is a separate switch: after applying, it archives your products that the whole job never mentioned, and only if the job was clean. See Merge and replace . Example, run on production. A product has two variants, a brand and a stock of 5. The replace job sends only the 250 g variant, with a title and a price. Afterwards the brand is gone (the value you no longer send), the stock you did not resend is dropped to 0, and the 1 kg variant you stopped sending is archived . A merge job with the same row would have changed only the price. Fair turns Each vendor, and the store key, has its own lane. Closed jobs take turns across lanes, so a small update is not stuck behind another vendor's huge feed. An idle open job holds no turn. Within a lane, work goes oldest close first. Ownership, adoption and holds Ownership. A product has one owner: a vendor or the merchant. A vendor key never changes ownership, and a SKU clash with another owner fails with SKU_CONFLICT . Adoption. Products already in the catalog stay the merchant's until the merchant assigns them to a vendor; the vendor's first push then links each one by SKU and records its externalId . A push never claims an unassigned product. The vendor wins. On a vendor-owned product, what the vendor sends outranks the merchant's dashboard edit. Holds. If the merchant archives or drafts a vendor product in the dashboard, the vendor can still update its data but cannot republish or restore it until the merchant lifts the hold ( held in the answer). A SKU clash, walked through Vendor A owns DEMO-GUJI-250 . Vendor B pushes a different product with the same SKU. The batch is accepted (a SKU clash is found when the row is applied), the row fails with SKU_CONFLICT in the error report, and nothing of vendor A's product changes. Vendor B cannot see A's product to find out why: it answers 404 , and a store-only route answers 403 VENDOR_KEY_NOT_ALLOWED . Resolve it by choosing a SKU of your own, or ask the merchant to assign the product to the right vendor. Holds in detail . API archive and the 30-day purge Deleting through the API archives : the product leaves the storefront and can be restored. An API archive is purged 30 days later (the whole product, unless another source still supplies it). A merchant's dashboard archive never purges. An archived product stays archived when later pushes resend it, until an explicit restore or a row that sends status: "active" . The storefront edge cache holds an answer for at most 60 seconds, so an archived product can still appear for up to a minute. It is gone on the next uncached read. The purge in practice: The purge in detail ."},{"title":"Errors","route":"/product-catalog/push/errors","headings":["Errors","The envelope","Codes","Row issues","Job failure codes and other codes","In the SDK"],"text":"Product Catalog · Push API Errors Every failed request answers the same envelope with a stable error.code . A failed row is not a failed request: it is reported in the batch answer and the job's error report. The envelope issues appears on validation errors and names every problem. Quote requestId when you ask for help. A 429 and some 409 s carry Retry-After . Codes Retryable means the same request can succeed later without a change. Always resend with the same Idempotency-Key . Row issues A failed row is not a failed request. A batch answer lists refused rows in issues as { index, code } (the position in the batch, 0 based; no message) and counts them in rowsRefused . The job's errors.csv adds the row number (job-wide, from 1), SKU, field , severity, message and externalId. Rows refused or failed count in rowsFailed ; warnings leave the row applied and count in rowsWarned . Every code a push can report: [ code: r.code , r.title, r.fix]) /> Warnings are MERCHANT_HOLD , INVALID_GTIN_DROPPED , CATEGORY_TOO_DEEP , DUPLICATE_SKU_REPLACED and SCATTERED_PRODUCT_ROWS in merge mode (in replace mode it refuses the product). A currency the store has no price list for, or a locale it has not enabled, refuses a vendor row: for a currency the error is FIELD_NOT_ALLOWED with "The store has no price list in this currency."; for a locale it is LOCALE_NOT_ENABLED . Stock rows in PATCH /inventory report invalid with the stock codes above. Job failure codes and other codes The same codes, with the exact response and a corrected request, are on Troubleshooting . In the SDK The admin client throws the same classes as the rest of @usethrottle/catalog : a CatalogError with the server's code , and a RateLimitedError (with retryAfterSeconds ) for every 429 . See Errors and rate limits for the storefront side."},{"title":"Your first vendor feed in 10 minutes","route":"/product-catalog/push/guide","headings":["Your first vendor feed in 10 minutes","1. Create a key","2. Open a job","3. Send a batch","A row-level error","4. Close the job","5. Poll until completed (or use a webhook)","The webhook alternative","6. Read a product back","7. Verify on the storefront","All seven steps in one script","What to do next"],"text":"Product Catalog · Push API Your first vendor feed in 10 minutes Seven steps take two products from your system to the live storefront. Every step has the request as curl and as SDK code, and the answer you should get. All of it was run against production before publication; ids are real examples and your ids differ. Replace the demo- and DEMO- ids with your own. A vendor key from the merchant, Node 20+ (or just curl ), and npm install @usethrottle/catalog for the SDK form. The HTTP answers are the contract; the SDK returns the inner object (for example the job without the job wrapper). 1. Create a key Keys are created by the merchant, in the Product Catalog dashboard: Storefront › Vendors , open your vendor, Create key . A vendor key starts with pc_vk_ and is shown once ; copy it into your server's secret store. If you are the merchant, use a store key ( pc_sk_ ) instead. Export it, then prove it works with any read: export CATALOG_VENDOR_KEY=pc_vk_… Check before moving on: 200 with a products list means the key is valid. 401 AUTHENTICATION_FAILED means the key is wrong or revoked; 403 VENDOR_PAUSED means the merchant paused you. A vendor that already has products sees them here (the SDK returns the same object). 2. Open a job A job is a staged push: nothing changes in the catalog until you close it. Open one and keep its id. Check before moving on: 201 , state: "open" , failureCode: null and an expiresAt 24 hours away. Export the id: export JOB_ID=<jobId> . The SDK's job.get() returns the object inside job . 3. Send a batch A batch is up to 1,000 rows and 5 MiB. All rows of one product go in the same batch. Send an Idempotency-Key so that a retry never stages the batch twice. Check before moving on: 202 , rowsAccepted equals the rows you sent, rowsRefused: 0 and an empty issues . Nothing is applied yet. A row-level error One bad row does not fail the batch. Here the second row has no sku : the batch still answers 202 , the bad row is listed in issues by its position ( index , 0 based), and the good row is accepted. The error report (after the job finishes) names the field and counts rows from 1 across the whole job. This example runs in a scratch job, so the main feed stays clean. Fix: correct the row and send it in the same job as a new batch with a new Idempotency-Key (the body changed). Rows already accepted stay staged. 4. Close the job Closing tells the catalog the feed is complete; it applies the staged batches in the order they arrived, in the background. Check before moving on: 202 , state: "closed" , finishedAt: null . Closing twice is harmless (the second call answers 200 with the job). Any batch sent now answers 409 JOB_CLOSED . 5. Poll until completed (or use a webhook) Poll the job every 5 to 10 seconds until finishedAt is set. A small job took about 10 seconds; a 120,000-product feed took about an hour. Check before moving on: finishedAt is set, failureCode is null and rowsFailed is 0. If not, download GET /v1/catalog/jobs/{jobId}/errors.csv . On a repeat run of the same feed the counts read unchanged instead of created . The webhook alternative Instead of polling, the merchant sets a webhook URL for your vendor (Storefront › Vendors › webhook) and you get a signed catalog.run.completed or catalog.run.failed event. Verify the signature on the raw body, then act. Dedupe on id , because an event can arrive twice or late. Check: your receiver answers 2xx within 3 seconds, and data.runId equals your job id. See Webhooks . 6. Read a product back Address the product by your own id. This is the push API's view: status, hold, archive and purge state, variants. Check before moving on: status: "active" , held: false , the price and quantity you sent. 404 means the id is not yours or the job has not finished. 7. Verify on the storefront Shoppers see the product through the storefront API with a publishable key ( pc_pk_ , type server; ask the merchant). This is the final proof. Check before moving on: the title and priceRange match what you sent. A few seconds can pass between finishedAt and the product appearing; a 404 for longer means the product is a draft (send status: "active" ), held, or archived. All seven steps in one script What to do next Concepts : merge and replace, the job lifecycle, ownership and holds. Full sync : archive what your feed no longer lists. Stock : live stock with PATCH /inventory . Limits and throughput : plan a large feed. Troubleshooting : every error code with a fix. Reference for AI agents ."},{"title":"Stock: set and adjust","route":"/product-catalog/push/inventory","headings":["Stock: set and adjust","PATCH /v1/catalog/inventory","Adjust rules","Results per row"],"text":"Product Catalog · Push API Stock: set and adjust Every stock write chooses, per row, between set (the quantity becomes the sent value) and adjust (the sent value is a signed delta added to the quantity on hand). Set is the default, so an existing caller is unchanged. A stock set or adjust inside a sync job is staged with the job and applies at close, not on arrival ; a staged set re-bases on-hand stock at that moment. PATCH /v1/catalog/inventory is synchronous: the quantity changes before it answers. PATCH /v1/catalog/inventory The body is { rows: [...] } , 1 to 1,000 rows, at most 1 MiB. A row names a sku and can carry quantity (an integer), quantityMode ( set or adjust ), priceMinor , salePriceMinor ( null clears it), currency and availability . Adjust rules Atomic. Two adjusts that arrive together both apply (5 + 3 + 2 = 10); the last writer never wins. An Idempotency-Key is required. A request, a job batch or a vendor single batch with an adjust row needs an Idempotency-Key of 1 to 200 characters, or the answer is 400 IDEMPOTENCY_KEY_REQUIRED before anything is written. A repeated key answers the first answer again and never applies the delta twice. Choose one key per delivery event, not per attempt. Reusing a key with a different body is 409 IDEMPOTENCY_CONFLICT . The SDK generates a key when you pass none. On-hand only. An adjust changes the stored quantity. Stock reserved by open carts is not touched, and availability keeps being computed from reservations as before. Below zero. An adjust may take the quantity below zero only when the variant's backorders setting is allow . Otherwise the row fails with QUANTITY_BELOW_ZERO and the quantity stays. The check uses the backorders value stored before the row writes : a row that also turns backorders on is still judged against the old value. Nothing is silently clamped to zero. One mode and one row per SKU per request. The same SKU twice, or set and adjusted together, fails every row involved ( DUPLICATE_SKU_IN_BATCH , STOCK_MODE_CONFLICT ). Results per row The answer is { results: [...] } , one entry per row, in order: updated , unchanged , not_found (an unknown SKU, or one outside a vendor key’s reach, never SKU_CONFLICT ) or invalid . ], [ code: quantity , The quantity the row left on hand. Reconcile against this, not your own arithmetic. ], [ code: code , html: Why a row is invalid : QUANTITY_BELOW_ZERO , QUANTITY_OUT_OF_RANGE , QUANTITY_MODE_WITHOUT_QUANTITY , STOCK_MODE_CONFLICT or DUPLICATE_SKU_IN_BATCH . ], [ code: sourceWins , false when the caller’s value does not win the quantity (the store key under a value the merchant set by hand). ], ] /> A failed row never fails the others. In a job or a vendor single batch, the quantity each stock-writing row left is recorded and paged from GET …/stock (see reports )."},{"title":"Limits and throughput","route":"/product-catalog/push/limits","headings":["Limits and throughput","Limits","Throughput: two measured runs","What to do about it","Images","How fresh is the storefront?"],"text":"Product Catalog · Push API Limits and throughput Every number you can hit, what happens when you hit it, and how long a large feed really takes. Limits 400 INVALID_REQUEST ], [ Bytes per batch , 5 MiB (5,242,880 bytes) , html: 413 REQUEST_BODY_TOO_LARGE ], [ Inventory request , 1,000 rows, 1 MiB , html: 413 REQUEST_BODY_TOO_LARGE ], [ Batches per job , About 2,000 (roughly 2 million rows) , html: 409 JOB_FULL ], [ Open jobs per caller , 3 , html: 409 TOO_MANY_OPEN_JOBS ], [ Waiting batches per caller , 2,000 received, not yet applied , html: 429 PUSH_QUEUE_FULL , Retry-After: 60 ], [ Job lifetime while open , 24 hours , html: Expires: JOB_EXPIRED ], [ Request rate , 600 per 60 s per key (approximate) , html: 429 RATE_LIMITED with Retry-After ], [ Idempotency-Key , 1 to 200 characters , html: 400 INVALID_REQUEST ], [ Job CSV report , Up to 900 parts , html: 409 REPORT_TOO_LARGE ], [ Report retention , 30 days after the run finishes , html: 410 REPORT_EXPIRED ], [ Refs per archive, restore or assign call , 100 , html: 400 INVALID_REQUEST ], [ GET /products page size , 1 to 100, default 50 , html: 400 INVALID_REQUEST ], [ externalId length , 255 characters , html: 400 INVALID_REQUEST or a refused row ], [ Idempotency-Key memory , 24 hours , After that the same key is treated as new ], [ Stock adjust de-duplication (job rows) , 7 days , A repeated adjust row of the same delivery is not applied twice ], [ Vendors per store / keys per vendor , 200 / 2 active , Creation is refused ], ] /> The rate limiter is approximate : it is not an exact meter, so a burst can slip a little past 600 or be refused a little early. Treat 600 per minute as a design target, not an exact meter, and always honor Retry-After . A vendor key is limited on every route; the store key on jobs and products routes only. Throughput: two measured runs These are two measurements made on 2026-11-01 on one production store, each run once. They are not a guarantee, a benchmark of your feed, or a target. The feed was 120,000 products (372,242 rows) in 373 batches, mode merge, four parallel senders, with images on 10% of the products. Expect about 1 hour per 120,000 products with images , roughly 6.7k to 7.5k rows per minute on average, and plan on a feed with many new image URLs taking that long or longer. The apply rate falls during a run (about 12k to 13k rows per minute at the start, about 3.5k in the middle) and recovers once the image copies drain. The fix between the runs cut database reads by half and made them independent of catalog size, but did not make the run faster. Updates to existing products with no image changes run faster: a price update of about 150,000 rows on the same store applied at about 46,000 rows per minute (a single run on 2026-11-01, 195 s, Worker e844ed62). The same 120,000-product feed ran in about 4 minutes on a local test stack. Do not read that as a production figure. What to do about it Split very large catalogs across jobs (for example by category or by 20,000 products), and keep at most 3 open at once. Poll the job every few seconds, or use the webhook, rather than holding a connection open. Closing returns at once. Send updates without images as a separate, small job so they are not queued behind a big image feed (lanes take turns, but a lane applies its own work in order). Images Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer. A completion event means rows are written, not that images are copied. See known limits . How fresh is the storefront? Rows are visible a few seconds after finishedAt (8.6 s and 39 s were measured on the two large runs). An archived product can still be served for up to 60 seconds from the edge cache."},{"title":"Products: read, archive, restore, rename","route":"/product-catalog/push/products","headings":["Products: read, archive, restore, rename","Read","Weight and dimensions drive live rates","Volume tiers: bulkTiers","Naming products","Archive and restore","The 30-day purge","Rename","Categories"],"text":"Product Catalog · Push API Products: read, archive, restore, rename Writing a product is a push ( jobs and batches ). These routes read what you pushed and change its state. They are synchronous, and a vendor key reaches only its own products. Read GET /v1/catalog/products answers one product when you pass exactly one of externalId , sku or handle , and otherwise a page of the caller's products with a nextCursor ( null at the end; limit 1 to 100, default 50). A product that is not the caller's answers 404 , so a vendor cannot tell it exists. Weight and dimensions drive live rates A variant you push can carry weightGrams , lengthMm , widthMm and heightMm (grams and millimetres, each a number or null ). They now drive live shipping rates: when a buyer adds the variant to a cart, Throttle copies them onto the cart line (kilograms and centimetres), and a connected carrier or rate aggregator quotes with the item's real weight and box. Reading a product back returns the same four fields. Empty means unknown. Send null to clear a value. A value of 0 is refused, never stored as a weightless item. Whole numbers in range. weightGrams is a whole number from 1 to 10,000,000 (10 t); each size is a whole number of millimetres from 1 to 100,000 (100 m). A value outside that, or a fraction, refuses the row with INVALID_ROW and the field path in the report, for example variant.weightGrams . Values already stored are not changed. Dimensions are a set. Throttle uses length, width and height only when all three are present. No weight keeps today's behaviour. A variant with no weight puts no weight on the cart line, and the rate is worked out as it was before. The merchant sees the same numbers in the storefront's Specifications and in the shipping docs for UPS and FedEx . Volume tiers: bulkTiers A push row can carry bulkTiers : volume tables keyed by customer group. The keys work like groupPrices : a group name (any case), a group id, or * for all buyers. Each value is that target's whole table for the product. The model, the price rule and examples are on Volume pricing . null or [] , Clears that target’s table for the product. Other targets keep theirs. ], [ Rows of one product in one batch , html: They combine per target. The first row sets the ranges and types. Values per SKU are merged. A later row with other ranges or types, or a second value for one SKU and currency, is refused with BULK_TIERS_CONFLICT . ], [ Replace mode (full sync) , Behaves like groupPrices. It replaces the tables of the targets you name. It never deletes the table of a group your batch did not name. ], [ A vendor key , html: Refused with FIELD_NOT_ALLOWED . Only the store key may send bulkTiers. ], [ A key that names no group , html: GROUP_NOT_FOUND on the key. The row writes nothing. A percent group is accepted. ], [ A tier that names a SKU of another product , html: BULK_TIER_SKU_UNKNOWN . A SKU created by another row of the same call is known. ], [ A table that breaks a rule , html: BULK_TIERS_INVALID , with the tier and the rule in the field, such as bulkTiers.Dealer[1].minQuantity . ], ] /> Last writer wins. There is no source precedence. A later write replaces the table, whoever sent it, as it does for group prices. Reading it back. GET /v1/catalog/products returns bulkTiers keyed by group id (lowercase UUID), or * for the all-buyers table, never by name, and only when a table exists. A vendor key's read never carries it. Tables of groups Throttle no longer lists are left out. Every maxQuantity is explicit. If the read needs group names and Throttle cannot supply them, it answers 409 EXTENSION_UPGRADE_REQUIRED (the install has no group grant) or 503 CUSTOMER_GROUPS_UNAVAILABLE (retry). It never answers with some tables missing. Read, then write back. A store key that reads a product and pushes the same rows back writes the tables it read as its own. With no source precedence this changes nothing the buyer sees. Naming products The archive, restore and rename routes name a product with a ref : an object with exactly one of externalId , sku or handle . results: [ index, status ] , status archived , unchanged , held or not_found . ], [ code: POST /v1/catalog/products/restore , code: products : [ref, …] , html: The same shape, status restored , unchanged , held or not_found . ], [ code: POST /v1/catalog/products/rename , code: product : ref, handle : new-handle , html: The renamed product. 409 HANDLE_TAKEN when the handle is in use. ], [ code: PUT /v1/catalog/products/vendor , html: Store key only. vendorId : string | null, products : [ref, …] , at most 100 refs; a null vendorId unassigns. , html: Per product: assigned , unchanged or not_found . ], ] /> Each result carries the index of the product in your request, so one missing product does not fail the rest. Archive and restore Deleting through the API archives . The product leaves the storefront at once (it answers 404 ) and can be restored for 30 days. An archived product stays archived when later pushes resend it, until an explicit restore or a row that sends status: "active" for it. Only the key that may write the product can archive or restore it. A vendor cannot archive the merchant's products. Holds stick. If the merchant archived or drafted the product in the dashboard, the vendor's restore answers held and changes nothing until the merchant lifts the hold (see Vendors and keys ). A push to an archived product keeps updating its data; it just does not bring it back. The 30-day purge A product archived through the API is purged 30 days after the archive. Merchant dashboard archives never purge. What a purge removes: The whole product (its variants, images, reviews as the existing product delete rules do, and its data) when no other non-manual source still supplies one of its variants and it has no archive or draft hold. Otherwise only the archiving source's own values, and the product stays archived. Past orde"},{"title":"Jobs, batches and runs","route":"/product-catalog/push/runs","headings":["Jobs, batches and runs","Rows","Merge and replace","Sync jobs","Limits and guardrails","Idempotency","Full sync","Fair turns","Single batches","Runs and progress","Error reports and stock results"],"text":"Product Catalog · Push API Jobs, batches and runs A row describes one variant (a SKU) and the product it belongs to. Rows travel in batches ; many batches make a sync job ; every job and every single batch is applied as a run that you can follow. Rows A row is keyed by sku and grouped into a product by productHandle . A vendor row also carries externalId , the vendor's own product id, which is how the product is found again after a rename. Optional parts: product (title, description, brand, images, categories, tags, options, draft, taxCode ), variant (price, currency, stock, GTIN, dimensions), status ( draft or active ), attributes , prices (other currencies), translations and quantityMode ( set or adjust ). The API reference lists every field and its limits. Images are public URLs; the catalog copies them through its media pipeline (see the image limit ). Categories can be an id or a path, up to 10 levels deep; missing levels are created. Merge and replace Replace needs a product's rows together. All of a product's rows must sit next to each other in one batch . Rows of a product that an earlier batch of the job already claimed, or rows of it that are not adjacent, are refused with SCATTERED_PRODUCT_ROWS , and nothing of that product in the batch applies. The SDK never splits a product across a batch boundary. A row that is refused still counts as sent for the whole job, so its variant is never archived and its values are never withdrawn by a replace. A sent null blanks a field in either mode. A mode is chosen per job (or per single batch), never per row. Sync jobs Open a job with POST /v1/catalog/jobs ( mode , and optionally fullSync ), send batches to POST /v1/catalog/jobs/{jobId}/batches , then close it with POST /v1/catalog/jobs/{jobId}/close . Nothing applies until close. A batch is validated when it arrives (the answer lists refused rows in issues ) and stored. At close the batches apply in the order received, then a full sync runs if requested. The job is all-or-nothing in this sense: until the close, the catalog has not changed. Open for 24 hours at most. A job not closed within 24 hours expires. Its staged batches are discarded, never applied, and the job ends as failed with JOB_EXPIRED (the webhook and the progress view say so). Resend the feed in a new job. States. open (batches accepted), closed (applying or finished; read finishedAt and failureCode ) and expired . Each batch is staged , applied or discarded . Stock in a job applies at close, not on arrival. A staged set re-bases on-hand stock when the job closes. For live stock, use PATCH /v1/catalog/inventory ( Stock ). Limits and guardrails 400 INVALID_REQUEST ], [ Bytes per batch , 5 MiB , html: 413 REQUEST_BODY_TOO_LARGE ], [ Batches per job , About 2,000 (roughly 2 million rows) , html: 409 JOB_FULL ], [ Job lifetime , 24 hours open , html: The job expires and is discarded ( JOB_EXPIRED ). ], [ Open jobs per caller , 3 , html: 409 TOO_MANY_OPEN_JOBS (retryable once one closes or expires). ], [ Waiting batches per caller , 2,000 received but not yet applied, across open and running jobs , html: 429 PUSH_QUEUE_FULL with Retry-After: 60 . , ], [ Request rate , 600 requests per 60 seconds per key , html: 429 RATE_LIMITED with Retry-After . A vendor key is limited on every route; the store key on jobs and products routes only. , ], [ Idempotency-Key , 1 to 200 characters , html: 400 INVALID_REQUEST ], ] /> The store key is one caller: its jobs share one set of caps, and one lane. Send the next batch after a 429 only once Retry-After seconds have passed, with the same Idempotency-Key . Idempotency Send an Idempotency-Key (1 to 200 characters) with every batch. A retry with the same key answers the first answer again instead of staging the batch twice (the replay carries an Idempotent-Replayed header); the same key with a different body is 409 IDEMPOTENCY_CONFLICT . A job batch, a vendor single batch or an inventory request that contains an adjust row must carry one, or the answer is 400 IDEMPOTENCY_KEY_REQUIRED before anything is stored. The SDK makes a key for you when you pass none. Full sync fullSync: true (off by default, never implied) archives the caller's products that are missing from the whole job , once, at close. It never runs per batch. The archive pass is skipped, and the job ends with FULL_SYNC_ARCHIVE_SKIPPED , when any row in the job was refused or failed, or when nothing was seen (an empty job). Nothing is archived on a job that is not clean. A job that expires unclosed is different: it ends failed with JOB_EXPIRED . While a full-sync job is open, it refuses its own source's other writes : another job or a single batch from the same key (and for a vendor, any of that vendor's keys) answers 409 RUN_IN_PROGRESS . Other vendors are not affected. Fair turns Applying takes turns. Every vendor, and the store key, has its own lane, and within one store the lanes take turns, so a small update from one vendor is not stuck behind another vendor's multi-hundred-batch feed. Only a closed job takes a turn. An idle open job never blocks anyone: its staged batches sit in storage, take no turn and apply nothing. Within a lane, work applies one item at a time, oldest close first, so a vendor's single batch waits behind that same vendor's earlier-closed job. A job finishes in the turn that applies its last batch. Single batches For a small update, POST /v1/catalog/variants sends one batch (up to 1,000 rows and 5 MiB) without a job and answers 202 with a run to follow. With a vendor key it has the full push behaviour ( externalId , status, replace, adjust, and a mode in the body). With the store key it is today's endpoint, unchanged: no externalId , status, replace or adjust; use a job for those. A vendor single batch counts toward the same waiting-batch cap as job batches. Runs and progress GET /v1/catalog/runs/{runId} and GET /v1/catalog/jobs/"},{"title":"Admin SDK","route":"/product-catalog/push/sdk-admin","headings":["Admin SDK","Install and create the client","Methods","What the SDK does for you","Images"],"text":"Product Catalog · Push API Admin SDK @usethrottle/catalog/admin wraps the push API: it opens jobs, cuts a feed into batches, waits out a full queue, makes the idempotency keys and follows the run to the end. The admin entry is outside the package's 1.x freeze: a breaking change to it ships as a minor release, named in the changelog, until it is frozen. Every export carries a TSDoc @experimental tag. The HTTP API itself is the stable surface. Install and create the client The admin entry ships in @usethrottle/catalog 1.1.0 and later. createCatalogAdmin({ key }) takes a store key ( pc_sk_ ) or a vendor key ( pc_vk_ ). It is server-only : in a browser environment it throws CatalogError SERVER_ONLY , and it throws INVALID_ADMIN_KEY for any other key (a publishable key gets its own message). The key is never part of an error message. Options: baseUrl , timeoutMs (default 60 seconds) and fetch . Methods What the SDK does for you Idempotency keys. It makes a UUID for every job batch, vendor batch and adjust call that has none, and one retry after a network error reuses it, so a delta is never applied twice. A key you pass is 1 to 200 characters. A full queue. A 429 PUSH_QUEUE_FULL waits retryAfterSeconds , then sends the same batch again with the same key, at most 3 times; after that the RateLimitedError is thrown. wait(). job.wait() and runs.wait() poll every 5 seconds for up to 24 hours ( intervalMs , timeoutMs , signal ). They resolve even when the job failed: read failureCode (or status ). A job that failed client-side is left open and expires after 24 hours; its staged batches are discarded, never applied. A vendor run answer has pushMode beside mode . Stock in a job still applies at close; use inventory.set or inventory.adjust for live stock ( Stock ). Reports: job row numbers are job-wide, and a job whose CSV is above 900 parts answers 409 REPORT_TOO_LARGE ; page stockResults() for stock, and split a very large feed into smaller jobs for error reports. Images Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer."},{"title":"Troubleshooting","route":"/product-catalog/push/troubleshooting","headings":["Troubleshooting","Find your problem","{item.title}"],"text":"Product Catalog · Push API Troubleshooting One section per problem: the exact response, the cause, the fix with a corrected request, and how to confirm it is fixed. Bodies come from real production answers (ids shortened) except where marked as the envelope only. Quote requestId when you ask for help. The full code list is on Errors . Find your problem items.map((item) => ( item.title ( where(item.status) ) )) items.map((item) => ( item.title Where you see it: where(item.status) . item.response !== && ( ) Cause. item.cause Fix. item.fix requests[item.id] !== undefined && Confirm. item.confirm ))"},{"title":"Vendors and keys","route":"/product-catalog/push/vendors","headings":["Vendors and keys","Vendors","What a vendor key can reach","Ownership, ids and clashes","The vendor's push wins","Holds: what the vendor cannot undo","Vendor on orders"],"text":"Product Catalog · Push API Vendors and keys A vendor is a supplier whose products the merchant sells. The merchant creates the vendor and its keys; the vendor never logs in to anything and talks to the catalog only through the API. Vendors The merchant adds a vendor under Storefront › Vendors in the Product Catalog dashboard: a name (creating takes a name only), and a status of active or paused . The webhook URL is set separately, under Storefront › Vendors › webhook. A store holds at most 200 vendors. A vendor cannot be deleted; revoking its keys and archiving its products covers it. Each vendor has at most 2 active keys ( pc_vk_ ), so a key can rotate. A key is shown once when created; only a hash is kept. Revoking or pausing applies on the next request. A paused vendor's keys answer 403 VENDOR_PAUSED before the body is read. Its products stay exactly as they are. What a vendor key can reach A vendor key reads and writes its own products only : products and variants, status (draft or active), handle, archive and restore, stock, prices in the store's currencies, images by public URL, attribute values, translations and categories (a path such as Coffee > Single origin creates missing levels). It also reads its own products, jobs, runs and reports. It cannot touch another vendor's or the merchant's products, set customer-group (trade) prices, create new attribute types, or change collections, filters, price lists, locales, settings, keys, checkout or reviews. Anything outside its reach answers 404 (a resource that is not its own) or 403 VENDOR_KEY_NOT_ALLOWED (a route a vendor key may not call). The store key works on every push route and may act on any product, including assigning a product to a vendor. Ownership, ids and clashes Every product has one owner: a vendor, or none (the merchant). Ownership never changes through a vendor key. externalId is the vendor's own product id, unique per vendor. Two vendors may use the same id for two different products. The store key's own products have a separate id space. A row that creates a vendor's product needs one ( EXTERNAL_ID_REQUIRED ). SKUs stay unique per store. A row whose SKU belongs to another vendor's or the merchant's product fails with SKU_CONFLICT and never takes the SKU over. Adopting existing products. Products already in the catalog (CSV, dashboard) stay merchant-owned until the merchant assigns them to a vendor, one or in bulk. The vendor's first push then links each assigned product by SKU and records its externalId . A push never claims an unassigned product. A new product with no status is created as a draft . Send active to publish it; the vendor decides whether a product shows. Vendor batches are canonical rows . A mapping profile cannot set externalId , so a vendor batch that needs one must not use a profile. A full sync with the store key archives the store's products that its job did not send. A product the merchant has just assigned to a vendor still has the store as its only supplier until the vendor's first push, so that full sync may archive it. Once the vendor supplies the product, a store-key full sync no longer touches it. Assign products after the store's full sync, or let the vendor push first. The vendor's push wins On a vendor-owned product, a field the vendor sends ranks above the merchant's dashboard edit and above every other source. That includes a rename : the vendor's handle replaces the merchant's. A sent null blanks the field. Store-key pushes keep today's precedence: a merchant's dashboard edit still wins over them. Replace mode drops only the caller's own values for fields it did not send, so another source's value (the merchant's) shows instead, and archives only variants the caller supplied. Nothing the merchant added by hand is touched. A replace needs all of a product's rows together, adjacent in one batch (see Merge and replace ). Holds: what the vendor cannot undo If the merchant archives or drafts a vendor product in the dashboard, that is a hold. The vendor's pushes keep updating the product's data, but cannot republish or restore it until the merchant lifts the hold. This lets a merchant stop selling one vendor product without pausing the whole vendor. An archive made through the API is different: it is the vendor's own and is lifted by a restore, or by a row that sends status: "active" (see Products ). The result of a held product is held in an archive or restore answer. Vendor on orders The merchant can switch Vendor on orders on in the dashboard (it is off by default). Then each Throttle order line created from a catalog cart for a vendor-owned product carries the vendor under the reserved metadata.lineResolver key, which merchant order reads and merchant order webhooks return (for drop-ship routing, for example): Only resolver carts record a vendor, the carts the catalog prices through the line resolver . The legacy checkout records no vendor on an order line, and cannot, because it cannot write that reserved key. The vendor is never part of a buyer's view of the cart or order."},{"title":"Webhooks","route":"/product-catalog/push/webhooks","headings":["Webhooks","Set one up","Events","Verify the signature","Retries"],"text":"Product Catalog · Push API Webhooks Instead of polling a job, give the catalog a URL and it tells you when the work is done. One event per finished job or batch, signed, and retried if your server is down. Set one up The merchant sets a webhook URL per vendor, and one for the store key, in the Product Catalog dashboard ( Storefront › Vendors ). Creating an endpoint shows its signing secret ( pc_whsec_… ) once; store it with your other secrets. The URL must be https , with no explicit port, credentials or fragment, no IP literal, no single-label host and no special-use host ( localhost , .local , .internal , .test , .example , .invalid ), and at most 2,048 characters; otherwise it is refused with 422 WEBHOOK_URL_INVALID . Redirects are not followed, and each delivery times out after 3 seconds. Events fire only for sync jobs and vendor single batches . Upload runs and the store key's single batch send none. Events data.runId is the job id for a job. The counts are the same as the progress view and the error report is at …/errors.csv until reportExpiresAt . An event can be delivered more than once: dedupe on its id . The event says the rows are written, not that images are copied. Copies continue afterwards; until a copy lands the storefront serves the vendor's own image URL, so keep those URLs public (see known limits ). Verify the signature Every delivery carries X-Catalog-Signature: t=<seconds>,v1=<hex> , where v1 is the HMAC-SHA256, with your secret, of <t>.<rawBody> . The header can hold up to eight v1 digests (any match passes, so a secret can rotate). Reject a timestamp more than 300 seconds old. Check the raw body text, before any JSON parsing. verifyCatalogWebhook uses WebCrypto only and returns true or false ; it never throws. Answer any 2xx quickly and do the work afterwards. Retries A delivery your server does not accept with a 2xx is tried again. The retry schedule is a list of gaps after the previous attempt , in seconds, not offsets from the first: [ String(index + 1), index === 0 ? None: at once : gap >= 3600 ? $ gap / 3600 h : $ gap / 60 min , String(gap), ]) /> That is GAPS.length attempts over about TOTAL_HOURS hours in all. A receiver that is down longer than that misses the event. The run is still there to poll ( GET /v1/catalog/runs/{runId} or GET /v1/catalog/jobs/{jobId} ), so reconcile from the API after an outage."},{"title":"Product Catalog Quickstart","route":"/product-catalog/quickstart","headings":["Product Catalog Quickstart","1. Install the SDK","2. Create keys","3. Run your first query","From your website","With curl","Next steps"],"text":"Product Catalog Product Catalog Quickstart From nothing to a list of your products in three steps. You need a Throttle application with the Product Catalog extension installed and some products in it. 1. Install the SDK Node.js 20 or later, or any evergreen browser. In TypeScript, moduleResolution must be node16 , nodenext or bundler : the package has only an exports map, which the older node setting cannot read. 2. Create keys Storefront calls use publishable keys ( pc_pk_… ). Create them in the catalog dashboard: Open the Product Catalog extension in your Throttle dashboard and go to Storefront › Keys . For your website, create a key with type Browser and put your site's origin under Allowed websites , one per line, such as https://shop.example.com . Origins are matched exactly and must be https. For Node.js, a server or curl , create a second key with type Server . It has no websites: it refuses any request that comes from a browser. Copy each key when it is shown. Store the server key in an environment variable. A browser key cannot list http://localhost : allowed websites are https only. While you develop, call the catalog from your dev server with the server key, or serve your site over https (for example https://localhost:8443 ) and list that origin. Keys and channels explains the three key types and what each one protects. 3. Run your first query This script lists five products with their lowest price. A script sends no Origin , so it uses the server key. It prints one line per product: its handle, its title and its lowest price in minor units ( 4999 is $49.99). The client talks to https://catalog.usethrottle.dev by default and gives up on a call after 10 seconds. From your website The same call in a page, with the browser key. It works only from an origin on the key's allowed websites. With curl The API is plain HTTP. Send the key in X-Catalog-Key . Use the server key here too: a browser key refuses a request without an allowed Origin ( 403 ORIGIN_NOT_ALLOWED ). Next steps Products, filters and sorting : build a shop page with filters, facets and paging. Cart and checkout : send the shopper to Throttle's checkout. React and Next.js SSR and caching : hooks, a cart and server rendering. Pushing products in : the Catalog Push API puts a merchant's or vendor's products into the catalog; start with the first feed guide."},{"title":"React","route":"/product-catalog/react","headings":["React","CatalogProvider","The read hooks","useTags, useCollections and useReviewEligibility","Keeping previous data","Refresh errors","The cache","initialData: hand over a server answer","useCart","Customer carts","useSubmitReview"],"text":"Product Catalog React @usethrottle/catalog/react wraps the catalog client in a provider and hooks, with a small cache, a session-backed cart and review submission. It works with React 18.2 and 19 (an optional peer dependency), is marked use client , and needs no other library. CatalogProvider createCatalogClient . Required. ], [ code: customerKey , html: The signed-in customer's id, or null . It partitions the cache and the cart by customer. Required whenever customerToken can return a token. , ], [ code: cartStorage , html: Where useCart keeps the cart session id: get, set, remove , each sync or async. The default keeps it in memory only. , ], [ code: cartUrls , html: returnUrl?, cancelUrl?, storefrontUrl? , sent on every cart useCart creates, so each must be an absolute https URL on an allowed return website (otherwise leave them out and pass URLs to checkout(input) ), and used by its checkout() . See return URLs . , ], [ code: throttleBaseUrl , html: Throttle's API, for the cart session. Default https://api.usethrottle.dev . , ], [ code: throttleCheckoutUrl , html: Throttle's hosted pages, for a cart link the hook builds itself. Default https://checkout.usethrottle.dev . , ], ] /> Keep one client per currency and language , memoised on both; on a currency switch run useCart().switchCurrency() first and swap the client once it resolves. Pass customerToken as a function. With @usethrottle/auth 0.10.1 or later that is () => auth.getAccessToken() , read on every request. A new client per customer would start a new cart. Change customerKey in the same update as the token. Reading the customer from useAuth() , as above, does that. A change starts an empty cache, so every mounted hook fetches again and one shopper never sees prices fetched for another. It is required whenever customerToken can return a token: the hook drops the cart on a sign-out or a customer change only by watching it, so without it one customer's cart stays for the next shopper. In the browser, set keyInQuery: true on the client so reads need no preflight; see Keys and channels . useCatalog() answers the provider's client, for a call no hook covers. The read hooks product , or redirectTo for a renamed handle. , ], [ code: useRelated(handle, limit? ) , code: products.related , html: products ], [ code: useFilterValues(key, query?, options?) , code: filters.values , Every value of one filter for a selection. ], [ code: useCategories( depth? ) , code: categories.tree , The category tree. ], [ code: useCollection(handle) , code: collections.get , html: The collection page, or redirectTo . , ], [ code: useSuggest(q, debounceMs?, limit? ) , code: suggest , Suggestions. No request under 2 characters; one per pause in typing (200 ms by default). , ], [ code: useReviews(handle, sort?, rating?, limit?, cursor? ) , code: reviews.list , html: Reviews and their summary, or redirectTo . , ], [ code: useConfig(options?) , code: config , Currencies, locales, sorts, the review settings and the generation. ], ] /> Every read hook (and the three in the extras entry ) answers data, dataFor, error, isLoading, isPreviousData, isStale, isValidating, refetch : data : the answer, typed as the client's call answers it, or undefined . error : the CatalogError of the last attempt, or undefined . A failed refresh keeps the last data . isLoading : no data and no error yet. isValidating : a request for this key is in flight, first load or refresh. refetch() : fetch again now. It never rejects. They take enabled ( false makes no request), initialData and staleTimeMs . A null handle or key makes no request either, which is how one hook waits for another. Each hook also answers dataFor (the query the shown data answers), isPreviousData and isStale , and takes keepPreviousData ; see Keeping previous data and Refresh errors . useTags, useCollections and useReviewEligibility These three hooks (1.2.0 and later) live in @usethrottle/catalog/react/extras , which keeps the /react entry small. They use the provider and the cache of /react : import CatalogProvider from /react and these from /react/extras . tags ], [ code: useCollections( limit?, cursor? ) , code: collections.list , html: collections ], [ code: useReviewEligibility(handle) , code: reviews.eligibility , html: Whether the signed-in shopper may review the product ( canReview ). No request while signed out or while handle is null ; asked again on every mount and kept per customer. , ], ] /> useCustomerKey() , from /react , answers the provider's customerKey . The ReviewEligibility type, the answer of reviews.eligibility , is exported from either entry. Keeping previous data keepPreviousData: true keeps a hook's last settled answer on screen while the next key loads, so a filter change or a typed query does not flash empty. isPreviousData is true while data is the old answer. isLoading stays false meanwhile. dataFor is the params object the shown data answers: for useSuggest the query echo is dataFor.q . While data is undefined (a first load, or a new key without keepPreviousData ) it is the params just asked for, so check data before treating dataFor as its params. If the new key fails, error is set and the old data stays, with isPreviousData still true . isStale is for revalidation failures of the data's own key. Data is never kept across a customerKey change: one customer's answer is not shown to the next. Refresh errors isStale is true while the shown data was not confirmed by the latest attempt: a revalidation failed, or an initialData seed under a customerKey is still being revalidated. A failed revalidation keeps the data and sets error . A success clears both. Retries. The hook retries by itself only when the failure is retryable: a NetworkError , a TimeoutError or a 5xx. The retries come 2 seconds after the failure and again 10 seconds after that, so two retries. Other 4xx answers are not retried, and a 429 keeps its pause with no extra retry"},{"title":"Product reviews","route":"/product-catalog/reviews","headings":["Product reviews","The settings","List reviews: reviews.list","May this shopper review? reviews.eligibility","Submit a review: reviews.submit","Review errors","Show review text safely"],"text":"Product Catalog Product reviews Shoppers signed in with their Throttle customer account can review the products they bought. The storefront lists published reviews and their summary, checks whether the shopper may write one, and submits it. The settings The merchant turns reviews on in the Product Catalog dashboard, on the Reviews screen: pending ) until the merchant approves them. ], [ Ratings on product lists , html: List answers carry rating: average, count , and the best_rated sort and rating filters become available. , ], [ Show imported reviews , Reviews imported from a file are shown and counted. They are never marked verified. ], ] /> The first time reviews are turned on, “Verified buyers only” and “Hold new reviews for approval” come on with it, and the catalog looks through the last 365 days of orders for buyers. A full product carries rating while reviews are on; config() answers reviews: enabled, onLists . List reviews: reviews.list reviews.list(handle, options) answers the product's published reviews, a summary and nextCursor : sort : newest (the default), highest or lowest . rating : 1 to 5, an exact match (4 means four-star reviews, not “4 and up”). limit 1 to 50 (default 10), and cursor for the next page. summary is average, count, histogram : the average rating ( null with no reviews), the number of reviews, and the number per star from 1 to 5. Each review has rating , title , body , displayName , verified (a verified buyer), imported , createdAt and the merchant's reply (or null ). A renamed product answers redirectTo . An unknown product, or reviews turned off, is 404 NOT_FOUND . Review lists are public and cached like the rest of the catalog. In React, useReviews(handle, sort, rating, limit, cursor ) reads them. May this shopper review? reviews.eligibility reviews.eligibility(handle) needs the shopper's customer token (the client's customerToken , see Customer prices ) and answers canReview, reason? . The reasons, checked in this order: Eligibility is a quick check. It does not read the order again, so a purchase refunded since can still answer canReview: true ; the submit then refuses it. Submit a review: reviews.submit reviews.submit(handle, rating, title?, body, displayName ) needs the customer token too. rating is 1 to 5; title is at most 120 characters, body 1 to 5,000 and displayName 1 to 60. It answers 201 review: id, status : A verified email is always required , even with “Verified buyers only” off. With Verified buyers only on, the shopper needs a paid order for the product, and the catalog reads that order from Throttle again before it accepts the review. One review per customer and product. A rejected review keeps the slot; only the merchant deleting it frees it. With Hold new reviews for approval on, the review is pending and appears only once approved; otherwise it is approved and shows at once. Send an idempotencyKey and reuse it when you retry the same submission: a replay answers the first review instead of making a second. useSubmitReview does this for you (see React ). A refused token throws CustomerTokenInvalidError : there is no signed-out fallback for a review. Review errors Retry-After: 900 ; the SDK throws it as RateLimitedError ; it never pauses the React provider's reads. , ], [ code: RATE_LIMITED , 429 , More than 5 submissions a minute from one customer, or 10 accepted reviews an hour from one IP address. Retry-After says when. , ], [ code: REVIEW_VERIFICATION_UNAVAILABLE , 503 , The catalog could not read the order from Throttle to confirm the purchase. Nothing was saved; retry (Retry-After: 10). , ], [ code: EXTENSION_UPGRADE_REQUIRED , 409 , The store has not accepted the Product Catalog extension version that reads customer accounts. , ], [ code: CUSTOMER_TOKEN_INVALID , 401 , No customer token, or one the catalog refuses. ], [ code: NOT_FOUND , 404 , No such product, or reviews are off. ], ] /> Show review text safely A review's title, body, display name and reply are plain text written by a shopper or the merchant, stored as given. The API never turns them into HTML and never cleans them: your storefront must escape them when it renders them. React escapes text in JSX for you; never pass review text to dangerouslySetInnerHTML or innerHTML ."},{"title":"Search and suggestions","route":"/product-catalog/search-and-suggestions","headings":["Search and suggestions","Search results","Suggestions","Search as you type in React"],"text":"Product Catalog Search and suggestions Two calls cover search: products.list with q for a results page, and suggest for the dropdown under a search box. Search results A search results page is a product list with q (up to 200 characters). It matches product titles, brands, product types, Google categories, public attribute values and descriptions, plus SKUs, GTINs and MPNs. With a locale , it also matches the locale's translated titles and descriptions. Everything else on products.list combines with it: filters and facets (with counts for the search), a category or collection, paging and fields. Without a sort , results come by relevance . Any other sort works too. Relevance pages stop at 1,000 products deep: past that the page is empty and page.capped is true . Shoppers rarely go that far; offer filters instead. The answer's applied.q echoes the search. Keep the search in the page URL with the URL helpers ; q is part of the shop query they read and write. Suggestions suggest(q, limit ) ( GET /v1/storefront/suggest ) answers what matches the start of what the shopper typed. q must be 2 to 100 characters; anything else answers 400 INVALID_REQUEST . limit : 6 by default, at most 8 , ], [ code: categories , handle, name and productCount , Up to 5 ], [ code: brands , name and productCount , Up to 5 ], [ code: tags , tag and productCount , Up to 5 ], [ code: collections , handle, title and productCount , Up to 5 ], ] /> Categories, brands, tags and collections match by case-insensitive prefix and come most products first. Every name comes from public products only, so a draft title, a hidden attribute or an archived brand never shows up. Suggestions take the client's currency and locale . They always show list prices: a suggestion request never carries the customer token, so a signed-in shopper's group prices (see Customer prices ) appear on product pages and cards, not here. One request per keystroke pause. Without keyInQuery the answer is cached under the guest partition. With keyInQuery: true (1.2.0 and later), suggest bypasses the SDK's ETag cache and sends no If-None-Match : the request carries only accept plus any client headers you set, so it needs no preflight (a client with custom headers preflights again). See Keys and channels . Link each kind where it belongs: a product to its page, a category or collection to its page, a tag to products.list( tags: [tag] ) , and a brand to a shop page filtered by your brand filter (its key is whatever the merchant named it in Storefront › Filters). Search as you type in React useSuggest(q, debounceMs, limit ) from @usethrottle/catalog/react sends no request while the trimmed text is shorter than 2 characters, and one request per pause in typing: debounceMs , 200 ms by default. Answers are cached in the provider, so typing back to an earlier text shows its suggestions at once. Like every hook, it answers data, dataFor, error, isLoading, isPreviousData, isStale, isValidating, refetch ; with keepPreviousData: true the last suggestions stay while the next ones load, and dataFor.q is the text they answer. Suggestions have their own rate limit for browser, app and legacy keys: 600 requests a minute per visitor, twice the limit of the other routes, so a fast typist is not cut off. The React page covers the provider and the cache."},{"title":"Stock and availability","route":"/product-catalog/stock-and-availability","headings":["Stock and availability","What the API tells you","A quantity the store cannot fill","Reserve stock at checkout","Oversold orders"],"text":"Product Catalog Stock and availability The storefront API never answers a stock quantity. It tells you whether a product or variant can be bought and whether stock is running low, and the cart refuses a quantity it cannot fill. What the API tells you in_stock , out_of_stock , preorder , backorder or null (not set). , ], [ code: lowStock , Products and variants , A tracked variant at or below the store’s low-stock threshold. A product whose stock is all held in checkouts answers false (it is out of stock instead). , ], [ code: purchasable , Full products and variants , Public, priced in the answer’s currency, and available or backorderable. , ], ] /> That is all: no counts, ever. A storefront can show “In stock”, “Only a few left” or “Sold out”, never “3 left”. The one number the API answers is maxQuantity , and only when a requested quantity is refused (below). Stock is counted only for variants that track inventory, and a tracked variant that allows backorders is never refused for stock. A quantity the store cannot fill carts.check , carts.create and every change to a resolved cart judge each line against the stock available right now. A tracked line that wants more than that is refused with QUANTITY_UNAVAILABLE and maxQuantity , the most that can be ordered now (also capped by the variant's maximum order quantity). A line with none on hand is OUT_OF_STOCK . On carts.check the refusal is a line of the answer ( ok: false ). On carts.create it is 422 CART_ITEMS_INVALID , and on a cart session Throttle's 409 quantity_unavailable ; the SDK throws both as CartLineError , whose lines carry maxQuantity . maxQuantity can be 0 while units are still on hand: with reservations on, other shoppers' checkouts can hold the last units (the variant then reads out_of_stock until a hold lapses). Say so (“In other shoppers' checkouts right now”) rather than “Sold out”: a hold that is not paid for lapses within minutes. Reserve stock at checkout Reserve stock at checkout is a per-store setting in the Product Catalog dashboard, under Storefront › Settings › Stock . It is off by default ; with it off, stock is the quantity you import or enter, and nothing below happens. With it on, the catalog keeps its own count: Holds at checkout. When a shopper starts checkout from a catalog cart, the catalog holds the cart's tracked lines for 15 minutes , only if every line fits; otherwise it holds nothing and refuses the lines that do not fit. Starting checkout again replaces the cart's holds. A cart's own holds never count against it. Holds lapse on their own. An unpaid hold simply expires; nothing has to release it. An abandoned cart releases its holds earlier when Throttle reports it. Sales. An order takes its catalog lines off stock and releases its cart's holds. Cancels and returns. A cancelled order puts its lines back, and so does a return once it is received with restocking on. A refund of money alone changes no stock. Counting starts from the quantities you have when you turn it on; earlier orders never move stock. A new quantity from an import or the API becomes the new starting point. Turning it on needs the Product Catalog extension version that reads carts and returns; the dashboard says so if the store has not accepted it yet. Oversold orders The order is the truth. A paid order is never refused or changed because of stock: its sale is always recorded, even when that takes a variant below zero. This can happen because Throttle's checkout session lasts 30 minutes, longer than the 15-minute hold, so a shopper who pays late can buy units another checkout has since taken. The product's Inventory card and the Products list show Oversold by N for a variant that sold N more units than it has. The merchant fixes it by restocking, with “Adjust stock”, or by cancelling an order, which puts its units back. See Cart and checkout for every cart error, and Line resolvers for how Throttle asks the catalog to check stock."},{"title":"Storefront components","route":"/product-catalog/storefront-components","headings":["Storefront components","Start","Install","Two catalog keys: browser and server","Quick start","StorefrontProvider","One cart","What wins when sources disagree","Presets","Styling and the layer order","URL state","SEO","Analytics","Right to left","Keyboard and accessibility","Account page","Shell state","Next"],"text":"Product Catalog Storefront components @usethrottle/storefront-react is a set of React components for a Throttle product catalog: the shop and collection listing, the product page, search, the cart drawer, the account page and the page frame around them. They read their filters, sorts and listing layout from your catalog's storefront settings. The card style and toggles, the badges, the product page options and the catalog wording come from props ( card , badges , product , strings ), from a Throttle Builder, or from the package defaults. The catalog's /config no longer feeds those four. Start A new Next.js store: run npx @usethrottle/create-store my-store . See create-store . An existing app: install the package, wrap the app in StorefrontProvider and render a component. See below. Next.js specifics: route helpers, caching and the hosting-cost rules are on Next.js and caching . Read the cost section before you deploy. Install The package needs @usethrottle/catalog ^1.4.1 , @usethrottle/money ^1.1.0 , and React 18 or newer. Next.js >=15 , @usethrottle/scripts and @usethrottle/auth are optional peers (auth is read only by the ./account entry). Your app and the package must resolve one copy of @usethrottle/catalog and of react ; two copies are two React contexts, and each reads a different cart. Check with pnpm why @usethrottle/catalog . StorefrontNextProvider , the provider wired to Next's router and links. ], [ code: @usethrottle/storefront-react/account , html: AccountPage and StoreShellProvider . Needs @usethrottle/auth . ], [ code: @usethrottle/storefront-react/styles.css , The same stylesheet as a file, for a cached, flash-free server render (with injectStyles false). ], ] /> Two catalog keys: browser and server A catalog has two kinds of key, and a store uses both. They are not interchangeable. 403 ORIGIN_NOT_ALLOWED ). It also works for local development. , ], ] /> A NEXT_PUBLIC_ variable is written into the JavaScript your visitors download. The catalog refuses a server key on a browser request ( 403 SERVER_KEY_IN_BROWSER ), but the key is still exposed. Keep it in a plain variable on your host, and never use a secret ( pc_sk_ ) key in a storefront. See Keys and channels . Quick start A client-only app (Vite, for example) needs a provider and a component. The provider reads your catalog's settings in the browser, and the history router is its default. For Next.js, give the provider the settings the server already loaded ( loadSettings ) so the first paint needs no request, and use StorefrontNextProvider . The route files are three lines each; see Next.js and caching . StorefrontProvider One provider holds everything the components share: the catalog client and its settings, the resolved site design (theme, brand, menus), the router, the link component, analytics, the cart drawer and your text overrides. client . ], [ code: client , A ready catalog client (a server-built one, or a fixture in tests). ], [ code: settings , html: The settings answered on the server ( loadSettings ). The first render uses them with no request. ], [ code: preset, theme, scheme , html: The look. See Theming . ], [ code: locale, currency, dir , html: Language and currency for the reads. dir defaults from the locale (right to left for Arabic, Hebrew and the like). ], [ code: appearance , html: parts (class names per part), variables and darkVariables (token overrides, the last word). ], [ code: localization , Text overrides for any string, in any language. ], [ code: card, badges, product, strings , html: Site-wide display options: the card (style, rating, swatches, brand, compare-at, badges, second image, quick add), the badges (sale, new, low stock, custom), the product page (layout, sections, related) and the catalog wording by key. Each is a partial group, filled field by field. A component's own prop beats these, and a Throttle Builder's value beats both. Site keys such as footer.copyright still come from /config ; catalog keys do not, so pass strings or localization for locale-specific wording. ], [ code: builderOverrides , The non-null display values a Throttle Builder set (same shape as the four props above). Set by the Builder renderer; a null value defers to the props. ], [ code: analytics , html: Where GA4-shaped events go. See Analytics . ], [ code: router, linkComponent , html: How the URL is read and links are drawn. StorefrontNextProvider sets both. ], [ code: customerKey, customerCart, cartStorage, cartUrls , html: Cart wiring. See One cart . ], [ code: generationWatch , html: The open tab's check for a catalog change. Default on, every 60 s at the least; false turns it off. ], [ code: injectStyles , html: Default true: the provider renders the stylesheet in its own markup, so it is in the HTML the server sends and the first paint is styled (the client adopts it, no second copy). Set false and import styles.css yourself to ship it as a cached file instead. ], [ code: imageOrigin , html: Where catalog media is requested. Every image URL whose path starts with /media/ (cards and the gallery) is requested at <imageOrigin>/media/... ; '' is your own origin, so a rewrite of /media/:path* to the catalog saves the phone a second connection. Default: the catalog's URLs. ], ] /> One cart StorefrontProvider creates the one CatalogProvider of your app. The add-to-cart buttons, the cart button and the drawer read the same cart as your own useCart() from @usethrottle/catalog/react . Hand the cart wiring to the storefront provider and it forwards it unchanged: cartStorage : where the cart session id is kept ( get , set , remove ). The default is memory only, so a reload starts a new cart. customerKey and customerCart : whose cart this is, and resuming a signed-in customer's cart on any device. cartUrls : returnUrl , cancelUrl and storefrontUrl , sent on every cart and used by checkout() . Each is an absolute https URL on an allowed return web"},{"title":"Components","route":"/product-catalog/storefront-components/components","headings":["Components","Money is always formatted for you","Pieces","Shop","Product page","Volume pricing","Frame","Merchandising","Shopper tools","Pages","Slots","Hooks and helpers"],"text":"Product Catalog / Storefront components Components Every public export has a JSDoc comment, so your editor shows what each prop does on hover; this page is the map of what exists. All of them take classNames (class names per part key ), className (the root) and unstyled , and read their defaults from your catalog settings (a prop wins over the setting, the setting over the package default). The card, badge, product page and wording options are the exception: they no longer come from the catalog's /config . ProductCard ( card , badges , strings ), ProductGrid , ShopAll , ProductCarousel , RecentlyViewed and ProductPage (all four, with product ) take them as props; the order is a Throttle Builder's value, then the component's prop, then StorefrontProvider 's, then the package default. Where a component has a single-purpose prop for the same option ( variant or quickAdd on a card, layout or sectionsStyle on a product page), that prop wins over the group prop ( card.style , product.layout ). The server loaders take the same values as an optional display input so the server's requests match the client's. Money is always formatted for you Components show every amount with formatMoney from @usethrottle/money , in the record's own currency. A slot that draws a price receives minor (the amount in the currency's minor units) and currency , never a pre-formatted string, and must call formatMoney(minor, currency) . Do not divide by 100, call toFixed(2) , use Intl currency styles, hard-code a symbol or default to USD. Catalog answers also carry ready-made display strings where a read gives them. Pieces product , generatedAt (required, ISO: the new badge ages against it, never the browser clock), variant (standard, minimal, overlay, row), meta (brand or category), position , listName , slots , onSelect ], [ code: Price , One price with its labels. , html: minor , currency , compareAtMinor , priceContext (anonymous, customer, email_unverified, anonymous_fallback) ], [ code: Money , An amount drawn by formatMoney. , html: minor , currency , compareAtMinor ], [ code: StarRating , A rating as five stars, one image to a screen reader. , html: value , count , size ], [ code: Badge, Swatch , A label; a colour or texture dot. , html: kind , tone ; value , hex , image , selected , disabled ], [ code: Image , A picture that reserves its space. , html: src , alt , aspectRatio (required), sizes , srcSet , priority , eager ], [ code: RichText , Catalog HTML through an allow-list: no script, style, event handler or javascript: URL. , code: html ], [ code: Link , A link through the store link component (a plain anchor, or next/link). , html: href , prefetch , any anchor attribute ], ] /> Reserved for a later release, rendering nothing today so a slot can already name them: WishlistButton , BackInStock , FrequentlyBoughtTogether , ReviewPhotos , ReviewVotes , QuestionsAndAnswers . Shop ShopAll is the listing page for the shop, a collection, a category, a tag or a search: heading, controls, filters, grid and pagination, laid out by your settings. Give it initialData from loadShopAll and it renders at once and fetches nothing until the shopper changes the selection. With children it is ShopAll.Root around them, so you lay the pieces out. { kind: 'all' } , or collection , category , tag with a handle , or search . ], [ code: initialData , The server answer (loadShopAll). No request on mount. ], [ code: filterLayout , sidebar, topbar or drawer. The markup carries the sidebar and the Filters button; CSS shows the right one by width, so the server paint is already right. ], [ code: pagination , numbered, load_more or infinite. ], [ code: columns , html: { desktop, mobile } ], [ code: priorityCount , How many cards, from the first, load their picture at once. The first is the page's largest paint (high priority, preloaded in the HTML), the rest of the row load at once at low priority, so they do not compete with it, later cards are lazy. Default: the desktop row size; 0 leaves all lazy. ], [ code: cardVariant, cardMeta , How the cards are drawn; the line above each title (brand or category). ], [ code: card, badges, product, strings , Display options for this list (partial groups). They beat the provider\\ s and lose to a Throttle Builder\\ s value. The card toggles and badges reach every card in it. ], [ code: baseUrl, jsonLd , Absolute URLs for the JSON-LD; turn the JSON-LD off if you render it yourself. ], [ code: view , grid (default) or list. list draws one card per row, through data-view= list on each product grid. ], ] /> ShopAllContext and ListingTemplateShell are for Builder listing templates: read the state with useShopAll() in your own code. The pieces on ShopAll : Root , Heading , Breadcrumbs , FilterSidebar , FilterBar , FilterDrawer , ActiveFilters , SortSelect , ResultCount , ProductGrid , Pagination , SlotAbove , SlotBelow . FacetGroup draws one filter (checkboxes, colour swatches, a dropdown, a yes or no choice, or a numeric range; values OR within a filter and AND across filters). useShopAll() answers the state and actions (see Recipes ). Product page ProductPage is the whole page: breadcrumbs, the gallery and buy box in the layout ( classic , stacked or editorial ), the sections (tabs, accordions or a stack), related products, reviews and the sticky add bar. Give it initialData from loadProduct . With children it is ProductPage.Root ; the pieces are JsonLd , Breadcrumbs , SlotAbove , Gallery , BuyBox , VariantPicker , Price , StockStatus , QuantityInput , AddToCart , StickyAddToCart , ProductSections , ShippingSection , TagList , CategoryList , RelatedProducts , Reviews , ReviewForm , SlotBelow . useProductPage() answers the product, the chosen variant and options, stock, the quantity and add() . In a Server Component, use the named exports ProductPageRoot , ProductJsonLd and the other pieces (such as StickyAddToCart ) instead of Pro"},{"title":"create-store","route":"/product-catalog/storefront-components/create-store","headings":["create-store","Usage","The two key prompts","Options","What you get","--builder-mode build"],"text":"Product Catalog / Storefront components create-store @usethrottle/create-store writes a complete Next.js store on @usethrottle/storefront-react : the shop, collections, categories, tags, product, search and account pages, the cart drawer, and the cache-safe webhook and sync routes. Usage pnpm create @usethrottle/store my-store does the same. The folder must be empty or missing (default my-store ). The command asks for your keys, writes .env.local , and installs dependencies with the package manager that ran it. The two key prompts A catalog has a browser key and a server key , and a store needs both (see the two catalog keys ). The command asks for them in this order: "Catalog publishable key (pc_pk_...)" : the browser key. It goes to NEXT_PUBLIC_THROTTLE_CATALOG_KEY . "Catalog server key, for your store's server (pc_pk_..., press enter to skip)" : the server key. It goes to THROTTLE_CATALOG_SERVER_KEY . You can skip it, and the command warns that your server cannot read with only a browser key; add it to .env.local before you run the store. Both start with pc_pk_ , so the command asks the catalog which is which (a read with and without a website origin) and never trusts the order you typed them in. If you give a server key first, it asks for the browser key next. If you give them the wrong way round with flags and the catalog confirms it, it swaps them. If the catalog cannot place a key (offline, or no answer), it asks for both and takes the roles on your word, with a note. The one rule the command enforces last, whatever path it took: a key the catalog says is a server key is never placed in NEXT_PUBLIC_THROTTLE_CATALOG_KEY , because that variable is published to every visitor. A secret key ( pc_sk_ ) is refused outright; a storefront never uses one. Options , The catalog browser key. A server key given here is detected. ], [ code: --server-key , The catalog server key, for reads made by your store server. Asked for after the browser key when missing. ], [ code: --yes, -y , Ask nothing. Needs --catalog-key. A server key given alone needs the browser key too, and keys the catalog cannot tell apart need both flags. ], [ code: --builder-mode , html: Default live (nothing added). build adds a Throttle Builder site generated at build time from a frozen release, with no Builder reads while the store runs. See Builder delivery modes . ], [ code: --pm , The package manager (default: the one running the command). ], [ code: --skip-install , Write the files and stop before installing. ], [ code: --offline , Do not call the catalog to tell the keys apart. Then pass both --catalog-key and --server-key. ], ] /> What you get The store renders its pages per request from catalog data kept until the catalog changes, so it writes no ISR. Its README.md lists the cost rules; the reasons are on Keeping ISR costs down . Set THROTTLE_WEBHOOK_SECRET and point the catalog's storefront.changed webhook at /api/throttle/revalidate before you go live. --builder-mode build The store gains app/(store)/[[...path]]/page.tsx (the one route, made by createBuilderRoute , with every page of the release in generateStaticParams and dynamicParams = false ; / is the Builder home, with the shop there until you publish one, so the store has no app/page.tsx ), app/not-found.tsx (the Builder not-found template), app/robots.txt/route.ts , app/sitemap.ts , lib/builder.ts (the build client), lib/packs.ts , and a layout, provider and next.config.ts that read the site from the release. Set THROTTLE_BUILDER_KEY (the build key, server and build only) and THROTTLE_MEDIA_ORIGIN ; BUILDER_RELEASE_ID builds an older release. The build reads the release once into .builder/release.json and the running store never calls the Builder. Its README says one full build per release, zero Builder-driven ISR writes. Without the option the store is exactly as before."},{"title":"Next.js and caching","route":"/product-catalog/storefront-components/nextjs","headings":["Next.js and caching","Setup","Route helpers","Keeping ISR costs down","1. The cache policy: kept until the catalog changes","2. Search is no-store and dynamic","3. One coarse tag, cleared at most once a minute","4. The signed revalidate handler and the sync handler","5. staticParams defaults to 0","6. primaryCache: 'no-store' and its trade-offs","7. Deploys, preview and the layout","8. Bots and deep pagination","Checklist"],"text":"Product Catalog / Storefront components Next.js and caching The /next entry gives a Next.js App Router store one helper per route, a provider wired to Next's router, and the two handlers that clear the cache when your catalog changes. The defaults are set so a store does not write to the ISR cache on every change, every visit or every deploy. Read Keeping ISR costs down before you go live. Setup Next.js 15 or newer. Both keys are needed: the server reads with the server key, the browser with the browser key (see the overview ). In app/providers.tsx use StorefrontNextProvider from /next/client . It is StorefrontProvider with Next's useRouter , usePathname and useSearchParams and next/link , and with the open-tab check wired to the sync route ( syncPath , below). Pass settings from loadSettings in the layout so the first paint needs no request, and import @usethrottle/storefront-react/styles.css in the layout, before your own CSS, with injectStyles={false} : the sheet then ships as a cached file, with the layer order first, instead of inside every page's HTML. To serve images from your own origin, add a /media/:path* rewrite to the catalog and pass imageOrigin="" . Route helpers searchParams , so it renders per request. A missing handle is a 404, a renamed one a 308. ], [ code: createProductPage( ...store, staticParams ) , A product, by handle. , html: staticParams defaults to 0. See the cost section. ], [ code: createSearchPage(store) , Search results, query in ?q=. , Dynamic, never cached, noindex. ], [ code: createAccountPage(store) , The account page (needs @usethrottle/auth). , Never indexed. ], ] /> Each helper returns { Page, generateMetadata } (and generateStaticParams for products), built on loadShopAll , loadProduct , loadSearch and the metadata builders from /server . Use those directly if you want your own page around the components. Shared options: getPreviewToken ). It reads cookies, so the route renders per request: preview deployments only. ], [ code: site , A function returning the site design, for the title template and the share image (a Builder store passes its own). ], [ code: primaryCache , html: 'default' or 'no-store' . See the cost section. ], ] /> Keeping ISR costs down On Vercel every page regenerated into the ISR cache, and every cached read written to the data cache, is a billed write. A store that regenerates often, or writes a page per URL a crawler tries, pays for each one. A deploy also starts with an empty cache, so every prerendered page is written again. The defaults below are chosen so a store pays close to nothing for caching. Each rule says what to keep and what it costs to break it. 1. The cache policy: kept until the catalog changes createStorefrontServerClient reads on STOREFRONT_CACHE_POLICY : every kind of read (settings, navigation, pages, product, listings, facets, related, reviews) is 'until-changed' . A read is kept, with the catalog SDK's one-hour safety limit as the longest it can go without a check, and cleared sooner when the catalog changes. Nothing revalidates in under one hour. Next regenerates a page on its lowest revalidate time, so one short time on one read would regenerate every shop, collection and product page, per filter, sort and page, that often. Override one kind with cachePolicy: { listings: '120m' } if you must. Keep any override at an hour or more. Never set revalidate under 3600 on a route, in next: { revalidate } on a fetch, or in route segment config. A request with a customer token, a cart or a preview token is never cached, whatever the policy says. 2. Search is no-store and dynamic STOREFRONT_CACHE_POLICY.search is 'no-store' , and loadSearch (and any listing carrying a q ) reads with cache: 'no-store' . Every query is a new URL; caching them is what makes a hosting bill grow. createSearchPage reads searchParams , so Next renders it per request. If you write your own search route, read searchParams or export dynamic = 'force-dynamic' . 3. One coarse tag, cleared at most once a minute Every read carries a single tag, throttle-catalog ( CATALOG_TAG ). A change clears that tag, not one tag per product or per route, and the clearing is coalesced: at most once a minute per server instance ( REVALIDATE_WINDOW_MS , a floor you cannot lower), however many notices arrive. A burst of merchant edits is one regeneration, not one per product. A change that arrives inside the window is left pending and applied by the first call after it; there is no timer, because Next applies a tag clearing when the request that called it ends. With several instances each has its own window. Never use revalidatePath . It regenerates a named page whatever changed, and a loop over paths is a write per path. The package never calls it, and a store should not either. 4. The signed revalidate handler and the sync handler Two route files, both short: storefront.changed webhook. The primary path. , html: Checks the signature first: an unsigned or wrongly signed request is a 401 and clears nothing. A verified notice clears the one tag, at most once a minute. A test event clears nothing. secret accepts a list, for rotating it. , ], [ code: createGenerationSyncHandler( client ) , html: An open tab that saw the catalog's generation move (the provider's generationWatch ), before it refreshes. , html: Reads the live generation (at most once per minIntervalMs , default 5 s), and only if it differs from the one the cache holds clears the tag, at most once a minute. Answers 200 { changed, throttled? } , or 502 { changed: false } when the catalog cannot be read. A change found inside the window carries retryAfterMs ; the tab asks again then. It needs no auth because it cannot empty the cache unless the generation really moved. , ], ] /> Set the webhook up. Add THROTTLE_WEBHOOK_SECRET and point t"},{"title":"Recipes","route":"/product-catalog/storefront-components/recipes","headings":["Recipes","Restyle with Tailwind","Swap the Price slot","Rearrange ShopAll sections","Headless filters with useShopAll","Add GA4","A Vite (client-only) store","Add an account page","Pick a preset in code","A collection shelf and a product carousel","Arrange the product page","Keep an open tab fresh without webhooks","Widget packs for the Throttle Builder"],"text":"Product Catalog / Storefront components Recipes Each recipe is a real file that is typechecked against the package, so the code you copy is the code that compiled. Every amount a recipe draws goes through formatMoney or a component that uses it; none divides by 100 or writes a currency symbol. Restyle with Tailwind Pass utility classes per part key in classNames . They are added after the package's classes and win because the package's CSS lives in @layer throttle , below Tailwind's components and utilities layers. The one requirement is the layer order, declared first in your CSS. Part keys are listed in STOREFRONT_PART_KEYS , and every element shows its own in data-throttle-part in the browser inspector. Swap the Price slot A slot gets the props its default takes. The price slot gets minor , currency , compareAtMinor and priceContext ; draw them with formatMoney(minor, currency) . Rearrange ShopAll sections Give ShopAll.Root children and place the pieces yourself. Put filters in the top bar or a drawer with filterLayout , and choose pagination and columns ; each defaults to your catalog's setting. Headless filters with useShopAll useShopAll() answers the facets, the selection ( query ) and the actions ( toggleValue , setValues , setRange , setSort , setPage , clear ). The selection is the URL, so your markup stays shareable and the back button works. Wrap in <Unstyled> to drop the package's classes for what you draw. Add GA4 Pass gaAnalytics() as analytics . Your page loads gtag.js or Google Tag Manager; the storefront pushes the ecommerce events ( view_item_list , select_item , view_item , add_to_cart , remove_from_cart , view_cart , begin_checkout ). To send them through Throttle's own scripts instead, use throttleScriptsAnalytics(scripts) with @usethrottle/scripts . To send your own events, useTrack() . A Vite (client-only) store No server is needed: the provider reads the catalog's settings in the browser with a browser key, and its history router is the default. Add your site's origin to the key's allowed websites. Persist the cart session with cartStorage , or a reload starts a new cart. Add an account page Install @usethrottle/auth , add the account publishable key to your catalog's brand settings, and render AccountPage . In Next.js, createAccountPage(store) does it in three lines. Pick a preset in code Without a Throttle Builder your props decide the theme; with one, the Builder does and a development warning names the prop it shadowed. appearance.variables always has the last word. See Theming . A collection shelf and a product carousel Both read their products in the browser unless you give them initialData from loadMerchProducts , which lets a server component send the first render with the products already in it. Arrange the product page Keep an open tab fresh without webhooks The signed webhook is the primary way a change reaches your store. If you cannot set it up, the open-tab check still works: the provider's generationWatch (every 60 s at the least) sees the catalog's generation move and POSTs to syncPath before it refreshes the page, and createGenerationSyncHandler clears the cache only when the generation really moved, at most once a minute. A visitor with a tab open sees a change within about a minute; a store with no open tabs updates through the one-hour safety limit. Do not lower generationWatch below 60 s, and do not clear the cache with revalidatePath or a short revalidate : those are the settings that turn a catalog edit into hundreds of ISR writes. The reasons and the checklist are on Keeping ISR costs down . Widget packs for the Throttle Builder @usethrottle/storefront-react/builder exports catalogPack() and commercePack() for @usethrottle/builder-react . They wrap the components on this page (the product grid, collection shelf, featured product, product carousel, category list, reviews list, search box, language and currency switches, cart button, account button) as Builder widgets, and add the data sources that feed them. The entry needs @usethrottle/builder-react and @usethrottle/builder-schema (both optional peers of this package); the core package never imports them. To use a page s or menu item s Show when rules (signed in, cart, buyer groups), give <BuilderProvider> a viewer . useStoreViewer() builds it from the buyer session; it runs in the browser only. Upgrade @usethrottle/builder-react and @usethrottle/builder together: a store on an older renderer has group-rule content hidden by the Builder until it upgrades. See Storefront auth and Layout . Data sources. catalog.products , catalog.product , catalog.collection , catalog.categories and catalog.reviews resolve on the server; context.product and context.listing are what a slot hands over (the product page s product, the listing page s listing), not a read; catalog.cart and throttle.customer are per shopper and resolve in the browser only. A page makes one lookup request for all the catalog ids it stores (so a renamed collection still renders) and one list request per widget, never one per product. Money. A money field is amount, currency, display , with amount in minor units and display from formatMoney . A template prints only display or currency . Slots. product.above and product.below know product ; shop.above and shop.below know listing . Manifest. @usethrottle/storefront-react/builder-pack.json is the data-only part of both packs (widget definitions, data sources, slot points), generated at build time. The Builder s server validates documents with it and never imports React. Cost. The packs read through the catalog client s until-changed policy (an hour at most, cleared by the catalog s cache tags). They never call revalidatePath and never revalidate on a shorter time."},{"title":"Theming","route":"/product-catalog/storefront-components/theming","headings":["Theming","Two kinds of setting","Site design precedence","Presets","Tokens, dark mode and appearance","Text and languages","Slot outlets"],"text":"Product Catalog / Storefront components Theming A storefront's look comes from several places that can disagree: a Throttle Builder, your own props, your catalog settings and the package's presets. This page says which one wins, field by field, and how to override the result. Two kinds of setting Catalog display is how the shop works: the listing, the card, the badges, stock text, the product page and its sections, filters, sorts, routes and catalog strings. It is read from your catalog settings. A prop on a component wins over the setting, and the setting over the package default. Site design is how the site looks and speaks: the theme, the brand (store name, logo), the menus, the announcement, SEO defaults, the site strings ( footer.copyright , nav.menu , nav.account ), the page route and the account key. It is resolved from the sources below. Site design precedence The provider resolves the site design once, in resolveSiteDesign (also exported from /server ). preset , theme and scheme props. 3. The preset's defaults ( clean and auto ). , ], [ Every other site field: brand, menus, announcement, SEO defaults, site strings, page route , html: 1. The Builder (or the site prop). 2. The package defaults. Decided field by field. The catalog no longer supplies any of these. , ], [ The account publishable key , html: The throttlePublishableKey prop, then the Builder's connections, then none. ], [ Token overrides , html: appearance.variables and appearance.darkVariables , applied last, always. They beat every row above. ], ] /> A null from a source is a value (it clears the field); undefined falls through to the next source. With no Builder, the tokens are the preset's, then your theme prop, merged deeply. With a Builder, its values go on top. A Builder whose theme is not customized contributes only its preset and colour scheme. When a Builder's theme shadows a preset , theme or scheme prop, one development warning names the prop. Remove the prop or change it in the Builder. The Product Catalog no longer holds site design (brand, theme, menus, home page, announcement, SEO defaults, site wording) or content pages, and catalogSiteDesign is removed. Manage them in the Throttle Builder, or provide your own site design with the site prop, or set the theme in code. The catalog keeps how catalog pages display: product cards, badges and the product page. Presets Preset tokens (colours for light and dark, fonts, radius, spacing scale) are plain data in @usethrottle/ui/presets ( PRESET_NAMES , PRESET_TOKENS ). That entry has no React and no directive, so it is safe in a server component, and the Throttle Builder reads the same data. The storefront root carries data-throttle-preset="<name>" ; each package keeps its own per-preset CSS for its own components, keyed by that attribute (storefront CSS never reads the tokens from anywhere else). Tokens, dark mode and appearance scheme is light , dark or auto (the visitor's system setting). With auto , the dark palette moves into a scoped rule so it beats the stylesheet's own dark rule. theme overrides preset tokens ( radius , spacingScale , fonts , and the light and dark palettes). appearance.variables (and darkVariables , used in dark and in auto ) set the CSS custom properties directly: colorPrimary , colorBackground , borderRadius , fontFamily and so on. This is the developer's token layer and always has the last word. appearance.parts adds class names per part key, the same as classNames on a component but for the whole tree. A Throttle Builder site can set the same map in Theme, Advanced, Package part classes ( partClasses ); it is laid under appearance.parts , so the prop wins for a key both set. Values that carry { , } , ; , url( or @import are dropped from generated CSS, because the CSS can be built from data a site owner typed. Text and languages Every string resolves in this order, first match wins: the Builder's strings; your localization prop; for a catalog string, the catalog settings' strings ; the package's English ( SF_STRINGS_EN , or the SDK's defaults for catalog strings). localization is a nested object, for example { cart: { title: 'Basket' } } , so any language is a data change. Strings take {name} placeholders. Set locale (and dir when the locale is not enough) on the provider; prices and dates follow it. Slot outlets A SlotOutlet is a place where a host may add content: product.above , product.below , shop.above and shop.below . The storefront core never imports the Throttle Builder; it talks to one through two hooks in @usethrottle/ui : useSiteDesign() (the site design a host provides) and useSlotOutlet(name) (the renderer a host registered for a slot). A product outlet's renderer receives { context } with the product and the chosen variant SKU; a listing outlet's receives the source, the total, the filters, the sort and the page. With no host, or no renderer for a name, the outlet renders nothing, not even its wrapper, so a store without a Builder is unchanged. SiteDesignProvider and SlotOutletProvider from @usethrottle/ui let a host (or a test) provide them without the Builder package. For the components that take a replacement directly, see Slots ."}]}
|
|
1
|
+
{"generatedAt":"2026-12-06T11:51:20.117Z","entries":[{"title":"Docs","route":"/","headings":["Docs","Product docs","{c.title}","Developer docs"],"text":"Documentation Docs Look up how one thing works. Product docs explain what a feature does and where its edges are; developer docs are the API contract. New to Throttle? What Throttle stores → Integrating? Developer quickstart → Doing a job end to end? Guides by role → Product docs totalProduct pages on how each feature behaves — for operators, finance, and admins. productCards.map((c) => ( c.title c.blurb c.links.map((l) => l.label ) )) Developer docs The API, SDKs, webhooks, and extension platform. Building something new? Start with the developer overview . developerCards.map((c) => ( c.title c.blurb && c.blurb c.links.map((l) => ( l.label isExternal(l.href) && ↗ )) c.more && c.more.label )) Looking for what Throttle connects to? See integrations . For what each part of the product does, see features . .hub max-width: 1180px; margin: 0 auto; padding: 48px 24px 96px; .hub-head margin-bottom: 56px; .hub h1 font-size: clamp(34px, 4vw, 48px); line-height: 1.1; letter-spacing: -0.03em; margin: 8px 0 16px; .hub-lead font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 62ch; margin: 0 0 28px; .hub-start display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; .hub-start a display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); text-decoration: none; .hub-start a:hover border-color: var(--teal); .hub-start strong font-size: 15px; color: var(--ink); .hub-start span font-size: 14px; color: var(--teal); font-weight: 600; .hub-band margin-bottom: 64px; .hub-band-head display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 22px; .hub-band-head h2 font-size: 24px; letter-spacing: -0.02em; margin: 0; .hub-band-head p font-size: 15px; color: var(--muted); margin: 0; .hub-band-head a color: var(--teal); .hub-grid display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; .hub-card padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); .hub-card h3 font-size: 17px; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--ink); .hub-card > p font-size: 14px; line-height: 1.5; color: var(--muted); margin: 0 0 14px; .hub-card ul list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; .hub-card li a font-size: 14.5px; color: var(--ink); text-decoration: none; .hub-card li a:hover color: var(--teal); .hub-more display: inline-block; margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--teal); text-decoration: none; .hub-foot font-size: 15px; color: var(--muted); .hub-foot a color: var(--teal); @media (max-width: 960px) .hub-grid grid-template-columns: repeat(2, minmax(0, 1fr)); @media (max-width: 640px) .hub padding: 40px 16px 80px; .hub-grid, .hub-start grid-template-columns: 1fr;"},{"title":"Throttle Builder","route":"/builder","headings":["Throttle Builder","Where things live","How a page is built","The guide","{page.label}","Show when: control who sees a section","How the rules combine","Examples","For developers"],"text":"Throttle Builder Throttle Builder Throttle Builder is where you build your store's website without code: the home page, shop and product templates, content pages, cart and account pages, the header and footer, menus and the announcement bar. You can build in the visual editor, or connect an AI agent such as Claude, Cursor or VS Code and let it build for you within the access you give it. Your products, cart and checkout stay in Throttle. Where things live Throttle Builder opens from your installed extensions in the Throttle dashboard. Its left menu has three groups: How a page is built A page is a stack of sections . A section has one to six columns , and a column holds components : headings, images, buttons, product grids, forms and more ( builderData.components.length are built in). A column can also hold an inner section with its own columns. A section can turn its columns into tabs, an accordion, a carousel or a show-and-hide toggle. Every setting can differ on desktop, tablet and phone. Everything you change is a draft until you publish . Every change is kept in history, so you can undo it or restore an older version. The guide pages.map((page) => ( page.label page.description Open guide )) Show when: control who sees a section Show when lets a section, inner section or component appear only for some shoppers. Select it in the editor (a column has no Show when in the editor; an AI agent can set one), open the Advanced tab and find Show when . At the top, one line tells you in plain words what the rule does right now, for example Shown only to signed-in shoppers when the cart has items . With no rule it says Always shown . The line updates as you change the controls. How the rules combine Every control you set must be true at the same time (an AND , never an OR ). A control left on its default, such as Everyone or Any cart, is ignored. Picking groups always means signed-in shoppers. Devices work with no script, so the section is in the page for every device and the browser's screen width decides (the same breakpoints as the per-device Hide setting). Dates are decided in the shopper's browser after the page loads, so a page is never rebuilt when a date passes: the content of a section with dates is not in the server HTML (search engines and visitors without JavaScript never see it), it is an empty placeholder until the browser knows the time, an expired window collapses its placeholder, an open tab flips at the date, and a shopper whose device clock is wrong sees it at the wrong time. Menu items take both: a menu item limited to some devices is hidden by CSS on the others, in the header, the drawer and the mega menu alike. Examples A welcome banner for new visitors. Who sees it: Signed-out shoppers. Summary: Shown only to signed-out shoppers . A free-shipping nudge in the cart. The cart: Cart has items. Summary: Shown only when the cart has items . A members-only message. Only these groups: Wholesale, and The cart: Cart has items. Summary: Shown only to signed-in shoppers in the group Wholesale when the cart has items . Use it for messages, not for member prices. A phone-only banner. Devices: Phone. Summary: Shown only on phones . A Black Friday strip. Dates from 2026-11-27 00:00 until 2026-12-01 00:00, time zone Europe/Istanbul. Summary: Shown from 27 Nov 00:00 to 1 Dec 00:00 (Europe/Istanbul) . A countdown for tablets and desktops. Devices: Tablet and Desktop, Dates: until 5 Dec 18:00. Summary: Shown on tablets and desktops, until 5 Dec 18:00 . It only hides things on the store page. The content is still in the page's source, so never use it for anything private. The full details, including older renderers and AI agent use, are in Layout . Menu items take the same rule; see Header and footer . For developers If you build the store's code, start with Developers and the Builder developer reference ."},{"title":"Connect and AI agents","route":"/builder/ai-agents","headings":["Connect and AI agents","The Keys and AI agents screen","The address","Key kinds","Publishable key channels","Limits","Access levels","Set up your tool","Claude: claude.ai or the desktop app (sign in, no key)","Claude Code (uses a key)","Cursor (uses a key)","VS Code (GitHub Copilot, uses a key)","Let it see your store","Revoking","Next"],"text":"Throttle Builder Connect and AI agents An AI agent can build and edit your store with the Builder: it reads your site, edits drafts, checks its work in a preview and, if you allow it, publishes. You give it one address and either a key or a sign-in, and you choose what it may do. It can never change your catalog data. The Keys and AI agents screen In the Builder dashboard, open Keys and AI agents . From top to bottom it has: Connect an AI agent : choose your tool, then paste the address and a key into it (step by step below). Let it see your store : how to give the agent a browser so it can look at its own work. Test the connection : paste a key to see that it works and which tools your agent gets. It is checked once and not kept. Keys : your keys, each with its name, last four characters, level and when it was last used, and a Revoke button. Hosted assistants : assistants such as claude.ai that signed in instead of using a key. Troubleshooting : the common problems with their fixes ( copied on the Troubleshooting page ). The address Every assistant connects to the same address. Your key or your sign-in decides which store it works on. Key kinds Choose Create key , give the key a name after the tool or place that will use it, then say what it is for. A key is shown once, when you create it. Copy it then. It cannot be read back later. Publishable key channels Limits Up to 2 active secret keys and 20 active publishable keys . Revoke one to free a place. Keys do not expire. A key cannot be changed or read back: to rotate one, create a new key and revoke the old one. Each key or assistant may make 120 tool calls and 60 writes a minute ( rate limits ). Access levels Each secret key and each signed-in assistant has a level. You can change it at any time, and it applies on the very next call. Code permission. Code can read and change anything on your store pages. There is no separate code switch for a key: a key or assistant at Draft or above may write custom code components. They reach your store only when someone with Publish access publishes the page. See code components . Full can be granted only by the workspace owner or the person who installed Throttle Builder. Allow publishing. Keys and connections made before access levels are shown as Custom (legacy) and keep exactly the scopes they had. Only these have an Allow publishing switch: with it on, the agent can publish pages to your live store without asking you. Once a key matches a level, lower the level instead. New keys use levels. A tool a level may not use is not even listed to the agent. The full list is on the MCP tool reference . Set up your tool Choose your tool in Connect an AI agent . Supported: Claude (claude.ai, the desktop app and Claude Code), Cursor and VS Code with GitHub Copilot. Each snippet below uses the placeholder tb_sk_PASTE_YOUR_KEY . Replace it with your own key. Claude: claude.ai or the desktop app (sign in, no key) claude.ai connectors cannot send a key, so they sign in to Throttle instead. There is no key and no client ID: paste the address only. In claude.ai or the Claude desktop app, open Settings , then Connectors , then Add custom connector . Name it Throttle Builder and paste address as the URL. Leave Advanced settings empty. Do not paste a client ID or a secret. Choose Add , then Connect . Throttle opens: sign in. Pick the workspace, the application and the environment where Throttle Builder is installed, choose the level, and choose Approve . The assistant then appears under Hosted assistants , where you can change its level or revoke it. A new connection can take up to 5 minutes to work; if claude.ai says it could not connect, wait and reconnect. Claude Code (uses a key) Choose Create a key , pick a level and copy the key from the dialog. Run this once in a terminal, from the folder you work in: Then run claude mcp list : throttle-builder should say Connected. Cursor (uses a key) Save this as ~/.cursor/mcp.json (your own user config, which is not part of any project), then restart Cursor. To keep it in a project file ( .cursor/mcp.json ), keep the key out of it: set an environment variable named THROTTLE_BUILDER_KEY to your key and use this. In Cursor Settings, MCP: throttle-builder shows a green dot and its tools. VS Code (GitHub Copilot, uses a key) Save this as ~/.copilot/mcp-config.json (VS Code's user-level Copilot config, not part of any project), then run MCP: List Servers and check throttle-builder is listed (start it if it shows Stopped). To keep it in the project, save this as .mcp.json in the workspace root. Project files are often committed, so it reads the key from an environment variable named THROTTLE_BUILDER_KEY : set it to your key. VS Code reads an existing .mcp.json as is; to add one with MCP: Add Server , turn on the setting chat.mcp.workspaceRootConfig.enabled . Copilot Chat in Agent mode lists the throttle-builder tools. The screen also shows VS Code's older, deprecated setup ( .vscode/mcp.json ) for people who still use it. VS Code on macOS opened from the Dock does not see variables exported in your shell, so the key would be empty. Start it from a terminal where the variable is set ( export THROTTLE_BUILDER_KEY=tb_sk_PASTE_YOUR_KEY && code . ) and restart VS Code. Let it see your store An agent that cannot look at a page is guessing. Add one browser tool to your agent: it asks Throttle Builder for a preview link, opens it, looks and fixes what it sees. It opens preview links at 390, 768 and 1280 px wide. The screen offers three: Playwright MCP (start here): opens a clean browser the agent controls, at any width. In Claude Code: claude mcp add playwright -- npx @playwright/mcp@latest . Claude in Chrome : uses your own Chrome, signed in as you. Needs a direct Anthropic plan and the Claude in Chrome extension (version 1.0.36 or later); start Claude Code with claude --chrome . Chrome DevTools MCP : adds the console, network requests and performance. In Claude Code"},{"title":"MCP tool reference","route":"/builder/ai-agents/tools","headings":["MCP tool reference","How the tools work","Rules that apply to every tool","baseRev: do not overwrite someone else's edit","Idempotency keys","Rate limits","Errors every tool can return","What each level can call","Tools by area","{g.label}"],"text":"Throttle Builder MCP tool reference The Builder gives an AI agent tools.length tools. This page lists every one, grouped by what it is for: the access level it needs, each input, what it answers and the errors it can return. How to connect an agent is on Connect and AI agents . How the tools work An agent sees only the tools its access level allows. A tool it is not allowed is not listed at all. Every change goes to a draft . Nothing reaches the store until a tool that publishes is called, and only a Publish or Full key has those. Answers are JSON text. A refusal comes back with isError set and an error object holding a code and a message , and sometimes more (for example issues ). Every change in a draft is recorded in the page history and can be undone with undo_change . Catalog data (products, collections, categories) is read only here. An agent cannot change it. Rules that apply to every tool baseRev: do not overwrite someone else's edit Reading a page or the site answers a draftRev . Send it back as baseRev on the next write. If the draft changed in between (you or another agent edited it), the write is refused with DRAFT_CONFLICT , nothing is saved, and the agent reads the page again. Leaving baseRev out writes on top of the current draft, except for update_menu and restore_site_settings_version , which always need it. Publishing always needs it too. Idempotency keys Most writes take an optional idempotencyKey (1 to 128 characters). Repeating a call with the same key within 24 hours returns the first answer instead of writing again. Keys belong to one key and one tool, so two keys that pick the same text do not collide. Use a new key for each different change. Tools that insert something also need an index when you send a key, otherwise INDEX_REQUIRED . Rate limits Each key or connected assistant may make 120 tool calls a minute , and 60 writes a minute (a write also counts as a call). Over the limit the answer is 429 RATE_LIMITED with Retry-After: 60 . A write that cannot be counted is not made. Errors every tool can return [ code: e.code , e.when]) /> Input that does not match a tool's schema is refused before the tool runs. Fixes for the errors you meet most are on Troubleshooting . What each level can call [ LEVEL_NAME[l]!, $ tools.filter((t) => level(t) === l).length tools at exactly this level , ]) /> Each level also has every tool of the levels below it. A key made before access levels (shown as Custom) keeps the scopes it had, and the tools marked "Needs Allow publishing" below need that switch on as well. Tools by area groups.map((g) => ( g.label ( g.tools.length ) )) groups.map((g) => ( g.label g.blurb g.tools.map((tool) => const note = TOOL_NOTES[tool.id]!; const lv = level(tool); return ( tool.id tool.description Needs: LEVEL_NAME[lv] access or above. Scopes: tool.scopes.join( , ) . tool.requires.length > 0 ? Also requires: $ tool.requires.join( , ) . : tool.needsAllowPublishing ? A key made before access levels also needs Allow publishing. : Kind: tool.kind === read ? reads only : writes tool.destructive ? ; changes the live store or throws work away, so a client may ask you first : tool.affectsLive ? ; changes what shoppers see : . Answers: note.returns tool.inputs.length === 0 ? ( No inputs. ) : ( [ code: f.name , f.required ? Yes : No , f.type, [f.description ?? , constraint(f)].filter(Boolean).join( ), ]) /> ) note.errors.length > 0 && ( [ code: e.code , e.when]) /> ) ); ) ))"},{"title":"Components","route":"/builder/components","headings":["Components","{group.label}","Options every component has","How the option tables read"],"text":"Throttle Builder Components Components are the blocks you place in a column: a heading, an image, a product grid, a contact form. The Components library in the editor holds three kinds: Built-in components (this page), your own Custom code components and Saved sections. The store has builderData.components.length built-in components. Custom and saved components are on Saved and code components . Sections, columns and inner sections, which hold the components, are on Sections and layout . groups.map((group) => ( group.label group.blurb [ html: $ c.title , c.description, ]) /> )) Options every component has These options are on every component, whatever its type, and are not repeated on each component page. [ s.label, code: s.key , TAB_LABEL[s.tab], s.key === anchor ? Starts with a letter; letters, digits, - and _; 64 characters at most. It becomes the element id, so a link to #name scrolls to it. : allowedValues(s), defaultValue(s), ]) /> How the option tables read Theme colour values are written token:name and follow the theme, including dark mode; a hex colour stays fixed. Spacing takes a step of the theme's spacing scale (none, xs, s, m, l, xl, 2xl) or a size in pixels. Size takes a step of the theme's type scale (xs to 3xl) or a size in pixels. One value per language means the text is translated: each store language has its own value. Every option can be overridden for tablet and phone. See responsive overrides ."},{"title":"Contact forms","route":"/builder/contact-forms","headings":["Contact forms","Add a form","Where messages go","Spam protection","What an AI agent can see","If the picker says Builder needs an update"],"text":"Throttle Builder Contact forms The contact form component puts a form on a page. Every message is saved in Throttle and emailed to the store owner, or to addresses you choose. It works without JavaScript; with it, the shopper stays on the page and sees the success message. Add a form Add the Contact form component to a column. In its settings, under Form , pick one of your Throttle site forms or create a new one. Choose Email to : Store owner (the default) or Custom addresses . Choose which fields to show (name, email, phone, subject, message, consent checkbox), their labels and which are required. Email and message are shown and required by default. Set the Submit label , the Success message and the Error message , or set Go to this page after sending to send the shopper to a page instead of showing the message. Publish the page. The component never holds or shows an email address in the page. The Builder writes the recipient setting to the form in Throttle. A subject can be a free field or a list: put the choices in Subject options , separated by commas. Where messages go Saved in Throttle. Every submission is stored with the form. You read them in the Throttle dashboard (the Forms area), not in the Builder. Emailed. To the store owner, or to the custom addresses you set. Your own team members' addresses are notified at once. Any other address (a shared sales inbox, say) is first sent a confirmation email and receives nothing until someone clicks Confirm. Webhook. Developers can subscribe to the form.submitted event. See Site forms . Spam protection There is no captcha. These protections run on every form: Hidden trap field. The component includes an invisible field named _gotcha that people never see or fill in. A submission with it filled in gets the normal success answer, but nothing is stored or emailed. Rate limit. At most 10 submissions a minute from one IP address; more are refused with a 429 answer. Own site only. A form made through the Builder accepts posts from your store's own address only, so other websites cannot use it from a browser. Fixed recipients. Emails go only to the addresses set on the form. A submission can never choose who receives mail. Size limits. At most 50 fields and a 64 KB body per submission. The full list, with the error codes, is on Site forms . If the email does not arrive, check spam folders and filters first. What an AI agent can see An AI key can list your forms ( list_site_forms ), create one ( create_site_form ) and read submission metadata only ( list_form_submissions ): how many there are, when each came in, its topic and whether its email was delivered. It never sees names, email addresses, phone numbers or messages. The topic is shown only when it is exactly one of the subject options you set on the form. Free text a visitor typed is hidden, because it could hold personal details, and so is any option that looks like an email address, phone number or web address. If the picker says Builder needs an update Listing and creating forms needs a permission ( forms:write ) that only newer Builder versions ask for. In the Throttle dashboard open Extensions, then Throttle Builder, upgrade it and approve the new Forms permission. Then reload the Builder. More on Troubleshooting ."},{"title":"Builder for developers","route":"/builder/developers","headings":["Builder for developers","The packages","Install","Minimum versions that fit together","create-store","storefront-react without the Builder","Which setting wins","Developer reference"],"text":"Throttle Builder Builder for developers Your store reads what you publish in the Builder through a few npm packages. create-store scaffolds a Next.js store; with --builder-mode build it also adds a Builder site wired to them. This page lists each package, its current version and what it is for. The packages Install Minimum versions that fit together storefront-react v.storefront expects builder-react >=0.8.0 <1.0.0 and builder-schema >=0.4.0 <1.0.0 (both are optional peers: needed only when you use the Builder). Keep all four Builder packages on their latest release together. It also expects @usethrottle/catalog ^1.4.1 || ^2.0.0 , @usethrottle/money ^1.1.0 , @usethrottle/auth 0.17.0 or later, @usethrottle/scripts 0.4.0 or later, and Next.js 15 or later. The SDK sends the minimum schema version it needs ( schemaMin for SDK v.builder ) on every read, which the Builder uses to serve the current site settings format. Install builder-schema at that version or later; the SDK's changelog says when the minimum moves. After upgrading Builder packages, run pnpm dedupe (or npm dedupe ). Two copies of @usethrottle/ui in your lockfile split the theme, and the store draws its default look. A component that is newer than your installed storefront-react is not available in your store. Update the package. See Troubleshooting . create-store It asks for your catalog's browser key ( pc_pk_... ) and then its server key, writes them to .env.local and installs dependencies. The store has the shop, collections, categories, tags, product, search and account pages, the cart drawer, and the cache-safe webhook and sync routes. The default, --builder-mode live , adds no Builder. To show Builder pages in a store made that way, set up the SDK yourself: see Builder for developers . Only --builder-mode build adds a Builder site. Its options: , The catalog browser key. With --yes it asks nothing. ], [ code: --server-key , The catalog server key, for reads made by your store server. It is asked for after the browser key. ], [ code: --offline , Do not call the catalog to tell the keys apart. Then --catalog-key and --server-key are both needed. ], [ code: --pm , The package manager. ], [ code: --skip-install , Write the files and stop. ], ] /> More options and the hosting-cost rules are in the create-store guide . storefront-react without the Builder @usethrottle/storefront-react is a components package on its own: drop-in React storefront components that read their display from your catalog's settings. You do not need the Builder to use it. Which setting wins When you use the Builder, the order is: Builder setting , then the SDK prop you pass to the component, then the default . A value a merchant sets in the Builder overrides the same value passed as a prop; a prop overrides the default. Without the Builder, the prop and the default are all there is. Card, badge, product and catalog wording is no longer read from the catalog's /config . Pass strings or localization , or use the Builder's per-locale wording. See Storefront components for every component and its props. Developer reference Builder for developers : how the pieces fit together. The SDK ( @usethrottle/builder ). Rendering ( @usethrottle/builder-react ). The document format ( @usethrottle/builder-schema ). MCP for developers and the guide's tool reference . Widget API and widgets guide . Delivery modes , Media and Site forms ."},{"title":"Getting started","route":"/builder/getting-started","headings":["Getting started","Before you start","1. Install Throttle Builder","2. Connect your store","Product Catalog","Your store","3. Give your developer a key","4. Tell your store when you publish","5. Choose how pages reach your store","6. Make your first page","7. Preview","8. Publish","What to do next"],"text":"Throttle Builder Getting started This page takes you from nothing to a published page. Most of the time goes into two steps that need the person who builds your store's website, called your developer below: giving them a key, and giving them a secret for store webhooks. Before you start You need: A Throttle workspace with your store's application. Product Catalog, if you sell products. Without it the shop templates and the cart are not part of your store. A developer who connects your store's website to the Builder once. 1. Install Throttle Builder The left menu has three groups. Everything in this guide is in one of these places. 2. Connect your store Open Connections in the Connect group. It has two cards. Product Catalog The card shows whether Product Catalog is Installed , with its version, or Not installed . Choose Check again after you install it. If it is not installed, the product components are hidden from the library. Without a linked key, product components show placeholders in the editor. Your store Under Your store , enter the Store URL , for example https://shop.example.com . Use the address only, with no path. It is used for links in the editor and as the default place change notices are sent. Choose Save to draft , then Publish site settings . The same card has a Throttle publishable key field (it starts with pk_ ). It lets the sign-in and order components talk to your store. Your developer gives you the value. 3. Give your developer a key Your developer's code needs a key to read what you publish. Your developer sets it as THROTTLE_BUILDER_KEY in the store's server and build environment. It must never go in the browser. If you lose it, make a new one and remove the old one from the same screen. The developer side is on Developers . An AI agent uses a secret key with an access level. See Connect and AI agents . 4. Tell your store when you publish On Store webhooks your store gets a signed notice when pages or settings are published, so it refreshes what it saved. Set it up once. Your store needs the revalidate route /api/throttle/builder-revalidate , which your developer sets up. Without it the notice has nowhere to go. Your developer sets the secret as THROTTLE_BUILDER_WEBHOOK_SECRET . You can have up to 5 endpoints. Rotate secret gives an endpoint a new secret at once, so your store must be updated with it. 5. Choose how pages reach your store Open Site , then the Delivery tab. There are two modes. Live : the store reads each page as it is published and refreshes only what changed. It is the default. Build-time : published changes wait until you choose Release . Your host then rebuilds the store once from a frozen copy of everything published. This mode also needs a deploy hook. If you are not sure, stay on Live. You can switch at any time. The choices are explained on Wording, delivery and shop . 6. Make your first page The editor saves as you work, and the top bar shows Saved · draft . Pages are covered on Pages and templates , and how a page is laid out on Sections and layout . 7. Preview Choose Preview in the top bar to see the page without the editor. Share link makes a preview link you can open in a new tab or copy and send. To look at the page on phone, tablet and desktop widths, use the device buttons. 8. Publish Nothing you change is live until you publish it. Choose Publish in the top bar and confirm in the dialog. If the site settings have unpublished changes, the dialog offers Also publish the site settings . On Pages & templates , each page shows Draft , Unpublished changes or Published . History, undo and restoring an older version are on Publishing and history . What to do next Set the look of the whole store under Site : Site settings . Build your menus and your header and footer . Upload images on Media . Let an AI agent build for you: Connect and AI agents ."},{"title":"Header and footer","route":"/builder/header-and-footer","headings":["Header and footer","Open them","Build a header","Menu items for some shoppers","Phones","Sticky header","Build a footer","Templates without the header and footer","Publishing"],"text":"Throttle Builder Header and footer The header and the footer are shown on every page of your store. In the Builder they are parts : documents you design with the same sections, columns and components as a page. Open them On Pages & templates , choose Header and footer in the Show filter. The two rows are Header and Footer (kind Part ). Both exist from the start. In the editor you can also switch to them from the document list at the top, under Header and footer . A store has exactly limits.partsPerSite parts: one header and one footer. An AI agent addresses them as part:header and part:footer in get_page , add_section , add_widget and the other page tools. The published header is written as a header element and the footer as a footer element, on the server with every page. A part with no sections draws nothing. Build a header A typical header is one section with a few columns. Components for it: Logo , Your logo from Site settings, linked to the home page. ], [ html: Menu , Your header menu. Use the Drawer mode so it becomes a menu button on phones, or Mega for wide panels. ], [ html: Announcement , The announcement bar from Site settings. Put it in the top section. ], [ html: Search box , Search with live suggestions. ], [ html: Cart button , The cart with its item count; it opens the cart drawer. ], [ html: Account button , A link to the account page. ], [ html: Locale switch and Currency switch , Language and currency selects, shown when the store offers two or more. ], ] /> The catalog components (search, cart, locale and currency) need Product Catalog. The announcement text, the logo and the menus are set under Site ; see Announcement , Brand and Menus . Menu items for some shoppers Each menu item takes the same Show when rule as a section: signed-in or guest, cart state, Only these groups and a date window (from and until). A menu item has no device rule: use the separate header and mobile menus. The Menu component and the header drawer leave a hidden item out. An item with a rule is left out until the buyer is known , so the server-rendered header never shows it and it appears after the page loads. The store has to pass the viewer to the Builder. Like every Show when rule this is presentation only: a hidden link's page is still reachable by its URL. A store on an older renderer ( @usethrottle/builder-react 0.5.14 or earlier) loses menu items that carry any visibility rule (signed-in, cart or groups) until you upgrade @usethrottle/builder-react and @usethrottle/builder together; the same store also hides group-ruled sections. Phones Use the Phone device button to check the header at 390 px. Columns stack on phones, so give the header columns phone widths, or set the Menu to the Drawer mode so the links collapse into a menu button that opens a full-screen drawer. See Sections and layout . Sticky header Select a header section and open Header behaviour on its Content tab. Turn on Stick to the top so the header stays in view while the shopper scrolls (the editor keeps the page still; Preview shows it sticking). Collapse into a menu button below folds the header into a menu button under a width: Never , Tablet width and below (1024 px) , Phone width and below (768 px) or Custom width ( Collapse below (px) , from 768 to 1280). Menu button label sets the words on that button for the current language; leave it empty for the store's own word. See Sections and layout . Build a footer The footer is fully yours. Add sections and columns, then use the Menu component for your footer menu, text and rich content for contact details, images, buttons, and the Copyright component for the line at the bottom. The copyright text comes from the footer wording under Site , with the year and your store name filled in. A contact form can sit in the footer; see Contact forms . Templates without the header and footer The header and footer normally appear around every page and template. A template whose meta has frame set to none (default site ) is drawn without them, for example a frameless 404 page: the store hides them with CSS, so they stay in the page HTML. You turn it off with Show header and footer in the template's Search and sharing dialog, or an AI agent sets seo.frame with update_page_meta . See Pages and templates . Publishing The header and the footer are published on their own, like a page: choose Publish in the editor. They are shown on every page after that. See Publishing and history ."},{"title":"Sections and layout","route":"/builder/layout","headings":["Sections and layout","How a page is built","Section options","Content tab","Style tab","Advanced tab","Columns","Inner sections","Limits","Responsive: desktop, tablet and phone","How overrides work","In the editor","Column widths on tablet and phone","Interactions: tabs, accordion, carousel and show / hide","Things to know","Entrance animations","Sticky sections and the drawer","Show when: signed in, cart, buyer groups, devices and dates","How dates are decided","Older renderers","Next"],"text":"Throttle Builder Sections and layout A page is a stack of sections. A section has columns, and a column holds components or an inner section. Every setting can be different on desktop, tablet and phone, and a section can turn its columns into tabs, an accordion, a carousel or a show and hide toggle. How a page is built In the editor, the Add tab has a Layout group. Choose Section (one column) or a section with 2 to 6 columns to add it to the page, and Inner section to put a row of columns inside a column. The Layers tab shows the whole page as a tree. Click a section, column or component to change it on the right. Settings are on three tabs: Content , Style and Advanced . AI agents use add_section , set_columns , add_inner_section and update_node . Section options Content tab Style tab Two more background settings sit on the Style tab, next to Background image ( background.mobileImage and background.priority in the page document): Phone image ( mobileImage ), an image picker, is a second picture used instead of the background image at phone width (767 px and below), so you can crop differently for a narrow screen. Load the image first ( priority ), a toggle that is off by default, marks the background as the main image of the page. The page then asks the browser to load it early with high priority, one request for the desktop picture and one for the phone picture when they differ (a preload with a media query). Use it only for the background at the top of the page. Tablet overrides are not preloaded. An AI agent sets both in background with add_section or update_node : mobileImage is a media id and priority is true or false. Advanced tab Hide hides the section (it can be set per device), Anchor gives it an id so a link can jump to it (a letter first, then letters, digits, dashes or underscores, 64 characters at most), and Entrance animation animates it in. See Entrance animations . Columns A section has 1 to 6 columns. Use Columns with the minus and plus buttons on the Content tab of a section, then choose one of the width presets (for two columns: 50 / 50, 33 / 67 and 67 / 33; for three: three equal columns, or 25 / 50 / 25). You can also drag the edge between columns on the canvas. The column widths always add up to 100. On a phone, columns stack one under another at full width by default. Use Order when columns stack to reverse them. On a tablet, columns keep their desktop widths unless you set tablet widths. Inner sections An inner section is a row of columns inside a column, for a layout inside a layout. It has the same options as a section. An inner section cannot contain another inner section. It can only sit in a column of a section, not inside another inner section, and saved sections go on the page itself, not inside a column. Limits Responsive: desktop, tablet and phone There are three screen sizes. Every option of a section, column and component can be set differently for each. How overrides work Your normal settings are the desktop settings. Tablet inherits desktop. A tablet setting is an override that applies only on tablets. Phone inherits tablet. If you set something on tablet and not on phone, phones use the tablet value. Removing an override makes the device follow the wider one again. In the editor Use the Device buttons at the top ( Desktop 1280 , Tablet 768 , Phone 390 ). The settings panel then says Editing for Tablet. A change here is an override that only applies at this width. A setting with an override shows a small chip with the device name. Choose Reset to inherited on the chip to remove the override. An AI agent uses set_responsive ; a null value removes an override. Column widths on tablet and phone On desktop the widths add up to 100. On tablet the columns keep their desktop widths unless you set widths for tablet. On phone every column is 100 wide, so they stack, unless you set widths for phone. When you set tablet or phone widths, set them for every column of the section, not just some. Use the width presets while the Tablet or Phone device is selected. If columns do not fit in one row, the one that does not fit moves to the next row. Column count can be changed only while the Desktop device is selected. Interactions: tabs, accordion, carousel and show / hide Choose a section's Interaction on its Content tab. Its columns become the panels, so a section with three columns becomes three tabs, three accordion items or three slides. It works for sections and inner sections, can differ per device, and each mode shows only its own options. Things to know Panel title sits on each column and is shared by all devices. If a tabs or accordion panel has no title it shows a number, and the editor and AI tools warn you ( PANEL_TITLE_MISSING ). Autoplay pauses when the shopper hovers or focuses the carousel, and has a visible Pause button. It does not run for shoppers who asked their device for reduced motion. All the panels are in the page HTML, so their text can be read by search engines. Without JavaScript the tabs show every panel one under the other, and the accordion and show / hide use the browser's own open and close. An AI agent sets these with update_node on the section, for example interaction , carouselAutoplay , carouselIntervalMs , accordionMultiple and toggleLabelOpen . Entrance animations Sections, columns and components have Entrance animation and Entrance delay on the Advanced tab. The animation plays once, when the block scrolls into view. The animations are None (default), Fade in , Slide up , Slide in from the left and Zoom in . The delay is in milliseconds, from 0 to 2000. Shoppers who asked their device for reduced motion see no animation. Content is hidden before it animates in only where scripts run, so without JavaScript everything is visible. Sticky sections and the drawer A section in the page document can be sticky ( frame.sticky set to top ) so it stays at the top while the shopper scrolls, and can collapse into a drawer under a w"},{"title":"Media","route":"/builder/media","headings":["Media","Upload images","Add from URL","Sizes and width variants","Alt text","Where images are used","Deleting an image","What an AI agent can do"],"text":"Throttle Builder Media Every image on your pages comes from the media library. You upload an image once, describe it with alt text, and pick it in any component or setting that takes an image. Pages use these library images, never a typed address. Upload images Open Media , then drop images on the drop area or choose files with the file picker. You can upload several at once. A file that is too big or the wrong type is refused with a message that names the file. You can also pick or upload an image from the picker inside any image setting. Add from URL Choose Add from URL above the drop area. Type the Image address , optionally write Alt text (optional) , and choose Add image ( Cancel closes the form). Throttle downloads the image once and keeps its own copy in your library, so it needs a public https address (PNG, JPEG, WebP, GIF, AVIF or SVG, up to 10 MB, 20 KB for an SVG). The same button is in the picker inside any image setting. The library itself is Throttle's media library, shared with the rest of your store, with its own limits (60 uploads a minute, 10,000 images and 5 GB of originals). See Media for developers . Sizes and width variants Throttle keeps your original and makes WebP copies at 320, 640, 1024, 1600 and 2400 pixels wide, never larger than the original (a 1100 pixel image gets 320, 640 and 1024). The Builder uses these copies so a phone does not download a desktop-size image. You do not choose a size; the store picks the right one. Alt text Select an image to see its size, then write Alt text (up to 500 characters) and choose Save alt text . Alt text describes the image for people who cannot see it and for search engines. An image without it shows as "Image with no alt text" in the library, and an image setting shows "No alt text" until you add it. Use Search by alt text to find an image. An AI agent changes alt text with update_media . Where images are used Choose an image in a component's image setting, in a section or column background, in the brand settings or as a page's share image. The setting holds the image's id. When you publish, the Builder freezes the images a page uses into the published copy, so a store never has to ask the library for them one by one. Deleting an image Select the image, choose Delete , then Yes, delete . Delete does not refuse an image that pages use. It is a soft delete. Pages that were already published keep showing it, because their copy was frozen when you published, until its file is removed (30 days). When you publish a page that still uses a deleted image, the publish succeeds with a warning ( ASSET_DELETED ): "This image was deleted from the media library. It keeps showing until its file is removed; replace it." Replace it before then. An image that no longer exists at all blocks the publish. An AI agent deletes with delete_media , which needs the Publish level, or Allow publishing on a key made before access levels. Ask the agent to check where an image is used first. What an AI agent can do Details and errors are on the tool reference ."},{"title":"Menus and mega menu","route":"/builder/menus","headings":["Menus and mega menu","The Menus editor","Several menus","The mobile menu","Items, levels and links","What an item can link to","Category tree","More item options","Mega menu","Showing a menu on a page","On the server","Next"],"text":"Throttle Builder Menus and mega menu Menus are the lists of links in your header and footer. You build them once under Site , then show them anywhere with the Menu component. They are written into the page on the server, so shoppers and search engines get the links straight away. Opening a link in a new tab, CSS classes, descriptions, badges, the mega menu and category-tree items are saved only once your store has moved to the new site settings. Until then the Menus tab shows them and says they are not in the draft you publish yet ("They show in the editor now and save once the store upgrade is live"); labels, links, nesting, order and named menus always save. Until then a mobile menu with items also counts as one of the extra named menus, and the tab says phones keep showing the header menu until the Builder update ships. The Menus editor Open Site and choose the Menus tab. It has three panels: Add items on the left, the menu as a tree in the middle, and the selected item on the right. A preview under the editor draws your changes as you make them. Changes go to your site draft; publish them with the site settings (see Publishing and history ). Undo and redo cover every edit. Drag an item to move it, or select it and use Up , Down , Nest and Un-nest . Tick items in Add items and add them to the end of the menu. Select an item to edit its Label and Link . An AI agent edits one menu with update_menu , or all of it with update_site_settings . Several menus Every site has a Header menu , a Footer menu and a Mobile menu . You can add up to limits.namedMenusMax more named menus, for example help . Choose the menu to edit in Menu to edit . Use New menu to add one (lower case letters, digits and dashes, starting with a letter, 40 characters at most), Rename to rename it and Delete menu to delete it. A component that shows a deleted menu shows no links. A named menu is shown by choosing its name in the Menu component's Menu option. The default name is header . The mobile menu Phones use the header menu unless you make a mobile menu. On the Mobile menu tab, choose Make a mobile menu from the header to start from a copy, then remove what phones do not need. When a mobile menu has items, a Menu component set to header shows it on phones (up to 767 px wide) and the header menu on larger screens. Both are in the page HTML and CSS chooses which is shown. Items, levels and links A menu has up to limits.menuDepth levels : top-level items, then items under them, then one more level. A menu holds up to limits.menuItems items in total, counting an automatic category tree after it fills itself. What an item can link to The catalog kinds need Product Catalog linked. An item whose target cannot be found is shown as plain text on the store, not as a link. Category tree With Product Catalog, Add category tree adds one item that fills itself with your live categories, so new categories appear without editing the menu. Choose where it Starts from (all categories or one) and Levels shown (One level or Two levels). Items cannot be nested under a category tree. More item options Mega menu A mega menu opens a wide panel under a header item. It works only on top-level items of the header menu . Select such an item and switch on Mega menu panel . To show the panels, set the Menu component to the mega mode. On phones the panels become a list that opens one level at a time, and the featured block is hidden. Turn the panel off before nesting an item that has one. Showing a menu on a page Add the Menu component to a column of the header, footer or any page. Choose the Menu name and a Mode . On the server The menu is written into the page HTML with the page. The browser does not fetch it afterwards. Every level is a nested list of links inside a navigation element, so search engines can follow all of it. Without JavaScript, submenus open when you hover or focus an item. Menus are part of the site settings, so they go live when you publish the site settings, not with a page. Next Header and footer : where menus usually go. Saved sections for mega menu featured blocks."},{"title":"Pages and templates","route":"/builder/pages-and-templates","headings":["Pages and templates","The Pages & templates screen","Content pages","Create a page","Page settings","Templates","Shop templates need Product Catalog","The one component each template needs","The product template layouts","Components that belong to templates","Default layout and Reset template","Which templates search engines skip","Search and sharing for a template","Scripts","The 404 page","Frameless templates","Content around catalog pages","Next"],"text":"Throttle Builder Pages and templates Your store is made of two kinds of page. A page is one page you write, such as the home page or About. A template is designed once and filled in for every product, collection, category and so on. The Pages & templates screen The table has a Show filter ( All , Pages , Templates , Header and footer ) and a search box. Every row opens in the editor. Each row shows its Kind , its Status and when it was Last edited . Draft : never published. Unpublished changes : live, with newer changes waiting. Published : what is live is what you see. Default layout : a template you have not changed yet. The More actions menu of a page has Publish (when it has changes), Settings , Duplicate and Delete . The home page cannot be deleted. A deleted page stays live until you publish the deletion; it is listed as Deleted · Publish to remove with a Publish deletion button. Content pages Create a page Type a name in New page name , choose Content page or Landing page under Page type , and choose Create page . The page opens in the editor as a draft. The home page already exists. An AI agent uses create_page . Page settings Open Settings from the row menu. If the store has more than one language, pick the language to edit first. An AI agent changes all of these with update_page_meta . When you change a live page's address, visitors to the old address are sent to the new one after you publish. After you publish a page path, the /pages/ address redirects to the path with a permanent redirect (308). The store itself answers on the shop, cart, account, checkout and system addresses, so a page cannot use those paths. Templates Open a template from Pages & templates like any page. A bar at the top says which template it is and where the store answers it. You design it with the same editor: sections, columns and components. Shop templates need Product Catalog The shop, collection, category, tag, search, product and cart templates appear only when Product Catalog is installed. Without it the table says how many shop templates are hidden, and your edits to them are kept. The account, sign-in, sign-up, verify email, order complete and not-found templates are always part of your store. The one component each template needs Each template must hold one particular component exactly once. Publishing is blocked until it is there, and the editor shows a banner telling you which one to add from the Add tab. Listing grid ], [ Product , html: Product buy box (or a Product main , which includes it) ], [ Cart , html: Cart lines ], [ Account , html: Account dashboard ], [ Verify email , html: Verify email ], [ Sign in , html: Sign in ], [ Sign up , html: Sign up ], [ Order complete , html: Clear cart ], [ Not found , Nothing in particular ], ] /> The product template layouts The product template ships these starting layouts: productVariants.join( , ) . There are three real layouts: Classic (the gallery beside the buy box), Stacked and Editorial ; split is the old name of classic and draws the same page. They are the same three choices as the Layout option of Shop display and the Page layout option of the Product main component. Every starting layout holds the breadcrumbs, the product main block and the product details. An AI agent picks one when it resets the template, with reset_template and its variant option. The visual editor has no variant picker on the template itself: choose the layout in Shop display and apply it with Reset template , or change Page layout on Product main. Components that belong to templates Product main, Product gallery, Product buy box, Product breadcrumbs, Product details, Product related and Product reviews can be used only on the Product template. The listing components (Listing header, Listing grid, Listing filters, Listing toolbar) and the cart components read the page they sit on. Outside their template the editor shows a note instead. Everything else can be used on any page, template, header, footer or saved section. All of them are listed on Components . Default layout and Reset template A template you have not changed shows Default layout in the list. Throttle supplies the default design: for example the listing templates hold a header, toolbar, filters and grid, and the cart holds a heading, cart lines, an empty-cart message and a summary. To go back, open the template and choose Reset template , then Reset to default . Only your draft changes. What is live stays until you publish, and you can still restore an older version from History. Choose Keep my draft to cancel. Which templates search engines skip These templates start as noindex, which asks search engines to leave them out: Search results , Cart , Account , Verify email , Sign in , Sign up and Order complete . The shop, collection, category, tag, product and not-found templates are indexed. A template can have its own title template, description and noindex setting; an AI agent sets them with update_page_meta and the document template:product (or another template name). The page-level search settings are on Search and sharing . Search and sharing for a template In the editor, open the More actions menu of a template row and choose Search and sharing . The dialog Search and sharing: (template name) has: Title pattern : up to 200 characters, with buttons to insert the tokens that mean something on that template ( product.title on Product, listing.title on Shop, Collection, Category and Tag, query on Search, and store on all). It shows an example title. Empty uses the store's own title for the template. Description , per language, up to 300 characters, with a length meter. Empty uses the site's default description. Hide this template from search engines : a switch that says what the template does by default and whether you changed it. Choose Save settings to write it to the template draft; publish the template to make it live. A template row shows Hidden from search when it is hidden, "},{"title":"Publishing and history","route":"/builder/publishing","headings":["Publishing and history","Drafts and autosave","Preview","Publish","History: versions and undo","Changes and undo","Versions and restore","Discard draft","Delivery: Live or Build-time","Releases (Build-time)"],"text":"Throttle Builder Publishing and history You never edit what visitors see directly. You edit a draft , look at it in a preview, and publish when it is right. Every change is kept in a history you can undo or restore from. Drafts and autosave Every page, the header and footer, saved sections and templates have a draft and, once published, a live copy. Site settings have their own draft too. The editor saves your draft by itself, a moment after you stop typing (less than a second, and at most every 3 seconds while you keep editing). You never press Save. The top bar shows the state: Saved · draft , Unpublished changes , Offline, changes kept (they are saved when you are back online) or Not saved . If the draft was changed elsewhere, for example by an AI agent, a banner says This page changed elsewhere and offers Keep mine or Reload their version . Preview Preview in the top bar shows the page without the editor. Exit preview goes back. The Preview link menu makes a link to share the draft with someone who has no Throttle account. It needs no sign-in, is read only and expires (1 hour for a person's link). For an AI agent, get_preview_url answers draftUrl (the draft, no sign-in, 12 hours, drawn at the window's own width so it can be checked at 390, 768 and 1280 px), liveUrl (the published page, or null) and storePreviewUrl (the draft on your store itself, 1 hour). The store preview needs a store URL in the site settings, and it is the only place a code component runs. Publish Choose Publish in the top bar. The dialog says "This makes the current draft live for visitors." and lists problems that would break the live store; fix them and publish again. Publish saves your draft first, so what goes live is exactly what you see. If the draft changed after the preview (you or another agent edited it), publishing stops with a conflict, so nothing you have not looked at goes live. Images are frozen into the published copy (see Media ). AI agents: publish (page, header, footer, template; with includeSite also the settings) and publish_site_settings need the Publish level. Publishing a page deletion or a saved section needs Full . publish always needs the baseRev the agent previewed. History: versions and undo Choose Version history in the top bar. It has two lists. Changes and undo Undo and Redo in the top bar ( ⌘Z , ⇧⌘Z ) step back through your editing, up to L.undoSteps steps. The change list shows each draft change, by you or by an AI agent, newest first. Undoing a change says "Undone. Nothing was published.": it only changes the draft. An agent uses list_changes and undo_change (with document site for the site settings). It must undo the newest change that is not undone first. Versions and restore Every publish saves a version. Each document keeps the latest L.versionsPerDocument . Restore puts an older version into your draft. Your current draft is saved first as a checkpoint, so you can go back to it. Nothing goes live until you publish. An agent uses list_versions and restore_version ; for site settings list_site_settings_versions and restore_site_settings_version . Discard draft Discard draft throws away your unpublished changes and goes back to the published copy. It is not offered when nothing has been published. An agent uses discard_draft . Delivery: Live or Build-time How your store gets what you publish is a setting you can change at any time, in the Site screen ( Wording, delivery and shop ). Only an admin or developer can change it. Releases (Build-time) In Build-time mode the dialog says "this page goes live when you press Release ". The Release panel lists what was published since the last release. Set a deploy hook (a public https address from Vercel, Netlify or your host) and Release calls it once to rebuild. Without a hook a release is still made, but nothing is sent. Releases are limited: one every 10 seconds and 20 an hour. The latest 50 are kept. Roll back to this on a release rebuilds the store with exactly what that release held, as a new release. AI agents: create_release , list_releases and rollback_release need the Full level and a store in Build-time mode (otherwise NOT_BUILD_MODE ). The technical side is in Delivery modes for developers. See Troubleshooting ."},{"title":"Saved and code components","route":"/builder/saved-and-code-components","headings":["Saved and code components","The Components library","Saved sections","Create one","Insert it on a page","Edit once, change everywhere","Detach","Publishing and deleting","Code components","On by default, with one store-wide switch","Who can do what","How it renders: server first, then hydration","Safety and kill switch","Never on cart, checkout, account or sign-in","Limits","Versions and rolling back","What an AI agent uses","The template language for custom components"],"text":"Throttle Builder Saved and code components Beyond the built-in components you can reuse a section on many pages (a saved section), and write your own components with HTML, CSS and JavaScript (a code component). Both live in the Components library next to the built-in ones. The Components library Open Components in the Builder. It has three kinds, shown as tabs and as a Kind of component filter. The address #/components?kind=builtin , custom or saved opens a tab directly. Choose a card to see its details: its kind, how it renders, when it last changed, where it is used and what pages it works on. A custom or saved component shows the pages that use it, each with an Open button. New component offers Code (your own HTML, CSS and JavaScript, rendered with the page) and Saved section (an empty section you build once and add to many pages). The advanced kinds Composite (several built-in components bundled as one) and Template (markup with placeholders that reads your catalog data) are made by an AI agent or through the Widget API. See Components . Saved sections A saved section is a section you build once and use on many pages. A page that uses it holds a link , not a copy. Edit the saved section once and every page that uses it changes, after you publish it. Create one Open a page and select a top-level section. Choose Save as section in its toolbar and give it a name. This makes a copy you can add to any page. Or choose New component , then Saved section , to start from an empty one. An AI agent does the same with create_saved_section . Only a top-level section can be saved, and a saved section cannot hold another saved section. Insert it on a page Add it from the Saved tab of the Add panel in the editor, or with insert_saved_section . The block shows as Linked saved section , with the buttons Edit saved section and Detach . Edit once, change everywhere Edit saved section opens it in the editor. The panel shows its state: "Published as version N", with or without unpublished changes, and the other pages that use it. A change reaches the pages that use it only when the saved section is published. Detach Detach turns the block into a copy that belongs to this page. Other pages keep the link. An agent uses detach_saved_section . Detach is one undo step. Publishing and deleting A page cannot be published while a saved section it uses has never been published ( SAVED_SECTION_UNPUBLISHED ). Publish the saved section first. A person can publish a saved section from the editor. An AI agent needs the Full level ( publish_saved_section ). A saved section that a draft or published page still uses cannot be deleted ( SAVED_SECTION_IN_USE , with the list of pages). Detach or remove the links, publish those pages, then delete it. Limit: L.savedSectionsPerSite saved sections per store. Code components A code component is your own HTML, CSS and JavaScript, saved as versions you can roll back. You place it on a page like any component and it is drawn with the page. Only people and AI agents you trust should write code. Anything you publish with a code component runs for every visitor on the pages that allow it. On by default, with one store-wide switch Code components are on by default for every store. The switch is Allow code widgets on this store in Site settings . Only an admin can turn code on . Anyone who edits can turn it off with Turn off all code , and every code component then stops on your store with the next page load. No AI key can change this switch. If an agent is told CODE_WIDGETS_OFF , only a person can fix it. Who can do what How it renders: server first, then hydration Server-rendered HTML. The markup and CSS are written into the page by the server, like any other component, so the content is there before any script runs and search engines can read it. The script runs after load. On a live store page where code is on, the component also carries its input (its settings and data) and one <script async> for its own script. The script starts after the document is ready, once for each copy of the component on the page. The script receives the component's element and its input. Errors stay inside. If a script throws, the element is marked with an error and the rest of the page is left alone. A run that takes longer than 50 ms logs a warning in the browser console. Where it is only drawn. In the editor, in the Builder preview and anywhere code may not run, the markup and CSS are drawn but the script never runs, with a Runs on your store badge. To see it run, open the store preview link ( storePreviewUrl from get_preview_url ). Safety and kill switch The script is stored once per version and is never part of the published page. The page holds only a fingerprint of it and a link to a Throttle address. That address checks on every request that code is on and that this version is active. If not, it answers an empty script that does nothing. So turning code off, or turning a version off, stops it even on pages your host has cached. The markup and CSS are checked again by the store before they are drawn, the same way as a template component, and the CSS is sanitised. Code is not sandboxed: it runs in the store page with the page's own power. The switch and the version history are the protection, not a sandbox. The syntax is checked when you save, which says nothing about what the code does. A script runs once per copy of a component, so guard anything global (such as adding a listener to document ). Never on cart, checkout, account or sign-in Scripts never run on the cart, checkout, account, sign-in, sign-up, account verification or order-complete pages, and the rule is not a setting. The renderer refuses any path with a segment such as checkout, cart, basket, account, sign-in, log-in, register, order, pay, payment, password or wallet, or one that begins with confirm, thank, receipt, invoice or quote. The templates in CODE_TEMPLATE_DENY (cart, account, account-verify, sign-in, "},{"title":"Site settings","route":"/builder/site-settings","headings":["Site settings","The tabs","Saving and publishing site settings","Which setting wins"],"text":"Throttle Builder Site settings Site holds everything that applies to the whole store rather than to one page: its look, its name and logos, menus, the announcement bar, how it appears in search and when shared, its wording and how it reaches your store. Open it from Build in the left menu. The tabs Saving and publishing site settings Site settings are a draft, like pages. A change on any tab is saved to the site draft on its own (the bar says All changes saved ) and shows in the editor and in preview. Nothing changes on your store until you choose Publish site settings in the Site screen's bar. Publishing the site refreshes every page of the store once, because every page uses the theme, menus and brand. See Publishing and history . An AI agent reads the site with get_site and changes it with update_site_settings ; each section it sends replaces that whole section of the draft. Agents cannot change the Throttle key in Connections or the store page paths: only a person can. Which setting wins Many site settings, such as card style, badges and shop wording, can also be set by your developer in code, as props of the @usethrottle/storefront-react components. The order is always: The Builder setting , when you have set one. The SDK prop your developer set in code (a component's own prop beats the store-wide one). The standard default. A setting left on Default in the Builder defers to the code. So a developer can give the store a sensible look in code, and you can change any part of it from the Builder without a deploy. The editor decides this from your store: a store that has moved to the new site settings saves everything on this page and shows none of the notices below. Until then these settings are held in the editor and are not in what you publish: several announcement messages with targeting, style and rotation (only the first message that has not ended is kept); the mobile logo and the logo heights; the extra menu settings (new tab, CSS class, description, badge, mega menu and category-tree items); and the store paths on the Settings tab, Shop display and Shop wording (their notice says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet."). On Search and sharing, structured data, indexing, robots.txt, the sitemap and redirects are read-only. Title, description and share image always save. Leaving the Site screen warns you when an edit is held only in the editor."},{"title":"Announcement","route":"/builder/site-settings/announcement","headings":["Announcement","Turn it on","Messages","Rotation","Style","With an AI agent"],"text":"Throttle Builder · Site settings Announcement The announcement bar is the thin strip at the top of the store for news such as free shipping or a sale. Set it up on the Announcement tab of Site. It shows wherever the Announcement component is placed, usually at the top of the header. Until your store has moved to the new site settings, the tab says: "This Builder keeps the first message that has not ended; it turns the bar off if every message has ended. Extra messages, targeting, the style and the rotation show here and are saved and published once the Builder is updated." Turn it on Switch on Announcement bar . The Live bar preview shows the bar as a new visitor sees it today, from your draft. An enabled bar needs at least one message. Messages Choose Add message to add one. A bar holds up to five. Move messages up and down to set their order. Each message shows a status: Live , Scheduled or Ended . Times are in your time zone, shown under the fields. A scheduled message appears and disappears on its own: the store is refreshed at the next start or end time. Messages for everyone are in the page HTML from the server. A message only for signed-in shoppers or only for guests appears after the page loads, in space the bar has already reserved, so the page does not jump. Rotation With several live messages, turn on Rotate messages to show one at a time, changing on its own. Shoppers can also step through them. Change every sets the time on each message, 3 to 15 seconds (6 by default). Transition is Fade or Slide. Rotation pauses on hover and keyboard focus, and stays still for shoppers who ask their device to reduce motion. Style With your own colours, the tab warns when text and background contrast is under 4.5:1 (WCAG AA), because shoppers will struggle to read it. You can still save. Contrast is not checked for a colour with transparency. With an AI agent An agent sets the bar in the announcement section of update_site_settings . See the MCP tool reference ."},{"title":"Brand","route":"/builder/site-settings/brand","headings":["Brand","Store name","Logos","Logo height","Favicon","Share image"],"text":"Throttle Builder · Site settings Brand The Brand tab of Site holds your store name, your logos, the favicon shown in the browser tab and the image shown when a page is shared. Every image comes from your Media library : upload a file or choose one already there. Store name The store name is shown in the header when there is no logo, in emails and in search results. It is the only store name. Use 1 to 80 characters. Logos Each slot has Upload a file and Choose from Media . The Logo component in the header shows the right logo for the shopper's screen and colour scheme. Until your store has moved to the new site settings, the tab says: "The mobile logo and the logo heights are saved once the Builder is updated. Until then they show in the preview here and are not saved or published." The light and dark logos always save. Logo height Set the height for Desktop and tablet (16 to 120 px, 32 by default) and for phones (16 to 80 px, 28 by default). The header grows to fit, and the width follows the logo's shape. The preview shows the logo at either height. Favicon The favicon is made for you from the mobile logo, or else the light logo. Choose Regenerate to make it again after you change a logo. To use your own, upload a square image of at least 512 × 512 px; it replaces the generated icon. The card previews it in a browser tab. Share image The share image is shown when a page is shared and has no image of its own. Use 1200 × 630 px. The tab previews how it looks on Facebook and LinkedIn , as an X, large card , in iMessage and in Slack . Each network crops a little differently, so keep the important part in the middle. A page's own share image, set in its page settings, wins over this one. The default title and description that go with it are on Search and sharing ."},{"title":"Search and sharing","route":"/builder/site-settings/search-and-sharing","headings":["Search and sharing","Site defaults","Previews","Structured data","Indexing","Hide the whole site","Canonical base address","Per page and per template","Sitemap","robots.txt","Redirects","With an AI agent"],"text":"Throttle Builder · Site settings Search and sharing The Search and sharing tab of Site decides how your store looks in Google and when a page is shared, which facts search engines read, what they may crawl and where old addresses go. Each page can override the defaults in its own page settings. Site defaults Used by every page that has not set its own. page is the page title and store your store name; the default is page – store . Up to 200 characters. ], [ Default description , The description for pages that have none of their own. One per store language. ], [ Default share image , Used when a page has no image of its own. You can also set it on the Brand tab. ], ] /> Previews Previews shows how a page looks when found or shared: a Google result on a computer and on a phone, and the cards that Facebook, X, iMessage and Slack draw. Pick the page to preview, for example a product page or a collection page. Google writes its own snippet sometimes, and the price and stock in a product result come from Product structured data. Structured data Structured data are facts search engines read to show prices, ratings and paths in results. They are written into the page HTML as JSON-LD. The tab has a switch for each kind, but only some of them change what your store writes today. A store that already writes its own Organization data can turn the automatic data off with the siteJsonLd: false option of createBuilderRoute . See Builder for developers . Structured data, indexing, robots.txt, the sitemap and redirects are read-only until your store has moved to the new site settings. The tab says: "Structured data, indexing, robots.txt, the sitemap and redirects switch on with the next Builder update. Until then you can edit the title, description and share image, and the other sections are read-only." Indexing What search engines may crawl, and where old addresses go. Hide the whole site Hide this whole site from search engines is for a store that is not ready. Every page tells Google and other crawlers not to list it, but pages still open for anyone with the link. While it is on, every Site tab shows a red warning. Turn it off before you go live. Canonical base address Search engines treat this address as the real one for every page. Use the site address without a path, such as https://shop.example.com. Leave it empty to use your store address. Per page and per template Noindex and canonical are set per page: open a page in Pages, then Page settings , Search . Templates set them once for every page they draw. These templates start as noindex: search results, cart, account, account verification, sign in, sign up and order complete. Sitemap The store publishes /sitemap.xml . Choose which kinds of address it lists: pages, products, collections, categories and tags (all on by default). Under Leave out of the sitemap , list addresses to skip, one per line, up to 200, or pick a page. robots.txt The store publishes a generated robots.txt . By default it disallows /cart, /account, /sign-in, /sign-up, /order/ and /search. Under Extra robots.txt lines you can add up to 50 lines of your own (User-agent, Allow, Disallow, Crawl-delay, Sitemap or # comments, 200 characters each); they go between the generated ones. Reset to default restores the standard lines. The tab warns about a line that would block the whole site. Redirects Redirects sends old addresses to new ones. Each row has From (a path such as /old-address; end it with * to match everything under it), To (a path or a full address) and Type : A site has up to 500 redirects, and a chain of redirects may be 3 hops long at most. Paths the store needs for itself cannot be redirected: /api, /_next, /sitemap.xml, /robots.txt, /favicon.ico and /.well-known. You can import and export the table as a CSV file. A store that is still being built is best hidden with the switch above rather than with robots.txt: robots.txt only asks crawlers not to read pages, while noindex tells them not to list them. With an AI agent An agent sets these in the seo section of update_site_settings , and a page's own title, description, image, noindex and canonical with update_page_meta . See the MCP tool reference and Pages and templates ."},{"title":"Theme and custom CSS","route":"/builder/site-settings/theme-and-css","headings":["Theme and custom CSS","Presets","Colours","Fonts, corners and spacing","Custom CSS","Custom CSS rules and limits","Related"],"text":"Throttle Builder · Site settings Theme and custom CSS The Theme tab of Site sets the look of every page at once: colours, fonts, corners and spacing. Below it, Custom CSS lets you add your own styles to the store. The tab has a live preview of the store as you change it. Presets A preset sets every colour, font and corner at once. There are three: Clean , Editorial and Bold . Pick one to start, then change what you like. Once you change a colour or a font, the theme is customized and your values are used instead of the preset's. Picking another preset then asks first: Replace my changes or Keep mine . Reset to preset throws your changes away. Colours The store has a Light palette and a Dark palette , each with the same 14 colours. Switch between them at the top of Colours . The tab warns when text and its background are under a 4.5:1 contrast ratio, the level that reads comfortably. [label, code: key , code: cssVar ]) /> A component's colour option takes either one of these theme colours or a fixed hex colour. A theme colour follows the palette, so it changes in dark mode; a hex colour does not. Fonts, corners and spacing [kind, list]) /> Custom CSS Custom CSS applies to your store pages, never to checkout. It is one stylesheet for the whole site, and it is not scoped: a rule can reach any element of the store pages. Use theme variables so presets and dark mode keep working. The editor is a code editor built for this: Highlighting and suggestions. Press Ctrl Space for suggestions: the store's theme variables with their current values, and the CSS class names your pages, header and footer use. Lint. Problems show as you type, with their line; Go to line jumps there. A variable your site does not set is a warning: it falls back to the property's default. Format. Shift Alt F tidies the stylesheet. Live preview. 300 ms after you stop typing, the preview takes the new CSS, as long as it has no errors. Save. Cmd or Ctrl S saves to the draft. A stylesheet with errors is not saved: fix them first. Publish the site to put it live. Custom CSS rules and limits The stylesheet is checked before it is saved, and any problem refuses the whole sheet, so a store never gets half a stylesheet. The rules keep the stylesheet from loading anything or running code: @media , @supports and @keyframes . @import , @font-face and every other at-rule are refused. At-rules nest 4 deep at most. ], [ Media queries , Widths in px, em or rem, plus prefers-reduced-motion, prefers-color-scheme, hover and pointer. ], [ url() , Only an absolute https address on your store’s media origin (an image from Media), with no query or fragment, or a small data:image/svg+xml (4 KB at most). ], [ Functions , The usual value functions are allowed: var, calc, min, max, clamp, colour functions (rgb, hsl, oklch, color-mix, light-dark and more), gradients, transforms, filters, shapes and counters. Functions that load a resource or run code (image-set, image, cross-fade, element, paint, src, expression) are refused. ], [ Properties , Any property and any custom property (--name), except behavior and binding. ], [ Selectors , Elements, classes, ids, :has, :not, :is, :where, :nth-*(An+B) and pseudo-elements. Attribute selectors only on data-*, aria-*, role, type, hidden, open and disabled. ], [ Text , Printable ASCII outside comments and strings; no backslash escapes in names or url(); no ; no javascript: or expression( in strings. ], ] /> Each refusal names its line and column and a stable code, such as SITE_CSS_AT_RULE , SITE_CSS_URL , SITE_CSS_URL_ORIGIN , SITE_CSS_FUNCTION , SITE_CSS_PROPERTY , SITE_CSS_SELECTOR , SITE_CSS_ESCAPE , SITE_CSS_SYNTAX or SITE_CSS_TOO_LARGE . Anyone who can edit the site can change custom CSS; others see it read only. An AI agent sets it as theme.customCss with update_site_settings , and the same rules apply. Related Sections and layout : per-section spacing and backgrounds. Components : colour and size options of each component. Site settings : which setting wins."},{"title":"Wording, delivery and shop","route":"/builder/site-settings/wording-delivery-shop","headings":["Wording, delivery and shop","Wording","Languages","Shop wording","Delivery","Shop display","Settings","Code components","Store pages"],"text":"Throttle Builder · Site settings Wording, delivery and shop Four smaller tabs of Site: Wording for the words around the store, Delivery for how published pages reach it, Shop display for product cards and product pages, and Settings for the code switch and the paths of the store's own pages. Wording The words around your store: the menu button, the account link, the announcement close button, the skip to content link, the breadcrumb home label, the footer copyright line and more. Leave a box empty to use the standard wording. Each box shows its key, such as nav.menu . Languages The tab lists the languages your store speaks; with Product Catalog installed, they are the languages set there. Otherwise choose Add language and use a language code such as fr or pt-BR. Switch the language at the top to edit its words. Words you do not translate show in the default language. Shop wording With Product Catalog installed, Shop wording holds the words of your shop, in groups: Shop page, Home page, Search, Product lists, Filters, Sorting, Product page, Cart, Navigation, Empty states, Errors, and Yes and no. Leave a box empty to use your catalog's wording. Each group shows how many words you changed. Until your store has moved to the new site settings, the tab says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet." Delivery How your store gets the pages you publish. You can switch at any time. Only an admin or developer of the store can change it. On build-time, Next release lists what is waiting. Release now builds your store once with everything published; you can release once every 10 seconds and 20 times an hour. The release history lists earlier releases, and Roll back to this makes the store use one of them again. The Deploy hook is the address your host (Vercel, Netlify or any https URL) gives you to start a build. Throttle calls it once for each release. Without one you can still release, but nothing is sent to your host. Your developer sets up the store side: see Builder delivery modes . Shop display Shop display comes with Product Catalog: without it, the tab asks you to install the catalog and link it in Connections. It sets how products look everywhere in the store. Every option starts on Default , which defers to your developer's code and then the standard look; what you set here wins over both (see which setting wins ). Until your store has moved to the new site settings, the tab says: "These show here now and are saved to your draft once the store upgrade is live, so they are not in what you publish yet." An AI agent's import_catalog_display is refused with SETTINGS_V2_NOT_ENABLED until then. Import from catalog copies how your Product Catalog shows products today into your draft, to start from. Review it, then publish. Badge colours come across too: the sale colour, the new colour and each custom badge's colour. A badge left on the catalog's default colour isn't copied, so it keeps your theme's colour, exactly as the store shows it today. Settings Code components Allow code widgets on this store is the store-wide switch for code components . It is on by default. Only an admin can turn code on; anyone who edits can turn it off. Turning it off stops every code widget on your store with the next page load, and nothing is deleted. Code never runs on checkout, cart, account or sign-in pages, whatever this switch says. Store pages Where the store's own pages live. Change a path only if it clashes with a page you already have. Only a person can change these, not an AI agent. Checkout is Throttle's hosted checkout. The cart page hands the shopper over to it, and the Order complete page welcomes them back."},{"title":"Troubleshooting","route":"/builder/troubleshooting","headings":["Troubleshooting","Common errors","PERMISSION_REQUIRED","Stale baseRev (DRAFT_CONFLICT)","Validation errors","A component is not available in your store","Changes are not showing on the store","A preview link has expired","Code does not run on the cart, checkout or account","Catalog components show placeholders","The Troubleshooting list on the Keys and AI agents screen","{entry.symptom}"],"text":"Throttle Builder Troubleshooting Find the symptom, read why it happens and follow the steps. The first part is every entry of the Troubleshooting list on the Keys and AI agents screen; the second covers common problems in the store itself. Common errors PERMISSION_REQUIRED The key or connection has too low a level for the call. The answer names what is missing: level:publish , level:full or draft . Raise its level under Keys or Hosted assistants ; it applies on the next call. See access levels and the full entry below . Stale baseRev (DRAFT_CONFLICT) The draft changed after the draftRev the agent wrote against, because you or another agent edited it. Nothing was saved. Ask the agent to read the page again and redo the change. When publishing, ask for a new preview and look at it first. In the editor the same thing shows as the banner with Keep mine and Reload their version . See baseRev . Validation errors DOCUMENT_INVALID means a change would break a placement rule or a setting value. Nothing was saved, and the answer lists each issue with its path and message. Ask the agent to fix those and try again, and to run validate_page before publishing. PUBLISH_BLOCKED lists what would break the live store. A component is not available in your store A component newer than the @usethrottle/storefront-react installed in your store cannot be drawn there. Update the package (and keep @usethrottle/builder-react on 0.5 and @usethrottle/builder-schema on 0.4). See Builder for developers . Changes are not showing on the store Check that you published , not only saved. The top bar should not say Unpublished changes. In Build-time delivery a publish waits for Release . See Publishing . In Live delivery your store learns of a publish through a signed webhook and a cache check, so the page refreshes within moments. If the webhook is not set up or your host cannot receive it, a page can stay cached for up to an hour. Reload with the cache bypassed once. If one page stays stale, publish it again. A preview link has expired Preview links run out: a person's link after 1 hour, an agent's draft link after 12 hours and the store preview link after 1 hour. Make a new one with Preview link , or ask the agent for fresh ones with get_preview_url . Code does not run on the cart, checkout or account That is on purpose. Scripts never run on cart, checkout, account, sign-in, sign-up or order-complete pages, whatever you set. The markup and CSS still show. If code does not run elsewhere, check that Allow code widgets on this store is on in Site settings, that you published the page, and that you are looking at the store preview link, not the editor preview. See code components . Catalog components show placeholders Product grids, collections and similar components need your Product Catalog. With no catalog key linked, they show a placeholder in the editor and the preview ("Connect your catalog key in Site settings, Connections"). Open Connections , check that Product Catalog says Installed and link the catalog server key (a pc_pk_ key made with the server channel). See also the menu entry below . The Troubleshooting list on the Keys and AI agents screen These are all entries.length entries, in the same order and words as the screen. On the screen, #/keys?help=<id> opens one. entries.map((entry) => ( entry.symptom Code: entry.code Why: entry.why Fix: entry.fix.map((step) => step ) entry.copy && ))"},{"title":"Build a checkout that settles cleanly.","route":"/developers","headings":["Build a checkout that settles cleanly.","Choose Your Path","{title}","Canonical URLs"],"text":"Native checkout docs Build a checkout that settles cleanly. Throttle gives your storefront a hosted payment surface, server-side checkout sessions, signed webhooks, native carts, and shipping/tax calculation. Start the quickstart View API reference 1. Merchant backend Creates a checkout session with a secret API key. 2. Buyer browser Mounts the payment iframe and receives postMessage events. 3. Merchant webhook Receives signed durable payment and order events. Choose Your Path V1 focuses on native Throttle checkout and carts. Start with a payment-only embed, then add carts, shipping, tax, and webhooks as your integration grows. Building an app for other merchants to install rather than integrating your own store? That path starts with extensions. paths.map(( href, title, body, icon ) => ( title body Open guide )) Canonical URLs Examples use the branded Throttle URLs below. Keep these values on your backend unless the variable is explicitly prefixed for browser use."},{"title":"Analytics","route":"/developers/analytics","headings":["Analytics","Which one","Pages in this section"],"text":"Analytics Analytics There are two ways to get analytics off a Throttle checkout: Throttle s first-party tracking settings for GA4 and Meta, or your own script. Pick based on whether a vendor secret is involved. Which one Google Analytics 4 and GTM — the built-in path. The Measurement Protocol API secret stays server-side. , ], [ Meta purchase tracking, including the Conversions API, and attribution capture , html: Track conversions — Meta s Conversions API token stays server-side. , ], [ Something Throttle does not build in — a custom collector, cookie-based attribution stitching, a vendor with no secret to protect , html: Your own scripts — merchant-authored JavaScript Throttle runs in an isolated sandbox on hosted checkout. , ], [ A product feed for Google Merchant Center / Meta Commerce Manager , html: Product feeds — Throttle stores no catalog, so this is a recipe for building one from your own catalog source. , ], ] /> Pages in this section Google Analytics 4 and GTM — setup for every surface, the event reference, consent, and server-side purchases and refunds. Track Conversions — Meta purchase events, server-side forwarding, clientContext attribution. Your Own Scripts — the register() contract, consent, external domains, and the management API. Product Feeds — feeds live with your catalog; keep referenceId equal to the feed item id."},{"title":"Google Analytics 4 and GTM","route":"/developers/analytics/google-analytics-4","headings":["Google Analytics 4 and GTM","What runs where","Set up","Hosted pages","Embedded checkout","Option 1: the loader on your page","Option 2: the React embed","Secure Fields (your own card form)","What is automatic","Funnel events","Passing the visit from your server instead","Headless storefronts","Script tag","npm","Next.js App Router","Options","GTM and a Google tag together","GA4 inside your GTM container only","Event and dataLayer reference","Ecommerce params","What you publish","The dataLayer shape","Custom events","Consent and Consent Mode v2","Cross-domain","Joining the purchase to the visit","analyticsContext()","clientContext on cart routes","Server-side purchases and refunds","Status","Debugging","FAQ","Purchases show as Unassigned or Direct in GA4","I see two purchases","I get no events on a headless site","Events fire twice on a Next.js site","Which environment does a sandbox use?","Does Throttle change my GTM container?","Related"],"text":"Analytics Google Analytics 4 and GTM Throttle sends the GA4 ecommerce funnel from hosted pages, embedded checkout and your own storefront. It sends purchase and refund from its server, so ad blockers and closed tabs do not lose a sale. What runs where gtag.js for your G-ID. GTM never loads on a Throttle domain. , Sent by the hosted page. , Throttle server. , ], [ Embedded checkout (iframe) , None in the iframe. Your page owns the tag. , html: The iframe forwards each event to your page. @usethrottle/scripts or onAnalyticsEvent sends it. , Throttle server. , ], [ Secure Fields (your own card form) , Your page owns the tag. , html: You send them. See Secure Fields . , Throttle server. , ], [ Headless storefront , html: @usethrottle/scripts loads gtag.js, GTM, or both. , html: You publish storefront events. The loader maps them to GA4. Checkout events come from Throttle. , Throttle server. , ], ] /> A GTM container runs arbitrary code. Hosted pages show a card form and buyer details, so Throttle will not run your container there. A GTM container ID saved in Tracking settings is used on your own storefront only. Hosted pages ignore it. Set up The server sends a purchase whenever both the Measurement ID and the API secret are saved. serverSideEnabled no longer controls GA4. It now gates the Meta Conversions API only. With an ID and no secret, purchases come from the browser, and the dashboard shows a warning that ad blockers and embedded checkouts will miss them. Hosted pages No code. Once the ID is saved, these pages load your G-ID and send the events in the event table . page_view , begin_checkout , add_shipping_info , add_payment_info . The Meta pixel runs here too. ], [ code: /cart/:cartSessionId , html: page_view , view_cart , add_to_cart , remove_from_cart . ], [ code: /q/:token , html: page_view , view_quote , accept_quote . ], [ code: /q/request/:formToken , html: page_view , generate_lead . ], [ code: /billing/:token , html: page_view only. ], ] /> URLs are redacted. Hosted URLs contain a capability id. GA4 receives /c/:token as page_location and page_referrer , with only utm_* and gclid kept from the query. This holds whatever your data stream s Google tag settings are, including "Ignore duplicate instances of on-page configuration". Enhanced measurement does not see hosted pages. Your tag runs in a hidden, token-free frame on the hosted page, so the automatic page_view is the only page-level event it sends there. Scrolls, outbound clicks, form interactions and file downloads on hosted pages are not measured. Page titles. Each page has its own: Checkout, Cart, Quote, Request a quote and Update payment method. Meta pixel. Only /c and /s load it. The other pages do not. Consent. Append ?consent=granted or ?consent=denied to the hosted URL. See Consent . Abandoned-cart links ( /r ) render nothing. They, the hosted cart's Checkout button, the quote page's accept and continue-to-checkout buttons, and the /c to /s redirect pass consent , utm_* , gclid , gbraid , wbraid , _gl and _tga on to checkout. Never in the iframe. Hosted analytics does not run in embed mode. Embedded checkout The iframe runs no Google tag. It posts each funnel event to your page as throttle.scriptEvent , only to origins in the application s allowed origins. Your page sends them to GA4. Pick one of two ways. Option 1: the loader on your page Install @usethrottle/scripts (see Headless below). It listens for the iframe, maps each event, and sends it. On throttle.ready it also hands the iframe your GA client id, session id, UTMs and consent. Option 2: the React embed onAnalyticsEvent receives GA4 names and params. It does not fire purchase when the server is already sending it. The embed reads your _ga cookies and posts them into the iframe, because the iframe s own cookies are third-party. If you send purchase yourself from throttle.completed or onSucceeded , remove it. With an API secret saved, Throttle sends the purchase from the server, and a second one double-counts revenue. If you must keep yours, turn off Throttle sends purchase events in Tracking settings ( sendPurchaseEvents: false ). Secure Fields (your own card form) With Secure Fields the whole checkout page is yours, so Throttle sends no browser events from it. Purchases and refunds still come from Throttle s server. What is automatic Purchase and refunds. Once the Measurement ID and API secret are saved, Throttle sends purchase when the payment is captured and refund for each refund, from its server. The visit. When pay() or complete() runs, useSecureCard reads your page s _ga and _ga_<stream> cookies, UTMs and click ids, and sends them as clientContext on /complete . The server purchase then joins the buyer s GA4 session. Reading the context can never fail the payment. Overrides. Pass the clientContext prop on SecureCardProvider to set keys yourself, for example consent: analytics: false when the visitor declined, or a gaSessionId when your page runs more than one GA4 property. Your keys win, one by one. With a custom completeFn , the hook passes the context as clientContext in its arguments; send it on your own /complete call. Funnel events Send the funnel from your own page. With @usethrottle/scripts , publish the cart events ( cart.viewed , cart.item_added , ...) and use Throttle.track() for custom events. track() refuses purchase , refund , begin_checkout , add_shipping_info and add_payment_info , and publish() refuses every checkout.* name. Send the three checkout steps with gtag directly. Do not send purchase from the browser: the server already sends it, and a second one double-counts revenue. Passing the visit from your server instead You can also send clientContext when your server creates the checkout session. Read it in the browser with Throttle.analyticsContext() and pass it through. At completion the hook s context is merged over it, key by key, and the completion value wins. Headless storefronts Throttle cannot see "},{"title":"Product Feeds Live With Your Catalog","route":"/developers/analytics/product-feeds","headings":["Product Feeds Live With Your Catalog","Why Throttle does not generate feeds","Reference: Next.js feed route from a CMS","The ID-consistency contract"],"text":"Analytics Product Feeds Live With Your Catalog Throttle stores no product catalog by design — feeds for Google Merchant Center, Meta Commerce Manager, and other ad platforms belong to your catalog source. Why Throttle does not generate feeds Products are not stored in Throttle. Product and line item data arrives from your cart/checkout payload and is saved as cart and order line items — Throttle is the system of record for transactions , not for your catalog. A product feed needs the full catalog (every product, in stock or not, with images, descriptions, and category data), which only your catalog source has. Reference: Next.js feed route from a CMS A compact route handler that renders a Google Merchant Center RSS 2.0 feed from a CMS query. Meta Commerce Manager accepts the same format, so one feed URL usually serves both platforms. The ID-consistency contract Dynamic remarketing only works when the ids in your purchase events match the ids in your feed. Throttle carries your catalog id through checkout untouched — but only if you send it. The referenceId your cart integration sends Throttle on each line item (surfaced as sku on throttle.completed and used as content_ids / item_id in purchase events ) must equal the feed item id ( <g:id> ). If they diverge, Google and Meta cannot join purchases back to catalog items and dynamic remarketing silently degrades. Use one canonical id — typically the SKU — in both places. Same id everywhere: feed g:id , cart line item referenceId , and any pixel ViewContent / AddToCart events your storefront fires. Variants: if your feed lists variants as separate items ( g:item_group_id grouping), send the variant id as referenceId , not the parent product id. Server-side too: Throttle's server-side conversions build content_ids from the order line items' referenceId — a missing referenceId drops that item from the join."},{"title":"Track Conversions in GA4 and Meta","route":"/developers/analytics/track-conversions","headings":["Track Conversions in GA4 and Meta","How it works","Embed recipe","Hosted setup","Server-side conversions","Attribution capture (clientContext)"],"text":"Analytics Track Conversions in GA4 and Meta Fire purchase events from the embed with zero extra fetches, let the hosted page inject your pixels for you, or forward conversions server-side — with attribution captured end to end. How it works Where the purchase event fires depends on which checkout surface you use. In the embed, your page hosts the pixels; on the hosted page, Throttle injects them. Google Analytics 4 and GTM . For Meta, throttle.completed (and onSucceeded in the React SDK) carries total , currency , and lineItems so you fire the pixel event yourself — no extra fetch. Throttle never injects pixels inside the iframe; that would double-count. , ], [ Hosted checkout page , Throttle — gtag.js and/or the Meta pixel are injected when tracking settings are configured. The GA4 tag loads under Consent Mode; the Meta pixel waits for consent. , The GA4 funnel fires from the page. With a GA4 API secret, the GA4 purchase comes from the server; without one, the page sends it before the redirect, using beacon transport. The Meta purchase fires from the page. , ], [ Server-side (either surface) , Nobody — Throttle forwards the purchase from its backend. , html: When enabled, Throttle POSTs the purchase to the GA4 Measurement Protocol and Meta Conversions API at the payment moment, using the attribution snapshot on order.clientContext . , ] ] /> Embed recipe Protocol v1.4 additively extends throttle.completed with total (minor units), currency , and lineItems . Convert minor units to major with toDecimalString(total, currency) from @usethrottle/money before handing values to analytics; dividing by 100 is wrong for JPY and KWD. Each line item's sku is the merchant catalog id (the cart line item's referenceId ). Use it as item_id / content_ids so purchase events join against your product feed for dynamic remarketing. The analytics fields are optional — payment-only sessions with no cart snapshot omit them, so guard with fallbacks as above. Hosted setup For the hosted checkout page, configure tracking once per application and environment via GET/PUT /api/v1/tracking-settings . Only the public ids reach the buyer's browser; secrets stay server-side and come back masked from GET . requireConsent defaults to false . When it is on, the GA4 tag loads with every signal denied until you pass consent=granted on the checkout URL, and the Meta pixel waits for the same signal. An explicit consent=denied always wins. Server-side forwarding reads the same choice from clientContext.consent : marketing gates Meta, and for GA4 a denied choice sends the purchase with denied ad flags. See Google Analytics 4 and GTM . Server-side conversions Browser pixels miss buyers with ad blockers and tabs closed mid-redirect. Save the per-channel secrets and Throttle forwards the purchase from its backend at the payment moment. GA4 needs only its ID and API secret. serverSideEnabled gates Meta only. Throttle sends: card payments at capture, Net-N invoices at authorization (issuance), and subscription renewal charges skipped — renewals are not new acquisitions. GA4 Measurement Protocol — sends a purchase event with transaction_id set to the order id, using the captured gaClientId / gaSessionId when available. Requires ga4MeasurementId + ga4ApiSecret (create the API secret under the GA4 data stream's Measurement Protocol settings). Meta Conversions API — sends a Purchase event with event_id set to the order id and user_data built from the SHA-256-hashed buyer email, server-stamped IP address and user agent, and the fbp / fbc cookies from clientContext . Requires metaPixelId + metaCapiAccessToken . or server — Measurement Protocol and gtag purchases do not reliably dedup. With a GA4 API secret saved, the hosted page and the embed bridge skip the browser purchase . If you send your own from throttle.completed , remove it. transaction_id = orderId guards against page-level double-fires. , ], [ Meta , html: Both fire — the browser pixel and CAPI event are deduplicated natively by Meta via eventID = orderId . Keep the browser fbq Purchase in place; it improves match quality. , ] ] /> Forwarding failures are logged and not retried in v1. Treat server-side conversions as an analytics signal, not an accounting source of truth — use webhooks for durable side effects. Attribution capture (clientContext) POST /api/v1/checkout/sessions accepts an optional clientContext attribution blob. The hosted page also auto-captures what it can at completion (UTMs, click ids, GA and Meta cookies, landing page, referrer) and Throttle merges the two per key — completion-time values win — then server-stamps ipAddress and userAgent . The merged snapshot lands on order.clientContext (merchant order GET ) and on the order.created webhook payload. clientContext is also accepted on POST /api/v1/cart-sessions/{id}/checkout-session and POST /api/v1/carts/{id}/finalize . Accepted keys: landingPage , referrer , utmSource , utmMedium , utmCampaign , utmTerm , utmContent , gclid , fbclid , msclkid , ttclid , gaClientId , gaSessionId , fbp , fbc , and consent ( analytics?, marketing?, adUserData?, adPersonalization? ). Unknown keys are rejected; ipAddress / userAgent are server-stamped and rejected as client input. The buyer's first-party attribution cookies live on your domain, not the checkout domain. Capture UTMs, click ids, and the _ga / _fbp / _fbc cookies on your storefront, persist them with the cart, and send them as clientContext when your server mints the session. The hosted page's completion-time capture is a best-effort fallback."},{"title":"API Surface by Integration Task","route":"/developers/api-reference","headings":["API Surface by Integration Task","{group.title}"],"text":"Curated reference API Surface by Integration Task Start here for the endpoints most native checkout integrations need. Use the full OpenAPI reference when you need every schema and response field. Open full Swagger docs Download OpenAPI JSON endpointGroups.map((group) => ( group.title group.description group.endpoints.map((endpoint) => ( )) ))"},{"title":"Throttle Builder","route":"/developers/builder","headings":["Throttle Builder","The pieces","Versions: what a store must run","Keys","Quick start: a live Next.js store","Wiring a store by hand","What it costs your host","Build with an AI agent","For merchants and for authors of widgets"],"text":"Developers / Throttle Builder Throttle Builder Throttle Builder is a marketplace extension where a merchant builds the pages, header, footer and announcement bar of a headless store with a visual editor, an API or an AI assistant. Your store reads what the merchant published and draws it with its own widgets. Nothing about the store's catalog, cart or checkout moves into the Builder. The pieces The SDK ], [ code: @usethrottle/builder-react , Renders a page document as React: the provider, header, footer, slots, the page route and the sitemap. , html: Rendering ], [ code: @usethrottle/builder-schema , The page document, site settings, limits and widget definitions as zod schemas. Pure TypeScript, no React. , html: Document schema ], [ code: @usethrottle/storefront-react/builder , The catalog and commerce widget packs: product grids, shelves, carousels, search, cart and account widgets. , html: Widget guideline ], [ MCP server , One address for an AI agent: connect with a key or by signing in, choose read, draft, publish or full, and the agent checks its own work in a browser. , html: MCP server ], [ Widget API , Create, version, validate and switch off custom widgets with a secret key. , html: Widget API ], [ Delivery modes , A store reads the Builder live, or from a frozen release at build time. , html: Delivery modes ], ] /> Images the merchant uploads live in the media library . The Builder freezes each one it uses, with its width variants, into the published page, so a store never calls Throttle for an image while rendering. Versions: what a store must run The Builder can place saved sections, interactions (tabs, accordion, carousel, show and hide), the countdown widget, entrance animation, custom CSS and code widgets. A store must run @usethrottle/builder-react 0.4.0 or later and @usethrottle/builder-schema 0.2.1 or later before a merchant or an AI agent uses any of them. Upgrade the store first. Fails to render. The page does not draw. ], [ A code widget , Draws nothing and runs nothing: code needs the renderer of 0.4.0. ], ] /> Pages that use none of these draw exactly as before on every version, so upgrading changes nothing for them. If you manage a store for a merchant, upgrade before turning the code switch or an agent's level up. Keys A merchant has at most 20 active publishable keys and 2 active secret keys. A key is shown once, when it is made, and only its last four characters afterwards. createBuilderClient refuses a tb_sk_ key. Quick start: a live Next.js store In live mode the store reads the Builder while it runs and clears its cache when the Builder sends a signed change notice. This is the default. For a store that reads a frozen release at build time instead, see Builder delivery modes . The shortest correct path is to let create-store write the files, then change four of them: (or at its own path) within a few seconds. , ] /> The secret the endpoint shows once is THROTTLE_BUILDER_WEBHOOK_SECRET . Without the endpoint, a published change reaches the store only when the hour-long cache runs out. Each part is explained on its own page: rendering , the SDK . Wiring a store by hand The pieces a hand-made store must get right, each learned the hard way: Mount both providers, in this order. A header or footer with a cart button or search box (catalog widgets) fails with "useStorefront() was called outside a StorefrontProvider" on every page unless StorefrontNextProvider wraps BuilderProvider . Draw the Builder's header and footer yourself. BuilderProvider only supplies them; the store mounts BuilderHeader and BuilderFooter . StoreFrame draws the package's own header and footer instead, so what a merchant publishes would never show. Leave Cache Components off. create-next-app on Next 16 turns cacheComponents on; loadSite reads the clock for the announcement bar, and the build stops with "Route / : Next.js encountered the unstable value Date.now() while prerendering". Remove cacheComponents and partialPrefetching from next.config.ts . Install every peer. storefront-react needs @usethrottle/catalog , @usethrottle/money , @usethrottle/auth (0.17 or later) and @usethrottle/ui ; pnpm add of the three Builder packages alone leaves the build failing or warning. The home page is at / . With createBuilderRoute in app/(store)/[[...path]] , delete app/page.tsx . A page without its own path is at /pages/<slug> . Put THROTTLE_BUILDER_KEY in your server environment only, never in a NEXT_PUBLIC_ variable. A server-channel key refuses any request that carries an Origin , so a browser could not use it anyway. What it costs your host The Builder is built so a store pays close to nothing for it on a host that bills for cached pages. Live mode. Every Builder read is cached for at least an hour ( revalidate: 3600 , with no option for less). A change notice clears only the cache tags of what changed, so a page edit refreshes that page and not the whole site. Publishing the site (theme, menus, brand, announcement) or the header or footer is different: every page reads those, so every page you then visit is rebuilt once. The catalog product pages prerender no product by default ( staticParams is 0, and the cap is 50), and a Builder page is rendered on its first visit. Build mode. One full build per release and no Builder-driven ISR writes. Every page of the release is generated at build, on purpose. The cost rules of the catalog routes are in Keeping ISR costs down . Build with an AI agent Connect an AI agent with one address, https://builder.usethrottle.dev/mcp : claude.ai and Claude desktop sign in with that address alone, and coding tools (Claude Code, Cursor, VS Code, Windsurf) add a key. The agent reads your store, edits the draft, opens a preview link in a browser of its own at 390, 768 and 1280 px, and publishes only if you gave it the Publish or Full level. Start at Connect an AI agent . For merchants and for authors of widgets Widget guideline "},{"title":"Builder delivery modes","route":"/developers/builder-delivery-modes","headings":["Builder delivery modes","Live and build","What shows up, and when","Releases, the Release button and the deploy hook","The build client","The announcement bar","Next.js"],"text":"Developers / Throttle Builder Builder delivery modes A store reads its Throttle Builder pages in one of two ways, chosen per store: live (the default) or build . In build mode the store generates every page from a frozen release when you build it and makes no Builder request while it runs. Live and build Live mode is unchanged by build mode. In the Builder, a store's release settings say which mode it is in; switching to build mode gives up any change notices still waiting, because nothing reads them. What shows up, and when Measured on a real store in each mode (a Next.js store, the Builder worker, a change made and published in the editor). Live times are from the moment the publish returned to the moment the page showed it; the signed notice arrives about 2 to 3 seconds after the publish (the Builder gathers one notice per burst of changes). (or its own path) in about 2 seconds; the page list tag is cleared too. , Release, then build. ], [ A deleted page , The page stays live until the deletion is published (Pages and templates, Publish deletion; an AI key at the Full level can publish it). Then it answers 404 in about 3 seconds. , Publish the deletion, Release, build. Until then the old release still serves it. ], [ Menus , Publish the site settings. The site, header and footer tags are cleared: about 4 seconds, on every page. , Publish the site settings, Release, build. ], [ Site settings, brand, announcement , Same as menus: publish the site settings, about 4 seconds. , Release, build. The announcement start and end times are the exception, see below. ], [ Theme , Same as menus. , Release, build. ], [ Header or footer , Publish the part. Only that part tag is cleared: about 4 seconds, on every page. , Release, build. ], [ A saved section , Publish the saved section (it needs the Full level for an AI key). The notice names every published page that uses it: about 4 seconds, and the pages need no publish of their own. , Release, build. ], [ A store template (shop, product, ...) or a slot , Publish it. Its own tag is cleared. , Release, build. ], [ Catalog data (a product title, a price) , Not a Builder change. The catalog tells the store through its signed storefront.changed webhook (to /api/throttle/revalidate), or an open browser tab notices the generation change within 60 seconds and calls /api/throttle/sync. With neither, the store shows the change when its hour-long cache runs out. , The same, and it needs no rebuild: catalog pages render per request from the catalog, and the frozen release is not touched. ], ] /> Releases, the Release button and the deploy hook In build mode, published changes pile up. Release (in the Builder, or a secret key holding releases:write ) freezes everything published at that moment into one immutable release: site settings, every page, the header and footer, slots, the frozen custom widgets and the frozen assets. A release id never changes what it holds, and a rollback is a new release of an older snapshot. Set a deploy hook in the Builder's release settings (Vercel: Project Settings, Git, Deploy Hooks; Netlify and any https URL work too). Each release calls it once, with retries, and the host builds the store again. A store with no hook still releases; you start the build yourself. The build client getReleaseBundle({ release? }) reads GET /v1/releases/latest/bundle or GET /v1/releases/:id/bundle , once per process. The release is the argument, else the client's release option, else the BUILDER_RELEASE_ID environment variable, else the newest. A value that is not a 26-character release id fails with a message naming it, before any request. The client sends no cache tags, runs no generation watcher and listens for no notices. Every other read of the client ( site , pages , parts , slots , bundle ) is answered from the bundle, so @usethrottle/builder-react renders it with no network. Put THROTTLE_BUILDER_KEY in your server and build environment only, never in a NEXT_PUBLIC_ variable. The browser needs no Builder key in build mode. A bundle is read into memory whole, up to 48 MB, so the build machine needs that headroom. A response that is cut short fails with "bundle truncated (too large or interrupted)". A build that cannot read its release (a wrong id, a site with no release yet, a refused key, Builder down) fails the build with a clear error. It never bakes a store without its header and footer into every page, which is what a live store does to ride out an outage. The announcement bar A release holds the announcement with its on/off switch and its startsAt and endsAt . The window is decided when a page is rendered, not when the release is made, because build-time sites get no change notices. The Builder pages of a build-mode store are generated once, at build, so on them a start or end time that passes after the build only takes effect with the next release. The bar also shows on pages rendered per request (the catalog pages: shop, search, products), and on those it turns on and off at its times with no rebuild. Next.js builderStaticParams lists every page of the release and refuses a live client. Build mode is the one place a store generates every page: a release is one build, not one write per visit. create-store sets all of this up: The scaffold reads the newest release (or BUILDER_RELEASE_ID ) once, in next.config.ts , and writes it to .builder/release.json . Next copies that file into the build output ( outputFileTracingIncludes ), and every page, the layout's header, footer and slots, and the sitemap render from it. The running store makes no Builder request at all, not even on a cold instance rendering search or a product page, and needs no Builder key. If the file is missing or corrupt at run time the page fails with a clear error, even when the key is set on the host: a quiet fallback would download the whole release on every cold start. Only next dev reads from the Builder (a fresh release when the"},{"title":"Document schema","route":"/developers/builder/document-schema","headings":["Document schema","The page document","Responsive overrides","Data bindings","Validating and upgrading","Edit operations","Limits","Site settings","Saved sections","Interactions and entrance animation","Countdown","Custom CSS and code widgets","What the package exports"],"text":"Developers / Throttle Builder Document schema @usethrottle/builder-schema is the one definition of what a Builder page is. The Worker, the editor, the MCP tools and the renderer all validate with it. It is pure TypeScript plus zod 4: no React, no I/O, no Node imports. The page document A document is { schemaVersion: 1, sections, customWidgets?, assets? } (a section in sections may be a saved-section reference). The last two appear only in a published snapshot: the frozen custom widgets and the frozen media assets the page uses. The header, the footer and each slot are documents of the same shape. columns , , html: Props: width (boxed or full), contentWidth (600 to 1600), gap , paddingX , paddingY , minHeight , verticalAlign , background , stackOrder , flat (true makes the inner box, row, columns and built-in widget boxes display: contents , so widget markup lays out as the section\\ s own content; the boxes that go lose their own margin, padding and background (a built-in widget\\ s spacing, a column\\ s padding and background) and the section\\ s vertical align stops applying; anchors and entrance animations on a column or built-in widget have no effect; a custom or code widget keeps its box, and a section with an interaction ignores it), hidden , anchor . ], [ code: column , Widgets and inner sections , html: Props: width (a percent from 10 to 100, at most 2 decimals), verticalAlign , padding , background , hidden , anchor . Desktop widths add up to 100. ], [ code: saved-section , Nothing (a reference) , html: Root only: ref is the ULID of a saved-section document. See Saved sections . ], [ code: inner-section , 1 to 6 inner columns of widgets , Goes inside a top-level column only, never inside another inner section. ], [ widget , Nothing , html: type ( basic. , catalog. , commerce. or custom. ), v , props , optional responsive and data . ], ] /> A node id is 8 to 24 lower-case letters and digits, unique in the document. Every object is strict : an unknown key is an error, and prototype names ( __proto__ , constructor , prototype ) are refused anywhere in props, params or overrides. A colour is token:name or #rrggbb (or with alpha). Spacing is a token ( none xs s m l xl 2xl ) or a number of pixels. An anchor starts with a letter and uses letters, digits, - and _ (64 at most). A setting value is a string, number, boolean, null, a list or a map of those. A translatable text is a map of locale tag to text. Responsive overrides A node's props are the desktop values. responsive.tablet and responsive.phone hold sparse overrides. Desktop is 1025 pixels and wider, tablet 768 to 1024, phone 767 and narrower. Tablet inherits desktop, and phone inherits tablet. In an override, null means no override here : inherit again. A setting can therefore never be overridden to null . A tablet or phone width override must set every column of its section, or none. Data bindings A widget's data maps each input name to a binding: { source: catalog.products , params } for a source, or { source: context.product } (no params) for what the slot it sits in knows. An unknown source is SOURCE_NOT_ENABLED , and a source whose result type the input does not accept is RESULT_TYPE_MISMATCH . Money in a source's answer is { amount, currency, display } ; show display . Validating and upgrading An issue is { path, code, message } (at most 50 per answer). CURRENT_SCHEMA_VERSION is 1. A client upgrades an older document and refuses a newer one. validateDocument checks a document against a widget registry ( createRegistry ), which is how the Worker knows a widget, its settings and its sources exist. Edit operations The MCP apply_ops tool takes exactly these ( agentDocOpsSchema , 1 to 500 operations, atomic). The editor's own schema also allows replaceDocument and the restore form of upgradeNode ; both are refused for an agent, and an agent upgrades forward only. invertOps returns the batch that undoes one. The undo contract is deep equality, not byte equality. Limits An editor autosaves after 800 ms of quiet and at least every 3 seconds. A preview link lasts one hour. The widget limits are on the Widget API page . Site settings brand : store name, light and dark logo and favicon, as media asset ids. theme : a preset ( clean , editorial or bold ); while customized is false the preset's tokens apply, and when true the store's own light and dark palettes do. Fonts for heading, body and mono come from a fixed list. radius is 0 to 32, and the spacing scale is compact, comfortable or roomy. menus : named menus of items (a label per locale and a target: a page, a URL, or a catalog category, collection, product or search). announcement : the bar, with an on/off switch and an optional startsAt and endsAt . seo : the title template ( {page} and {store} ), the default description and the default share image. routes.page is where Builder pages live in the store ( /pages/{handle} by default). The Builder calls its home page / , and the store decides where to serve it (by default /pages/home ; see pagePath in the rendering docs). locales , strings (wording per locale), connections.throttlePublishableKey and storeUrl . The read API answers settings resolved for one locale, so a localized value is a string there, not a map. Saved sections A saved section is a document of its own, so many pages can share one section. A page uses it through a reference node, which is allowed at the root of a document only and counts as one section. A reference inside a column is SAVED_SECTION_ROOT_ONLY . ref is the ULID of the saved-section document. That document is a page document with exactly one section and no reference ( savedSectionDocumentSchema ; anything else is SAVED_SECTION_ONE_SECTION ). A site holds up to 200 saved sections ( LIMITS.savedSectionsPerSite ). insert , remove , move and setProps ( hidden and anchor only) work on a reference like on"},{"title":"Builder MCP server","route":"/developers/builder/mcp","headings":["Builder MCP server","What this is, if you have never used MCP","Connect an AI agent","claude.ai or Claude desktop: the address only","Coding tools: the address and a key","Claude Code","Cursor","VS Code","Windsurf","Other MCP clients","Let your agent see its work","What the preview call returns","A first request to try","Levels, and the code switch","Who may grant what","What a level cannot do","Keys you made before levels","How an agent works on your store","Undo","What an agent can build","Code widgets","Credentials","OAuth for hosted assistants","Levels on the consent screen","Drafts, and publishing when the level allows","Scopes","Conventions","Tools","{group.title}","Troubleshooting"],"text":"Developers / Throttle Builder Builder MCP server An AI agent can build a store's pages, saved sections and design through the Builder's MCP server. It is one address for every store: https://builder.usethrottle.dev/mcp (Streamable HTTP, POST only, stateless, JSON answers). The store is chosen by the key you give the agent, or by what you pick when you sign in. What the agent may do is set by its level : read, draft, publish or full. Saved sections, interactions (tabs, accordion, carousel, show and hide), the countdown, custom CSS and code widgets need a store that runs @usethrottle/builder-react 0.4.0 or later and @usethrottle/builder-schema 0.2.1 or later . A store still on 0.3.x is not broken by an agent that uses them, but it shows less: interactions are drawn as a plain row of columns, a countdown is empty, custom CSS is ignored, and a page that contains a saved-section reference fails to render . Upgrade the store first. See Versions . What this is, if you have never used MCP MCP (Model Context Protocol) is the standard way to plug a tool into an AI assistant. The Builder is the tool; the assistant (Claude, or the AI in your code editor) is the one that uses it. Once connected, you describe what you want in plain words ("add a winter sale page with a countdown") and the assistant reads your store, makes the change as a draft , looks at the result in a browser, and, if you allowed it, publishes. Connecting means telling the assistant two things: the address above, and who it is allowed to act as. There are two ways to do that, and you only need one. The address only. You sign in to Throttle and approve. No key. , A Throttle login with access to the store. ], [ Claude Code, Cursor, VS Code, Windsurf or any other coding tool , html: The address and a key. The key is a password you make in the Builder and paste into the tool. , A key from Keys and AI agents in Throttle Builder. ], ] /> Connect an AI agent claude.ai or Claude desktop: the address only If Claude says it could not connect, wait up to 5 minutes after you added it (Claude takes a moment to recognise a new connector) and connect again. You can change the level later without connecting again, and revoke the connection at any time, in Throttle Builder under Keys and AI agents . Coding tools: the address and a key In every snippet, tb_sk_PASTE_YOUR_KEY stands for your key. Use a secret key ( tb_sk_... ); a publishable key ( tb_pk_... ) never works here. Claude Code Run this once in a terminal, from the folder you work in. Then run claude mcp list : throttle-builder should say Connected. Cursor Save as ~/.cursor/mcp.json (your own user config, which is not part of any project), then restart Cursor. In Cursor Settings, MCP: throttle-builder shows a green dot and its tools. Want it in a project file ( .cursor/mcp.json )? Those files are often committed, so keep the key out of it: set an environment variable named THROTTLE_BUILDER_KEY to your key and use this. VS Code Save as ~/.copilot/mcp-config.json (VS Code's user-level Copilot config, not part of any project), then run MCP: List Servers and check throttle-builder is listed (start it if it shows Stopped). Copilot Chat in Agent mode then lists its tools. Want it in the project? Save this as .mcp.json in the workspace root. Project files are often committed, so it reads the key from an environment variable named THROTTLE_BUILDER_KEY : set it to your key. VS Code reads an existing .mcp.json as it is; to add one with MCP: Add Server , turn on the setting chat.mcp.workspaceRootConfig.enabled . For VS Code's older MCP setup (deprecated; VS Code plans to remove it in February 2027), use .vscode/mcp.json or MCP: Open User Configuration . The project form asks for the key instead of storing it. Windsurf Add to ~/.codeium/windsurf/mcp_config.json , then refresh MCP in Cascade. Cascade shows throttle-builder with its tools. Other MCP clients Any client that speaks Streamable HTTP MCP and can send a header: give it the address and this one header. To try the key from a terminal, the MCP inspector prints the tools the key allows. The Claude Code snippet and the inspector command were run against a real store. The VS Code JSON shape was checked against VS Code's own documentation. The Cursor and Windsurf snippets follow each tool's documented format but have not been run in the apps themselves: if your tool shows no tools after a restart, check its MCP log for the first error. Let your agent see its work An agent that cannot look at a page is guessing. Throttle never takes screenshots for the agent : there is no server-side screenshot. Instead the agent asks for a preview link, opens it in a browser of its own , looks, and fixes what it sees. So add one browser tool to your agent. Start with Playwright MCP. In another tool, add the same server in its MCP settings: the command is npx with @playwright/mcp@latest (or chrome-devtools-mcp@latest ) as its argument. What the preview call returns get_preview_url answers three links, and the widths to check: draftUrl : the draft drawn by the Builder itself, readable without signing in, valid for 12 hours, and marked noindex . It is responsive, so the agent resizes its own window to 390, 768 and 1280 px and checks each. There is no device input: the agent chooses the size. storePreviewUrl : the same draft drawn by your store , with your store's own fonts and widgets. It lasts 1 hour; ask again for a new one. It is built from the published store address, and it is null when the site has no published store address. A link made for an agent runs only the code that a published page already holds; code that exists only in a draft shows as off. Code widgets run only here : the Builder's own preview draws a code widget's markup and CSS with a "Runs on your store" badge and never runs its script. liveUrl : the page as shoppers see it now, or null for a page never published. A first request to try"},{"title":"Rendering Builder pages","route":"/developers/builder/rendering","headings":["Rendering Builder pages","Entries","The site: loadSite and BuilderProvider","Saved sections","Code widgets","Slots","Next.js: createBuilderPage","Next.js: createBuilderRoute","The sitemap","Change notices","Preview","Interactions, countdown, entrance and custom CSS","What the renderer guarantees","Build mode"],"text":"Developers / Throttle Builder Rendering Builder pages @usethrottle/builder-react draws a published page document as React and gives the store its header, footer, slots and site design. It reads through the SDK and never calls a cache API of its own. Entries use client ): BuilderProvider , BuilderHeader , BuilderFooter , BuilderSlot , BuilderPage , BuilderPageView , BuilderRenderer , AssetImage , compileResponsiveCss , createRendererRegistry , basicPack and the types. Re-exports BuilderUnavailableError and BuilderNotFoundError . ], [ code: @usethrottle/builder-react/server , html: Server loaders: loadSite , loadBuilderPage , builderSitemap , getBundle . ], [ code: @usethrottle/builder-react/next , html: createBuilderRoute (one catch-all route for pages and store templates), createBuilderPage (one page route), BuilderTemplate (a template inside your own route, such as the 404) and DEFAULT_STORE_TEMPLATE_PATHS . Each route helper returns Page, generateMetadata . ], ] /> It needs React 18 or newer, and Next.js 15 or newer for ./next . The widgets come from packs: the Builder's own basic widgets are always present, and @usethrottle/storefront-react/builder adds the catalog and commerce widgets (see the widget guideline ). The site: loadSite and BuilderProvider loadSite makes one Builder read for the request (the settings, header, footer and the slots you name) and resolves the data of their widgets that does not depend on the shopper. Reads of one request are shared: an ask that an earlier read already covers reuses it, and asks in the same tick merge into one. A layout does not know the page, so on a Builder page route the layout read and the page read are two reads unless loadSite is given page . BuilderProvider is a client component, because a pack holds components and functions that a server component cannot pass down: create the packs in a client module of your store. It fills the site design (menus, brand, announcement, strings, theme), the slot outlets and the page renderer for the rest of the tree. site is plain data, so the server can pass it. Give the provider a builderKey or a client only if a BuilderPage below it reads its own page in the browser; that needs a key of the browser or app channel. With no answer and no last good answer, loadSite returns { status: unavailable } and logs once per process. The header, footer and slots then render nothing and the catalog pages keep working. A Builder page throws BuilderUnavailableError and lets your error boundary answer, never a blank 200. A widget that throws blanks only itself. Media. An image shows only when its src is https on exactly mediaOrigin . With no origin, no image shows. The logo, favicon and share image follow the same rule. Saved sections A page, header, footer or slot can hold a reference to a saved section: one section kept once and used by many pages. The read answer carries the published section of every saved section the document uses ( savedSections ), and the renderer draws it where the reference stands. loadSite and loadBuilderPage keep it with the page or part, so there is nothing to pass. Every id inside a saved section is written as <reference id>-<inner id> in data-b-id , so two references to the same saved section on one page never share CSS. A reference whose section the answer does not hold renders an empty box with data-b-missing and nothing else; the rest of the page is not affected. A page holds at most 20,000 nodes with its saved sections expanded; references past that are left out and render as missing. Code widgets A code widget is a widget with markup, CSS and a script. The page document holds only the markup, the CSS and the script s hash; the script itself is served from the Builder, one file per widget. A store runs a code widget only when all of these hold: the merchant turned code on in the dashboard ( code.enabled in the read answer), the widget is not turned off, the page is on the route allow-list, and the render is a live store page (not the editor, not a preview, and not interactive={false} ). Then the widget carries data-b-code , its input as <script type= application/json data-b-code-input> and one <script async src> for its script. In every other case only its markup and CSS are drawn, marked data-b-code-inert , and no script is written. Route allow-list. It lives in the renderer and is not a setting. Code never runs on /checkout , /cart , /account , /sign-in , /sign-up , /login , /register , /order(s) and /pay (and below them), whatever else matches, and the same words on any segment of the path ( /fr/checkout , /de/account/orders ), whatever your page route is. The words include common synonyms ( basket , bag , payment , my-account , login , password , wallet and others); a handle with one of those names (a product called bag ) runs no code either. The limit: with a root-level page route such as /{handle} , code may run on any root-level page whose name is not on that list, so never put your own checkout or account under another root page name. Elsewhere it runs only on / , your page route ( routes.page of the site settings) and the catalog routes: /p/{handle} , /c/{handle} , /collections/{handle} , /tags/{tag} , /search and /shop , or the templates you pass as catalogRoutes . The path is normalised first ( /pages/../checkout is /checkout ). Without pathname no code runs. Leaving a code route is a full page load. A script that has loaded cannot be unloaded, so when a client-side navigation moves from a page that loaded code to a path that is not a code route (checkout, account, sign-in, cart), BuilderProvider loads the new address again from the server and no code survives there. The check also runs when the provider unmounts. Put BuilderProvider in a layout that also covers checkout, account and sign-in: only then does it draw an empty placeholder instead of the denied page while the rel"},{"title":"Builder SDK","route":"/developers/builder/sdk","headings":["Builder SDK","The client","Answers","Errors and last good answers","Caching in Next.js","Change notices: @usethrottle/builder/next","A backstop for a missed notice: @usethrottle/builder/watch","Preview","Build mode"],"text":"Developers / Throttle Builder Builder SDK @usethrottle/builder is the headless client of Throttle Builder. A store reads the published pages, the header and footer, the slots and the site settings with it, and clears its own cache when the Builder says something changed. The client tb_pk_... ), sent as X-Builder-Key . A secret key ( tb_sk_ ) is refused with a TypeError . ], [ code: baseUrl , code: https://builder.usethrottle.dev , The Builder host. ], [ code: timeoutMs , 3000 , Per read, the body included. ], [ code: fetch , global fetch , Your own fetch, for tests. ], [ code: previewToken , none , html: Reads drafts with X-Builder-Preview . Never cached, never answered from a last good copy. ], ] /> Every read takes { locale } , which picks the text of a translated value (the locale, then its language, then English). A page slug or slot name is a non-empty string of at most 128 characters. The client sends no Origin header, so on a server it needs a key of the server or app channel. A browser key works only from the exact https origins it lists. A page document of an older schema version is upgraded on read, and one of a newer version throws BuilderUnavailableError with reason unsupported-document , so an old SDK never renders what it cannot read. Answers { redirectTo } (a site path) for an address that moved. An unpublished page is 404 PAGE_NOT_FOUND . ], [ code: parts.get(name) , code: GET /v1/parts/:name , html: The header or footer document. Unpublished is an empty document. ], [ code: slots.get(name) , code: GET /v1/slots/:name , A slot document. Unpublished is an empty document. ], [ code: bundle( page, slots ) , code: GET /v1/bundle , Site, header, footer, optionally one page and the named slots, in one read. ], ] /> A page answer also carries a seo object ( title , description , shareImage and noindex ) next to its document. Every document carries its frozen custom widgets and frozen assets, so rendering needs no further request. A page, part, slot or bundle answer can also carry savedSections (the published section of every saved section the document references, by the id of its document) and code ( { enabled, scriptOrigin, codeSiteId } : whether the store runs code widgets and where their scripts come from); the client passes both through unchanged, and a code store allows script-src https://builder.usethrottle.dev . The shapes are in the document schema . Errors and last good answers reason is timeout , network , status , invalid-response or unsupported-document ; status holds the HTTP status when there was one. ], [ code: BuilderNotFoundError , A page that is not published and has no redirect. ], [ code: PreviewExpiredError , A preview token that is expired or not valid (401). A preview read never falls back to the published page. ], ] /> A published read that fails with BuilderUnavailableError within 10 minutes of a good one answers the good one (per process, at most 200 reads kept) and logs once. After that the failure reaches you. A not-found or an expired preview is an answer, and is never softened. Caching in Next.js Every published read is kept until a change notice clears it: next: { revalidate: 3600, tags } . The hour is only a safety net behind the notices, and there is no option for a shorter time, so a Builder read can never cost ISR writes on a timer. The client never calls revalidatePath . A preview read is no-store . , One page. ], [ code: throttle-builder:part: , The header or the footer. ], [ code: throttle-builder:slot: , One slot. ], ] /> A read carries the tag of what it holds, so a change clears only that. A change to the site or the menus clears the site, header and footer reads and never the pages. Constants and helpers: BUILDER_TAGS , scopesToTags and UNTIL_CHANGED_REVALIDATE_S . Change notices: @usethrottle/builder/next The handler checks the X-Throttle-Builder-Signature header and clears the cache tags of the notice's scopes with revalidateTag , never a path. When a notice names more than 20 tags it clears the coarse tag once instead. { revalidated: [...tags] } ], [ code: 400 , The body is not a builder.changed notice. ], [ code: 401 , The signature is missing, stale (over 300 seconds) or wrong. ], [ code: 413 , The body is over 64 KB. ], [ code: 500 , No signing secret is set in this environment. Nothing is revalidated. ], ] /> The signature is t=<unix seconds>,v1=<hex> , an HMAC-SHA256 over throttle.builder-notice.v1.<t>.<raw body> (up to 8 v1 values are accepted, compared in constant time). The label means a catalog or webhook signature never verifies as a Builder notice. To check one yourself: secret may be a list. Add the new secret, change it in the Builder, then remove the old one. A backstop for a missed notice: @usethrottle/builder/watch It reads the site generation with a conditional request (an unchanged answer is a 304 ) at most every 30 seconds (60 by default), only while the tab is visible, and calls onChange when it moves. It never revalidates a cache itself. It takes a publishable key and refuses a secret one. router.refresh() renders from the server s data cache, so the store needs a route that clears it. createWatchSyncHandler from @usethrottle/builder/next is that route: it reads the site generation from the Builder (at most once every 20 seconds per instance), and compares it with the generation the store s own data cache holds (a throttle-builder -tagged read of the same answer, shared by every instance). Only when they differ does it clear the throttle-builder tag, so a cold start or repeated calls clear nothing: purges follow real publishes. It answers 500 with no key and 502 when the Builder cannot be read. Preview previewMiddleware(req) , getPreviewToken() and PREVIEW_COOKIE from @usethrottle/builder/next carry a one-hour preview token from the link a merchant opens to the client. See rendering . Build mode createBuilderClient({ mode: build &#"},{"title":"Widget API","route":"/developers/builder/widget-api","headings":["{{settings.heading}}","Widget API","Authentication and limits","Endpoints","Errors","A definition","Throttle Template reference","CSS rules","Limits","Versioning","200: nothing was stored","200: not valid","201","A new version: the same body with \"v\": 2","Turn one version, or every version, off"],"text":"Developers / Throttle Builder Widget API A custom widget is a definition (data, not code) that a merchant can place on any page. Two kinds exist: a template widget (Throttle Template plus restricted CSS) and a composite widget (other widgets wired to a few settings). The Widget API stores them. The editor and the MCP tools use the same checks. Authentication and limits Base URL https://builder.usethrottle.dev . Send a secret key as Authorization: Bearer tb_sk_... . A secret key is refused when the request carries an Origin , and a publishable key never works here. Writes need widgets:write ; the two reads accept widgets:read or widgets:write . Every answer is cache-control: no-store . 30 writes a minute for the whole store (two keys share it): the 31st is 429 RATE_LIMITED with Retry-After: 60 . Validation has its own allowance of the same size. A request body is at most 128 KB, a definition at most 64 KB, and JSON may nest at most 40 levels. An answer lists at most 50 issues. Endpoints 200 { ok, issues, definition? } . Nothing is stored. ], [ code: POST /v1/widgets , code: widgets:write , html: Stores a new widget type. 201 { type, version, status: active } . ], [ code: POST /v1/widgets/:type/versions , code: widgets:write , html: Stores the next version of an existing type. The body\\ s type must equal the path. 201 , as above. ], [ code: PATCH /v1/widgets/:type , code: widgets:write , html: Body { status: active | disabled } . :type may be custom.name@2 to change one version. 200 { type, status, versions } . ], [ code: GET /v1/widgets , code: widgets:read , html: { widgets: [{ type, title, kind, latestVersion, versionCount, status }] } ], [ code: GET /v1/widgets/:type , code: widgets:read , html: The latest version, or custom.name@2 for one: { type, version, kind, status, createdAt, definition, versions } . ], ] /> A definition is plain JSON data. A type is custom. followed by a lower-case name of letters, digits and hyphens (at most 64 characters after the dot). A new widget, and each new version, is stored as active. A widget a merchant turned off in the Builder can only be turned back on by the merchant: a key gets 403 WIDGET_REENABLE_DASHBOARD_ONLY . Errors An issue is { path, code, message } . The codes you will meet are INVALID_SHAPE , INVALID_VALUE , REQUIRED , FORBIDDEN_KEY , DUPLICATE_KEY , LIMIT_EXCEEDED , VERSION_RULE , TEMPLATE_SYNTAX , TEMPLATE_FORBIDDEN , ELEMENT_NOT_ALLOWED , ATTRIBUTE_NOT_ALLOWED , FIELD_NOT_ALLOWED , UNKNOWN_REFERENCE , CSS_SYNTAX , CSS_FORBIDDEN , CSS_PROPERTY_NOT_ALLOWED , NO_RECURSION , BINDING_TARGET_MISSING and BINDING_TYPE_MISMATCH . A path inside the template or CSS carries a line and column, such as css:1:25 . A definition Settings. At most 40 of your own, each with a key (a letter, then letters and digits, at most 40), a label , a tab ( content , style or advanced ), an output and a control : text , richtext , number , select , toggle , color , spacing , image , link , icon , alignment or font-size . The common settings hidden , anchor , spacingTop and spacingBottom are added for you and do not count. Every setting needs a default that passes its own control. A select needs options. Output. A markup setting is read by the template. A css setting reaches the stylesheet as var(--w-<key>) , so it must use the color , spacing , font-size , alignment , number , toggle or select control, never free text, and it cannot be translatable. A select option that reaches CSS is lower-case letters, digits, hyphens and colons. Translatable text. A text setting with translatable: true takes a map of locale to text, such as { en : Hello , fr : Bonjour } . Data inputs. At most 5. Each names the result types it accepts ( product[] , product , collection , category[] , review[] , customer , cart ), whether it is required and a label. The merchant binds the input to a data source; a template may read only the fields of the sources the input accepts. Money is printed only as price.display (or price.currency ): a template that reads a money amount as a number is refused. Composite. The body is either columns (an inner section, which then only goes at the top level of a column) or a stack of widgets. Each binding copies a setting into a node's prop and must use the same control. Data inputs reach inner nodes through targets . A composite cannot hold another composite. Throttle Template reference A template is HTML-like markup with {{ }} tags, parsed into a closed set of nodes. Nothing builds a string of HTML from it: the renderer returns React elements, so a value is always text. A tag holds one plain path (letters and digits, up to six segments) and optional filters. Helpers, arguments, comparisons, index access, parent paths and {{else if}} are refused. Paths start at settings , data , locale or a loop variable. Names that exist on every object (such as constructor ) are refused. Elements: div span p h1 h2 h3 h4 h5 h6 a img ul ol li strong em small figure figcaption section article header footer details summary br hr . A heading or block element cannot sit inside a p . details with a summary gives a click-to-open section (an FAQ accordion, for example) with no script; it always starts closed, since the open attribute is not allowed. Attributes: class , title , aria-label , aria-hidden and role on any element; href on a ; src and alt on img ; and data-* (not data-b- , which the renderer owns). No id , no style , no event handlers. class , role , aria-hidden and data-* are static text. A class is 1 to 10 tokens of lower-case letters, digits and hyphens, and none may start with b- , tb- , tsf- or throttle- . A role is a non-interactive one (such as region , list or img ). href is either one {{ }} value with no filters (a link setting or a url field) or a fixed https URL or path. src is one {{ }"},{"title":"Widget guideline","route":"/developers/builder/widgets-guide","headings":["{String(props.title)}","Widget guideline","Three kinds of widget","A widget definition","The component","Data sources","Packs, link targets and slots","Versions and migrations","Interactions, countdown, saved sections and code","Interactions","Countdown","Custom CSS","Saved sections","Code widgets","The integration contract"],"text":"Developers / Throttle Builder Widget guideline A widget is a definition (data) plus a React component. The Builder editor, the Worker and the MCP tools read only the definition. The store renders the component. This page is for the person writing a widget. To add a widget without writing code, use a custom widget . Three kinds of widget @usethrottle/builder-schema , components in @usethrottle/builder-react : heading, text, image, button, spacer, divider, video, logo, menu, announcement, copyright. Every renderer carries them. , The Builder. ], [ Pack , code: catalog.* commerce.* , html: Definitions, data sources and components in @usethrottle/storefront-react/builder . The Builder bundles the data half ( builder-pack.json ). , Throttle, in a release of the package. ], [ Custom , code: custom.* , A template or composite definition stored with the Widget API. Rendered by the Builder\\ s own template runtime. , A merchant or an agent, no deploy. ], [ Code , code: custom.* , html: A custom widget of kind: code : markup, CSS and a script that runs on the store page. Off unless a person turned code on. See Code widgets . , A merchant, or an agent with the code switch. ], ] /> The Worker validates against the builder-pack.json of one pinned version of @usethrottle/storefront-react , plus the store's custom widgets. A widget appears in the editor only if it is in that manifest. A pack you write in your own store can render widgets that are already in a page, but it cannot add a new one to the library. A widget definition type is basic. , catalog. , commerce. or custom. followed by a lower-case name. v starts at 1. group is layout , basic , catalog , commerce or custom . Each setting has a tab ( content , style , advanced ), an output ( markup reaches the component as a prop, css reaches the stylesheet as a custom property) and a control . A css setting must use a control whose value is a token, number, colour or enum ( color , spacing , font-size , alignment , number , toggle , select ), never free text. At most 40 settings of your own. The common settings ( hidden , anchor , spacingTop , spacingBottom , entrance , entranceDelayMs ) are appended and do not count. entrance is drawn by the renderer around every widget, so your component needs no code for it. data names the inputs: what result types each accepts, whether it is required, a label and an optional default binding. placement may say slotsOnly , notIn ( header , footer , slot ) or topLevelOnly (not inside an inner section). Every setting reaches the component already prepared: defaults filled in, translatable text resolved to the page locale, and an image setting replaced by its frozen asset with its width variants. The component The component gets WidgetRenderProps : node , props , data , editMode , locale , mediaOrigin , resolveLink , inlineEdit (editor only) and budget (custom widgets). Rules every widget keeps: Money is printed through display only. A price is { amount, currency, display } . Never format an amount yourself. Images go through AssetImage with the mediaOrigin you were given: https, on exactly that origin, or no image. Links use resolveLink for a link target, and every href is checked again with safeUrl from @usethrottle/builder-schema . No raw HTML. No dangerouslySetInnerHTML or innerHTML . Rich text is parsed into React elements. No data, no noise. With nothing to show, render the hint when editMode is on and nothing in a store. A widget that throws blanks only itself. Own properties only ( Object.hasOwn ) when you look up anything keyed by document or settings data. Shopper data is browser-only. A source with perShopper: true is never read on the server; the widget draws nothing until it arrives, so the server and first browser render match. Do not set a revalidate time or call a cache API. Reads go through the client, which keeps them for at least an hour and clears them when something changes. Data sources id is provider.name , lower case. provider is catalog or commerce . result is one of product[] , product , collection , category[] , review[] , customer , cart . fields is the allow-list of what a template may read, by dotted name, with a type ( string , number , boolean , money , image , url , date , list ). A money field is printed only as .display or .currency . cacheKind is listings , product , reviews or none . Params are checked by the resolver, because they come from a document: clamp numbers, default what is missing. A binding is { source, params } , or { source: context.product } inside a slot, which takes what the page knows. The catalog pack ships catalog.products , catalog.product , catalog.collection , catalog.categories , catalog.reviews , catalog.cart , context.product , context.listing and, in the commerce pack, throttle.customer . Packs, link targets and slots Link targets. A pack may give linkTargets.resolve(target) , which turns a menu or link target it owns (a category, collection, product or search) into an href, or null when it cannot. null means no link, never a wrong one. A catalog target holds the catalog id, so call warmCatalogLinks on the server before rendering menus. Slots. A pack lists the places its pages render a slot ( { name, context: product | listing | none } ). The catalog pack's are CATALOG_SLOT_POINTS . A slot's widgets read the context through context.* bindings. Registration. createRendererRegistry puts the built-in pack first. A pack cannot replace a basic.* type, and the first definition of a type and version wins. catalogPack({ catalogKey, cartStorage?, onLocaleChange?, onCurrencyChange?, display? }) (with a client , display is { builderOverrides: shopDisplayOverrides(site) } , or a function that answers it per request, so the shop description, the search heading and the Shop crumb follow Site > Wording > Shop wording) and commercePack({ auth? }) are the two packs in @usethrottle/st"},{"title":"Build Cart State That Checkout Can Trust","route":"/developers/cart-api","headings":["Build Cart State That Checkout Can Trust","0. Configure your application","Who owns each step","End-to-end cart flow","Shipping and tax","The cart is the source of truth for shipping and totals","Addresses","Discounts","Subscription lines","Inputs and add-ons on a line","Resolved carts","Two add-item shapes","Owned lines","Open the hosted cart page for a cart","Native cart endpoints","{title}","unitPrice is per period, per seat; quantity is seats.","Stored as: type \"subscription\", name \"Barista Club — 14-day free trial\",","unitPrice 0, recurring.amount 2000, subscriptionId null (until checkout completes).`;","Add a line the app prices","The body is optional. 201 (new) or 200 (reused):","\"data\": {","\"sessionId\": \"cart_9f2c…\",","\"cartUrl\": \"https://checkout.usethrottle.dev/cart/cart_9f2c…\",","\"expiresAt\": \"2026-10-27T12:00:00.000Z\",","\"urls\": {","\"returnUrl\": \"https://shop.example.com/thanks\",","\"cancelUrl\": \"https://shop.example.com/cart\",","\"storefrontUrl\": \"https://shop.example.com\"","}","}`;"],"text":"Native carts Build Cart State That Checkout Can Trust Use @usethrottle/cart when Throttle owns the cart, totals, and checkout handoff for your application. 0. Configure your application Following the SDK example verbatim before this step fails with missing_application_id on POST /carts , or the embed renders Embed not authorized . Both checks happen before any SDK error path. From the dashboard, copy your Application UUID (Settings → Identifiers) into THROTTLE_APPLICATION_ID . From Embed Config , add your storefront origin (e.g. http://localhost:3000 ) to allowedOrigins . From API Keys , create a secret key in the workspace environment you want to use. Non-production keys look like sk_uat_* ; production keys look like sk_live_* . Every field on the wire is camelCase ( applicationId , unitPrice , referenceId ). Single shape — no snake_case aliases. See Conventions for the full rule. You don't have to plug in a payment processor to test cart → checkout end-to-end. Every new Application gets a sandbox payment sub-account on signup, so a checkout session minted with an non-production environment key renders the Card Simulator out-of-the-box. See Workspace environments for provider routing details. Who owns each step Your backend owns cart mutations and secret-key calls. The browser renders buyer controls and the checkout iframe, but it never receives your sk_ key. End-to-end cart flow The cart client wraps the native cart endpoints and throws ThrottleApiError for non-2xx responses. It extends the shared ThrottleError (from @usethrottle/errors , re-exported by every SDK), so one instanceof ThrottleError catch handles errors from all Throttle SDKs. See the error reference . The full request/response schemas for every endpoint on this page live in the public OpenAPI 3.1 document at api.usethrottle.dev/openapi.json . Open it in Swagger UI to try requests against a sandbox key, or pipe it into openapi-typescript / openapi-fetch for typed client generation. The pre-generated client lives at @usethrottle/cart . Most applications use native Throttle carts : create a cart with POST /api/v1/carts , then pass its cartId to POST /api/v1/checkout/sessions . The externalCartId field is only for applications that have connected an external cart provider. Passing externalCartId on a native application returns 400 invalid_mode (“this application uses native Throttle carts”) — create a cart first and use cartId instead. Shipping and tax Use cart calculation from your backend when a cart already exists in Throttle. Use storefront quote tokens for read-only estimates before checkout. Quote tokens start with qt_ (tokens minted before this change start with pk_ and remain valid indefinitely) and are scoped by application and allowed origin. They can estimate totals, but they cannot mutate carts or create orders. POST /api/v1/shipping-tax/quotes also accepts an X-API-Key carrying shipping_quotes:write instead of a quote token — see the API reference . carts.create and carts.update accept an optional customerEmail — a way to attach a buyer’s email to a cart without minting a full customer record (e.g. an “email me my cart” field). When set, an otherwise-anonymous abandoned cart becomes recoverable: the cart.abandoned webhook carries it as customer.email (with id: null ). A fully linked customer’s email always takes precedence. Pass null on update to clear it. Pass customerId: null on update to detach the customer; omit it to keep the customer. Detaching does not clear customerEmail ; send customerEmail: null too. Detaching does not clear the addresses either; send shippingAddress: null and billingAddress: null to clear them. carts.create and carts.update accept an optional buyerVatNumber , and the public POST /api/v1/checkout-sessions/:id/calculate accepts it too so a hosted or embedded checkout can capture it as the buyer types. Pass null to clear it. On a cross-border supply between two EU member states, a buyer VAT number zero-rates the sale under the reverse-charge rules — the buyer self-accounts for the VAT. A domestic B2B sale still carries VAT, so supplying a VAT number there changes nothing. The decision is recorded once, at calculation time, and surfaces as taxReverseCharge on the cart and on the resulting order; the customer invoice PDF renders the required notice. This applies when the tax axis is in app_based mode with a connected provider. Your provider decides the final treatment — setting a VAT number does not by itself guarantee zero tax. Because of that, the public GET /api/v1/checkout-sessions/:id response carries collect.vatNumber . It is true only when the merchant s published tax mode is app_based , and Throttle s own hosted checkout hides the VAT field when it is false. Build a custom checkout the same way: asking for a number no provider will read records data that changes nothing, while implying the buyer s supply will be zero-rated. The field is read-only and derived server-side — the collect object you pass at session create still only accepts shippingAddress and billingAddress . The same public POST /api/v1/checkout-sessions/:id/calculate accepts an optional email . Send it from a custom checkout the moment the buyer has entered one. A tax exemption belongs to a customer, so the calculation can only apply one if it knows who is buying. A cart that carries no customerId — a guest checkout, or a quote accepted by its buyer — is quoted as an anonymous buyer unless the email identifies an existing customer. Completing the checkout resolves that email anyway, so an exempt buyer who was never identified during calculation is charged tax on screen while the document filed with your tax provider records the sale as exempt. The email is written onto the cart and never cleared from this route, so a later estimate that omits it does not erase one the cart already had. No customer is created here — an email that matches nothing is simply quoted as a guest. The cart is the source of t"},{"title":"Cart sessions","route":"/developers/cart-sessions","headings":["Cart sessions","How it works","Set your allowed origins first","Create a cart session","Build the cart","Cart badge: just the number","Buyer details","Shipping & discounts","Hand off to checkout","Skip the UI: Throttle's hosted cart page","One hook for the whole flow: useThrottleCheckout","Resolved carts: lines priced by an installed app","Mobile apps: no Origin needed","Adding and changing lines","Refresh","Shipping on resolved carts","Checkout hand-off","Signing in","Switching currency: absorb a cart","In @usethrottle/cart","Only allow prices from installed apps","Extra cart currencies","Endpoints","Add a line by the app's id for the item. The app sets name, price and image.","Re-check every line the app owns (send {} as the body)","→ { \"data\": { \"cartSessionId\": \"cart_<id>\", \"cart\": { … }, \"changed\": false } }`;","Update an item","Remove an item","Read the current cart","\"data\": {","\"cartSessionId\": \"cart_<id>\",","\"status\": \"active\",","\"unitCount\": 4,","\"total\": 12497,","\"currency\": \"USD\"","}","}`}","Apply a discount code (a goods code or a free-shipping code)","Remove only the free-shipping code (kind=order removes the goods code)"],"text":"Guide Cart sessions Create and own a Throttle cart directly from the browser — no backend required. Cart sessions are the front door for JAMstack / static storefronts that don't run a server with a secret key. Prefer a typed client? CartSessionClient in @usethrottle/cart wraps every endpoint below — create/resume a session, then addItem , selectShipping , applyDiscount , checkout . In React, the useCartSession hook in @usethrottle/checkout-react adds reactive cart state + automatic localStorage persistence. The raw HTTP API is documented here for reference. How it works Server-side integrations build carts with a secret sk_ key. A frontend-only storefront can't hold a secret key, so it uses a cart session instead: You create a cart session with your storefront quote token ( qt_… — the same token used for shipping/tax quotes, from the dashboard Shipping & Tax page or POST /api/v1/shipping-tax/quote-tokens ) from an allowed origin. Quote tokens minted before qt_ start with pk_ and keep working. A pk_ publishable API key is a different credential and is refused with 401 invalid_quote_token . Throttle creates the cart and returns an opaque cart_… session id. That id is a bearer capability scoped to exactly one cart — hold it client-side (e.g. in localStorage ) and use it to add, update, and remove items. Because the cart lives in Throttle from the first add-to-cart, you get abandoned-cart recovery and a clean hand-off to checkout for free. Creation is authorized by your publishable token + the application origin allowlist. Every later call is authorized by possession of the opaque cart_… id + origin. No secret key is ever exposed to the browser, and a session can only ever touch its own cart. Set your allowed origins first Cart-session requests are rejected unless the request Origin is on the application's allowlist (the same allowlist used by embedded checkout and quotes). Set it via PUT /api/v1/embed-config . A resolved cart also accepts a request that sends neither Origin nor Referer , as a mobile app does. Create a cart session Returns cartSessionId (the cart_… token), expiresAt , a branding block ( logoUrl , primaryColor , merchantName — each nullable), and a cart snapshot. The same branding block is also returned by GET /api/v1/cart-sessions/ id , so a storefront rendering its own cart UI can brand it without a separate call. Build the cart /items \\\\ -H Origin: https://shop.example.com \\\\ -H Content-Type: application/json \\\\ -d name : Premium Widget , unitPrice : 2999, quantity : 2 # Update an item curl -X PATCH https://api.usethrottle.dev/api/v1/cart-sessions/cart_ /items/ \\\\ -H Origin: https://shop.example.com -H Content-Type: application/json \\\\ -d quantity : 3 # Remove an item curl -X DELETE https://api.usethrottle.dev/api/v1/cart-sessions/cart_ /items/ \\\\ -H Origin: https://shop.example.com # Read the current cart curl https://api.usethrottle.dev/api/v1/cart-sessions/cart_ \\\\ -H Origin: https://shop.example.com /> quantity is an integer between 1 and 10,000 on both add and update. Above that the request is rejected with Quantity cannot exceed 10000. — a cart line is not a bulk order; larger asks belong on the quote surface. The add-item route (and the SDK s addItem ) accepts the same recurring block as the Cart API, so a browser cart can hold subscription lines. The limits and codes are identical: see Cart API → Subscription lines . Cart badge: just the number A storefront header shows a count next to the cart icon on every page load. Reading it from GET /api/v1/cart-sessions/ id works, but that response carries the line items, both addresses, the buyer's email and their notes — the whole cart, shipped to every page of the site, to render one integer. /summary is the small read for it: /summary \\\\ -H Origin: https://shop.example.com # # data : # cartSessionId : cart_ , # status : active , # unitCount : 4, # total : 12497, # currency : USD # # /> unitCount counts units , not distinct lines: a cart holding 1 stand, 2 notebooks and 1 keyboard reports 4 , not 3 . The same field is on the cart object every other cart-session endpoint returns, so a page that already has the cart doesn't need this call. The typical shape on a storefront: restore the session id from localStorage on page load, draw the number, and forget the id once the session is finished. A finished session answers 200 with zeros — unitCount: 0 , total: 0 , currency: null — and a status of expired or converted . A third value, checkout , means the cart is mid-payment: keep the id, because the checkout cancel path reopens that cart and the buyer will want it back. This is the one endpoint that does not send cart_session_expired (410): a badge runs on every page, and drawing a zero shouldn't need a try / catch . An id that was never issued is still a cart_session_not_found (404) — that is a bug in the integration, not a finished cart. A cart the abandoned-cart sweep has taken reports its real unitCount with status: active — the buyer can still come back to it — and the summary never reopens it. Only a write does that, so a link prefetcher or an email scanner hitting a badge cannot resurrect a cart with nobody present. Buyer details PATCH /api/v1/cart-sessions/ id sets buyer-editable fields on the cart: customerEmail and notes , both optional. Send null for either to clear it. The body must carry at least one of the two — an empty object is rejected with Provide at least one of customerEmail or notes. On a cart backed by an external cart provider, customerEmail is rejected with mode_not_supported (422) rather than accepted and dropped; notes works on both providers. \\\\ -H Origin: https://shop.example.com -H Content-Type: application/json \\\\ -d customerEmail : buyer@example.com , notes : Leave at the door /> A guest cart is invisible to abandoned-cart recovery until it has a known email. Setting customerEmail here — even without a full customer record — is what makes the cart eligible for th"},{"title":"Developer Changelog","route":"/developers/changelog","headings":["Developer Changelog","2026-12-05 — Order fees in the API, webhooks and exports","2026-12-05 — Order fees in order emails","2026-12-04 — Resend an order email","2026-12-04 — Invoice on terms respects the maximum order total","2026-12-03 — Invoice terms for approved customers only","2026-12-03 — Imports report paid orders with a balance","2026-12-03 — Cancelling an order closes its balance link","2026-11-28 — Catalog weight and dimensions drive live shipping rates","2026-11-29 — Collect a balance on a placed order","2026-11-24 — Emails sent to a customer, per order and per customer","2026-11-24 — order.edited; order line edits: SKUs, shipped orders, webhook detail","2026-11-22 — Customer segments","2026-11-21 — Extra email recipients on a subscription; cancelsAt on a failed renewal","2026-11-20 — Checkout pay button text","2026-11-20 — Trial-ending email; no renewal reminder during a trial","2026-11-19 — subscription.trial_will_end","2026-11-19 — Invoices name their subscription; PATCH can move or end a trial","2026-11-18 — Clear a cart's addresses","2026-11-17 — Charge a saved card on an order","2026-11-17 — Manual line discounts when editing an order","2026-11-17 — Take a card payment on a draft order","2026-11-17 — Delete a draft order","2026-11-15 — Extensions: sandbox flags and a full-width layout","2026-11-14 — Dashboard feature switches","2026-11-13 — Exclude products from a discount code","2026-11-13 — Site forms","2026-11-11 — Customer groups","2026-11-10 — Integration history entries","2026-11-09 — Record history","2026-11-08 — Installations carry the pinned version's iframe URL","2026-11-08 — Move an order to another customer","2026-11-07 — More currencies can be enabled, in their own minor units","2026-11-06 — Customer search matches company; carts can detach a customer","2026-11-02 — Quotes: catalog lines","2026-11-01 — Customer carts follow the buyer","2026-10-27 — Internal notes on orders and customers","2026-10-26 — Physical subscriptions","2026-10-24 — Line items on the order list","2026-10-23 — Customer directory for extensions"],"text":"Release notes Developer Changelog Public, developer-facing contract changes for the Throttle API, embedded checkout, webhooks, and SDKs. Internal refactors and UI-only changes are excluded. Breaking marks an entry where code that worked before may stop working or behave differently. Deprecated marks an entry where something still works but is on its way out. Entries with no marker are additions or fixes; a fix can still change what you see, so read any that touch a route you call. 2026-12-05 — Order fees in the API, webhooks and exports New Order fees : fee definitions ( /api/v1/fees , /api/v1/fees/settings ) and per-document fee routes on carts, orders, quote revisions and subscriptions. Fee edits need a merchant credential. Orders, carts, quote revisions and invoices gain feeTotal and fees ; subscriptions gain fees . Both read 0 and [] while fees are off. POST /api/v1/orders accepts fees and feeCharge . subscription.* webhooks carry subscription.fees ; quote events carry revision.feeTotal and revision.fees . The orders CSV export appends two columns at the end: fee_total and fees . The MCP server has a list_fees tool. 2026-12-05 — Order fees in order emails Order confirmation, payment receipt, Net-N invoice and subscription-renewed emails print one row per order fee between Shipping and Tax. Rows with an amount of 0 are never shown. Templates receive order.fees (an array of label, amount ) and order.feeTotal . If you have overridden one of these templates, add the rows yourself: #each order.fees this.label money this.amount ../order.currency /each 2026-12-04 — Resend an order email New: POST /api/v1/orders/ id /emails/ emailId /resend ( orders:write ) sends the customer one of the order s emails again: the same email, to the same address. The dashboard shows it as Resend on the order and customer Emails tabs. Emails sent to the customer 2026-12-04 — Invoice on terms respects the maximum order total Changed: POST /api/v1/orders/ id /invoice-on-terms now applies the Invoice Terms maximum order total, as checkout already did. An order over the cap for its currency, or in a currency with no cap once any cap is set, is refused with 422 net30_over_limit before anything is placed. 2026-12-03 — Invoice terms for approved customers only New: eligibility on the Invoice Terms connection ( all_customers , the default, or approved_customers ). With approved_customers , only customers whose profile has netN , or terms negotiated on a quote, can be invoiced on terms. Everyone else gets 422 terms_not_approved . Existing connections are unchanged. 2026-12-03 — Imports report paid orders with a balance New: errorSummary.paid_below_total on an order import. It counts and names re-imported orders the file says are paid whose recorded payments come to less than the total. It is not a row error, it appears in the dry run too, and no payment is changed. 2026-12-03 — Cancelling an order closes its balance link Changed: POST /orders/:id/cancel and moving an order to cancelled with POST /orders/:id/status now close an open balance link first. If the customer is paying it right then, the order is not cancelled and the request answers 409 payment_in_progress ; if the link cannot be closed, it answers 502 payment_link_cancel_failed . 2026-12-02 — Orders CSV export writes decimal amounts Breaking Changed: money columns in GET /orders/export.csv . Every amount, including the existing total and comp_amount , is now a decimal in the row s currency: 5.00 , not 500 . If you parse this file and divide by 100, stop. JSON responses still use integer minor units. New: rows=lineItems answers one row per line item, and the orders file gains customer, money, tracking and address columns at the end. amount_paid , amount_refunded and amount_due are blank for an imported order with no payment record. 2026-12-02 — OpenAPI document names production and version 1.0.0 Breaking Changed: servers . The OpenAPI document lists https://api.usethrottle.dev first, so Try it out in the API reference calls the API instead of your own machine. The local development server is still listed second. Changed: info.version is 1.0.0 (was 0.1.0 ), matching the /api/v1 paths. No path, request or response changed. Changed: the Organizations and Stores tags are listed last and described as the legacy names for the workspace and its applications. The routes are unchanged and still supported. SDK: @usethrottle/api-client . OpenAPI.BASE now defaults to https://api.usethrottle.dev (was http://localhost:3000 ). Code that sets OpenAPI.BASE is unaffected; to call a local server, set it explicitly. 2026-11-28 — Catalog weight and dimensions drive live shipping rates New: shipping on a line resolver answer. Optional { weightGrams, lengthMm, widthMm, heightMm } per line, in grams and millimetres. Omitted means unknown, never 0; a malformed object is dropped and the line still prices. Throttle stores weight and weightUnit: "kg" , and length , width , height and dimensionUnit: "cm" (only when all three are present) on the line, when the answer says requiresShipping: true . Shipping measures Changed: catalog lines carry shipping measures. Cart lines, quote lines picked from the catalog and the checkout cart built from an accepted quote now carry those keys, so live rates use real weights. The keys stay read-only for a browser ( 400 price_locked ). A line with no weight is unchanged, and a line without shipping stores exactly what it did before. Changed: Shippo and EasyPost parcels. Each line is converted from its own unit and sent in lb and in. A one-unit cart with all three dimensions ships in its own box. A parcel over 150 lb is not quoted and the cart falls back to your own shipping rules. New: @usethrottle/storefront-react . The product page's Specifications show Weight and Dimensions in the store's units ( product.units : imperial or metric ); formatWeight and formatDimensions are exported. Product page 2026-11-29 — Collect"},{"title":"API Conventions","route":"/developers/conventions","headings":["API Conventions","Base URL","Field naming: camelCase, single shape","Money: integer minor units","Errors","Typed errors in the SDK","Request IDs","Rate limits","Headers","When you go over","Pagination","Identifier prefixes","Timestamps and timezones","Quote and order numbers","Dashboard feature switches"],"text":"Reference API Conventions One section captures the rules that apply across every Throttle endpoint: base URL, naming, money, error shapes, rate limits, pagination, and workspace environments. When in doubt, this page wins over the per-endpoint docs. Base URL Every endpoint lives under one base URL, for every workspace and every environment: There is no separate host for test data. The API key you send selects the workspace, application and environment, so the same URL serves production and every non-production environment. Paths in these docs are written in full, for example POST /api/v1/carts . Field naming: camelCase, single shape Every request and response field on the wire is camelCase . One name per concept — no aliases, no alternate forms. Type generation from the OpenAPI spec is the intended workflow. Throttle public request and response bodies use camelCase. Use applicationId , customerId , lineItems , unitPrice , and externalId ; stale snake_case or store aliases are rejected with a validation error. Generated api-client@1.3.0+ already uses the current shape. Historical store terminology may still appear in dashboard labels or internal database migrations, but it is not exposed on the public wire. Money: integer minor units Money amounts are integers in the currency's minor unit , in requests and in responses. 2999 in USD is $29.99. Never send a decimal such as 29.99 . An amount is only meaningful next to its currency , a three-letter ISO 4217 code. The number of decimals comes from the currency, not from an assumption of 100: 1999 is ¥1,999 in JPY , which has no minor unit, and 1.999 in KWD , which has three decimals. Do not divide by 100 to display an amount unless you know the currency has two. See Multi-currency for the table and the formatting helpers. Percentages and rates are not money and are not in minor units: a percentage discount of 25% is 25 . Errors Every non-2xx response follows the same envelope: error.code is the contract — use it for programmatic handling. Reach for error.message only for surfacing a human-readable string in your UI. Field-level details identify unrecognized keys and may include a suggestion when the server can identify the intended canonical camelCase field: Typed errors in the SDK The envelope is published as a named ErrorEnvelope model, so @usethrottle/api-client exposes it as a type rather than leaving you to re-parse the body: ApiError extends ThrottleError , so one catch covers every Throttle SDK. err.message is the message the server sent; if a response carries no message, it falls back to a description of what that status means on this API, and the raw description stays available as err.statusDescription . Request IDs API responses carry an x-request-id response header, and it s readable cross-origin (it s in Access-Control-Expose-Headers ) — hijacked and streamed replies are the exception. Where the response body is a JSON envelope, meta.requestId is the same value, where present: If your own request already carries an x-request-id header matching ^[A-Za-z0-9_-] 8,128 $ , Throttle honours it and echoes it back unchanged — useful for correlating a request across your own systems. Anything that doesn t match (too short, too long, or containing characters outside A-Za-z0-9_- ) is ignored, and a fresh req_<uuid> is generated instead. ThrottleError s requestId field — available in @usethrottle/errors 1.1.0 and later — exposes the same value across every Throttle SDK: quote it when contacting support, since it s the fastest way for us to find the exact request in our logs. It s read from meta.requestId when the response body carries one; for a hand-built error body without a meta envelope (a 401, 403, or 500), it falls back to the x-request-id response header instead, so it s populated either way. On earlier versions, read x-request-id or meta.requestId directly from the response. Rate limits Each credential gets its own allowance: 200 requests per 60 seconds for an API key . The limit is counted per key, not per workspace and not per IP address, so two keys in the same workspace do not use up each other's requests. sk_ or pk_ ) , Key , 200 , ], [ OAuth connection, such as a connected AI assistant , Connection , 200 ], [ Dashboard session , Signed-in user, per workspace , 600 ], [ html: Payment-method client token ( X-Throttle-PM-Token ) , Subscription or customer the token was minted for , 200 , ], [ No credential (public routes) , Network address , 200 ], ] /> The window is fixed. It opens with the first request and resets 60 seconds later, when the full allowance comes back at once. Dashboard traffic is counted apart from your keys, so a bulk job running on a key does not slow the dashboard down for your team, and the reverse. Callers without a credential that share a network address share one allowance. Headers Every response that was counted reports where you stand: A request rejected before it is counted carries none of these headers. A 401 for a missing or invalid key is one example. The headers are also not listed in Access-Control-Expose-Headers , so browser code calling the API cross-origin cannot read them. Read them on your server. When you go over The request is not processed and the response is 429 rate_limit_exceeded in the standard error envelope: Wait the number of seconds in retry-after , then send the request again. Branch on the status or on error.code ; the message is for people and its wording is not part of the contract. Retrying sooner only returns another 429 . For imports and backfills, pace the work under the limit instead of sending as fast as you can and reacting to 429 s. Watching x-ratelimit-remaining is enough. Give each integration its own API key. Allowances are per key, so a batch job on one key cannot starve checkout traffic on another. A few routes, mostly public ones that take no API key, set a lower limit and count it separately from the general allowance. The headers on a response alway"},{"title":"Customer Groups","route":"/developers/customer-groups","headings":["Customer Groups","Concepts and limits","The group object","Routes","Members: use the customers routes","What buyers see","Look up groups for many customers","Import column","Events","Group-limited promotion codes","Identity proof","Group data for extensions","Tax exemption","What each tax mode does","Where the exemption shows up","Errors","201","200","List the members of one group, or the customers in no group:","200: customers in no group and unknown ids are left out","must present the buyer's own storefront customer token."],"text":"Customers Customer Groups A customer group is a named set of customers. A group is either fixed (the product catalog stores its own prices per variant and currency) or percent (a percentage off the regular price). Groups also decide who may use a promotion code. Manage them in the dashboard under Customers › Groups , or with the API below. In the dashboard dialog, the Pricing field lists Percent off first (the default), then Fixed prices set in the catalog . Without Product Catalog installed in the environment, Pricing is disabled and groups only control who can use group-only discount codes. Concepts and limits Scope. A group belongs to one application and one environment (production or a sandbox). Another environment's group id answers 404 not_found . One group per customer. Adding a customer to a group moves them out of any other group. Membership lives in its own table, so the group never appears on a customer unless the call below adds it on purpose. At most 50 groups per application and environment. The 51st create answers 409 customer_group_limit_reached ( details.limit: 50 ). Names are 1 to 100 characters, trimmed, and unique ignoring case ( 409 customer_group_name_taken ). Names are labels, not identifiers: use the group id everywhere in code. Percent groups carry percentBps , 1 to 10000 basis points off the regular price (1500 = 15%, 10000 = free). A fixed group has percentBps: null . Disabled groups count as no group. Their members get regular prices and are not eligible for codes limited to that group. Memberships stay, so enabling the group restores everything. The kind can change. The catalog keeps the fixed prices of a group whatever its current kind and reads them only while the group is fixed . Deleting removes the group and its memberships. A group that a discount names cannot be deleted: 409 customer_group_in_use with details.discounts listing each discount's id, code and name. The group object Routes Every route is camelCase only and rejects unknown fields with 400 naming the field (for example percent_bps ). lower(name) then id . No pagination. ], [ code: POST /api/v1/customer-groups , code: customer_groups:write , html: Body name , kind , percentBps (required for percent), enabled (default true), taxExempt with taxExemptReason (required together). ], [ code: GET /api/v1/customer-groups/ id , code: customer_groups:read , One group. ], [ code: PATCH /api/v1/customer-groups/ id , code: customer_groups:write , Switching to percent needs percentBps; switching to fixed clears it. A PATCH that changes nothing writes nothing and emits no event. ], [ code: DELETE /api/v1/customer-groups/ id , code: customer_groups:write , html: Answers removedMemberCount . ], [ code: POST /api/v1/customer-groups/ id /members , code: customer_groups:write , html: 1 to 100 customerIds . All or nothing: an id that is not a customer of this environment answers 422 customer_not_found and nothing changes. ], [ code: POST /api/v1/customer-groups/ id /members/remove , code: customer_groups:write , Same body. Non-members count as unchanged. ], [ code: POST /api/v1/customer-groups/lookup , code: customer_groups:read , Up to 100 customer ids to their groups in one call (below). ], ] /> Dashboard users need the matching permission, application:customer-groups:read or application:customer-groups:write (see Permissions ). Publishable keys cannot call these routes, and extensions may request customer_groups:read but not customer_groups:write (see Scopes ). Members: use the customers routes A customer's group is a field on the customers API for callers who hold the group scopes. POST and PATCH /api/v1/customers accept customerGroupId (a group id, or null for no group). It needs customer_groups:write as well as customers:write . An unknown or other-environment group is 422 customer_group_not_found before anything is written. Customer responses carry customerGroupId (nullable) only for callers holding customer_groups:read . They then also carry taxExemption : the customer's effective exemption as the merchant sees it ( { v, source, entityUseCode, exemptionNumber, groupId, groupName } , source customer or group ), or null when none applies. Buyer proof is not applied here. Line resolvers and quote lookups are not sent the exemption: their customerGroup field is { id, kind, percentBps, version } . GET /api/v1/customers?customerGroupId=<id> lists the members of a group; customerGroupId=none lists customers in no group. It needs customer_groups:read . What buyers see A signed-in buyer can read the groups they belong to: the name and id of each, in groups on their own profile . A disabled group is hidden from them, as if they were not in it. Pick group names you are happy for the buyer to see. The Builder's Show when can use groups to show or hide content on the storefront. Look up groups for many customers POST /api/v1/customer-groups/lookup answers the group of up to 100 customers in one call. Customers in no group, unknown customers and other-environment ids are left out. It has its own rate-limit bucket per key and environment and answers Cache-Control: no-store . Import column A customer import can map a Customer Group column (field customer.customerGroup ). Cells name a group, matched ignoring case in the import's application and environment; none clears the group. A name that matches no group fails that row with customer_group_not_found . Mapping the column needs customer_groups:write . See Bulk imports . Events Four webhook events, readable with customer_groups:read : customer_group.created , customer_group.updated (carries previous values), customer_group.deleted (carries removedMemberCount ) and customer_group.members_changed (up to 100 changes of customerId , groupId , previousGroupId , and a source such as api , dashboard or import ). The other three carry the group, including its version . See Webhooks . Group-limited promotion codes A dis"},{"title":"Discounts for Cart-Backed Checkout","route":"/developers/discounts","headings":["Discounts for Cart-Backed Checkout","Supported types","Percentage off","Fixed amount off","Free shipping","Free-shipping codes","On the cart, the session and the order","Use the SDK","Preview without mutation","Customer limits","Limit a code to customer groups","Exclude products from a code","List and search codes","Cart and order records","Payment flow","Metadata","Apply to checkout","Pre-applying at session create","Discounts in more than one currency","Current boundaries"],"text":"Promotion codes Discounts for Cart-Backed Checkout Throttle supports percentage, fixed amount and free-shipping promotion codes. The payment processor does not validate or calculate codes; Throttle computes the discounted cart total before checkout hands the final amount to payment. Supported types Percentage off type: "percentage" , with value: 25 for 25% off. Fixed amount off type: "fixed_amount" , with value: 500 for $5.00 off in minor units. Free shipping type: "free_shipping" . It has no value ; it takes the delivery price off. See Free-shipping codes . A code applies after each line s own discountAmount (a manual discount the merchant set on the line or spread from an order discount). A 10% code on a $500 cart with $50 already off its lines takes $45, not $50, and a fixed-amount code is capped at what the lines come to after their discounts. Buy-X-get-Y is no longer an active product surface. Existing historical rows may remain inactive, but new code should only create percentage, fixed amount or free-shipping discounts. Free-shipping codes A free-shipping code makes delivery free for the orders it fits, by region and by shipping option, and can be limited to customer groups like any other code. It never changes a goods line's discount or the tax on goods. conditions.shipping.zoneIds lists the shipping zones the code applies to, matched against the ship-to address. null means all regions. conditions.shipping.targets lists the options the code makes free: kind: method , methodId for a native method, or kind: carrier_service , provider, carrier, serviceCode for a live carrier service. null means any option. An empty list is refused in both fields; send null . The API still accepts the legacy kind: method , methodId: flat_rate target, but it cannot apply end to end: a cart on the flat-rate fallback has no selected shipping method, so the code reads pending_shipping and charges full shipping. The dashboard does not offer it; use a native method or carrier service target, or null . The cap and the minimum are per currency. amounts[CUR].value is an optional cap on the reduction (no cap means free in full) and amounts[CUR].minOrder is the minimum goods subtotal. A code with caps is offered only in the currencies that have one. value itself is 0. The type is immutable. An update that changes it answers discount_type_immutable . Custom shipping is never touched. A typed amount (the dashboard's custom shipping) and a quote's flat or free shipping stay as set. A store that does not charge shipping refuses the code with 422 discount_not_applicable . Subscription renewals are out. The code applies to the order it is used on. Bring-your-own shipping records the code only if you send the reduction. When shipping is in bring-your-own mode, your checkout prices the shipping, so Throttle cannot see what the code took off. Send shippingDiscountAmount (minor units) on POST /api/v1/shipping-tax/external-snapshots for any cart that holds a free-shipping code, with selectedShipping.rateAmount as the original price ( rateAmount = totals.shippingTotal + shippingDiscountAmount ). Without it the order records no shipping code and the code's use is not counted against its limits. A value above the shipping price, or on a cart with no free-shipping code, answers 400 invalid_shipping_discount . On the cart, the session and the order Every cart, cart session and checkout session carries shippingDiscountTotal (0 without a code) and appliedShippingDiscount ( null without one). shippingTotal is the shipping the buyer pays, already net of the code, so the price before the code is shippingTotal + shippingDiscountTotal . appliedDiscount is the goods code only; its freeShipping flag is gone. Orders and invoices carry shippingDiscountTotal and shippingDiscountCode . applied : the code reduces shipping now. amount is the reduction. pending_address and pending_shipping : the code is on the cart but there is no ship-to address or no selected shipping option to judge yet. not_eligible with a reason of zone , shipping_option or minimum_order (with amountToMinimum ): the code stays on the cart with a reduction of 0 and works again once the cart qualifies. Use zoneIds , targets and cap to explain the rule ( US only , Add $12 more ). merchant_applies : your store prices shipping itself, so Throttle cannot; your checkout honours the rule. The shipping methods a shipping-tax calculation offers carry discountedAmount when the code would apply to them, so a custom checkout can show the price with the code beside the full price. The amount stays the full price. Usage is counted only when the order's shippingDiscountTotal is above 0, so a code that sat on a cart that never qualified is not used up. Group, date and usage-limit failures remove the code from the cart, as they do for goods codes; a group-limited code a buyer is not eligible for answers exactly like an unknown code. Use the SDK @usethrottle/discounts is a server-side, headless SDK. It does not ship a coupon input UI; your checkout owns that field. Preview without mutation Use preview when the buyer types a code in your order summary. It returns the discount amount and total without creating or changing a cart. Include a customer ID when you want the preview to check the customer redemption limit. When a code has a minimum order total and the order is under it, the validate and preview responses add minimum (the code's minimum in the order's currency) and shortfall (how much more the order needs to reach it). Both are money values: amount, currency, display , where amount is in minor units and display is the formatted string, for example €12.50 . They are absent when the order meets the minimum. A cart that applies such a code answers discount_invalid with the same minimum and shortfall in details . Format amount and currency with formatMoney from @usethrottle/money ; see Showing money . Customer limits New d"},{"title":"Embed Throttle Without Owning Payment UI","route":"/developers/embedded-checkout","headings":["Embed Throttle Without Owning Payment UI","PaymentEmbed","CheckoutEmbed","Raw iframe","Origin allowlist","Preview origins","Choosing the right surface","Session lifecycle","Sequence: postMessage handshake","Query parameter reference","postMessage event reference","Complete-session payloads","Completion errors","Payment-method filtering","Pay button text"],"text":"Checkout surfaces Embed Throttle Without Owning Payment UI Use an iframe-backed surface for payment capture while your backend controls session creation and your webhook endpoint controls durable state. PaymentEmbed Use PaymentEmbed when your storefront already owns cart, address, shipping, and order summary UI. Throttle renders the payment form and posts lifecycle events to the parent page. If you show a promotion-code field in that order summary, preview it on your server and apply it to the Throttle cart before creating the session. Both components build their own iframe URL and load the /c page by default. Pass route="s" to load the unified /s page instead — for example to match the route you give buildCheckoutEmbedUrl on your server. The component does not see a URL you built yourself. Card-vault (add-a-card) sessions are only served by /c . CheckoutEmbed Use CheckoutEmbed when you want a fuller hosted checkout flow inside your page. It supports the same terminal events plus checkout step changes. Raw iframe If you are not using React, render the hosted checkout iframe directly and validate the postMessage envelope before trusting events. Origin allowlist Embedded checkout refuses to render unless the parent origin is allowlisted. Configure production and staging origins before mounting the iframe. Preview origins Preview deployments get a new hostname per branch, so they cannot be listed one by one. In a non-production environment, an entry may use one wildcard as its leftmost label: https://*.preview.example.com matches https://pr-42.preview.example.com and any deeper subdomain. It does not match https://preview.example.com itself; list that separately if you need it. The wildcard must sit under a domain you own. One over a shared or public suffix ( https://*.vercel.app , https://*.pages.dev , https://*.co.uk ) is refused with 400 invalid_origin , because anyone can obtain a hostname there and could then host your checkout. Point a subdomain of your own at the preview host instead. Production takes exact origins only. A wildcard sent to the production environment is refused, and creating an application never accepts one, since that seeds every environment at once. For a domain cutover, list the old and the new origin side by side and remove the old one afterwards. A wildcard entry applies to embedded checkout, cart sessions, storefront sign-in and the script manifest. One exception: the sandbox that runs extension scripts only ever lets exact origins frame it, so sandboxed scripts do not run on a preview origin matched by a wildcard. A wildcard is also never used to build a link. If your allowlist holds only wildcards, set storefrontBaseUrl so buyer emails and relative image paths have a real host to point at. Throttle sends iframe events with a specific target origin. Your parent page should also verify event.origin , source: "throttle" , and version: 1 . Choosing the right surface The hosted checkout app exposes two route shapes. Both honour the same origin allowlist and emit the same postMessage events; they differ in who owns the buyer-data form (Throttle vs. the payment provider) and which payment methods can co-exist. /c/[sessionId] Provider proxy mode , The provider embed collects email, address, and card inside its own iframe. Throttle wraps it with merchant branding and a Pay button. , Card (provider) , code: PaymentEmbed , ], [ html: /s/[sessionId] Unified flow , Throttle renders the cart, address form, and a payment-method picker. Card and Net 30 can appear side-by-side as tiles in the same iframe. , Card (provider) and/or Net 30 , code: CheckoutEmbed , ] ] /> Session lifecycle Every embedded checkout follows the same four-step rhythm. Sessions are server-side state; embed tokens are short-lived JWTs that the iframe re-mints on demand. The session id ( sess_xxx ) is the durable handle stored in checkout_sessions . The embed JWT ( embedToken ) is a provider-signed credential the iframe needs to mount the card capture widget. The iframe re-mints it every render, so the JWT's ~30 minute TTL is rarely user-facing. The underlying cart stays open for the whole life of a session. The cart only becomes converted (terminal) when the session completes and the order is created — not when the session is created. So a buyer can return to an in-flight session and keep mutating the cart. If a later cart operation returns 409 cart_not_open , the cart was converted by a previously completed order; start a new cart for the new purchase. Completing a session whose cart was retired also answers 409 cart_not_open , with details.reason merged (a sign-in claim moved the buyer to their account's cart) or expired (the cart sat idle or its checkout expired). Nothing is ordered; start a new checkout session for the cart the buyer now has. checkout.getSession(sessionId) ( GET /api/v1/checkout/sessions/ id ) returns the session with its current status : open or processing while the buyer is in it, then completed , cancelled or expired . Use it to decide whether a session can be resumed or needs cancelling, instead of tracking that on your side. To tear down an in-flight session, call checkout.cancelSession(sessionId) ( DELETE /api/v1/checkout/sessions/ id ). It is idempotent, marks the session cancelled , and re-opens an associated cart still sitting in checkout . A completed session cannot be cancelled ( 422 already_completed ). GET /api/v1/checkout-sessions/ id returns currency : the session s currency, which is its cart s. Every amount the checkout page shows is in minor units of it, so a custom checkout formats its totals with it (for example formatMoney(total, session.currency) from @usethrottle/money ) without waiting for a card token. It is null only when the cart can no longer be read. GET /api/v1/checkout-sessions/ id — unauthenticated, what the iframe itself reads to render — returns recurringTerms when the session carries a recurring intent, otherwise null ."},{"title":"Collection Flags","route":"/developers/embedded-checkout/collection-flags","headings":["Collection Flags","The collect block","Worked combinations","Shipping only (default — physical goods, no separate billing)","Billing only (digital goods + invoicing)","Both (shipping + separate billing)","Neither (replaces ?mode=payment-only)","Flow: which steps render","Complete-session billing fields","Validation errors","Iframe behaviour","Migration: ?mode=payment-only","Next"],"text":"Embedded Checkout Collection Flags Tell Throttle which buyer addresses to collect during the embedded flow. Each session opts into shipping and billing capture independently — useful for digital-only carts, B2B Net 30 invoicing, and storefronts that already collected the address upstream. The collect block POST /api/v1/checkout/sessions accepts an optional collect object on the request body: true , except with subscriptions (below) , html: When true , the iframe renders the shipping address step and /complete requires shippingAddress . , ], [ code: collect.billingAddress , code: boolean , html: false , with two exceptions (below) , html: When true , the iframe emits a step: 'billing' postMessage and /complete requires billingAddress (or billingSameAsShipping: true ). , ] ] /> Omitting collect on a one-off checkout is equivalent to shippingAddress: true, billingAddress: false . Existing integrations that don't opt in keep the old shape. On a checkout with subscriptions, an omitted collect turns the shipping step on only when the cart holds a shippable one-time line or a physical subscription line ( deliveryMethod: shipment ); other subscription lines never ship. A collect object that leaves shippingAddress out still sets it to true . See Mixed Carts . An omitted collect.billingAddress defaults to true in two cases, because otherwise the checkout has no address to tax: the application taxes from the billing address (tax trigger billing_address ); the session shows no shipping step ( collect.shippingAddress resolves to false , for example a subscriptions-only cart), and the application uses a tax provider (tax mode app_based ) with an address trigger and the strict fallback policy, which refuses to complete a checkout it could not tax. In that second case, with the shipping_address trigger, tax is calculated from the billing address, and the order records metadata.taxTrigger: 'billing_address' so the filed tax document uses the same address. It also records metadata.taxTriggerSource: 'checkout' to mark that value as Throttle's: if the buyer retries a declined payment, the order's trigger is worked out again for the new attempt, and a stamp with that mark is replaced or removed. A metadata.taxTrigger you set on the cart or the session (the session's wins, as it does on the order) is never overwritten, and it also replaces a value already on an order that a retry reuses. The quote and the filed document both follow it, so shipping_address on a session with no shipping step is refused with tax_address_missing under the strict policy. An explicit billingAddress: false always wins. Worked combinations Pick the combo that matches your storefront. Every example below is the request body for POST /api/v1/checkout/sessions . Shipping only (default — physical goods, no separate billing) Billing only (digital goods + invoicing) Common for B2B Net 30 flows where shipping is irrelevant but the AR system needs a billing address. Both (shipping + separate billing) The buyer fills shipping, then is asked whether billing matches. If they uncheck "billing same as shipping", a billing form appears. Neither (replaces ?mode=payment-only) Use when your storefront has already collected the buyer's addresses. Send them as customer.shippingAddress and customer.billingAddress : they are stored on the session, returned when you read it, and carried onto the order when the session completes. An address submitted on /complete always wins over the one sent here. Flow: which steps render The two boolean flags fan out into four distinct iframe step machines. Use this to confirm the buyer journey before you ship — especially when a connector requires a billing address regardless of shipping. Complete-session billing fields When collect.billingAddress is true, the iframe POSTs the billing details on /complete . Two new request-body fields: billingAddress — same shape as shippingAddress : firstName , lastName , company? , addressLine1 , addressLine2? , city , stateProvince , postalCode , countryCode (ISO-3166-1 alpha-2), phone? . billingSameAsShipping — boolean, defaults to false . When true , the server copies the shipping address into the order's billing slot and you can omit billingAddress . Validation errors When a required address is missing, the server returns 422 address_required with a field extra so the iframe can highlight the right step. No card is authorised without the address. The card-form token mint ( GET /api/v1/checkout-sessions/:id/embed-token ) answers the same 422 address_required while a required address is on neither the session, its cart, nor the customer prefill, so the card form cannot authorise before the address step. The compact route ( /c ) has no address step: a session that still needs an address is sent to the full checkout ( /s ), which asks for it first. A refused completion voids the card hold. When POST /api/v1/checkout-sessions/:id/complete refuses an embed payment ( paymentMethod: "embedded" ) after the card was authorised — address_required or any other refusal that creates no order — Throttle voids that authorisation, so the buyer is not left with a hold. The transaction id cannot be completed on again ( 409 transaction_already_used ); start a new payment. Refusals the client is told to retry ( payment_unverified , checkout_in_progress ) keep the authorisation. Iframe behaviour The Pay button auto-disables until every collect-flagged field is complete. Parent-set submitDisabled still composes additively — see Parent Controls . With collect.billingAddress: true , the iframe emits an additional throttle.step.changed event with step: 'billing' . With collect.shippingAddress: false and collect.billingAddress: false , the buyer lands directly on the payment step (this combo replaces the legacy ?mode=payment-only URL flag). Migration: ?mode=payment-only The ?mode=payment-only URL query parameter is sti"},{"title":"Parent Controls","route":"/developers/embedded-checkout/parent-controls","headings":["Parent Controls","The submitDisabled prop","Defaults","Composes with collect-flag auto-disable","Without React","Message contract","Security","What does it actually do inside the iframe?","Common uses","Next"],"text":"Embedded Checkout Parent Controls Gate buyer interaction with the embedded checkout from the parent page. Useful when your storefront has fields that must be filled (shipping address, terms acceptance, plan selector) before the buyer should be able to submit the embedded payment. Is: a way for the parent to render an overlay over the entire embed area that swallows clicks until the parent says otherwise. The overlay is light-grey + cursor not-allowed so the buyer sees the form behind but can't interact with it. Isn't: a way to validate the buyer's data from the parent. Field-level validity is up to your form. The parent signals ready or not ready — Throttle just enforces the gate. The submitDisabled prop Both <PaymentEmbed /> and <CheckoutEmbed /> in @usethrottle/checkout-react accept a controlled submitDisabled?: boolean prop. When it flips to true , the SDK posts a parent → iframe command and the iframe renders a full-area overlay. When it flips back to false , the overlay disappears. Defaults Omitting submitDisabled entirely keeps the embed enabled (backward compatible). The SDK never posts a parent command in this case. submitDisabled= false and omitting the prop are equivalent at runtime, but passing false explicitly opts your embed into the parent-control protocol — useful when your form starts valid (e.g., everything pre-filled). The first parent command is sent after the iframe posts throttle.ready . You don't need to wait for this in your component code — the SDK buffers and re-sends. Composes with collect-flag auto-disable The iframe also auto-disables the Pay button until every field required by the session's collect flags (shipping address, billing address) is complete. Parent-set submitDisabled composes additively with that validation gate: the button stays disabled while either the parent says "not ready" or the iframe's own validation hasn't passed. Practically: you don't need to mirror the iframe's address validation in your parent form. Only gate on parent-controlled state (terms checkbox, plan selection, out-of-band eligibility checks). Throttle handles the rest. Without React The SDK is a thin wrapper over postMessage. Vanilla JS, Vue, Svelte, Angular — anything that mounts an iframe can post the same shape. Message contract The parent → iframe channel uses source: 'throttle-parent' to disambiguate from the iframe → parent events (which use source: 'throttle' ). The iframe ignores anything that doesn't match. Future commands will extend the same envelope; the protocol is additive. Security The iframe verifies event.origin matches the merchant-allowed parent origin before reading the message. A different page can't steal control. Setting disabled: false from an attacker doesn't bypass anything — it simply removes the overlay. The buyer still has to actually submit the form, and Throttle still has its own server-side validation on the /complete route. The overlay is cosmetic , not a security boundary. It blocks the buyer's clicks but doesn't prevent scripts. Treat submitDisabled as a UX gate, not a server-side enforcement primitive. What does it actually do inside the iframe? The iframe's EmbedShell listens for the parent command and renders a positioned overlay (semi-transparent white + cursor not-allowed) covering the embed content when disabled. The overlay sits at z-index 50 so it covers both Throttle's native UI and any nested provider iframe (the card form). The buyer sees what they've typed but can't click anything. We chose "overlay over the iframe" instead of "disable the submit button only" because the provider embed renders its own submit button inside a nested iframe we don't control. Greying the entire interaction surface gives the same UX outcome with stable semantics. Common uses Address before pay. Your parent page renders a shipping address form. Pass submitDisabled= !addressValid . Terms acceptance. A "I agree to terms" checkbox above the embed. Pass submitDisabled= !checked . Plan selection. Buyer must pick a plan before paying. Pass submitDisabled= !selectedPlan . Async eligibility. You're waiting on a backend check (e.g., calling subscriptions/eligibility-check ). Disable until the result returns. Next Embedded Checkout — full embed lifecycle and event reference."},{"title":"Workspace Environments","route":"/developers/environments","headings":["Workspace Environments","Environment-scoped keys","Dashboard environment selector","Manage environments","API keys are environment-scoped","Payment provider environments","Webhook environment routing","Cheat sheet","Production is immutable; non-production environments can be named for your flow.","Production:","Include archived environments for settings/audit screens","Create a non-production sandbox-provider environment","Archive a custom non-production environment"],"text":"Reliability Workspace Environments Throttle isolates production from every sandbox-provider environment inside the same workspace. Each workspace has one immutable production environment and can have multiple non-production environments such as test, UAT, and staging. Environment-scoped keys API keys are minted for a workspace environment. The raw key includes the environment slug, and every request is scoped to the key's environment end-to-end: sk_<environment-slug>_* — secret key for server-side requests. pk_<environment-slug>_* — publishable key for browser/frontend code. Publishable keys may hold only stateless compute scopes such as shipping_quotes:write and tax_calculations:write . Carts, discounts/promotions, orders, payments, subscriptions, shipping/tax settings, invoices, Net-N customer terms, dashboard views, webhooks, API keys, and connector state all carry an environmentId . A UAT cart never becomes a production order, and a production webhook endpoint never receives UAT events. Dashboard environment selector The dashboard topbar selector chooses the active workspace environment for reads and setup writes. Production workspaces can switch between production and any active non-production environment. Workspaces that have not completed go-live can work in non-production environments until production is available. Create and archive custom environments from Workspace Settings → Environments . Manage environments Every workspace starts with one immutable production environment. Create additional environments for UAT, staging, or QA; each custom environment is non-production and routes to sandbox-provider credentials. Production cannot be created, archived, or deleted. Archiving a custom environment removes it from normal selectors and prevents new work in that environment; historical rows keep their environment id for audit and reporting. API keys are environment-scoped GET , POST , and DELETE /api/v1/api-keys act only on the request's selected environment. Create separate keys for production, UAT, staging, or any other non-production environment you run. An API key whose environment contradicts an explicit X-Throttle-Environment-Id header is rejected outright with 403 environment_mismatch . Fetching a specific resource (an order, a subscription, and so on) by id from another environment answers 404 not_found instead — the lookup is already scoped to your environment, so a resource that belongs to a different one simply doesn't match, the same as an id that doesn't exist at all. Either way, use a key for the correct environment, or select the matching X-Throttle-Environment-Id for dashboard-session setup calls. Payment provider environments Throttle uses the workspace environment to choose the provider environment. Production routes to production processors; non-production environments route to sandbox-provider wiring such as the Card Simulator or sandbox payment processor. Production payment paths require production entitlement. Non-production environments are available for integration work before go-live. Webhook environment routing Outbound webhook endpoints are scoped to a workspace environment. Events carry environmentId in the delivered envelope and are delivered only to endpoints in the same environment. Cheat sheet Use non-production environment keys such as sk_uat_* for development and UAT. Use environmentId to choose dashboard-session setup scope; API keys already carry their environment. Going live makes the immutable production environment usable for production payment paths without changing the structure of your integration code."},{"title":"Bootstrapping Extension Credentials","route":"/developers/extensions/bootstrap","headings":["Bootstrapping Extension Credentials","The handshake, end to end","1. Issue client credentials","2. Where the client secret goes","3. Receive the install callback","4. Pull your credentials — read the secret, mint the key","Read the signing secret","Mint a fresh API key","Rotate a leaked signing secret","Error codes to distinguish in your handler","5. Recover: enumerate your own installs","The three credentials, and why they rotate differently","Next steps","secret API key holding extensions:write — an extension can never mint this","for itself (not on the extension_client allow-list).","→ { data: {","\"clientId\": \"extc_...\",","\"clientSecret\": \"...\", ← shown once, never again","\"installCallbackUrl\": \"https://your-worker.example.com/throttle/install-callback\"","} }","Calling this again ROTATES the pair — the previous secret stops verifying immediately.`;","public identifiers, wrong for the client secret.","The client secret goes in the deploy's secret store instead, never in a file","that gets committed:","(Vercel: vercel env add · Fly: fly secrets set · Render: dashboard env group)`;","you need the secret in order to verify a delivery in the first place.","\"installationId\": \"inst_01HZX...\",","\"installSequence\": 2,","\"endpointId\": \"we_01HZY...\",","\"url\": \"https://your-worker.example.com/webhooks/throttle\",","\"enabledEvents\": [\"order.created\"],","\"signingSecret\": \"whsec_...\",","\"previousSecretExpiresAt\": null","} }`;","keeps the outgoing one verifying for graceSeconds (default 86400 = 24h), so","deliveries in flight do not start failing before you have stored the new one.","\"signingSecret\": \"whsec_...\", ← the new one","\"previousSecretExpiresAt\": \"2026-09-15T10:00:00.000Z\"","replaces. Call this only after a delivery's signature has verified, and only","when you actually need to write back to Throttle."],"text":"Extensions Bootstrapping Extension Credentials Every credential Throttle mints by default belongs to one install and is shown to the installing merchant, once. That works for an iframe extension a human eventually opens, but it leaves a webhook-only extension with no machine route to its own secrets at all — every delivery fails signature verification until someone copy-pastes a secret out of the dashboard. Client credentials close that gap: a developer issues one pair for their catalog extension, and every install after that bootstraps itself. The handshake, end to end Four exchanges, only the first of which involves a person. The thing to hold on to is which way each arrow points and what it carries: Throttle pushes the fact of an install, and your extension pulls the secret — the push is deliberately worthless to anyone who intercepts it. 1. Issue client credentials From your extension's catalog settings in the dashboard, generate a clientId / clientSecret pair. This is a one-time, developer-facing action — it is never shown to a merchant. The route accepts a dashboard user holding the application:extensions:write permission, or a secret ( sk_ ) API key holding the extensions:write scope — but never the extension's own client credentials, which are deliberately not on the allow-list that reaches this route. An extension cannot mint its own credentials. installCallbackUrl must be https:// — a plain http:// URL is rejected with 422 invalid_callback_url . Calling this route again rotates the pair immediately — the previous secret stops verifying the moment the new one is issued. That is deliberate: a developer rotating their own deploy s secret picks up the new value from their own secret store in the same step, unlike the per-install rotations below, which do carry a grace window because a merchant is not redeploying anything. 2. Where the client secret goes A typical extension worker already keeps a wrangler.jsonc (or equivalent) with a vars block for public values like THROTTLE_EXTENSION_ID . That block is committed to git and readable by anyone with repo access — correct for an identifier, wrong for a secret. The client id is fine alongside it; the client secret is not. Put the client secret in your deploy's secret store — wrangler secret put for a Cloudflare Worker, or the equivalent for whatever you deploy to. Nothing about the existing vars block tells you where the line is; this is that line. 3. Receive the install callback Once you have client credentials and an installCallbackUrl on file, every future install of your extension POSTs a signed notice to that URL — the only human action anywhere in this flow is the merchant clicking Install. The payload carries identifiers only, never secrets : it tells you an install happened and who it belongs to, not how to authenticate as it. The request carries an X-Throttle-Install-Token header — an RS256 JWT signed with the same extension JWKS keypair your bridge already verifies session tokens against. aud is your extension id, sub is the installation id. The JSON body repeats the token's claims for convenience, but a receiver must verify the JWT against https://api.usethrottle.dev/.well-known/extension-jwks.json and trust its claims — never the body. A body is just JSON anyone could send; the signature is what makes workspaceId , applicationId , and the rest trustworthy. An install can never fail because your endpoint was unreachable. Throttle attempts the callback 3 times total (two retries) with backoff, then gives up silently — the merchant's install always succeeds regardless. Retries are status-driven, not blanket: any response below 500 ends delivery immediately — a 4xx is treated as a permanent rejection and is never retried. Respond 5xx for a transient failure you want Throttle to retry, and reserve 4xx for a failure that retrying would never fix (a bad or missing token). If the callback never arrives (dropped, never configured, all 3 attempts exhausted, or you lost your own datastore), enumerate your installs instead of waiting for it. 4. Pull your credentials — read the secret, mint the key Every route below authenticates with the same header: Authorization: Basic base64(clientId:clientSecret) . Nothing else accepts that scheme, and a client credential can reach only these three routes plus the enumeration route below — anything else is 403 before the handler runs, and so is the wrong verb on a route it can reach. But the read and the mint are not interchangeable , and treating them as one call is the mistake this section exists to prevent. A client id/secret pair base64-encodes to well over 76 characters, so GNU coreutils base64 (the default on Linux and most CI images) inserts a newline into the header value — BSD/macOS base64 does not, which is exactly why this ships unnoticed from a Mac. The wrapped header fails validation and comes back as 401 unauthorized , which reads as a wrong secret rather than a formatting bug. Pipe through tr -d \\n (portable) or pass base64 -w 0 on GNU systems. Fetching the signing secret is a read — idempotent, and safe to call before you have verified a request, which you must, because you need the secret in order to verify it in the first place. Minting the API key is not a read: it issues a brand-new key and expires the old one. Call it only after a delivery's signature has verified, and only when you actually need to write back to Throttle. Collapsing both into one ensureCredentials() call hands anyone who can guess an installation id a way to churn your keys from outside — the read is harmless to run on unauthenticated input, the mint is not. Read the signing secret Genuinely readable: the secret lives in cleartext on the installation's webhook endpoint row, so re-reading it changes nothing. Call this as soon as you learn an installation id — before you have verified anything with it — because it is what lets you verify. Mint a fresh API key API keys are hashe"},{"title":"Build an Extension","route":"/developers/extensions/build","headings":["Build an Extension","Design for each installation","Choose where code runs","Browser iframe","Publisher backend","1. Create the extension","2. Create and publish a version","3. Install into an application","4. Wire the iframe bridge","Option A — hosted script (no build step)","Option B — npm package","Sandbox flags and the full-width layout","React pattern","Deep links","Runtime model","Next steps","→ { data: { id: \"ext_...\", name: \"Inventory Sidebar\", lifecycle: \"draft\", ... } }`;","→ { data: { id: \"ver_...\", version: \"1.0.0\", status: \"draft\", ... } }","3. Publish the version (marks it installable)","→ { data: { id: \"ver_...\", status: \"published\", ... } }`;","Response (store the API key immediately — shown once. The signing secret can be read back later.):","\"data\": {","\"id\": \"inst_...\",","\"extensionId\": \"ext_xxx\",","\"versionId\": \"ver_xxx\",","\"status\": \"active\",","\"environmentId\": \"8a5f2d1e-3d2a-4d24-93a1-fd3f9e1f37f0\",","\"environmentSlug\": \"uat\",","\"environmentKind\": \"non_production\",","\"providerEnvironment\": \"sandbox\",","\"apiKey\": \"sk_uat_...\", ← store this securely; shown once","}","}`;"],"text":"Extensions Build an Extension This guide walks you from creating an extension catalog entry to having a working iframe panel with authenticated API access and live event delivery. Start with the Get Started tutorial . This page explains architecture and API mechanics after your first private install. Design for each installation Treat every installation as an independent tenant connection. Store a server-side record keyed by installation ID with the workspace, application, environment, pinned extension version, provider account reference, encrypted credential reference, status, last successful sync cursor, timestamps, and uninstall state. Throttle is the authority for whether an installation is active and which version and scopes it has. Your backend is the authority for provider credentials, mapping state, cursors, retries, and reconciliation. Never infer tenant identity from a provider account alone; validate the signed installation context. Stop queued and scheduled work when an installation is suspended or uninstalled. Choose where code runs Browser iframe Use for safe display settings and operator actions. Verify bridge identity and assume users can inspect all browser-delivered data. Publisher backend Use for provider secrets, event processing, scheduled synchronization, reconciliation, and privileged provider calls. 1. Create the extension The extension manifest declares what surfaces your extension exposes, which scopes it needs, and which events it wants to receive. You can declare an iframeUrl , a webhookUrl with eventSubscriptions , or both. Every scope listed must be extensionAllowed — see the Scopes reference . Every scope in the manifest is validated against the extensionAllowed flag when the extension is created or updated. Human and admin scopes ( team_members:* , billing:* , admin:* , * ) are never grantable to extensions and return 400 invalid_scope . 2. Create and publish a version Versions are immutable snapshots of the manifest. Create a version when you're ready to make an installable release, then publish it. A version must be published before it can be referenced in an install call. 3. Install into an application Installs are application-scoped and environment-scoped. The install response contains a one-time API key and, if a webhook URL is declared, the signing secret. Copy the API key immediately — it is shown exactly once. The signing secret is stable and readable at any time, so losing it is recoverable. The apiKey and webhookSigningSecret are unique to each install. Store them in your secrets manager. The API key is shown exactly once — losing it means uninstalling and reinstalling. The signing secret is stable and readable at GET /api/v1/installations/:id/webhook-secret . Copying either value into your extension by hand is deprecated and will be removed in a future release; use automatic setup . 4. Wire the iframe bridge For UI (iframe) extensions, call createBridge() once at page load. The bridge sends a ready message to the dashboard, which responds with a signed session token and context. The token is automatically refreshed before it expires (10-minute TTL). Option A — hosted script (no build step) Option B — npm package Sandbox flags and the full-width layout The dashboard renders your iframe with allow-scripts allow-forms allow-same-origin allow-popups . A version can request more with sandboxFlags , chosen from allow-modals (native confirm() and alert() ) and allow-downloads . Any other value is a validation error on the sandboxFlags field. The flags are part of the version: the merchant sees them in the install wizard next to the scopes, staff see them at review, and the iframe uses the flags of the version the installation is pinned to. An editor-style extension can also ask for the whole viewport. The dashboard hides its side navigation and page padding for that iframe, and restores them when you send default , when the merchant navigates away, or when the iframe loads a new document with the bridge (a reload starts from the default layout, so ask again after bridge.ready ). If your iframe navigates to a page that does not load the bridge, the full layout stays until the merchant navigates away or you ask for default first. The message needs @usethrottle/extension-bridge 1.2.0 or later. A dashboard without this feature ignores the message, so setLayout resolves 'unsupported' after one second. Both additions are optional: nothing changes for an extension that uses neither. React pattern Always pass targetOrigin: 'https://app.usethrottle.dev' to createBridge() . Without it the bridge falls back to document.referrer or '*' as the postMessage target, which can leak the session token to other origins if the referrer is spoofed. The bridge does not pass configSchema or installed config values automatically. The dashboard consumes configSchema to collect settings during install and stores the resulting config on the installation record. See the configuration schema guide for the full lifecycle. Deep links A link to the launch page can open your iframe at a specific page. Add a page query parameter, and the dashboard loads your iframeUrl with that value as its URL fragment, so ?page=/products?x=1 opens <iframeUrl>#/products?x=1 . Read location.hash in your iframe to route. The value must be URL-encoded in the query string. The dashboard accepts it only when it is a string that starts with / , does not start with // , contains no \ , no # and no control characters, and is at most 512 characters. Anything else is ignored and the iframe opens at its configured URL. An existing fragment on your iframeUrl is replaced. The page is applied when the iframe first loads; changing it later does not reload an open session. Runtime model A UI extension is loaded only after it is installed into an application. The dashboard opens the installed version's iframeUrl , creates a bridge host for that iframe origin, and mints "},{"title":"Extension Events","route":"/developers/extensions/events","headings":["Extension Events","Payload envelope","Verify signatures","Rotate the signing secret","Process idempotently","Delivery inspection and replay","You are told when your endpoint stops accepting deliveries","Auto-suspend on repeated failures","Event catalog","→ { \"data\": { \"installationId\": \"…\", \"endpointId\": \"…\",","\"signingSecret\": \"whsec_…\", # shown once","\"previousSecretExpiresAt\": \"2026-09-11T09:15:02.101Z\" } }`;","Replay a dead-lettered delivery","Send a verification ping to the installation's webhook URL.","The ping is signed with the installation's signing secret, like every delivery."],"text":"Extensions Extension Events Extensions can subscribe to Throttle events by declaring a webhookUrl and an eventSubscriptions list in their manifest. Throttle creates a managed webhook endpoint for each install and delivers signed events to your URL with the same retry and dead-letter mechanics as standard webhooks. Use this reference for backend and hybrid applications after your first private install , then validate retries and replays with the testing guide . Payload envelope Every delivery is a JSON POST with a stable top-level envelope. The event-specific payload lives under data . Headers: X-Throttle-Signature , X-Throttle-Event-Id , X-Throttle-Event-Type , Content-Type: application/json . Envelope fields: id (unique event ID), type , version (payload-schema version, currently "1" ), workspaceId , environmentId , environmentKind ( production or non_production ; omitted only when the environment could not be resolved, so treat absent as unknown rather than as production), createdAt , data . Additive fields are not a version bump. Throttle adds envelope fields and data fields without changing version , announced in the changelog but not ahead of the first delivery that carries them. Parse the envelope with a schema that strips unknown keys. A .strict() envelope schema rejects every delivery the moment a field is added, and if your handler reports that with the same 401 as a bad signature, the failure is indistinguishable from a rotated secret. Extension starter versions before PR #11 shipped exactly that schema; update and redeploy. Amounts: all money fields are integer minor units (e.g. cents for USD). Environment isolation: an install only receives events from the same workspace environment. The same event is never delivered across environments. The data shape for every event type is typed in @usethrottle/webhook-types . Import the ThrottleEvent discriminated union or ThrottleEventEnvelope generic and narrow on type to get the exact shape per event. Customer contact fields need customer_pii:read Events that involve a buyer carry a customer object under data : cart.* , order.* , payment.* , fulfillment.* , subscription.* and customer.* , where the customer is the subject of the event. The buyer s contact fields are delivered only to extensions granted customer_pii:read . Without the scope, email , phone , firstName , lastName and name arrive as null . The keys are still present, so the payload shape does not change. What stays: the customer id , externalId , externalCustomerId , company and every address, including the order s shipping address, which a fulfilment extension needs to ship. Which scopes count: the scopes of the version the installation is pinned to. customer_pii:read , or the legacy customers:read , which includes it. To start receiving the fields, publish a version that requests the scope and have merchants upgrade to it. Signatures: the fields are removed before the body is signed, so the signature verifies against exactly the body you receive. Replays follow the same rule. Verify signatures Each delivery includes X-Throttle-Signature in the format t=<unix-seconds>,v1=<hex-hmac-sha256> . The signed payload is <t>.<rawBody> — identical to the standard webhook signature scheme. The signing secret is the per-install webhookSigningSecret returned at install time. Signature verification fails if your framework parses and re-serializes JSON before you verify. Capture the raw request body string first, verify, then parse. verifyWebhook rejects deliveries whose t timestamp is more than 300 seconds (5 minutes) from the current clock. Pass toleranceSeconds to override. For 24 hours after the secret is rotated the header reads t=…,v1=<outgoing>,v1=<new> . Check every v1 against the secret you hold and accept if any matches — @usethrottle/extension-bridge 1.1.1+ and the starter's verifier do. A parser that keeps only the last v1 verifies once it holds the new secret, and not before. Rotate the signing secret Either side can rotate: your extension, authenticated as the installation, or the merchant from the dashboard. The old secret keeps verifying for graceSeconds (default 86400, max 604800) while every delivery is signed with both; 0 revokes it now — the leaked-secret case. When the merchant rotates, you are told: a signed extension.webhook_secret_rotated is delivered to the endpoint — dual-signed, so it verifies with the secret you still hold. It never carries a secret. On receipt, fetch the new one with GET /api/v1/installations/:id/webhook-secret and store it before previousSecretExpiresAt ; that read also reports the deadline while a window is open. Like extension.uninstalled , it is delivered to the installation's own endpoint without a subscription and cannot be listed in eventSubscriptions . previousSecretExpiresAt is null when the old secret was revoked immediately — fetch the new secret at once; deliveries in between will have failed and will be retried. Rotating again inside a window replaces the outgoing secret: only two are ever live. Process idempotently Extension event delivery is at-least-once. Retries use the same backoff schedule as standard webhooks: [5m, 15m, 1h, 6h, 24h] (max five attempts). After the fifth attempt, the delivery is marked dead_letter . Always store each event.id before applying side effects. Delivery inspection and replay Use the installation delivery routes to inspect past attempts and replay dead-lettered events. The delivery list and replay require the extensions:read and extensions:install scopes respectively. The delivery list and replays return payments and saved cards in their public shape , so a stored payload that was projected or cleaned no longer matches its original signature. A replay is signed again over the body it sends. The list shows a payload s customer contact fields only to a caller holding customer_pii:read ; for any other key they read as null . The dashboard pings "},{"title":"Get Started with Extensions","route":"/developers/extensions/get-started","headings":["Get Started with Extensions","Before you begin","Your first private install","You are done when"],"text":"Extensions Get Started with Extensions Build and privately install a third-party app using only Throttle's public dashboard, APIs, packages, and documentation. Before you begin A Throttle workspace and application Developer or Admin access to that application Node.js 20 or newer for the recommended starter A publicly reachable HTTPS URL during iframe or webhook development The list of scopes an extension may request — extensions can only hold scopes marked extensionAllowed , which is a subset of the full API scope catalog. Naming any other scope in your manifest is rejected at publish time. You can create, version, install, and test a private extension in your own workspace. Paid-plan or partner eligibility matters when you submit a public marketplace listing. Your first private install You are done when The iframe displays the verified workspace, application, environment, installation, and user context. The webhook returns 2xx only after verifying the signature against the unmodified raw body. Replaying the same event does not create duplicate provider work. Uninstalling stops scheduled work and removes or disables the installation's provider connection. Next, learn how to design the application , test failure cases , and prepare a marketplace submission ."},{"title":"Extension Identity JWT","route":"/developers/extensions/identity","headings":["Extension Identity JWT","Full claim set","How the dashboard delivers the token","TTL and auto-refresh","Verify tokens in your backend","Using the token as an API bearer","Key rotation","Verifying a shopper's customer token","200, Cache-Control: no-store","{ \"data\": { \"active\": true,","\"customerId\": \"c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f\",","\"emailVerified\": true,","\"expiresAt\": \"2026-10-20T12:15:00.000Z\" } }","# Any token that is not live for this application and environment:","{ \"data\": { \"active\": false, \"customerId\": null, \"emailVerified\": false, \"expiresAt\": null } }`;"],"text":"Extensions Extension Identity JWT When the dashboard opens an extension's iframe, it mints a short-lived RS256-signed JWT that identifies the installation, the acting user, and the current workspace and application context. The iframe receives this token through the bridge handshake and uses it as a bearer on every API call. Use this reference after completing the Get Started tutorial . Identity establishes who launched the iframe; scopes establish what it may do. Full claim set The JWT carries both standard claims ( iss , sub , aud , iat , exp ) and the full ExtensionSessionClaims object as top-level custom claims. The claim set is additive: Throttle adds claims without a version bump and without notice, and never removes or retypes one without a changelog entry. Parse the claims you use and ignore the rest. A strict parser that rejects unknown top-level claims will take every one of your panels dark the moment a claim is added, on our deploy, with no change on your side. iss is always "throttle" . Reject tokens with any other issuer. sub is the installationId . aud is the extensionId . environment reflects the install's workspace environment and matches the API key environment. role is the acting user's application-level role ( admin | developer | finance | viewer ). scopes are the scopes from the pinned version — a ceiling on what the token may do. user.name is currently set to the same value as user.email (workspace members do not have a separate display name column today). How the dashboard delivers the token The dashboard creates a BridgeHost (from @usethrottle/extension-bridge ) that wraps the iframe. When the iframe loads and calls createBridge() , the bridge immediately posts a ready message to the parent. The dashboard calls POST /api/v1/installations/:id/launch-token and replies with a session message carrying token , expiresAt , and a context object. The iframe bridge resolves bridge.ready with that context. POST /api/v1/installations/:id/launch-token is Clerk-JWT only — it requires an authenticated dashboard session. API keys cannot mint launch tokens because tokens embed a human user identity. Attempts with an API key return 400 launch_token_requires_dashboard_session . TTL and auto-refresh Tokens have a 10-minute TTL . The bridge tracks the expiry time and proactively sends a refresh message to the host when the token is within 60 seconds of expiry, or immediately on receiving a 401 from the API. The host mints a fresh token and sends a new session message. All pending and in-flight bridge.api.* calls wait for the refresh before proceeding. Verify tokens in your backend If your extension calls your own backend, pass the bridge token in the Authorization: Bearer header and verify it against the public JWKS. The JWKS endpoint is unauthenticated — no key needed. Always return null / reject on any verification failure — expired tokens, unknown key ID, wrong issuer, bad signature. Never attempt to use a partially-validated payload. The Throttle SDK's verifyExtensionSessionToken follows this contract: it returns null on any error and never throws. Using the token as an API bearer The extension-session JWT is also accepted by the Throttle API as a Bearer token on /api/v1/* routes. The token's scopes claim is used as the caller's granted scope set, exactly as with an API key. This means the iframe can call the API directly without the extension's dedicated API key being present in the browser. The token's scopes are the pinned version's scopes, which are themselves a subset of the extensionAllowed scopes. Calling a route that requires a scope not in the token's list returns 403 insufficient_scopes . Key rotation The JWKS endpoint may publish multiple keys (identified by their kid header). Your verification library (e.g. jose 's createRemoteJWKSet ) automatically selects the right key by kid and caches the JWKS response. Key rotation adds new key(s) to the set before retiring old ones — in-flight tokens remain valid through their TTL, and the JWKS cache handles the transition. Create your createRemoteJWKSet instance once at module initialization and reuse it. The jose library caches the JWKS and re-fetches on unknown kid . Recreating it per-request makes an unnecessary HTTP call on every token verification. See also: Security model for the full threat model around JWT issuance and iframe isolation. Verifying a shopper's customer token The JWT above identifies a dashboard user. A shopper signed in to a storefront holds a different credential: the accessToken from storefront customer accounts . When your extension's backend receives one (for example to show a signed-in shopper their own prices), ask Throttle whether it is live and whose it is. Never trust a customer id the browser sends on its own. Scope. Call it with your installation's secret API key holding customer_tokens:read ; list that scope in your extension's scopes . customers:read does not grant it, and you do not need it: introspection is its own narrow scope so an app that only checks sign-ins never holds customer PII, addresses or stored cards. Publishable pk_ keys cannot hold it ( 403 ). Answer. active: true only for a live access token of the calling key's own workspace, application and environment. Then customerId is the shopper, emailVerified is read from their account now (not from the token), and expiresAt is when the token expires. Inactive. An invalid, expired or revoked token, a signed-out session, or a token of another application or environment all get the same answer, { active: false, customerId: null, emailVerified: false, expiresAt: null } , so the answer tells you nothing more about the token. Treat the shopper as signed out. No caching by Throttle. Responses carry Cache-Control: no-store . Rate limit. The route has its own budget, 600 calls a minute per API key and environment, separate from the rest of yo"},{"title":"Installing Extensions","route":"/developers/extensions/install","headings":["Installing Extensions","Install an extension","Read your signing secret","Scope and event consent","Configuration","Configuration schema","Environment-scoped installs","List and inspect installs","Uninstall","Both the dashboard session token (Clerk JWT) and the Application ID header","are required — installs are application-scoped.","─── Response (apiKey is shown once — store it immediately) ──────────────────","Authenticate with the installation's own API key.","─── Response ─────────────────────────────────────────────────────────","The extension catalog entry and other applications' installs are unaffected.","→ 204 No Content`;","→ { data: { id: \"inst_xxx\", config: { ... }, ... } }`;","Response shape: paginated list","\"data\": [ { \"id\": \"inst_...\", \"extensionId\": \"ext_...\", \"status\": \"active\", ... } ],","\"meta\": { \"requestId\": \"...\", \"pagination\": { \"cursor\": null, \"hasMore\": false } }","One installation by id, scoped the same way. 404 not_found when this","application + environment has no installation with that id."],"text":"Extensions Installing Extensions An install pins a specific published version of an extension to an application, mints a dedicated API key (and optionally a webhook signing secret), and begins event delivery if a webhookUrl was declared. Install an extension Pass the versionId of the published version you want to install, or omit it to install the default version. For another workspace's public extension only the approved version may be named; see Versioning . Optionally pass config — a free-form JSON object that your extension reads at runtime. The install's environment is derived from the caller's API key or dashboard-selected X-Throttle-Environment-Id and cannot be overridden by the request body. apiKey is shown exactly once in the install response. If you lose it, the only recovery is to uninstall and reinstall — a new key is minted. The webhookSigningSecret is different: it is returned once on first install, but it is stable and your extension can read it back at any time (see below), so losing it is recoverable without a reinstall. Having a merchant copy the API key and signing secret out of the install wizard and paste them into your extension is manual setup. It still works, but it is deprecated and will be removed in a future release. Use automatic setup instead: your extension fetches both itself when it is installed. Read your signing secret Your extension can fetch the signing secret for its own installation, so it never has to depend on a human copying the value out of the dashboard at install time: Authenticate with the installation's own API key (or its extension session token, which reads the secret only while the installation is active — once a merchant suspends or uninstalls it, a session minted moments earlier gets 404 for the rest of its ten minutes). A dashboard user holding application:extensions:install can also read it, for a suspended or uninstalled installation too. Any other credential gets a 404 . The route needs no particular scope — the credential itself is the authorisation. Do not attach this response to an error. The natural failure handler — wrap the fetch error with the response body — puts a live signing secret into every error log you keep. Raise an error that carries the HTTP status and nothing else, and read the secret only on the success path. Uninstalling and reinstalling reuses the same installation row, and deliberately keeps the signing secret so verification does not silently start failing. Use installSequence — which increments on every (re)install while id stays put — to tell a reinstall from a restart, and to know when to discard credentials you cached against the install. Scope and event consent When you install an extension, you implicitly consent to its declared scopes and event subscriptions. The installer must hold the extensions:install scope (API key) or the application:extensions:install RBAC permission (dashboard user). The issued API key is scoped exactly to the version's declared scopes. If the extension later publishes a new version with additional scopes , upgrading to that version requires re-consent. The upgrade endpoint returns 409 new_scopes_require_consent listing the new scopes, and the caller must retry with acknowledgedNewScopes: true . See the Versioning guide . Configuration The config field is a free-form JSON object passed at install time and updateable any time thereafter. Use it for extension-specific settings such as API keys for third-party services, feature flags, or integration identifiers. Your extension reads it from the installation record; it is not embedded in the iframe URL or automatically included in the bridge session. Do not place ShipStation keys or other provider secrets in installation config when an iframe can read that config. Collect credentials through an authenticated setup flow, encrypt them in publisher-controlled storage, and retain only a non-secret connection status or provider account label in display configuration. bridge.ready resolves with user, workspace, application, environment, installation id, version, role, and scopes. It intentionally does not include config or configSchema . If a browser iframe needs config, give the extension an explicit read scope and fetch the installation record. Keep secrets that should never reach browser JavaScript on your extension backend instead. Do not store the webhookSigningSecret in config — the config object may be readable by anyone with extensions:read scope. Store the signing secret in your own secrets manager. Configuration schema Extension authors can publish a configSchema to describe the settings an installer should provide. The dashboard authoring flow includes a field builder for simple string, number, and boolean settings plus an advanced JSON editor for custom JSON Schema. During install and on the management page, Throttle uses this schema to render the configuration form. Empty schemas are treated as “no configurable options.” The builder emits a JSON Schema object with type: "object" , properties , and optional required . Use the advanced JSON mode for nested objects, arrays, enums, or provider-specific validation. configSchema lives on the workspace catalog extension while you are editing it. Creating a version snapshots that schema into the immutable version record. Installs use the pinned version's schema to collect per-install config values. Publishing a new schema does not rewrite existing installs until they upgrade to a version that carries it. Environment-scoped installs Installs are per environment. A UAT install receives only UAT events and gets an API key for that environment; a production install receives only production events and gets a production-environment API key. The installs are completely independent — each has its own config, its own API key, and its own event delivery endpoint. List and inspect installs Install status values: active , suspended . Suspended installs sto"},{"title":"Line Resolvers","route":"/developers/extensions/line-resolvers","headings":["Line Resolvers","What a line resolver is","Which installation is called","The request","Verify the signature","Test vector","The answer","Refusal codes and what the buyer gets","Timeouts, retries and fail closed","What Throttle stores","Shipping measures","Sign-in merges","Checkout","The completion guard","Shipping on resolved carts","Error reference","Related","Remove the resolver from the draft later (allowed only with PATCH):"],"text":"Extensions Line Resolvers A line resolver lets an installed extension own cart lines. Throttle never takes a price from the browser for a line your extension owns: it asks your resolver for the name, price, stock and limits on every add, quantity change, sign-in merge and checkout. What a line resolver is Your extension declares an HTTPS endpoint, lineResolverUrl . A storefront (or a merchant server) creates a cart with lineResolver: { extensionId } , which makes it a resolved cart . Lines added to it by referenceId are owned by your installation, and Throttle calls your resolver to price them. Opt in, per cart. Only a cart created with lineResolver is resolved. Every other cart behaves exactly as before: same status codes, same error envelopes, same response bodies, same webhooks. The one exception is an environment that turns on resolved lines only : there, unresolved cart-session carts are locked too. One owner per line. Each owned line records the installation that priced it, so a cart can hold lines from two resolvers after a sign-in merge, and each line is re-priced by its own resolver. Fail closed. If your resolver cannot answer, the operation is refused and nothing on the cart changes. Throttle never falls back to a browser price. Shoppers create resolved carts through cart sessions ; servers through the Cart API . This page is the contract for the resolver itself. Declare a resolver: lineResolverUrl lineResolverUrl is a manifest field on the extension, accepted by POST /api/v1/extensions and PATCH /api/v1/extensions/:id . A version snapshots it like any other manifest field, and an installation uses the URL of the version it is pinned to. https: URL on the default port (443). An explicit :443 is fine; any other port is not. , html: 400 validation_error : lineResolverUrl must be an https URL on the default port (443) . ], [ A DNS host name: no IP address (IPv4 or IPv6, in any notation), no localhost or *.localhost, no trailing dot. , html: Same 400 validation_error . ], [ No user name or password in the URL. , html: Same 400 validation_error . ], [ html: Requires webhookUrl and at least one entry in eventSubscriptions . Resolver calls are signed with the managed webhook endpoint's signing secret, which only exists for an extension that receives events. , html: 422 line_resolver_requires_webhook . The check runs on the stored extension merged with the PATCH, so a PATCH cannot drop the webhook side and strand a resolver. ], [ html: PATCH with lineResolverUrl : null removes the resolver. After that, eventSubscriptions: [] is allowed again. , — ], ] /> Domain-verified at review. Marketplace review checks the resolver URL's registrable domain against your workspace's verified domains, exactly as it does for iframeUrl and webhookUrl ( domain_not_verified otherwise). A new domain forces review. A version whose resolver domain differs from the approved one is flagged changed_line_resolver_domain and needs review again. Adding a resolver to an approved extension is a domain change too. See Publishing . Signing secret. The resolver is signed with the same secret your installation receives for webhooks. Rotate it with the webhook secret rotation ; resolver calls follow the same grace window. Throttle reads the signing secret from the managed webhook endpoint linked to the installation. An older installation whose managed endpoint does not carry that link is treated as having no secret: creating a resolved cart answers 422 line_resolver_not_available and an existing resolved cart answers 503 line_resolver_unavailable , both with reason: no_signing_secret . It is never called unsigned. Which installation is called lineResolver.extensionId on cart creation names your extension. Throttle maps it to that extension's installation in the cart's application and environment, and stores the installation on the cart. Creation is refused with 422 line_resolver_not_available and details.reason : A resolved cart's currency must be the environment's currency or one of the merchant's extra cart currencies (case-insensitive), or creation answers 422 currency_not_enabled with details: { currency, enabledCurrencies } , where enabledCurrencies lists the environment's currency and the extra ones. Your resolver is asked for prices in the cart's currency, so it may be called in any of them. On a cart in an extra currency a fixed_amount discount is refused with 422 discount_currency_unsupported , and a non-zero shipping rate from a shipping configuration in another currency with 422 shipping_currency_unsupported , so such a cart checks out with no shipping or a zero-rate method. A cart never changes currency: to sell in another one, start a new resolved cart. If the installation later goes away, is suspended, or loses its URL or secret, calls on its existing carts fail closed with 503 line_resolver_unavailable and the same details.reason . The request Throttle sends one POST per resolver per operation, with a JSON body of type cart.lines.resolve . cart.lines.resolve . ], [ code: id , A UUID for this request. The checkout retry sends the same body, so the same id. ], [ code: installationId , Your installation. Use it to find the merchant catalog to price from. ], [ code: applicationId / environmentId , The cart s application and workspace environment. ], [ code: cartId , The Throttle cart. On a create it is the id the new cart will get. ], [ code: intent , html: Why Throttle is asking: add , update , refresh or checkout (below). ], [ code: currency , The cart currency. Every ok line must answer in it. ], [ code: customerId , The signed-in customer of the cart, or null for a guest cart. ], [ code: customerEmailVerified , True when a live verified credential exists for that customer in this application and environment. It does not prove who attached the customer; see identityQualified below. ], [ code: customerGroup , html: Only sent when your pinn"},{"title":"Operating Your Extension","route":"/developers/extensions/operations","headings":["Operating Your Extension","Responsibility boundary","Throttle operates","The publisher operates","Baseline telemetry","Incident and lifecycle procedures"],"text":"Extensions Operating Your Extension Marketplace publication starts an operational commitment: monitor the integration, support installations, and release compatible upgrades. Responsibility boundary Throttle operates Catalog, versions, installations, and review systems Scoped extension credentials and identity tokens Signed event delivery and delivery logs Marketplace availability and platform status The publisher operates Application hosting, queues, and persistence Third-party credentials and provider API use Mapping, reconciliation, monitoring, and alerting Customer support, privacy obligations, and incident response Baseline telemetry Record the Throttle request ID, installation ID, event ID and type, extension version, provider account reference, attempt number, duration, result class, and environment. Use structured logs so one installation can be traced without searching payload contents. Do not log API keys, webhook signing secrets, access tokens, authorization headers, or customer-sensitive request bodies. Redact provider responses before attaching them to support cases. Incident and lifecycle procedures Back off and reconcile after provider outages or rate limiting. Surface expired credentials as an actionable installation state. Quarantine poison events and provide a replay procedure. Pause new installs or move the listing private during a material incident. Keep upgrades backward compatible; document and review new scopes. Publish deprecation notice and data export/deletion instructions before retirement. On uninstall, revoke provider access and stop scheduled or queued work safely. To show merchants what your extension did to a record (a sync, a label, a message sent), post a history entry with activity:write instead of an internal note. Use the Versioning guide for releases and the marketplace guide for listing changes or re-review."},{"title":"Extensions Overview","route":"/developers/extensions/overview","headings":["Extensions Overview","Choose your extension shape","Backend integration","Embedded application","Hybrid application","What Throttle provides—and what you provide","Throttle","Publisher","Two-level model: catalog vs installs","Catalog (workspace-level)","Installs (application-level)","Surfaces","UI iframe","Event webhooks","Lifecycle: draft → private → public","Versioning and pinned installs","Environment isolation"],"text":"Extensions Extensions Overview Extensions let you embed custom UI panels, receive live event webhooks, or do both — all from inside the Throttle dashboard and API surface, with an authenticated identity token, scoped API access, and signed event delivery. Choose your extension shape Backend integration Subscribe to events and process them on your server. Use this for connectors, synchronization, and work that must continue when nobody has the dashboard open. Embedded application Render an iframe and use the bridge for verified identity and scoped API access. Use this for configuration, reports, and operator workflows. Hybrid application Combine a background event processor with an embedded management UI. Most full-service provider connectors eventually use this model. A ShipStation-style connector should synchronize orders, fulfillment, tracking, cancellations, and returns on its backend. An iframe can configure and monitor the connector, but synchronization cannot depend on the iframe being open. What Throttle provides—and what you provide Throttle Catalog, version, installation, and marketplace workflows Scoped credentials and signed iframe identity Signed event delivery and installation configuration forms Publisher Hosting, persistence, queues, retries, and monitoring Third-party credentials and provider-specific behavior Support, privacy terms, incident response, and data lifecycle External developers use public APIs, packages, the dashboard, and these docs. You do not need access to Throttle's private repository. Build your first private install . Two-level model: catalog vs installs Extensions live at two levels. The catalog is workspace-scoped: one extension definition per workspace, with a name, surfaces (iframe URL and/or webhook URL + events), and a list of requested scopes. An extension can be authored by your workspace and used only internally, or promoted to public for any Throttle workspace to install. Installs are per-application. When a dashboard user installs an extension into an application, a single-use API key and (if a webhook URL is declared) a per-install signing secret are issued. Both are shown exactly once at install time; an extension should fetch its own with automatic setup , because having the merchant paste them in is deprecated. Multiple applications in the same workspace can each have their own independent installation of the same extension, with separate API keys, signing secrets, and configuration values. Catalog browsing supports cursor pagination and search. Use q to search extension name, slug, author, and description, and installable=true to return only private/public extensions with a published version before pagination is applied. Catalog (workspace-level) POST /api/v1/extensions — create GET /api/v1/extensions — list PATCH /api/v1/extensions/:id — update manifest POST /api/v1/extensions/:id/versions — create version POST /api/v1/extensions/:id/versions/:vid/publish — publish POST /api/v1/extensions/:id/lifecycle — promote/demote Installs (application-level) POST /api/v1/extensions/:id/install — install (pinned to a version) GET /api/v1/installations — list for this app POST /api/v1/installations/:id/upgrade — upgrade to new version PATCH /api/v1/installations/:id/config — update config POST /api/v1/extensions/:id/uninstall — uninstall Surfaces An extension manifest declares one or both surfaces. You can mix them freely. UI iframe Declare an iframeUrl in the manifest. The dashboard renders a sandboxed <iframe> at that URL when the extension panel is open. Your page calls createBridge() from @usethrottle/extension-bridge (or the hosted script tag) to handshake with the dashboard, obtain a signed identity token, and make authenticated API calls. See the Build guide and the Identity JWT reference . Event webhooks Declare a webhookUrl plus the list of eventSubscriptions your extension wants to receive. Throttle creates a managed webhook endpoint for the install and delivers signed events to that URL automatically. The per-install webhookSigningSecret is returned in the install response, and — unlike the API key — it is not lost if you miss it: GET /api/v1/installations/:id/webhook-secret reads the current value back at any time. See the Events reference . An extension can declare both iframeUrl and webhookUrl . The iframe bridge and the webhook delivery pipeline are independent — the bridge token gives the iframe REST access, while the webhook pipeline delivers async events to your server. Use both when you need a live UI panel and background event processing. Lifecycle: draft → private → public Every extension starts as draft . You iterate freely — create versions, update the manifest — before promoting it. draft — visible only within your workspace; can only be installed by your own workspace's applications; no published version required. private — still workspace-private but signifies the extension is production-ready. Installs within your workspace are in this state during internal testing. public — listed in the global marketplace; any Throttle workspace can install it. Requires the application:extensions:admin permission. Throttle must enable the public marketplace for your workspace. Versioning and pinned installs Installs are always pinned to a specific published version. Publishing a new version does not automatically upgrade existing installs — each install retains the version it was pinned to until explicitly upgraded via POST /api/v1/installations/:id/upgrade . If the new version declares additional scopes, the installer must acknowledge them; Throttle returns 409 new_scopes_require_consent listing the delta. See the Versioning guide . Environment isolation Installs carry the workspace environmentId selected by the installing caller. A UAT install issues a UAT API key and receives only UAT events; a production install issues a production API key and receives only production events. The catalog itself (the extension definit"},{"title":"Publishing to the Marketplace","route":"/developers/extensions/publishing","headings":["Publishing to the Marketplace","Before you submit","Eligibility","Paid plan or partner status","Publisher Agreement accepted","Listing requirements","Review lifecycle","What “Approved” unlocks","Future versions and re-review","Auto-publish (no re-review)","Requires re-review","Launch and rollback","Webhook events","Related guides","Requires: an accepted Publisher Agreement + a completed Listing.","Response:","\"data\": {","\"id\": \"rev_01HZX...\",","\"extensionId\": \"ext_xxx\",","\"status\": \"pending\",","\"versionId\": \"ver_xxx\",","\"createdAt\": \"2026-06-06T10:00:00.000Z\"","}","}`;","(a dashboard session works too). Field name is \"file\"; the response carries the","public URL to put on the extension / listing.","→ { \"iconUrl\": \"https://.../extensions/icons/01J....png\", \"key\": \"...\" }","→ { \"screenshotUrl\": \"https://.../extensions/screenshots/01J....png\", \"key\": \"...\" }","Then reference them: iconUrl on PATCH /api/v1/extensions/:id, and the","screenshot URLs in the listing's \"screenshots\" array on PUT /api/v1/extensions/:id/listing.`;","→ { data: { id: \"ext_xxx\", lifecycle: \"public\", ... } }`;"],"text":"Extensions Publishing to the Marketplace The Throttle marketplace lets any workspace discover and install your extension. Getting there requires meeting eligibility requirements, completing a listing, and passing a staff review. You control when the extension goes live after approval. Before you submit Confirm workspace eligibility and accept the Publisher Agreement. Publish the exact version you tested and document its functionality and upgrade behavior. Complete the listing, support contact, privacy policy, and terms of service. Demonstrate why every requested scope and event subscription is necessary. Complete the testing preflight and security review . Name an operational owner who will monitor errors and respond to customer and Throttle review messages. Review status and feedback are visible in the dashboard. Throttle does not promise a review turnaround in this guide; plan your launch around approval rather than a speculative date. Eligibility Your workspace must meet both of the following conditions before you can submit an extension for review: Paid plan or partner status Your workspace must be on an active paid Throttle plan, or have partner status granted by Throttle. Sandbox (trial) workspaces cannot submit extensions for public marketplace review. If you are on a trial and want to publish, upgrade your workspace first or apply for the partner program . Publisher Agreement accepted A workspace owner or admin must accept the Throttle Publisher Agreement in the dashboard under Extensions → Catalog → [your extension] → Review → Publisher Agreement . Acceptance is recorded once per workspace and covers all extensions you publish. The Submit button is disabled until acceptance is on record. Approval records that a specific version passed review; it does not list you. A workspace admin still has to set the extension's lifecycle to public , and that is only permitted while the approved version is still the one you are serving. Publishing any change afterwards moves you off the approved version and requires a new review before you can go public again. Listing requirements Before submitting for review you must complete your extension's public listing. The preflight check validates all of the following fields. Missing or invalid fields are returned as an array of specific errors with a 422 response. Public name — a human-readable display name for the marketplace listing, separate from the internal extension slug. Tagline — a single sentence (≤ 80 characters) that describes what the extension does. Category — one of the marketplace taxonomy categories (e.g. analytics , fulfillment , finance ). Displayed as a filter on the browse page. Icon — a square PNG, JPEG, WebP or SVG (≤ 2 MB) uploaded via POST /api/v1/extensions/icon-upload . Stored as a public object and referenced by its public URL. At least one screenshot — a minimum of one screenshot or promotional image (PNG, JPEG or WebP, ≤ 5 MB, 1280 × 800 recommended) uploaded via POST /api/v1/extensions/screenshot-upload . Used in the detail page carousel. Support URL — an HTTPS URL to a support page or ticketing system. Privacy policy URL — an HTTPS URL to your privacy policy. Required by the Publisher Agreement. Terms of service URL — an HTTPS URL to your extension's terms of service. The preflight check rejects any support, privacy, or terms URL that does not begin with https:// . Plain HTTP URLs are not accepted. Both image uploads are multipart/form-data and accept a secret API key with extensions:write as well as a dashboard session, so a release script can complete the whole listing without the dashboard. Review lifecycle Submitting for review kicks off an automated preflight followed by a manual staff review. The full state machine is: Submit — call POST /api/v1/extensions/:id/reviews (or use the dashboard Review tab). Throttle runs automated preflight checks (listing completeness, eligibility, scope diff against the previous approved version) and creates a review with status pending . A confirmation notification and email are sent to workspace members with the extensions:write scope. In review — a Throttle staff member claims the review. The review moves to in_review . Staff can see the automated check results and the scope delta relative to the previously approved version. Decision — staff selects one of three outcomes: Approved — the extension passes review. The developer receives a notification and email and can now publish the extension. Changes requested — staff adds feedback in a threaded conversation. The developer receives a notification with the feedback, addresses the issues, and resubmits. Rejected — the extension will not be published to the public marketplace. Staff includes a reason. The developer may fix the underlying issues and submit a new version for review. The review has a comment thread. Staff can add comments at any point during the review and the developer receives notifications for each message. Use the dashboard Review tab or POST /api/v1/extensions/:id/reviews/:rid/comments to reply. What “Approved” unlocks An approved review does not automatically make your extension public. Approval unlocks the Publish to marketplace button in the dashboard Lifecycle tab and the POST /api/v1/extensions/:id/lifecycle endpoint with lifecycle: "public" . You choose when to go live. Once public , the extension appears in GET /api/v1/extensions?installable=true and is browsable in the marketplace at /w/:ws/a/:app/marketplace . You can revert to private at any time via the lifecycle endpoint. Existing installs are not affected by a lifecycle change. Setting the lifecycle to private automatically publishes a version snapshotting the current configuration when no published version matches it, so a private extension is always immediately installable. Installing an extension that somehow has no published version fails with 409 no_published_version . Throttle retains the ability to revert a pu"},{"title":"Extension Scopes","route":"/developers/extensions/scopes","headings":["Extension Scopes","How scopes flow","Scope implication rules","Management scopes for extensions","Management scope summary","Team RBAC for extension management","Extension-allowed scope catalog","{group}","Name a page of known customers: up to 50 ids, comma-separated","200, Cache-Control: no-store","{ \"data\": [ { \"id\": \"c3d4e5f6-0a1b-4c2d-8e3f-4a5b6c7d8e9f\",","\"name\": \"Jane Doe\",","\"email\": \"jane@example.com\" } ],","\"nextCursor\": null }`;","{ \"data\": { \"installed\": true, \"version\": \"1.4.0\" } }","Not installed here: { \"data\": { \"installed\": false, \"version\": null } }`;"],"text":"Extensions Extension Scopes Extensions operate within a strict scope ceiling. Only scopes marked extensionAllowed may appear in an extension manifest. Human, admin, and management scopes are never grantable to extensions. Choose the smallest scope set that supports demonstrated behavior. Once selected, continue to installation and configuration . How scopes flow Scopes are declared in the extension manifest, snapshotted into a published version, and issued to an install. At each stage Throttle enforces the extensionAllowed ceiling: Manifest declaration. You list the scopes your extension needs in POST /api/v1/extensions or PATCH /api/v1/extensions/:id . validateScopesForExtension runs immediately — any scope with extensionAllowed: false (or an unknown scope) returns 400 invalid_scope . Version snapshot. When you publish a version, the manifest scopes are frozen into the version record. Subsequent manifest edits do not change the published version. Install. POST /api/v1/extensions/:id/install pins the install to a version. The install's API key is granted exactly the version's scopes — no more, no less. Iframe JWT. The launch-token endpoint mints a JWT whose scopes claim is the pinned version's scope list. Every bridge.api.* call is authorized against those scopes. Scope implication rules The same implication rules that apply to API keys apply to extension scopes: * covers all scopes — but * is never extensionAllowed and cannot appear in an extension manifest. resource:write implies resource:read on the same resource . For example, orders:write covers orders:read . Read never implies write. orders:read does NOT grant orders:write . No cross-resource implication. orders:read does not grant customers:read . The buyer s email, name and phone in event payloads need customer_pii:read . Without it they arrive as null ; addresses are still delivered. See customer contact fields . Finding customers: customer_directory:read An extension that shows or picks customers (for example a customer-group member list) needs their names, not their records. customer_directory:read answers only id , name and email , without customers:read and the PII, addresses and stored cards it carries. Scope. List customer_directory:read in your extension's scopes and call with the installation's secret key. The merchant sees it at install as "Find customers by name or email", among the other requested scopes. It is sensitive , so no OAuth connection can hold it. No other scope grants it except full access ( * ), customers:read included; a key without it gets 403 insufficient_scopes . Parameters. Send exactly one of q or ids . q is 2–100 characters, matched as a case-insensitive prefix of the full name, the last name or the email, and answers up to limit customers (1–20, default 10) ordered by email. ids is up to 50 comma-separated customer ids; every id found is answered, in the order given, and an integer limit is ignored. Unknown ids are skipped. A search never lists an erased (anonymized) customer; ids still names one, with name: null . Anything else is 400 validation_error . Answer. Only customers of the calling key's own workspace, application and environment. name is the first and last name joined by a space, or null when there is neither. nextCursor is always null : the directory answers one page. Responses carry Cache-Control: no-store ; do not store the answer either. Rate limit. Its own budget, 300 calls a minute per API key (per installation for calls from your iframe session) and environment. Over it you get 429 rate_limit_exceeded . Checking another extension: extension_presence:read An extension that adds features when a companion extension is present (for example a page builder that shows catalog widgets only when the Product Catalog is installed) asks one narrow question: is extension X installed here? Scope. List extension_presence:read in your extension's scopes and call with the installation's secret key. It is not sensitive and is never allowed on a publishable key; a key without it gets 403 insufficient_scopes . Parameter. extensionId is required and must be an extension id (a uuid). Anything else is 400 validation_error . Answer. Only for the calling key's own workspace, application and environment. installed is true only for an active installation (suspended and uninstalled answer false). version is the pinned version label, or null when not installed. Nothing else is exposed: no installation id, configuration, scopes or other extensions. Responses carry Cache-Control: no-store ; cache the answer yourself for a few minutes if you ask often. Management scopes for extensions The management scopes ( extensions:read , extensions:write , extensions:install ) control who can author and install extensions. These are Taxonomy B (human) scopes — they are not extensionAllowed . Extensions cannot manage other extensions. Management scope summary extensions:read — view the extension catalog and installation list. Required for GET /api/v1/extensions , GET /api/v1/extensions/:id , GET /api/v1/extensions/:id/versions , GET /api/v1/installations , GET /api/v1/installations/:id/deliveries . extensions:write — author, version, and publish extensions. Required for POST /api/v1/extensions , PATCH /api/v1/extensions/:id , POST /api/v1/extensions/:id/versions , POST /api/v1/extensions/:id/versions/:vid/publish , POST /api/v1/extensions/:id/lifecycle (draft/private). extensions:install — install, configure, and manage installs. Required for POST /api/v1/extensions/:id/install , POST /api/v1/extensions/:id/uninstall , PATCH /api/v1/installations/:id/config , POST /api/v1/installations/:id/upgrade , POST /api/v1/installations/:id/launch-token , POST /api/v1/installations/:id/deliveries/:deliveryId/replay , POST /api/v1/installations/:id/test . The extensions:install scope is a custom action — it is independent of extensions:write and extensions:read . Granting only exte"},{"title":"Scripts an Extension Ships","route":"/developers/extensions/scripts","headings":["Scripts an Extension Ships","The two tiers","Declaring a script","Shipping an update","Writing the script","Settings — one script, different merchants","Buyer data","Loading a vendor library","Cookies and storage","Review","Install lifecycle — when your scripts start and stop","Limits","then attach source to it."],"text":"Extensions Scripts an Extension Ships An extension can ship JavaScript that runs on the merchant's buyer-facing pages — hosted checkout, quote pages, and the merchant's own storefront. This is how a pixel, an analytics relay, a fraud signal or an announcement bar reaches real buyers without the merchant pasting code into a theme. Read this after your first private install . For the merchant's view of the same feature — and for a merchant writing their own script rather than installing an app — see Your Own Scripts . The two tiers Pick the tier when you declare the script. It decides where the code can run and how hard it is to get approved. sandbox — runs inside a null-origin sandboxed iframe with no access to the host page, its cookies or its storage. Allowed on every surface, including checkout. This is the default and what almost every app should use. dom — runs directly on the merchant's storefront page with full access to it. Restricted to the storefront surface, refused on checkout by the API, the manifest schema and a database constraint, and it requires a staff review of the source for every change. DOM-tier code is unsandboxed third-party JavaScript on every installed merchant's storefront. Nothing contains it, so it never auto-approves — a human reads the source. Use sandbox unless you genuinely need the page, and expect longer review turnaround when you do not. Declaring a script A script has two halves: a declaration , one per (extension, key) , carrying what the script is allowed to do; and source , which is per extension version. Source is attached to a draft version and frozen when you publish it. key — a stable lowercase handle. It identifies the script forever; merchants see it in their script inventory. surfaces — any of storefront , checkout , quote . consentCategory — essential , functional , analytics or marketing . The script does not mount at all until the buyer has granted that category. protectedData — none or hashed . See Buyer data . externalDomains — hostnames the script may reach. Enforced as a Content Security Policy, which matches hosts exactly : google-analytics.com does not cover www.google-analytics.com . One leading wildcard label is allowed — *.klaviyo.com — for a vendor SDK whose host set is the vendor's to change; it covers every subdomain and not the bare domain. A request the CSP refuses is reported as a blocked outcome with reason: csp , so it is diagnosable from the merchant's script health view. The list is frozen once a version containing the script is published. Shipping an update Pushing a key that already exists replaces its source on the target draft version — that is how you ship a new build. The response is 201 for a key that was new and 200 when an existing one was replaced. Capabilities freeze once the script has shipped. After any version containing the script is published, a push that changes tier , surfaces , consentCategory , protectedData or externalDomains is refused with 409 script_published_capabilities_frozen . Those fields live on the declaration and take effect immediately on every install already pinned to an approved version, so changing one would bypass review. Ship the new behaviour under a new key. Source-only pushes are always fine while the target version is a draft. Bug fixes do not need a new key. A published version is frozen. Attaching to one returns 409 extension_version_published — a sha256 in a merchant's inventory has to be the sha256 that actually ran. A new version inherits the previous version's scripts. Creating a version copies every non-deleted script forward byte-for-byte, so a version that changes nothing keeps shipping what you already shipped. Push only what changed. Deleting the declaration is how you stop shipping a script. A version that adds a script key the merchant does not already run requires them to re-consent, with acknowledgedNewScripts on the upgrade call. A version that drops one does not re-prompt: the merchant ends up running less, which needs no permission. Writing the script A sandbox-tier script runs inside a null-origin iframe. Four bindings exist at the top level: register , analytics , browser and settings . document , window , parent , top , opener , localStorage and sessionStorage are undefined . api.browser at the top level of your file throws api is not defined , and the merchant sees an error in their health panel with no other clue. Use the bare bindings at the top level, or api.* inside the register callback. Settings — one script, different merchants Every install can carry its own values for your script. A merchant sets them on the installed app's Scripts tab, and they arrive as settings in a sandbox script or as a data- attribute on a dom-tier tag. Missing settings are an empty object, never an error. Handle the empty case by doing nothing rather than throwing. The same tab lets a merchant switch one of your scripts off without uninstalling your app. Treat that as normal. They are handed to code running on a public page, and on the dom tier they are an attribute in the page's own DOM. Never ask a merchant to put a secret in them — use your install-time API key and your own backend for anything privileged. Buyer data What a script receives on checkout.completed depends entirely on the protectedData grade it declared. none — no buyer identifiers at all. The default, and correct for most scripts. hashed — emailSha256 and phoneSha256 , each a SHA-256 of the lowercased, trimmed value. This is the form GA4 and Meta's advanced matching want. A third grade, raw , used to be accepted and stored — and delivered exactly what none delivers. An app could declare it, pass review, and then receive no identifiers at all with nothing explaining why. It is now refused with a message pointing at hashed . If your integration genuinely needs plaintext, it needs a grade that does not exist yet, and that is a consent and data-protecti"},{"title":"Security Model","route":"/developers/extensions/security","headings":["Security Model","RS256 + JWKS","Iframe sandboxing and origin pinning","Short-lived tokens with auto-refresh","Scope ceilings","Webhook signature verification","Summary"],"text":"Extensions Security Model The extension security model is built on four pillars: RS256 asymmetric JWT signing with a public JWKS, iframe sandboxing and origin pinning via the bridge protocol, short-lived tokens with auto-refresh, and strict scope ceilings that block human and admin access. Apply these controls from the first private install. Before public submission, complete the testing preflight and the marketplace checklist . RS256 + JWKS Extension-session JWTs are signed with an RSA private key (RS256) held server-side. Throttle publishes the corresponding public key(s) at GET /.well-known/extension-jwks.json in standard JWK Set format. Any out-of-process verifier — your extension backend, a middleware layer, a Cloudflare Worker — can verify tokens without a Throttle-specific SDK or a symmetric shared secret. The protected header always carries alg: "RS256" and a kid . Reject tokens with any other algorithm. The issuer is always "throttle" . Reject tokens with a different issuer even if the signature verifies. The JWKS endpoint may publish multiple keys (key rotation). Your verification library selects the right key by kid automatically. Old keys remain in the set through their last token's TTL. The endpoint is unauthenticated — no API key required. Cache it at module init via createRemoteJWKSet . If token verification fails for any reason — expired, bad signature, wrong issuer, unknown kid , malformed structure — return null and reject the request. Never attempt to use a partially-validated payload. Iframe sandboxing and origin pinning The dashboard renders extension iframes with a restrictive sandbox attribute. All communication between the iframe and the dashboard host goes through the bridge's typed postMessage protocol — the iframe cannot access the parent's DOM or navigate the parent directly (those requests go through the bridge's navigate helper, which the host controls). An extension version may request extra sandbox flags, but only from a closed list: allow-modals and allow-downloads . Anything else, including allow-top-navigation and allow-popups-to-escape-sandbox (with allow-popups it opens unsandboxed windows that keep an opener, which allows tab-nabbing of the dashboard), is rejected when the extension is registered and ignored by the dashboard. The flags are shown to staff reviewers and to the merchant in the install wizard, like scopes, and adding one to a public extension requires a fresh review. The iframe always uses the flags of the pinned version, never those of a newer one. Origin pinning works on both sides of the bridge: Iframe side — the targetOrigin option passed to createBridge() restricts outgoing postMessage calls to the dashboard origin. Set this to 'https://app.usethrottle.dev' in production. Host side — the bridge host validates that inbound messages come from iframe.contentWindow at the declared targetOrigin . Messages from any other window or origin are silently ignored. Without targetOrigin , the bridge falls back to document.referrer and ultimately to '*' . A wildcard target sends the session token — including the signed JWT — to all windows in the frame stack. Always set targetOrigin to the exact dashboard origin. Short-lived tokens with auto-refresh Extension-session JWTs have a 10-minute TTL . Short TTLs limit the exposure window if a token is intercepted. The bridge handles renewal automatically: When the current token is within 60 seconds of expiry, the bridge proactively sends a refresh message to the host. When a bridge.api.* call receives a 401 , the bridge requests a refresh and retries the call once. The host calls POST /api/v1/installations/:id/launch-token and sends a fresh session message with the new token. All bridge.api.* calls in flight during a refresh wait for the new token before proceeding. Launch tokens can only be minted for active Clerk (dashboard) sessions — API keys cannot mint them. This ensures the token always embeds a real human identity and can be revoked by ending the Clerk session. Scope ceilings Extensions operate under a two-level scope ceiling. First, only extensionAllowed scopes may appear in a manifest — human scopes (team, billing, email, admin) are blocked at registration time. Second, the issued JWT and API key are scoped exactly to the pinned version's declared scopes — even if the workspace's API key holds broader access, the extension never inherits it. See the Scopes reference for the full extensionAllowed catalog and the management scope details. Webhook signature verification Extension webhook deliveries are signed with HMAC-SHA256 using a per-install signing secret. The signature covers the delivery timestamp and the raw body, preventing replay attacks older than 5 minutes (configurable). The signing secret is unique per install and stable — reinstalling does not rotate it, so verification keeps working across an uninstall/reinstall cycle. Read the current value any time with GET /api/v1/installations/:id/webhook-secret . The verifyWebhook helper uses constant-time comparison to prevent timing attacks. Never verify signatures with string equality ( === ) — use the provided helper. Capture the raw body before any JSON parsing. Parsing and re-serializing changes whitespace and key ordering and will break verification. Each installation has its own signing secret. A compromised secret for one install does not affect other installs or other applications. The secret survives an uninstall and reinstall — the installation row is reused — so a merchant reinstalling your extension will not break signature verification. See the Events reference for the full verification workflow and event catalog. Summary RS256 + public JWKS — no shared secret needed to verify tokens; key rotation is transparent to verifiers. Iframe sandboxing — restricts iframe capabilities; no direct DOM access to the parent. Origin pinning — postMessage is locked to the da"},{"title":"Extension Starter Repository","route":"/developers/extensions/starter-repository","headings":["Extension Starter Repository","Clone and run","What the starter includes","Extension surfaces","Safe integration foundations","Repository strategy","Required customization"],"text":"Extensions Extension Starter Repository The public starter will provide a production-shaped baseline for iframe, webhook, and hybrid extensions without depending on Throttle's private monorepo. The starter is published at github.com/Epic-Design-Labs/throttle-extension-starter . It implements the hybrid shape (embedded React iframe UI + a Cloudflare Worker backend) and is a template to copy, not a dependency. No private repository access is required. Clone and run The five-minute quickstart runs against a mocked bridge — no Throttle account or Cloudflare deploy needed. When you are ready to build your own integration, customize the template with pnpm run setup and follow the starter README through Test-mode registration, real webhook delivery, and Cloudflare deployment. What the starter includes Extension surfaces Iframe route and bridge handshake Backend identity-token verification Raw-body webhook signature verification Health endpoint and structured logging Safe integration foundations Install-aware persistence Idempotent event processing Environment-variable template Unit tests and deployment guidance Repository strategy Use one repository per provider integration by default. ShipStation, ERP, tax, analytics, and messaging connectors have independent credentials, data models, release schedules, incidents, and support ownership. A monorepo is reasonable only when one team deliberately shares their runtime and deployment lifecycle. The starter is a template, not a hosted runtime dependency. Your publisher workspace owns the catalog entry; your repository and infrastructure own the application code and provider synchronization. Required customization Declare the minimum scopes and event subscriptions, chosen from the scopes an extension may request . Define installation configuration without exposing provider secrets to browser JavaScript. Replace example handlers with provider-specific mapping and reconciliation. Add the provider's rate limits, retry policy, credential rotation, and support runbook. Validate clean installation and uninstall in Test mode. Pair the starter with the Build guide and use the security requirements as the implementation baseline."},{"title":"Testing Extensions","route":"/developers/extensions/testing","headings":["Testing Extensions","Testing ladder","Required scenarios","Delivery and recovery","Lifecycle and data","Marketplace preflight"],"text":"Extensions Testing Extensions Test mapping, delivery, isolation, recovery, installation, and removal before asking another workspace to trust your app. Testing ladder Unit tests — mapping, signature verification, idempotency, and conflict rules. Contract tests — current public Throttle request, response, and event shapes. Local HTTPS tests — iframe handshake and signed webhook delivery through a tunnel. Private install — full setup in a Test-mode application with realistic fixtures. Failure injection — timeouts, rate limits, expired credentials, retries, and provider outages. Production smoke test — a small, non-destructive live test after launch approval. Required scenarios Delivery and recovery Valid, missing, stale, and invalid signatures Duplicate and out-of-order events Timeout, 429, and 5xx retry behavior Poison event and dead-letter recovery Uninstall while work is queued Lifecycle and data Pagination and missing optional fields Version upgrade and new-scope consent Strict Test/Live separation Provider credential expiration Cancellation and return races for fulfillment apps Marketplace preflight All public endpoints use HTTPS and expose a useful health check. Scopes and event subscriptions are limited to demonstrated functionality. A clean install, configuration update, upgrade, replay, and uninstall all succeed. Logs and screenshots contain no credentials or customer-sensitive data. Support, privacy, and terms URLs are public and accurate. Use Test mode throughout development. Verify production behavior deliberately with live credentials only after the extension passes security and marketplace preflight. Review the Security Model before following the publishing procedure ."},{"title":"Extension Versioning","route":"/developers/extensions/versioning","headings":["Extension Versioning","Version lifecycle","Which versions can be pinned","Installs are pinned","Upgrading","Rollback","Versioning strategy","Response:","\"data\": {","\"id\": \"ver_new...\",","\"version\": \"1.1.0\",","\"status\": \"draft\",","\"scopes\": [\"orders:read\", \"customers:read\"],","\"notes\": \"...\",","\"createdAt\": \"...\"","}","}`;","Response: { data: { versions: [ { id, version, status, scopes, ... }, ... ] } }`;","If the new version requests scopes not in the current install:","HTTP 409","\"error\": {","\"code\": \"new_scopes_require_consent\",","\"newScopes\": [\"customers:read\"]","Retry with explicit consent:","→ { data: { id: \"inst_xxx\", versionId: \"ver_new...\", ... } }`;","\"Rollback\" and \"upgrade\" use the same endpoint — just target an earlier versionId.","No consent required if the older version's scopes are a subset of the current scopes."],"text":"Extensions Extension Versioning Extension versions are immutable snapshots of a manifest. Published versions cannot be changed. Installs are always pinned to a specific version, so rolling out a change requires publishing a new version and upgrading each install explicitly. After publishing an upgrade, follow the operations guide to monitor adoption, compatibility, and incidents. Version lifecycle A version starts as draft and becomes published when you publish it. Once published, the version record is frozen — its scopes , iframeUrl , webhookUrl , and eventSubscriptions never change. In the dashboard you never number a version by hand. Once an extension is private or public, Publish a new version on its Publish tab snapshots the saved settings as the next patch version (for example 1.0.3 after 1.0.2 ) and publishes it. The Versions tab lists every version and marks the one new installs get as Live . The API calls below do the same thing. Which versions can be pinned An install that names a versionId and an upgrade or rollback that names a targetVersionId follow the same rule: The version must belong to the extension. Any other id, including a version of a different extension, returns 404 not_found . A draft version is never pinned in production, which returns 422 draft_not_installable_in_live . Outside production, only the workspace that owns the extension may pin a draft. The workspace that owns the extension may pin any of its other versions, including published versions still awaiting marketplace review and older versions. Any other workspace may pin only the version a fresh install would get: the approved version of a public extension, or its latest published version if it has never been approved. Anything else returns 422 version_not_approved . An install with no versionId pins that same default version. Installs are pinned When an extension is installed, the install row records the exact versionId . Publishing a new version has no effect on existing installs — they continue running on the pinned version indefinitely. This provides stability: a breaking manifest change cannot affect installs that have not opted in to the upgrade. The dashboard may surface an "upgrade available" indicator when a newer published version exists for an installed extension. The installer decides when and whether to upgrade. Upgrading Use POST /api/v1/installations/:id/upgrade to move an install to a different published version. The install's API key is updated to reflect the new version's scopes; the config is preserved. Only an active installation can be upgraded or rolled back. A suspended or uninstalled installation returns 409 installation_not_active and is left unchanged. If the new version's scopes are a subset of the current version's scopes (scope reduction), no consent is required and the upgrade proceeds immediately. If the new version requests additional scopes, the endpoint returns 409 new_scopes_require_consent with the delta. Retry with acknowledgedNewScopes: true to confirm. The target must be a version this workspace may pin (see Which versions can be pinned ). Installers of another workspace's public extension can move to a new version once it is approved. The consent requirement protects against a malicious extension publisher silently acquiring new scopes. The installer must explicitly acknowledge each new scope — the 409 lists exactly which scopes are being added so the operator can make an informed decision. Rollback Rolling back to an older version uses the same upgrade endpoint — just target an earlier versionId . Because older versions have fewer or equal scopes, rollback typically does not require consent. After rollback, the install runs the older version's manifest (including its iframeUrl and event subscriptions). Rollback follows the same pinning rule as an upgrade: the owning workspace can roll back to any of its versions, while installers of another workspace's public extension can only target its approved version. The installation's config object is not changed by an upgrade or rollback. If the new version requires different config keys, update config separately via PATCH /api/v1/installations/:id/config . Versioning strategy Use semantic versioning (e.g. 1.0.0 ) — it is stored as a string, not parsed. Additive changes (new UI features within the same scopes, bug fixes, updated iframeUrl ) can be shipped as a new version without requiring install consent. New scopes always require explicit upgrader consent. Removing scopes does not require consent — it is a reduction. Keep at least the previous published version available to allow rollback without republishing. See also: Security model for how scope ceilings are enforced at the version level, and Installing extensions for the full install lifecycle."},{"title":"Idempotency-Key","route":"/developers/idempotency","headings":["Idempotency-Key","When to use it","Usage","How replay works","Scope","first response byte-for-byte. The header below tells you it's a replay."],"text":"Reliability Idempotency-Key Make every mutating Throttle request safe to retry by attaching an Idempotency-Key header. Throttle will replay the original response if you retry within 24 hours, even if the network blew up midway through the first attempt. When to use it Always, on every POST , PATCH , and DELETE from a server you can't fully trust the network between (i.e. all of them). It costs nothing when the request succeeds first try, and saves you from double- charging, double-creating, or double-cancelling on retry. Generate a fresh key per logical operation. A UUID v4 is the canonical choice. Reuse the same key when retrying the same operation (timeout, 5xx, connection reset). Do not reuse a key for a different operation. Throttle will reject the second call with 409 idempotency_key_reused . Usage How replay works Throttle hashes the canonicalised request body (SHA-256, key-sorted) alongside the key. On the second arrival within 24 hours: Same key + same body → original response replayed byte-for-byte with an extra Idempotency-Replay: true response header. The handler does NOT run again. Same key + different body → 409 idempotency_key_reused . Surfaces the integrator bug instead of double-charging. Scope Per workspace, per (method, path). The same key can be reused across endpoints without colliding — Throttle scopes the cache by tuple (workspaceId, key, method, path) . The path is the concrete request path with its ids filled in (the query string is ignored), so the same key sent to /subscriptions/A/pause and /subscriptions/B/pause is two separate operations. TTL: 24 hours. After 24h, the same key can be used again without replay. GET / HEAD requests ignore the header. They're already idempotent. 5xx responses are not cached. A transient server error doesn't pin a failure response to your key. The whole point is that the SAME key is reused. Generating a new UUID on every retry defeats the cache and risks double-charging. Persist the key in your job queue / outbox alongside the request payload."},{"title":"Bulk imports","route":"/developers/imports","headings":["Bulk imports","Before you start","1. Create and upload","2. Inspect, then map","3. Validate before you commit","What a committed order import writes","Runs are queued, so poll for the outcome","The error report round trip","Undo: what it removes, and what it does not","Full endpoint reference","201","that header, so a different one fails with SignatureDoesNotMatch.","PRE-run status. The run itself happens on a worker — poll for the outcome.","202 — queued. The outcome lands on the import row as undoResult."],"text":"Data migration Bulk imports Move a merchant's historical customers or orders into Throttle from a file their old platform exported. Four steps: upload, map, dry run , commit. The dry run is not optional — a commit rewrites order and customer history, so Throttle refuses to run one until you have been shown what it would do. Before you start CSV and TSV up to 500 MB and 500,000 rows. The extension on fileName selects the parser, so it has to be accurate — it is chosen before a single byte is uploaded. Excel up to 10 MB and 65,536 rows ( .xlsx , .xlsm ; .xls up to 25 MB). The lower ceiling is not arbitrary: a .xlsx is a ZIP whose directory sits at the END of the file, so a sheet cannot be decoded until the workbook, shared-strings and styles entries have all been read — it is parsed whole rather than streamed a row at a time. 65,536 is the .xls format's own ceiling, reused for both so there is one number rather than two. Past it, a sheet is refused with a message naming the cap; save it as CSV, which handles 500,000 rows. Spreadsheet dates cannot be misread. A date cell is a number plus a format, not text, so it is imported as ISO-8601 and the dateOrder choice cannot move it. That ambiguity is real only for CSV, where 03/04/2024 is two different days. A workbook with several sheets reads the first by default. POST /api/v1/imports/ id /inspect returns every sheet in sheets , and re-POSTing with sheetName : Orders reads that one instead. Changing the sheet re-saves the dialect, which retracts any dry run — the preview described a different grid. Naming a provider pre-fills the mapping. bigcommerce and shopify both ship export templates; omit it and the header-name matcher runs alone. The provider also selects the status vocabulary, which is not cosmetic: BigCommerce exports one status column that implies both position and payment, while Shopify splits it across Fulfillment Status and Financial Status and needs both read together — an order can be fulfilled but unpaid, or paid but unfulfilled. A status column may also hold Throttle's own status values, as a Throttle export writes them: the current names are taken as they are, and the names retired on 2026-11-23 are translated (an old closed becomes completed ; an old fulfilled becomes shipped for an order with a shipment line and completed otherwise). Only current names are written. A Throttle status says nothing about money, so payment comes from the payment column. Shopify blanks its order columns on continuation rows. Where BigCommerce repeats the order-level values on every line of a multi-item order, Shopify writes them on the first line only. The Shopify template declares that shape, so the blanks are read as the format rather than as an inconsistent export. Its single Billing Name column is split into first and last on the last space. One entity per file. entityType is customer or order . Scopes. Reads need imports:read ; every verb that creates, maps, runs or undoes an import needs imports:write . Publishable ( pk_ ) keys cannot hold either, and extensions are not granted them. Imports are scoped to one workspace environment. An import belongs to the application and environment its credential resolves to, and reading one from a different environment is 403 environment_mismatch . POST /api/v1/imports hands back a presigned PUT valid for one hour and you upload straight to storage. That is why the size ceiling is checked twice: once against the fileBytes you declare (before the URL is issued) and again against the object's real size at inspect time, because a presigned PUT signs the key and the content type — never the body length. 1. Create and upload A PUT that never happened, or one that stored zero bytes, is caught at the next step as 409 file_not_uploaded rather than becoming an empty mapping screen. 2. Inspect, then map POST /api/v1/imports/ id /inspect reads at most the first 1 MB of the file however large it is, so it answers immediately. It returns the sniffed dialect, the headers, a 20-row sample, the platform template it matched, a suggested target field per header, and detectedDateOrder . Those are suggestions — you confirm them. A customer import can map customer.customerGroup (header synonyms such as "group" or "price group"). Each cell names a group of the import's application and environment, matched ignoring case; none clears the group. An unknown name fails that row with customer_group_not_found . Mapping the column needs customer_groups:write . See Customer groups . A column you leave out of columns is ignored. That is how you skip one. Two columns mapped to one field is rejected , with both headers named. The mapper takes the first match and would discard the second silently, which is data loss, not a harmless duplicate. The one exception is customer.metadata — see below. A customer may carry up to five addresses. The first group s targets are customer.address.* ; the rest are customer.address2.* through customer.address5.* , with the same ten suffixes ( firstName , lastName , company , addressLine1 , addressLine2 , city , stateProvince , postalCode , countryCode , phone ). A group whose columns are all blank for a row produces no address for that row. The first address becomes the customer s default only if they had none; a customer who already has a default keeps it. A header s trailing group index is parsed, not matched. Address City - 2 , Address City #2 and Address City (2) all suggest customer.address2.city . An index above 5 is left unmapped rather than folded into an existing group. A digit that is part of the field s own name — Address Line 1 — is untouched. An order s products may arrive in ONE column. BigCommerce s control-panel order export gives an order a single Product Details cell holding every product, pipe-separated between products and Key: value within — so there are no per-line-item columns to map. Point that column at order.lineItems.packed and each p"},{"title":"Customer Invoices","route":"/developers/invoices","headings":["Customer Invoices","One list, three payment types","Auth and trust model","Pagination","Line inputs and add-ons","Per-application branding","Order fees","Refund behavior","Net 0 and invoice terms","Net-N invoice status","Amount due","Deposit receipts","Invoice numbers","When tax is filed on invoice terms","REST routes quick reference","Pages in this section","Merchant API: list invoices for a specific customer","Redirect directly to PDF (default)"],"text":"Finance Customer Invoices Every payment Throttle processes — a one-time card capture, a Net-N issuance, or a recurring subscription charge — lands in one unified, cursor-paginated invoice list. Your buyers see a single consistent view regardless of how they originally paid. Customers never hold an API key. Your backend mounts the @usethrottle/invoices/server proxy which resolves the authenticated buyer's identity and forwards only their own invoices. See React Package for the setup. One list, three payment types Throttle invoices are payment-source agnostic. The same GET /api/v1/invoices endpoint returns all three payment types in a single paginated response, ordered by creation time (newest first by default). Single-time card captures ( sourceType: "order" ) — generated when a buyer completes a one-time checkout session with a card. The invoice is marked paid immediately on capture. Net-N issuances ( sourceType: "net30" ) — issued at checkout time with a future dueAt timestamp (N days out). Status starts as open and transitions to paid once the merchant marks it paid or a payment is received. Subscription charges ( sourceType: "subscription" ) — generated on the initial subscribe and on every renewal. The invoice carries periodStart and periodEnd so buyers can see exactly which billing period each charge covers. A checkout that sells several subscriptions, or subscriptions and goods together, produces one order invoice ( sourceType: "order" ) listing every line, each subscription line with its period label (for example "Oct 1 – Nov 1, 2026", or "Oct 1 – Nov 1, 2026 · Payment 1 of 3" on an installment plan), plus shipping and tax; its total equals the capture. No separate first-period subscription invoice is issued for it. Renewals invoice as subscription charges. A single-plan checkout keeps its subscription invoice. Use the type query parameter to filter by source type if your UI needs to show a subset. Every invoice carries subscriptionId : the subscription a subscription charge bills, null on order and Net-N invoices. ( sourceId on a subscription charge is the subscription invoice id, not the subscription id.) To list one subscription's invoices, pass ?subscriptionId= to GET /api/v1/invoices or GET /api/v1/customers/:customerId/invoices : it returns its signup charge, renewals and plan-change charges. A checkout that sold several subscriptions (or subscriptions and goods together) bills its first charge on one order invoice, so that invoice has subscriptionId: null and is not in the filtered list; the renewals are. Auth and trust model The Throttle invoice API is a merchant-facing API: every call requires an sk_* secret key. Buyers cannot authenticate directly. The recommended pattern is a thin backend proxy: Your backend authenticates the buyer (Clerk, NextAuth, session cookie, etc.) and resolves their internal user id. The proxy calls GET /api/v1/customers/by-external/:externalId with your secret key to resolve the Throttle customerId . All reads are forwarded as GET /api/v1/customers/:customerId/invoices so the buyer only ever sees their own invoices. The @usethrottle/invoices/server package ships this proxy handler ready to mount in any framework that accepts a standard Request / Response interface (Next.js App Router, Hono, Remix, etc.). Pagination Invoice list endpoints return a cursor-paginated envelope. Pass the returned meta.pagination.cursor as the cursor query parameter to fetch the next page. When meta.pagination.hasMore is false there are no further pages. Line inputs and add-ons An order line with buyer inputs prints them under its description as Label: value lines (long values wrap), and an add-on prints indented directly under its parent with its group label. Order emails show the same inputs as Input Label: value with add-ons marked “↳”. A value longer than six printed lines is cut with an ellipsis on the PDF; the order keeps the full value. The invoice PDF font has no glyphs for non-Latin text or emoji, so those characters do not print on the PDF; they are kept in the order and in emails. Per-application branding Every invoice PDF is rendered with the application's configured logo and brand color. Set these on your application via the dashboard Settings → Branding panel or via PUT /api/v1/embed-config . The PDF renderer reads logoUrl and brandColor from application_env_settings at render time, so changes apply to invoices downloaded after the update (not retroactively). Order fees An invoice prints one row per order fee between shipping and tax. The merchant invoice routes ( GET /api/v1/invoices , GET /api/v1/invoices/:id and the per-customer list) return feeTotal and fees ( label, amount ), read from the billing snapshot frozen at issue: 0 and [] when the order had no fees. See Order fees . Refund behavior When a payment is refunded via the dashboard or API, the corresponding invoice status transitions automatically: Full refund — status becomes refunded ; the amountRefunded field reflects the full invoice total. Partial refund — status becomes partially_refunded ; the amountRefunded field shows the refunded portion. The re-rendered PDF shows the refunded amount and updated status. Buyers who download after a refund automatically see the current state. Net 0 and invoice terms netN is an integer from 0 to 365, or null , on a customer ( POST / PATCH /api/v1/customers ), a cart ( paymentTerms.netN ) and a quote. 0 means due on issue. null is not the same instruction: it falls through to the next source (negotiated quote term, customer, cart, then your default of 30). Who may be invoiced on terms is the Invoice Terms connection s eligibility ( PATCH /api/v1/net30/connection/{id} , or Configure on the dashboard): all_customers (the default) — anyone, guests included. approved_customers — only a customer whose profile has netN set (any value, 0 included"},{"title":"React Package · @usethrottle/invoices","route":"/developers/invoices/react-package","headings":["{invoice.number}","React Package · @usethrottle/invoices","Install","Provider","Hooks","useInvoices(params?, options?)","useInvoice(id, options?)","useDownloadInvoice()","Cursor pagination","Cache invalidation","REST routes","Invoice object fields","Boundaries"],"text":"Customer Invoices React Package · @usethrottle/invoices React hooks and a server proxy helper for surfacing a buyer's unified invoice list — card captures, Net-N issuances, and subscription charges — inside your storefront portal. Browser hooks never call Throttle directly. They call your backend proxy, which holds the sk_* key and resolves the authenticated buyer's identity before forwarding the read. Install Backend proxy · /server entrypoint Mount createInvoiceProxyHandler from @usethrottle/invoices/server on a catch-all route. The handler accepts any framework that exposes a standard Request object (Next.js App Router, Hono, Remix, etc.). createInvoiceProxyHandler(options) apiKey: string — your sk_* secret key. getCustomerId(request): string | null | Promise<string | null> — called on every request. Return the buyer's external id (e.g. your auth framework's user id). Returning null causes the proxy to reply 401 unauthorized . baseUrl?: string — defaults to https://api.usethrottle.dev . The proxy allows three read-only paths: /api/v1/invoices (list), /api/v1/invoices/:id (get), and /api/v1/invoices/:id/download (PDF URL). All other paths and non-GET methods return an error. List requests are transparently rewritten to /api/v1/customers/:customerId/invoices so the buyer can only read their own invoices. Provider Mount InvoiceProvider above any component tree that uses invoice hooks. The fetcher prop is the bridge to your backend proxy — every hook routes through it. Hooks useInvoices(params?, options?) Lists invoices for the authenticated buyer. Returns a QueryState<PaginatedInvoices> with data, isLoading, isFetching, error, refetch . params : status? ( paid | open | refunded | partially_refunded | void ), type? ( order | net30 | subscription ), cursor? , limit? , sort? ( asc | desc ). Note: The SDK normalizes the REST meta.pagination envelope into a top-level pagination on the hook result — so with the hooks you read result.data.pagination.cursor / .hasMore , whereas raw REST responses carry it under meta.pagination . useInvoice(id, options?) Fetches a single invoice by id. Skips the fetch when id is null or undefined . useDownloadInvoice() Returns an async function (id: string) => Promise<string> that fetches the signed PDF URL and opens it in a new tab. Returns the raw URL so your UI can also use it as an anchor href . To capture the returned URL for custom usage (e.g., render as an anchor href): Cursor pagination Responses carry a pagination object inside data.pagination . When hasMore is true, pass the opaque cursor string in the next useInvoices call. Cache invalidation All hooks share a cache version. Call useInvoiceInvalidation() to bump the version and cause every mounted hook to re-fetch. Use this after a refund or a payment action that changes invoice state. REST routes The following merchant-facing routes require an invoices:read API key scope. GET /api/v1/invoices — list invoices for the application (all customers, all source types). GET /api/v1/invoices/:id — fetch a single invoice. GET /api/v1/invoices/:id/download — 302 redirect to a 10-minute signed PDF URL; append ?format=json to get data : url : ... instead. GET /api/v1/customers/:customerId/invoices — list invoices scoped to a specific customer (used internally by the proxy). All list endpoints accept cursor , limit , sort (asc | desc), status , and type query parameters. Invoice object fields id — Throttle invoice id. number — human-readable invoice number (e.g. INV-sprinter-001 ). status — paid | open | refunded | partially_refunded | void . sourceType — order | net30 | subscription . currency — ISO-4217 currency code. subtotal, taxTotal, shippingTotal, discountTotal, total — integer minor units. amountRefunded — integer minor units refunded (0 when not refunded). issuedAt — ISO-8601 invoice date. dueAt — ISO-8601 due date for Net-N invoices; null for card captures and subscriptions. periodStart, periodEnd — billing period for subscription invoices; null otherwise. createdAt — ISO-8601 record creation timestamp. Boundaries The package is read-only — it surfaces invoices and PDFs but does not create or mutate payment records. Payment collection stays in @usethrottle/checkout-react . This package renders the resulting invoices. Merchant-wide views (all customers) are available via the REST routes with a secret key; the React hooks are scoped to the authenticated buyer's invoices through the proxy."},{"title":"MCP server","route":"/developers/mcp","headings":["MCP server","Install","Hosted / remote server","What it can do","Catching field-name mistakes before they 400","Writes","Connect by URL alone","Throttle Builder (OAuth)","Options"],"text":"Tools MCP server @usethrottle/mcp connects Throttle to AI assistants that speak the Model Context Protocol — Claude Code, Claude Desktop, Cursor, and anything else with an MCP client. It reads your commerce data, diagnoses failing checkouts, searches these docs, and checks request bodies against the published contract before you write code against it. Install The server runs locally over stdio and authenticates with a secret sk_ API key, exactly like the CLI. For Claude Desktop or any client that reads an mcpServers config: The key pins the workspace, application and environment — there is no way to switch from inside a tool call. Create a key that holds only the scopes the assistant needs, and start with a non-production environment. Publishable ( pk_ ) keys are rejected: they carry only browser-safe compute scopes and cannot read data. Hosted / remote server For clients that speak MCP over HTTP instead of stdio — n8n's MCP Client Tool node, for example — connect directly to https://mcp.usethrottle.dev/mcp (Streamable HTTP) instead of running @usethrottle/mcp locally. Send the same secret key as an Authorization: Bearer sk_... header — no separate provisioning, no OAuth. The tool surface and scopes are the same as the local server's read-only toolset, with two differences besides transport: the hosted server is strictly read-only, so seed_test_data is not registered there even on a non-production credential (seed from the local CLI instead), and api_get is not registered there either, because a tool that can read any path cannot declare in advance which scopes it uses. A session is created on your first call and reused for the rest of the connection; it is torn down after 30 minutes of inactivity or an explicit client disconnect. Claude's custom-connector static_headers auth type (Bearer token, no OAuth) works with this endpoint but is currently rolled out selectively by Anthropic. ChatGPT's Developer Mode does not support API-key auth for custom connectors at all — only OAuth or no auth — so it cannot use this endpoint yet. As of this change, the server also supports real OAuth 2.1 ( authorization_code + PKCE + refresh) for both platforms' native connector/directory flows, once each platform's OAuth client is registered. This is in addition to, not instead of — the static_headers path above still works too. customers:read and payments:read are OAuth-grantable, so search_customers , get_customer , search_payments and get_payment register on hosted/OAuth sessions too, not only on sk_ API keys. An OAuth connection never sees a shopper's personal data, because an OAuth grant cannot hold customer_pii:read . On every response to an OAuth token, email, phone and first/last name are withheld wherever they appear (orders, subscriptions, carts, invoices, quotes, events, webhook deliveries, the audit log): null in REST responses, and absent from MCP tool results, which drop null fields. Company and the merchant's external ids ( externalId , externalCustomerId ) are withheld too, since a merchant may key customers by email or name. REST addresses keep city, state, postal code and country and lose the street lines. Free-form fields are withheld whole, because a name or email can sit anywhere inside them: metadata , notes, hold and comp reasons, quote comment bodies, acceptance records, client context (IP address, user agent), tax ids and a payment's raw processorResponse . File downloads and exports (orders CSV, invoice PDFs, exemption certificates) return 403 oauth_file_download_forbidden . Nothing can be looked up by a withheld value either: GET /customers/by-external/:externalId and the externalCustomerId filter on subscriptions return 403 oauth_external_id_forbidden , a customer text search answers with no matches ( search_customers refuses q and lists by date instead), and search_orders matches only order ids, numbers and statuses. On top of that, each tool on an OAuth session returns a fixed list of fields chosen for its purpose, so a field the API adds later does not reach the assistant until it is added to that list. A field a buyer can type is not on any list: line-item and quote-item names, SKUs and reference ids (a quote request form takes them from the buyer), company, and every address line but the country. For the same reason get_top_products , which ranks by item name or reference id, is not offered over OAuth. API keys and the dashboard are unaffected. On every credential, API key or OAuth, a tool result never includes the payment processor's raw record: a payment's or transaction's processorResponse , or a saved card's metadata.gr4vy_payment_method . This covers get_payment , search_payments , get_order and api_get . The REST API still returns processorResponse on payments and payment transactions, but the field is deprecated: read the payment's own fields ( status , amount , capturedAmount , cardBrand , cardLastFour , errorCode ) instead. Those lists only hold if the token cannot go around them. An OAuth access token is issued for the MCP server (its aud is https://mcp.usethrottle.dev/mcp ) and works only there: sent straight to the REST API, it is refused with 401 oauth_token_wrong_audience . To call REST yourself, use an API key. (Automation connectors such as Zapier are registered for the REST API instead; see scopes .) get_integration_status reports each webhook endpoint's id, events and health but not its URL, since a destination URL often carries a secret in its path. What it can do Tools are registered per session based on what your key is actually allowed to do, so a read-only key produces a read-only toolset rather than tools that fail when called. whoami — which workspace, application and environment this key is pinned to, and whether it is production. search_docs — full-text search over these docs, with canonical links. describe_endpoint and validate_payload — the request shape of any endpoint, a"},{"title":"Media library","route":"/developers/media","headings":["Media library","Scopes","Upload an image","Add an image from a URL","List, read, rename and delete","Errors","201","200, newest first","Next page: pass nextCursor back as ?cursor=. The last page has \"nextCursor\": null.`;"],"text":"Media Media library Each store (an application in one environment) has one library of images. Upload a file or give Throttle a URL, and you get back a public URL for the original plus WebP copies at fixed widths, ready for srcset . A sandbox environment has its own library, separate from production. Scopes media:read lists and reads images. media:write uploads, renames and deletes them, and includes media:read . Extensions may request both. A publishable key ( pk_ ) cannot hold either. A dashboard session needs the Settings permission on the application to write. See scopes . Upload an image POST /api/v1/media takes multipart/form-data with a file part and an optional alt field (up to 500 characters). It answers 201 with the image. Types: PNG, JPEG, WebP, GIF, AVIF and SVG. Throttle reads the type from the file's own bytes and ignores the declared content type: a PNG sent as image/jpeg is stored as a PNG, and an HTML file sent as image/png is refused. Size: at most 10 MB and 40 megapixels (a 9000 by 9000 image is too big). An SVG is at most 20 KB. Privacy: a JPEG original is stored without its EXIF data (GPS position, camera, editing software). Its pixels, quality and orientation are unchanged. Other formats are stored exactly as uploaded, and variants are WebP files with no metadata. SVG is sanitised before it is stored, and the sanitised copy is what Throttle serves, so the stored bytes can differ from your file. Throttle keeps only shapes, text, gradients, clip paths, masks and local use references. It removes scripts, foreignObject , style elements, event attributes, animation, image and any link or reference that leaves the file. A DOCTYPE or ENTITY refuses the file. An SVG has no variants ; its size comes from its viewBox , or width and height , or is 300 by 150. Animated GIFs keep their animation in the original. Variants use the first frame. Variants: WebP copies at 320, 640, 1024, 1600 and 2400 pixels wide, listed in variants . A variant is never larger than the original, so a 1100 pixel wide image has variants at 320, 640 and 1024. Store limits: 60 uploads a minute, 10,000 images and 5 GB of originals. Deleted images stop counting toward the 10,000 right away, but their size counts toward the 5 GB until their files are removed (see below). Add an image from a URL POST /api/v1/media/from-url with { url, alt? } makes Throttle download the image and add it, with the same rules and the same 201 answer as an upload. The URL must be http or https and public. Private, loopback, link-local and cloud-metadata addresses (IPv4 and IPv6) are refused with 400 url_not_allowed , whether they are in the URL, behind a host name, or reached by a redirect. At most 3 redirects, each checked again ( 422 too_many_redirects ). The download stops at 10 MB ( 413 file_too_large ). The bytes must be one of the image types above ( 415 unsupported_media_type ). An SVG is sanitised like an upload. A download that fails or times out is 422 fetch_failed . List, read, rename and delete GET /api/v1/media : images, newest first, without deleted ones. limit is 1 to 200 (default 50), q matches alt text ignoring case, and mime filters on an exact type such as image/png . Page with nextCursor . GET /api/v1/media/{id} : one image. A deleted image is still returned, with deletedAt set, so a page that uses it can be flagged. PATCH /api/v1/media/{id} with { alt } : change the alt text. DELETE /api/v1/media/{id} : soft delete. The image leaves the list and stops counting toward the 10,000 images. Its files stay in storage and keep their URLs for 30 days, so a page that still uses the image keeps working. After that Throttle removes the files and the URLs stop working. Deleting twice is safe. An image belongs to one application and environment. Asking for it with a key from another environment answers 404 not_found . The url and every variant url are public and cached for a year, so a changed picture needs a new upload. They sit under /api/v1/assets/workspaces/{workspace}/applications/{application}/environments/{environment}/media/ . Errors 400 no_file : the multipart body had no file part. 413 file_too_large : over 10 MB (an SVG: over 20 KB). 415 unsupported_media_type : not a PNG, JPEG, WebP, GIF, AVIF or SVG image. 422 image_too_large : over 40 megapixels. 422 invalid_image : the file is damaged. 422 invalid_svg : the SVG is not well-formed XML, has a DOCTYPE or ENTITY, or has nothing safe to draw left after sanitising. 429 rate_limited : more than 60 uploads in a minute for this store. 409 media_quota_exceeded : the store holds 10,000 images or 5 GB of originals (deleted images count toward the 5 GB until their files are removed). 404 not_found : no such image in this environment."},{"title":"Metadata","route":"/developers/metadata","headings":["Metadata","Resources that accept metadata","Customers","Subscriptions","Carts and line items","Fulfillment hints on line items","Tax keys","How the keys travel from a quote to an order","Shipping keys","Orders and payments","Checkout sessions","On checkout sessions","On webhooks","Conventions","Dashboard exposure","Next","Matches the line link (lineItems[].subscriptionId), the order's subscriptionId,","or the legacy metadata.subscription_id pointer. Prefer it over q=$SUB_ID, which","substring-matches the whole metadata blob and can return unrelated orders.`;"],"text":"Cross-cutting Metadata Every major resource accepts a free-form metadata field — a JSON object you attach to capture your own business state. Throttle stores it as jsonb , returns it on every read, and emits it in webhook payloads. Outside documented automation keys, Throttle treats it as opaque storage. Metadata comes back out unchanged. A small set of documented line-item keys also drives fulfillment automation, such as fulfillmentType for digital delivery or access grants. Use the rest to bridge Throttle's data model with your own — sales rep IDs, campaign codes, contract numbers, feature flags, merchant notes. Resources that accept metadata Update support is missing on payments and checkout sessions because those are short-lived single-use records — payments capture once, sessions expire in 30 minutes. If you need to mutate metadata on them, do it at create time. Customers Subscriptions Carts and line items Fulfillment hints on line items When an order is paid and in awaiting_fulfillment , Throttle reads line-item fulfillment hints. Digital and access-grant items are fulfilled automatically; shipment and service items stay manual in the dashboard. Net30 invoices wait for capture before delivery. Cart items and order line items accept an explicit deliveryMethod field: shipment , digital , access_grant , service , in_person , custom , or none . This is the preferred way to say what an item needs — set it directly and skip the metadata hints below entirely. Omit deliveryMethod and Throttle resolves it once, at insert time, from type and the metadata hints below — then freezes the result on the row. It is not re-resolved on later updates, so changing an item s metadata after creation does not change its delivery method. Every order read returns the resolved value on each line item, so you never have to re-derive it: an order whose items are all digital , access_grant or none has nothing to ship and reaches completed without a fulfillment of your making. Defaults are conservative: unmarked products are shipments, subscriptions and tickets are access grants, services stay manual, and donations are not applicable. Metadata never makes a subscription line ship: only an explicit deliveryMethod: shipment does, which makes a physical subscription. For older integrations, requiresShipping: false is treated as digital unless requiresFulfillment: false is set. Tax keys A handful of metadata keys feed tax calculation and, with Avalara connected, the document Throttle files. They have no typed field of their own: the SDKs type metadata as Record<string, unknown> and the API does not validate them. A misspelled key or a value of the wrong type is silently ignored, and the line is taxed as if you had not sent it. Copy the names exactly. taxCategory means two different things. With the native engine it is matched against the categories on your tax rules: an exempt line is never taxed, and a value no rule lists — including a different case, such as Digital — is taxed only by a rule covering all categories, otherwise not at all. With Avalara it is sent as the line's AvaTax tax code. Native category names are never sent to Avalara, regardless of case: a line carrying standard or exempt falls back to the application's default item tax code. So exempt does not exempt a line under Avalara — send the AvaTax code for the treatment you mean. How codes resolve, and why an item in your AvaTax catalogue beats them, is in the Avalara AvaTax setup guide . taxIncluded must be a JSON boolean. The string "true" is ignored, and the line follows the application setting. transport is case-sensitive. A value outside the five above is never sent to AvaTax, because AvaTax rejects the whole transaction on one. Both the estimate and the filed document use the application default in its place, so a misspelling silently becomes the default. Set it on the cart or the checkout session, not only on the order: the estimate is calculated before the order exists and reads the cart with the session's metadata over it, and the order copies that same metadata for the filed document. The native engine ignores it. Use the camelCase key. Tax calculation and the filed document also accept tax_category and tax_included , but these are kept for older integrations; new code should send taxCategory and taxIncluded . The item identifier is referenceId , not sku AvaTax files each line under an item code, and Throttle sends the line's referenceId as that code. Carts and orders have no sku field: their line schemas are strict, so a top-level sku is rejected with a validation error. When a line has no referenceId , the estimate and the filed document both fall back to metadata.sku , but send referenceId : it is the field the order page shows and the one every integration reads. Quote lines are the exception: they take both sku and referenceId . How the keys travel from a quote to an order Quote → cart, on acceptance. Each line's metadata is copied whole, so taxCategory and taxIncluded come with it. The cart line's referenceId is the quote line's referenceId , or its sku when it has none. The quote's buyerReference lands on cart.metadata.buyerReference — a value given at acceptance wins. Of the quote's own metadata, only transport is carried; any other key, including purchaseOrderNo , stays on the quote. Cart → order. The order's metadata starts from the cart's (the merge order is under On checkout sessions, below), and each line keeps its metadata and referenceId . Estimate and filing. Tax is estimated from the cart and filed from the order. Because the order inherits the cart's keys, the buyer is charged on the same answers the document records. Avalara reads more per-order keys than these — shippingTaxCode and taxTrigger among them. They are covered in Overriding an application default on one order . Shipping keys Line-item metadata keys that size a shipment for a conn"},{"title":"Multi-currency","route":"/developers/multi-currency","headings":["Multi-currency","Enabled currencies","Payment coverage","Reading coverage","One rule for every create path","Amounts are per currency","Shipping","Net 30 and payment methods","Routing","Orders, payments and saved cards","Quotes","Minor units","The money package","Showing money","Reports","Order and presence","Example","What stays in USD","A currency the store has not enabled.","A carrier markup with one amount per currency.","above 100.00 USD or 90.00 EUR.","Enabling such a currency (PUT /api/v1/embed-config): details is an array,","and several refused codes share one message.","Payment coverage could not be read while enabling a currency"],"text":"Money Multi-currency A store has one main currency and may enable more. Every record is created in one currency, and every amount that depends on a currency (a discount, a shipping rate, a Net 30 cap, a routing threshold) is stored per currency. Throttle never converts an amount for you. Enabled currencies The main currency belongs to the application and is shared by its sandbox and production environments. The extra currencies are cartCurrencies , set per environment in the dashboard (a searchable multi-select under Cart pricing → Extra cart currencies ) or with PUT /api/v1/embed-config . An application reports both as enabledCurrencies , with the main currency first. PATCH an application or store currency to change the main currency. After the store's first production sale it answers 409 currency_locked and the response shows currencyLocked: true . A code that cannot be a main currency is 422 currency_not_supported . A currency can be enabled when it is an ISO 4217 currency with 0, 2 or 3 decimal places, is not a fund or test code, and its decimal places are confirmed by payment processors. Four-decimal currencies and codes whose processor handling is unconfirmed (HUF, TWD, ISK, UGX, COP and IDR among them) are refused: the embed-config PUT answers 400 validation_error with the reason in details[] , and an application main currency answers 422 currency_not_supported . Disabling a currency stops new carts, quotes and subscriptions in it. Existing records keep working in their own currency: sent quotes, renewals, invoices and refunds. Until multi-currency opens in production, a production environment accepts USD only. Adding a code to a production cartCurrencies , or creating a record in a non-USD currency there, answers 422 currency_not_available_in_production . An unchanged or shorter cartCurrencies list is still accepted, and sandbox is not restricted. Payment coverage A currency is payable when at least one active payment service on your connection accepts it. A service with an empty accepted-currency list inherits the list of its definition. Invoice Terms (Net 30) never makes a currency payable. The enable rule. Adding a code to cartCurrencies with PUT /api/v1/embed-config is refused with 422 currency_not_payable when no connected service accepts it ( details is an array of currency, payableCurrencies , several codes joined in one message). When coverage cannot be read the answer is 503 currency_coverage_unavailable and nothing changes. Not payable. A currency that is already enabled stays enabled when it stops being covered, and the dashboard shows it as "Not payable" (in Cart pricing and in the New order picker). In the Cart pricing multi-select, a currency that is not payable ("no payment provider accepts it") can't be added, and removing a currency asks for confirmation. Carts, quotes and orders can still be built in it. Only starting a payment is refused: 422 currency_not_payable with details as currency, payableCurrencies . This applies to cart finalize and checkout, cart-session checkout, order authorize, order and payment-link payments, quote accept and quote-link checkout, and the embed tokens and card sessions. If the coverage lookup fails on a payment path, the payment proceeds; only the enable gate fails closed. No connection. With no payment connection, the coverage route answers 200 with connection: "missing" , and the embed token keeps 402 connect_processor . Freshness. Payment paths use a coverage read cached for 60 seconds. The coverage route and the enable gate always read fresh. Reading coverage GET /api/v1/connectors/currency-coverage needs connectors:read for an API key, or the application:settings permission in the dashboard. It returns one row per enabled currency plus every currency an active service accepts: the main currency first, then the other enabled codes ascending, then the covered-but-not-enabled ones. usage (open carts and active subscriptions) appears only on enabled currencies, and only when the key holds both carts:read and subscriptions:read . valuation is ecb , fallback or none : how Throttle values a payment in that currency for its own billing. unknownServices lists services Throttle could not match to a definition. The MCP tool get_currency_coverage returns the same data. The production rule is unchanged: non-USD stays closed in production until the production gate opens. Coverage is read the same way in every environment. Both embed-token responses ( POST /api/v1/checkout-sessions/embed-token and GET /api/v1/checkout-sessions/{id}/embed-token ) carry originCountry , a nullable string: the buyer address country, else the store origin country, else US . One rule for every create path Carts, cart sessions, quotes, orders, subscriptions, the checkout embed token, the add-card embed token and imports all follow the same rule: A missing currency means the store's main currency. A given currency is matched case-insensitively and stored upper case ( eur becomes EUR ). It must be enabled, else 422 currency_not_enabled with details.enabledCurrencies . An unknown code ( XXX , ABC ) is 422 currency_not_supported . An integration that omitted currency used to get USD on orders, payments, subscriptions and quotes. It now gets the store's main currency. A USD-main store sees no difference. The old 422 currency_mismatch on an unresolved cart is replaced by the codes above. Amounts are per currency Throttle does not convert prices, so a currency with no entry is not offered . The legacy single-value field ( value , a method's rate, a flat markup's amount , maxOrderTotal ) mirrors the main-currency entry. 422 discount_currency_unsupported . See Discounts . , ], [ Shipping methods , code: currencyAmounts , html: The method is not offered. Selecting it is 422 shipping_method_unavailable . , ], [ Carrier markup , code: markup.amounts , A flat markup with no entry for the cart currency drops t"},{"title":"Order fees","route":"/developers/order-fees","headings":["Order fees","Concepts","Manage fee definitions","Fields on documents","Fees on one document","Fees on a direct order","Subscriptions and renewals","Quotes","Tax","Webhooks and types","MCP","Error codes","Related","201","Fees charge only while they are switched on for the environment:","Change one fee on this order only (rate for a percentage fee, amount for a flat one)","Remove a fee, and bring it back","Add a global fee that applies to subscriptions (from the next renewal), or stop charging one"],"text":"Orders Order fees An order fee is an extra charge on top of goods, shipping and tax: an insurance fee, a handling fee, a membership fee. You define fees once for an application and environment. They apply to new orders automatically, and you can remove, change or add a fee on one document. Each fee is its own row on every surface that shows money, placed after shipping and before tax. Concepts Global definitions. A fee is percentage ( rateBps , 1 to 10000, so 250 is 2.5%) or flat (an amount per currency in flatAmounts ). A percentage fee can carry a minimum and a maximum charge per currency. A fee can also have a minimum order amount, be limited to customer groups, be taxable (with an optional tax code), and apply to one-time orders, subscriptions or both. Archiving a fee does not touch documents that already froze it. The percentage base is the items after discounts. Shipping, tax and other fees are not in it, so fees never compound, and a discount code never reduces a fee. A flat fee stays even when the items are free. Each fee is rounded half-up to the minor unit, then the minimum and maximum apply. A flat fee with no amount for the document currency does not apply. Auto-apply. Storefront and hosted checkout carts, dashboard orders and quotes get the fees that are in force when they are created. Bulk imports and POST /api/v1/orders never get automatic fees: pass fees yourself (below). Per-document overrides. On a cart, an order or a quote revision you can add a global fee, add a one-off custom fee, change one fee's rate or amount for this document only, remove a fee (it stays as a removed row, so an automatic fee does not come back), or restore it. The source of a row is auto , override or custom . Frozen. Fee settings are copied onto the document when the fee attaches. Later edits to the global fee reach only open storefront carts and documents created afterwards. Fees stop being editable once money is on the document ( 409 fees_locked ). The one exception: when you edit the lines of a paid order, percentage fees are recalculated from their frozen settings and the difference goes through the normal charge or refund. Kill switch. Order fees are off by default per environment: PUT /api/v1/fees/settings with enabled : true . While it is off nothing is charged, and new orders, carts and quotes read fees: [] and feeTotal: 0 (a subscription still lists its stored snapshot), and totals are exactly what they were without fees. Turning it off also stops fees on quotes that were issued with fees and on subscription renewals. Orders, payment links and invoices already created keep their fees. Order fees are rolling out per application: GET /api/v1/fees/settings answers available , and while it is false turning fees on answers 403 fees_not_available . Refunds. Returns never refund fees by themselves. A full refund refunds everything; include fee money in a manual partial refund. Manage fee definitions GET|POST /api/v1/fees , PATCH|DELETE /api/v1/fees/:id , POST /api/v1/fees/reorder and GET|PUT /api/v1/fees/settings . Reads need applications:read , writes applications:write . DELETE archives the fee. reorder takes ids : [...] listing every current fee exactly once; fees are priced and shown in that order, with custom fees after global ones. Fields on documents Orders, carts, quote revisions (merchant and buyer reads), subscriptions ( fees only) and invoices carry feeTotal and fees . Rows you have removed are not listed. The change is additive: no existing field changed meaning. label is the text to print: the name, plus the rate for a percentage fee. Buyer-facing reads never list a fee whose amount is 0. Invoices read feeTotal and fees ( label, amount ) from the billing snapshot frozen at issue: 0 and [] on an invoice with no fees. The orders CSV export appends two columns at the end: fee_total and fees ( Label: 25.00; Label2: 18.00 , charged fees only). Fees on one document Fee edits are an admin action, including on carts. They need the scope above plus the matching dashboard permission: application:orders:write for carts, orders and subscriptions, application:quotes:write for quote revisions. A publishable key, an extension session or a payment-method token gets 403 permission_denied , so a buyer can never change what they are charged. Every route returns the document with its totals recomputed. An order made from a cart edits the cart's rows and re-quotes tax. A direct order re-prices over its own lines; a taxable fee is refused there ( 422 fee_invalid , details.field: taxable ) because a direct order carries the tax you send. On a quote only the working revision is editable. Order changes send order.updated . Fees on a direct order POST /api/v1/orders accepts fees (up to 20, stored as custom ) and feeCharge ( order , off_cycle or trial_signup ; default order ). Each fee takes name , kind , rateBps or flatAmount , taxable (default false; true is refused), taxCode , appliesToOneTime and appliesToSubscription . Unknown fields answer 400. A non-empty fees list answers 409 fees_disabled while order fees are off. Subscriptions and renewals A fee that applies to subscriptions is charged on the signup order and on every renewal. When a subscription is created, the signup order's fee rows that apply to subscriptions, with any overrides and removals, are copied onto the subscription as its snapshot. A renewal prices that snapshot: a percentage fee is a percentage of the renewal's plan amount, and a flat fee is charged once per renewal per subscription. Changing or turning off a global fee does not change existing subscriptions; add a fee to, or remove one from, a single subscription with the routes above. An added fee starts at the next renewal. A $0 trial signup charges no fees. The snapshot is still stored, and the first paid renewal charges it. Plan-change, proration and installment charges get percentage fees only, never a flat fee. In a mixed cart, a percentage fee's base"},{"title":"Authorize and Capture","route":"/developers/orders/capture","headings":["Authorize and Capture","The routes","Partial capture","amount vs capturedAmount","Full capture","Authorizing","Charge a saved card","Closing an order","Webhooks","Error codes"],"text":"Orders Authorize and Capture Most Throttle checkouts authorize and capture in one step. Splitting them lets you hold funds at order time and take the money when you actually ship — and take less than you held if the final total came in lower. The routes The order-scoped and payment-scoped routes do the same underlying work. Use the order-scoped pair when you are holding an order id and want Throttle to keep the order status in step; use the payment-scoped pair when you are working from a payment. Partial capture Only POST /api/v1/payments/{id}/capture accepts an amount . Omit it and Throttle captures the full authorized amount; pass one and it captures exactly that, in minor units. Capturing less than you authorized finalizes the payment at the captured amount — the uncaptured remainder is released back to the buyer by the processor, and there is no second capture against that authorization. Decide the final figure before you call this. If you need to bill more later, create a new payment on the order. Over-capturing is rejected with 400 capture_amount_exceeds_authorized . Its details are the authorized amount as a money value, amount, currency, display (minor units), plus requested , the amount you asked for in the same shape. A zero or fractional amount is refused with 400 invalid_capture_amount . Capturing a payment that is already captured is 409 payment_already_captured — a second capture moves no money, so a success there would be a lie. For network retries, send the original call again with an Idempotency-Key , which replays the first response. amount vs capturedAmount After a partial capture the payment keeps two figures, and they mean different things: amount — what was authorized . It does not shrink to match the capture. capturedAmount — what was actually taken, and what the buyer is charged. Anything that sums money — payouts, revenue reports, refund ceilings — must read capturedAmount . Reading amount overstates revenue on every partially captured order. Full capture The order-scoped route captures the whole authorization and keeps the order status aligned. The order must be past checkout and not cancelled: awaiting_payment , awaiting_fulfillment , awaiting_shipment , partially_shipped , shipped or completed . POST /orders/{id}/capture and /authorize check the payment first and treat an already-captured or already-authorized payment as a no-op, so a duplicated webhook or a retried job is harmless. The payment-scoped routes do not. Calling POST /payments/{id}/capture on a payment that is already captured , or /authorize on one that is no longer pending , fails. If you are driving these from a queue or a webhook handler, prefer the order-scoped pair or send an Idempotency-Key . Authorizing POST /api/v1/orders/{id}/authorize requires the order to be awaiting_payment — authorization is the first money step, so anything further along is a 400 invalid_order_state . On this route, re-authorizing an already-authorized payment is a no-op; on the payment-scoped route it is not (see above). Cancelling an order voids any open authorization, and any unpaid Net-N invoice ( authorized or pending ), automatically, so you do not need to release a hold or cancel the invoice by hand. See Order states . Charge a saved card POST /api/v1/orders/{id}/charge-saved-card charges a card the order s customer already has on file, for up to the order s outstanding balance: the total, less any comp, less what has been captured. Use it to retry a failed payment. The payment is created captured and the order advances as a processor capture would; a decline records nothing. Scope payments:write . paymentMethodId is the saved card s id from GET /api/v1/customers/{customerId}/payment-methods . Send an Idempotency-Key : a replay returns the first response, and the processor charge is keyed on it too. Closing an order POST /api/v1/orders/{id}/close moves a shipped order to completed , the terminal status, and moves no money. On an order that is already completed it changes nothing; from any other status it is 409 invalid_order_state . POST /orders/{id}/status with completed does the same from any status. Webhooks A successful capture emits payment.captured carrying both figures, so a consumer can tell a partial capture from a full one without re-fetching: A processor decline emits both payment.capture_failed and payment.failed . Handle whichever suits you, but expect both to arrive for a single failure. Error codes Full list and envelope shape on Error codes , and payment status meanings on Payment states ."},{"title":"Disputes and Chargebacks","route":"/developers/orders/disputes","headings":["Disputes and Chargebacks","Two ways a payment gets flagged","Flagging a payment","Clearing a dispute","How processor events are classified","Webhooks","Error codes"],"text":"Orders Disputes and Chargebacks A disputed payment is money you booked that is now contested — a card chargeback, or a B2B buyer refusing a Net-N invoice. Throttle surfaces both through the same three fields on the payment, written either by your own call or by the processor. If you are coming from a processor with a first-class Dispute resource, calibrate expectations: Throttle stores disputed , disputeReason , and disputeOpenedAt on the payment, plus disputeOutcome and disputeClosedAt once a card chargeback is decided. There is no evidence submission, no due date, and no dispute id on the payment. The fields exist so a contested payment stops looking like clean revenue in your reporting and your AR views — contest the chargeback in your processor s dashboard. Two ways a payment gets flagged You flag it. POST /api/v1/payments/{id}/dispute — mainly for Net-N receivables, where the dispute arrives as an email from a buyer rather than a processor event. The processor flags it. Inbound dispute.* and chargeback.* webhooks are matched to the payment by processor transaction id and write the same three fields. No configuration needed. Because both paths converge on the same columns, a consumer of payment.disputed does not need to care which one fired. Flagging a payment Scope payment_disputes:write . reason is required, 1–500 characters. disputeOpenedAt is stamped server-side. Flagging an already-flagged payment is a 409 already_disputed rather than a silent overwrite, so you cannot lose the original reason by retrying. Clearing a dispute Clearing sets disputed: false but deliberately leaves disputeReason and disputeOpenedAt in place, so the history of the dispute survives on the payment. It takes no body, and clearing a payment that was never disputed succeeds without emitting an event. How processor events are classified Inbound dispute events are classified from the event suffix and the target s status: disputed: true means a dispute is open right now — build your worklist from it. Once the processor decides a card chargeback, disputed goes back to false and disputeOutcome records won or lost , with disputeClosedAt . A lost chargeback rolls the order s paymentStatus up to charged_back . Net-N invoice disputes you clear by hand don t set an outcome. A resolution event for a payment that is not currently flagged is a no-op, and redeliveries of an open event will not re-fire payment.disputed — it is emitted only on the first transition into the disputed state. Webhooks payment.dispute_cleared carries only paymentId . payment.dispute_lost carries paymentId , reason , amount (minor units), currency , and closedAt , and fires once per loss. Subscribing to any of the three requires payment_disputes:read . Both are worth routing to a human — a chargeback is one of the few events where nobody finds out until a payout is short. See Webhooks . Error codes"},{"title":"Build an order from a cart","route":"/developers/orders/from-cart","headings":["Build an order from a cart","Create the draft order","Send a payment link","Collect a balance on a placed order","Take a card payment (phone orders)","Invoice on terms","Cancelling a builder order"],"text":"Orders Build an order from a cart The dashboard s order builder makes an order without a checkout: it fills a cart, turns it into a draft order, and then collects payment from the order. The same three routes are available to a secret key. Currency: an order without currency takes the store's main currency, and its payments follow the order's currency. See Multi-currency . Create the draft order POST /api/v1/orders/from-cart takes the id of an open cart in the credential s application and environment. Build the cart first with the cart API (line items, customer, addresses, shipping). Scope orders:write . The order is always created in draft and stamped metadata.createdVia: dashboard . Nothing is charged: a draft is an order waiting for a way to be paid. Its line items are locked to the cart s total, so PATCH /orders/{id}/line-items answers 409 order_edit_in_builder . Cancel the order and build a new one instead. See Order line-item edit codes . Converting a cart twice does not create a second order. The 409 names the first one: Send a payment link POST /api/v1/orders/{id}/payment-link opens a hosted checkout session on the order s cart that stays payable for seven days, and emails it to the order s customer. Send send : false to create the link without emailing it; emailedTo is then null , as it is when the order has no customer email. The body is optional. The route both changes the order and creates a checkout session, so an API key needs orders:write and checkout_sessions:write . Calling it again replaces the link: the previous session is cancelled first, so only the newest link can be paid. When the customer pays, the order leaves draft as any checkout does. The link pays the order exactly as built. Its page re-quotes tax only, on the cart s lines and shipping, and the buyer cannot change the email, addresses or VAT number: a /calculate that sends values other than the cart s answers 409 payment_link_details_locked . To change them, cancel the draft and build a new order. DELETE /api/v1/orders/{id}/payment-link cancels the link and answers 204 . It answers 204 when the order has no link, too. DELETE returns the same 403, 404, payment_in_progress , payment_link_conflict and payment_link_cancel_failed codes. Collect a balance on a placed order A captured payment cannot be increased. When an order s total goes up after it was paid (a line edit on an order whose customer has no saved card to charge, such as a guest checkout or a PayPal payment), the difference is left owing and the order reads partially_paid . GET /api/v1/orders returns each order s amountDue : its total, less any comp, less what has been captured. POST /api/v1/orders/{id}/balance-link opens a payment-only page for exactly that balance, payable for seven days, and emails it to the customer (the order s customer, else the email the order was placed with). Send send : false to create it without emailing it. The customer pays by card or any other method enabled for the application, and the payment is recorded on this order as a second payment. No new order is created. It works on any placed order, not only one built in the dashboard, and needs orders:write and checkout_sessions:write . Calling it again replaces the link and cancels the previous one. The balance is checked again when the customer pays: if it went down or was paid (a recorded payment, a saved-card charge), or the order was cancelled or put on hold, the payment is released, nothing is charged, and the page answers 409 balance_link_closed . The order then needs a new link for whatever is still owed. The emailed template is customer.order_balance_request . Cancelling the order from the dashboard or the orders API closes an open balance link first. If the customer is paying it right then, the cancel answers 409 payment_in_progress and the order is not cancelled. Take a card payment (phone orders) POST /api/v1/orders/{id}/card-entry starts a card payment the merchant types in for the customer: a mail or telephone order. It answers 201 with a sessionId , an embedUrl that is valid for 30 minutes, expiresAt and saveCard . The Throttle dashboard shows the embedUrl in a dialog under Take card payment (the order page s Card payment button); no other page may embed it, and its URL does not work as a page of its own. The card is typed into the payment processor s secure form, never into Throttle, and is charged as a MOTO transaction, so the bank does not ask the merchant for a 3-D Secure check meant for the cardholder. Send saveCard : true to save the card to the order s customer for future orders. It is always saved when the order has a subscription line, because renewals charge it. Saving needs a customer on the order: 422 customer_required otherwise. A card that is not saved is never stored. It takes the same orders as a payment link: a draft built in the dashboard from a cart. An open payment link, or an earlier card form, is cancelled first, so the order can only be paid once. It needs orders:write and checkout_sessions:write . A completed payment moves the order out of draft exactly as a checkout does, captured, with any subscriptions created on the saved card. Your payment processor must accept MOTO transactions on your account. Some, Stripe among them, enable it on request; until then a card whose bank wants a 3-D Secure check is declined. Invoice on terms POST /api/v1/orders/{id}/invoice-on-terms issues a Net-N invoice for the draft and moves the order to awaiting_fulfillment , the way a buyer choosing Invoice Terms at checkout does. The merchant accepts the terms on the buyer s behalf: companyName and billingEmail are recorded on the acceptance, and the payment s metadata records termsAcceptedBy: merchant . It requires an active Invoice Terms connector. An API key needs payments:write and orders:write . netDays (0 to 365, 0 is due on issue) sets the terms for this invoice. Omit it and the usua"},{"title":"Product inputs and add-ons","route":"/developers/orders/line-inputs","headings":["Product inputs and add-ons","For merchants: set up the catalog","For developers: the API flow","Create an order","Request fields","Response fields","Edit inputs on a placed order","Edit lines that have add-ons","Skipping validation","Errors"],"text":"Orders Product inputs and add-ons A product can ask the buyer for inputs (a truck year, an engraving) and offer add-ons (a sensor with a turbo). On POST /api/v1/orders , send the values on the line. Throttle checks them against the Product Catalog, snapshots them on the line, and turns every add-on into its own priced line. For merchants: set up the catalog Inputs and add-ons are defined on the product in the Product Catalog, in the product edit page or through the push API ( inputs[] and addOnGroups[] on the product, inputs[] and disabledInputKeys[] on a variant). Arrays replace the whole list when sent and are left alone when absent. Inputs are what the buyer fills in: a key (lowercase letters, digits and underscores, up to 40, fixed once saved), a label, a type (text, textarea, number or select), and whether it is required. Text, number and select inputs carry their own limits (length, min and max, whole numbers, the list of choices). A product-level input applies to every variant. A variant can add its own and switch off a product-level one by key. Up to 20 inputs apply to one variant. Add-on groups are optional extras sold with the product, such as an upgrade or a cable. A group has a label, an optional list of parent variant SKUs it applies to (empty means all variants), and choices. Each choice is a catalog SKU with a quantity mode: per unit (up to a maximum for each unit of the parent, default 1) or per line (a maximum for the whole line, default 1). Up to 10 groups per product and 20 choices per group. A choice whose SKU is missing or archived is saved as unresolved and cannot be bought until the SKU exists. An add-on is priced from its own catalog price, in the order currency, and taxed under its own tax code. Inputs never change a price. Buyers see inputs and add-ons on the product page, the cart and checkout. In the dashboard, the order builder and quote and subscription editors show the same fields. Everything below is for developers. For developers: the API flow The same inputs and addOns fields work everywhere a line is sent: orders (below), carts and cart sessions ( Cart API , Cart sessions ), quotes ( Quotes ) and subscriptions ( Managing subscriptions ). The server checks them against the catalog, snapshots them on the line and turns each add-on into its own priced child line. All error codes are in the error reference . Create an order The order has two lines. The add-on takes its name, image and price from the catalog (never from the request), and its tax code goes in metadata.taxCategory . Totals are the sum of every line, so the add-on counts in the subtotal, the total and the base of a percentage order fee. metadata.inputs mirrors the entered values for tools that only read metadata. On a line sent with inputs or addOns it replaces any metadata.inputs you sent, and removes it when the line has no inputs. A line sent with neither keeps your metadata exactly as sent. Add-on lines carry metadata.sku and metadata.parentSku . Request fields [ code: r.name , r.type, r.description]) minWidth= 620px /> Response fields [ code: r.name , r.type, r.description]) minWidth= 620px /> Edit inputs on a placed order PATCH /api/v1/orders/:id/line-items/:lineId/inputs replaces the inputs on one line. The body is { inputs, skipInputValidation? } , validated like order creation. It needs the orders:write scope. Send { inputs : {} } to clear them. Secret key or dashboard only: a publishable or extension installation key gets 403 secret_key_required . Inputs never change price, so no total, tax or payment moves and nothing is charged or refunded. The line's metadata.inputs mirror is rewritten (and removed when the inputs are cleared), and the order's history records the old and new values and who changed them. 409 line_already_fulfilled: the line has any fulfillment, whole or partial. 409 order_not_editable: the order is cancelled, refunded or voided. 422 invalid_line_inputs: an invalid value, or an add-on line ( unknown_input : add-ons take no inputs). 403 input_validation_skip_forbidden: skipInputValidation from a publishable key or storefront session. 404 not_found: no such order, or the line is not on that order, in this environment. The edit sends order.edited (never order.updated , which integrations treat as a sale). changedFields holds lineItemInputs , and previous.lineItemInputs lists the old snapshot of each edited line. No event is sent when the values did not change. Edit lines that have add-ons PATCH /api/v1/orders/:id/line-items keeps add-on lines tied to their parent. Money settles once per call, by card refund or charge or by the Net-N invoice, for the summed change of every line the call touches. Remove a parent: its add-ons are removed in the same edit and refunded (or taken off the invoice) together. Lower a parent's quantity: per-unit add-ons clamp to parent quantity times their maximum per unit (per-line add-ons keep their quantity), and the difference is settled in the same call. Raising the quantity leaves add-ons unchanged. Remove an add-on alone: allowed and refunded; the parent is untouched. 409 line_has_addons_or_inputs: a sku change on a line that has inputs or add-ons. Remove it and add the new item. 422 validation_error: an added line that sends parentLineId ; details.path names it. The parent link is set by the server, and new add-ons cannot be added to a placed order. Raising an add-on's quantity above its cap (parent quantity, as changed in the same call, times its maximum per unit; or its per-line maximum) is 422 addon_quantity_exceeded with details.maxQuantity . If a clamp leaves a child's line discount bigger than its new subtotal, the edit returns 400 invalid_discount_amount , so send a lower discountAmount for that child in the same call. No new events are sent. A refund of a parent line does not refund its add-ons, and refunding an add-on line alone leaves the parent as it is. Skipping validation"},{"title":"Returns and Exchanges","route":"/developers/orders/returns","headings":["Returns and Exchanges","Lifecycle","Open a return","How refundAmount is computed","Transitions","The refund on completion","Exchanges","Webhooks","Error codes"],"text":"Orders Returns and Exchanges A return is an RMA against a subset of an order s line items. It moves through an explicit state machine, and the money only moves at the end — either as a refund on complete , or as the price difference on an exchange. Lifecycle Only requested , approved , received , and completed hold a returned quantity against the order. Rejecting or cancelling releases it, so the buyer can open a fresh return for the same line later. Open a return POST /api/v1/orders/{id}/returns — scope order_returns:write . Pass the line items and quantities coming back. reason (max 1000 chars) and restock are optional. Throttle computes refundAmount at creation time and returns it on the object, so you can show the buyer the exact figure before anyone approves anything. List an order s returns with GET /api/v1/orders/{id}/returns and fetch one with GET /api/v1/returns/{id} — both scope order_returns:read . How refundAmount is computed Throttle refunds what the buyer actually paid for those units, not the list price. Per line that is: the line subtotal, plus the tax charged on it, minus any discount applied directly to that line, minus that line s proportional share of any order-level discount. The result is prorated across the returned quantity and telescopes exactly across repeated partial returns — returning 1 unit three times refunds the same total as returning 3 units at once, with no rounding drift. Transitions POST /api/v1/returns/{id}/transition with an action . Anything not listed here is a 409 invalid_return_state . The refund on completion Completing a return resolves the order s payment in captured or partially_refunded status and refunds refundAmount against it, stamping refundPaymentId on the return. The refund carries the reason return:{returnId} . If the order has no captured payment — an unpaid Net-N invoice, say, or an order captured outside Throttle — the return still moves to completed and no refund is issued. The server logs a warning, but the API returns 200. If you rely on a return implying money moved, assert on refundPaymentId being non-null rather than on the status. If the processor declines the refund, the transition fails with 402 refund_failed and the return stays in received , so you can retry. Exchanges POST /api/v1/returns/{id}/exchange swaps the returned goods for replacements instead of refunding. The return must be in approved or received ; it is an alternative route to completed that settles a difference rather than issuing the standard refund. Throttle then: creates a replacement order carrying metadata.exchange_for_return pointing back at the return, computes delta = replacementTotal − refundAmount , charges the customer s stored card when delta > 0 , or refunds the difference when it is negative, marks the return completed and stamps the replacement order id. Replacements are charged at list price — this path has no address-aware tax quote yet. Because delta compares against the return s paid value (which does include tax), an even-swap exchange produces a small refund roughly equal to the returned line s tax. The difference favours the buyer, never the merchant, but budget for it if you run high exchange volume. A delta > 0 needs someone to bill: if the original order has no customer attached you get 409 no_customer , and a declined card is 402 payment_failed . In both cases no replacement order is left half-settled. Webhooks Opening a return emits return.created . Every transition and every exchange emits return.updated , carrying status and previousStatus so you can react to a specific edge rather than polling. Subscribing requires order_returns:read . See Webhooks . Error codes Full list and envelope shape on Error codes ."},{"title":"Pick the Smallest Package That Does the Job","route":"/developers/packages","headings":["Pick the Smallest Package That Does the Job","Package Boundary"],"text":"SDKs and CLI Pick the Smallest Package That Does the Job Throttle publishes focused packages for checkout embeds, native cart orchestration, discounts, generated REST calls, and command-line setup. Each package card calls out where it is safe to run and whether it is production-ready today. Server SDKs do not take a separate environment option for normal API calls. Generate separate keys for Production, Test, UAT, or any custom non-production environment; the raw key is pinned to exactly one workspace environment. Every non-production environment routes to sandbox provider credentials. Clerk-authenticated dashboard calls that are not using an API key send X-Throttle-Environment-Id instead. packages.map((item) => ( )) Package Boundary For public integrations, use the @usethrottle/* packages above. If a package is not listed here, it is not public API."},{"title":"Upgrading api-client from 2.x to 4.x","route":"/developers/packages/api-client-2-to-4","headings":["Upgrading api-client from 2.x to 4.x","Breaking changes that stop compiling","Breaking changes that still compile","order.completed became order.fulfilled","What you gain","Upgrade checklist"],"text":"Packages Upgrading api-client from 2.x to 4.x Two major versions shipped a day apart in August 2026: 3.0.0 (one order status instead of two) and 4.0.0 (payments that are still in flight). This page lists every breaking change between 2.18.0 and 4.3.0 , taken from a diff of the two published packages. This page records the August 2026 changes and is kept as history. Since 2026-11-23 orders use ecom-standard statuses ( awaiting_payment , awaiting_fulfillment , awaiting_shipment , partially_shipped , shipped , completed ) and the events below were retired in turn: order.fulfilled is now order.shipped or order.completed , and order.closed is order.completed . That change is a new major of @usethrottle/api-client . For the mapping and the window in which the old values are still accepted, see Renamed statuses . Throttle serves one API version. Staying on 2.x does not keep the old behaviour — it keeps types that describe it. Three things are already true for a 2.x client today: postApiV1OrdersComplete returns 404, an order is never completed (it is fulfilled ), and order responses carry no fulfillmentStatus . Everything else in 2.x keeps working. Breaking changes that stop compiling OrdersService.postApiV1OrdersComplete is gone. The endpoint ( POST /orders/ id /complete ) was removed with the status it set. Use postApiV1OrdersStatus , which moves an order to any lifecycle status. Order status : completed became fulfilled . The full set is now draft , pending , processing , partially_fulfilled , fulfilled , cancelled , closed . Stored orders were migrated; you will not receive completed from any client version. fulfillmentStatus was removed from order responses and filters. Delivery progress is in status itself, with per-item counts in fulfillmentSummary . See Order states . Status unions grew. Order paymentStatus gained processing , disputed and expired ; payment status gained processing and expired . An exhaustive switch over either stops type-checking until it handles them. The delivery-log eventType filter no longer accepts order.completed . See the event rename below. Before 4.0.0 a payment the processor had not yet decided — a 3DS challenge in progress, a redirect the buyer had not returned from, a bank debit still settling — was reported as failed . If your code retries or re-charges on failed , make sure it does nothing on processing . Breaking changes that still compile The generated client takes positional arguments. Two list methods gained filters in the middle of their argument lists, so an existing positional call shifts by one or two places. TypeScript catches the shift where the types differ and misses it where both sides are string . OrdersService.getApiV1Orders — delivery was inserted before source , and subscriptionId before createdAfter . A call that filtered by customerId now passes that id as the free-text search q , and its createdAfter as customerId . Neither is a type error. WebhooksOutboundService.getApiV1WebhookDeliveries — status and eventType were inserted before limit and offset . TypeScript rejects a number where status is expected; plain JavaScript does not. Every other method kept its argument order. Re-check these two by hand; a green build does not prove them. order.completed became order.fulfilled order.completed was renamed to order.fulfilled on 2026-08-22 and is no longer delivered. Stored webhook and extension subscriptions were rewritten to the new name. order.completed is still accepted in enabledEvents when you create or update an endpoint, in 4.x as in 2.x, and is dropped from the saved list. That is deliberate: it keeps a read-modify-write of an old subscription list from failing. It is not a sign the event still fires. order.fulfilled is not in the 2.x enabledEvents type, but the API accepts it from any client. On 2.x, cast the value; on 4.x it is in the union. order.fulfilled and fulfillment.completed are different events — the first is about the order, the second about one fulfillment. Subscribe to whichever your handler is really about. What you gain Orders: postApiV1OrdersStatus , postApiV1OrdersHold / postApiV1OrdersHoldRelease , postApiV1OrdersComp / postApiV1OrdersCompReverse , getApiV1OrdersTimeline , getApiV1OrdersStatusHistory ; a delivery filter ( in_transit , delivered , returned ) and a subscriptionId filter; the same filters on the CSV export. Payments: postApiV1OrdersPaymentsRecord (record a payment taken outside Throttle, including cheque ) and postApiV1PaymentsMarkFailed ; payment responses declare errorCode and errorMessage . Fulfillments: postApiV1FulfillmentsDelivered . Subscriptions: postApiV1SubscriptionsRetryCharge and postApiV1SubscriptionsWaivePeriod . Webhooks: order.fulfilled , order.held , order.hold_released , order.comped , order.comp_reversed , payment.processing , payment.expired , payment.recorded ; the delivery log filters by status and eventType . Customers carry company ; embed config carries checkoutLinkBaseUrl . Upgrade checklist Search for postApiV1OrdersComplete , 'completed' and fulfillmentStatus . These are already wrong on 2.x, so fix them first — before or without the upgrade. Install 4.x and fix what the compiler reports: the removed method, the removed field, and any exhaustive switch over a payment status. Find every call to getApiV1Orders and getApiV1WebhookDeliveries and re-count the arguments against the lists above. The compiler will not find all of these for you. Replace order.completed with order.fulfilled in the event list you send, and in the handler that switches on the delivered type . Make sure nothing treats a processing payment as a failure."},{"title":"Payment Methods","route":"/developers/payment-methods","headings":["Payment Methods","Two-step auth flow","Endpoint reference","Subscription self-service","The SavedCard shape","Error reference","Security notes","Cards must be attached through the embed","React package","Step 1 — backend: mint a client token","Step 2 — frontend: render the component"],"text":"Buyer wallet Payment Methods Let buyers view, manage, and add payment methods in your storefront without exposing your secret key to the browser. A short-lived customer-scoped token gates all buyer-facing card operations; your backend mints it, the browser uses it. The add-card token takes an optional currency for the verification hold; see Multi-currency . @usethrottle/payment-methods wraps the flow below as a headless core, React hooks, and a pre-built component. See the React package section at the bottom of this page, or use the HTTP routes directly if you prefer. Only cards vaulted through the add-card embed — the flow on this page, which finishes at POST /api/v1/me/payment-methods/confirm — can be charged later for subscription renewals, plan changes, or any other merchant-initiated payment. That step is what records the processor buyer reference those charges require. Attaching a card directly with POST /api/v1/customers/ id /payment-methods stores it and lists it correctly, but it cannot establish that reference, so every later charge fails with 402 payment_failed: payment_method_not_chargeable . Use that endpoint only for record-keeping, never as a card wallet. Two-step auth flow The payment-methods API uses a client token pattern that mirrors how Throttle's embedded checkout protects your secret key. Your backend mints a short-lived token scoped to one customer; the browser uses that token for all card management calls. The secret key never leaves your server. Backend mints a client token. Call POST /api/v1/payment-methods/client-token with your sk_* secret key and the customer's Throttle customerId . Throttle returns a short-lived JWT. Browser calls the /me routes. All /api/v1/me/payment-methods* routes accept the token in the X-Throttle-PM-Token header. The token authorizes ONLY that one customer's payment methods — no cross-customer reads are possible. Endpoint reference POST /api/v1/payment-methods/client-token Mints a customer-scoped payment-method client token. Call this from your backend; never expose your secret key to the browser. Field Type Required Description customerId string Yes The Throttle customer ID ( cus_* ) for the authenticated buyer. subscriptionId string No Mint an update-card link for this subscription instead of a portal token. The token carries the subscription, lives 14 days instead of 30 minutes, and the response adds updateCardUrl — the hosted /billing/{token} page. Send it to the buyer yourself, or use it when the renewal-failed email is not enough. The subscription must belong to customerId ; otherwise 404 . Auth: X-API-Key (secret key, sk_* ). The key must have the customer_payment_methods:write scope. The returned token is a signed JWT. Pass it to the browser as a session value or a short-lived cookie; do not persist it long-term. The expiresAt timestamp (ISO 8601) tells the browser when to request a fresh token. GET /api/v1/me/payment-methods Returns the list of saved cards for the customer identified by the PM token. Auth: X-Throttle-PM-Token header (browser-safe) PATCH /api/v1/me/payment-methods/:id Sets a saved card as the default. Currently the only writable field is isDefault: true — you cannot unset a default directly; set another card as default instead. Auth: X-Throttle-PM-Token header Field Type Required Description isDefault boolean Yes Must be true . Promotes this card to the default; the previously-default card is demoted automatically. The customer's subscriptions that renewed on the previous default move to the new default, and each one emits subscription.updated . Subscriptions deliberately on another card stay where they are. The merchant set-default route behaves the same way. To move a single subscription, use PATCH /api/v1/me/subscriptions/:id/payment-method instead. DELETE /api/v1/me/payment-methods/:id Removes a saved card. Returns 200 with data: id , meta on success. Auth: X-Throttle-PM-Token header If the card being deleted is the default payment method and the customer has at least one active subscription, Throttle returns 409 cannot_remove_default . Prompt the buyer to set a different card as the default first, then retry the delete. Deleting a card that a subscription renews on, but that is not the default, is allowed: that subscription falls back to the customer's default card at its next charge. No subscription.updated is emitted for the change. POST /api/v1/me/payment-methods/embed-token Returns an add-only vault embed payload so the buyer can add a new card without going through a full checkout flow. The embed is configured to vault-only (zero-amount); it will not capture a charge. Auth: X-Throttle-PM-Token header The React component (see React package below) calls this endpoint and mounts the embed for you — you never handle the raw payload. Reach for the endpoint below only if you are building a fully custom embed; the provider-specific fields it returns are consumed by the widget, not by your code. Subscription self-service The same X-Throttle-PM-Token also reaches the customer's own subscriptions, so a buyer who has just saved a card can settle a past-due renewal without leaving the page. This is what Throttle's hosted “update your card” link uses; a portal you build can call it the same way. A token minted for a dunning link carries a subscriptionId claim naming the subscription it is about; a token minted through the client-token route does not, and can read any subscription the customer owns. Throttle's own hosted page for this flow is https://checkout.usethrottle.dev/billing/{token} : it shows the plan and the amount due, saves the card through the add-only embed, makes it the card for that subscription only (the customer's default card and their other subscriptions are left alone), and charges a past-due subscription while the buyer is still on the page. GET /api/v1/me/subscriptions/:id One of the authenticated customer&apos"},{"title":"Permissions Reference","route":"/developers/permissions","headings":["Permissions Reference","How permission checks work","Permission catalog","Permission scope notes","Workspace-only permissions","Read vs write split","Check permissions at runtime"],"text":"Workspace Permissions Reference Every dashboard action maps to a named permission. A permission is granted when the caller's workspace role or their application role on the target application satisfies the rule — whichever axis applies first wins. See Team management for how roles are assigned. This page describes role-based permissions (RBAC) — the rules that gate human users authenticating with a Clerk session in the dashboard. They are a separate system from API key scopes , which gate machine-to-machine calls made with an sk_ / pk_ key. A Clerk caller carries the wildcard scope and is gated purely by these permissions; an API-key caller is gated purely by its scopes and never by RBAC. The two systems compose; neither replaces the other. How permission checks work For each request Throttle resolves two values from the auth context: the caller's workspace-level role ( owner | workspace_admin | none) and their application-level role on the specific application being acted on ( admin | developer | finance | viewer | none). A permission is granted if either role set contains the caller. owner and workspace_admin satisfy most application-level permissions without needing an explicit per-application role. They act as supersets of any application role on any application in the workspace. Roles answer “can this person perform the action?” Environment grants answer “can this person use the selected workspace environment?” A caller must pass both checks. Requests outside the member's environment grant return 403 member_env_forbidden . The permission check is exposed at GET /api/v1/auth/permissions . The response lists every permission key and whether it resolves to true for the authenticated caller, optionally scoped to a specific application via the x-application-id header. Permission catalog The table below lists every permission string, which workspace roles satisfy it, and which application roles satisfy it. A dash (—) means that role axis is not checked for that permission. Permission Workspace roles Application roles workspace:delete owner — workspace:transfer owner — workspace:billing owner — workspace:invite-admin owner — workspace:settings owner, workspace_admin — workspace:invite owner, workspace_admin admin workspace:edit-member owner, workspace_admin — workspace:remove-member owner, workspace_admin — workspace:read-team owner, workspace_admin, member — workspace:audit-log owner, workspace_admin — application:settings owner, workspace_admin admin application:api-keys owner, workspace_admin admin, developer application:webhooks owner, workspace_admin admin, developer application:customers:write owner, workspace_admin admin, developer application:customers:read owner, workspace_admin admin, developer, finance, viewer application:customer-groups:write owner, workspace_admin admin, developer application:customer-groups:read owner, workspace_admin admin, developer, finance, viewer application:orders:write owner, workspace_admin admin, developer application:orders:read owner, workspace_admin admin, developer, finance, viewer application:imports:write owner, workspace_admin admin, developer application:imports:read owner, workspace_admin admin, developer, finance, viewer application:quotes:write owner, workspace_admin admin, developer application:quotes:read owner, workspace_admin admin, developer, finance, viewer application:forms:write owner, workspace_admin admin, developer application:forms:read owner, workspace_admin admin, developer, finance, viewer application:invoices:read owner, workspace_admin admin, developer, finance, viewer application:refunds:issue owner, workspace_admin admin, finance application:payments:read owner, workspace_admin admin, developer, finance, viewer application:payments:record owner, workspace_admin admin, finance application:orders:comp owner, workspace_admin admin, finance application:orders:hold owner, workspace_admin admin, finance application:finance:read owner, workspace_admin admin, developer, finance, viewer application:edit-app-member owner, workspace_admin admin application:extensions:read owner, workspace_admin admin, developer, finance, viewer application:extensions:write owner, workspace_admin admin, developer application:extensions:install owner, workspace_admin admin, developer application:extensions:admin owner, workspace_admin admin support:read owner, workspace_admin, member — support:write owner, workspace_admin, member — Permission scope notes Workspace-only permissions workspace:delete , workspace:transfer , workspace:billing , and workspace:invite-admin are exclusively for the owner. No application role satisfies these. workspace:settings covers workspace branding, sender domains, and workspace-scoped email settings. workspace:edit-member and workspace:remove-member require workspace_admin or above; no application role grants them. Read vs write split The finance role sees customers, orders, and payments but cannot write to customers or orders. It can issue refunds. The viewer role is fully read-only. It cannot issue refunds or perform any write action. The developer role is the same as finance plus write access to customers and orders, and access to API keys and webhooks. Check permissions at runtime Call GET /api/v1/auth/permissions with a Clerk JWT. Pass x-application-id to resolve application-level role flags for a specific application. The response shape is: workspaceRole : workspace_admin , appRole : developer , permissions : workspace:delete : false, workspace:invite : true, application:api-keys : true, application:customers:write : true, ... The dashboard uses this response to show or hide actions in the UI. Call it once on page load and cache client-side for the session duration."},{"title":"Accept Your First Payment","route":"/developers/quickstart","headings":["Accept Your First Payment","1. Configure your application","2. Create an API key","3. Create a checkout session","4. Render the React embed","5. Subscribe to webhooks"],"text":"Quickstart Accept Your First Payment This flow uses a server-created checkout session and the React payment embed. It is the fastest native Throttle integration path. The dashboard can run a test checkout for you: open App , then the Checkout tab, and click Run test checkout . If that completes, the application is configured correctly and any later failure is in your own integration. See Testing . 1. Configure your application Before any SDK call works, you need two values from the dashboard: the Application ID and at least one allowed origin . Both ship empty on a fresh signup, which is why following the snippets below verbatim returns applicationId is required or renders Embed not authorized . Sign in to the dashboard . A default application is created for your workspace on first login. If you have more than one, switch between them with the app switcher in the top bar. Open App Settings → General and copy the Application ID (the field has a Copy button; it also appears on the API keys page). Stash it as THROTTLE_APPLICATION_ID . Still in App Settings , add your storefront origin to Allowed origins (e.g. http://localhost:3000 in dev, https://shop.example.com in prod). Origins are scheme + host + optional port — no paths, no trailing slash. http://localhost and http://127.0.0.1 are accepted in every environment for local development. In a non-production environment you can also list one wildcard per entry for preview deployments, such as https://*.preview.example.com — see preview origins . Production takes exact origins only. Install the CLI with npm install -g @usethrottle/cli and set your allowlist without opening the dashboard: throttle embed-config set --origins http://localhost:3000 . It reads your secret key from $THROTTLE_API_KEY (or prompts for it); throttle embed-config show prints the current config. See the packages & SDKs page for everything the CLI and libraries expose. The embed enforces an origin allowlist server-side, and the cart/checkout endpoints reject requests without a valid applicationId . Both checks happen before any SDK error path — you'll see the failure as a 400 or an unauthorized embed instead of a hint that you need to set these. Every new application is automatically wired to a dedicated sandbox sub-account during signup, so PaymentEmbed renders (with the Card Simulator method) the first time you mint a checkout session in a non-production environment — no provider setup required. To accept real cards in production you still have to subscribe and add Throttle's production payment connection from Connectors ; details on Workspace environments . 2. Create an API key In the dashboard, open API keys (under Developers in the left nav), click Create key , and choose a secret ( sk_ ) key with the scopes you need. The raw key is shown once — copy it immediately; only the prefix is stored afterward. Keys are minted to one workspace environment, so the prefix carries that environment s segment — sk_live_* for production, or the environment s own slug otherwise, e.g. sk_test_* or sk_uat_* . Switch environments with the selector in the top bar before creating a key. Use a pk_ publishable key for browser-side shipping/tax quotes only; everything else uses the secret key from your backend. Never put an sk_ key in browser code, mobile apps, or public repositories. The browser should only receive a checkout session id or hosted URL from your backend. For everything beyond checkout — orders, customers, subscriptions, discounts, and webhooks — use @usethrottle/api-client instead of raw fetch . It's generated from the OpenAPI spec, so endpoints, event names, and request/response shapes are all typed (no guessing /webhooks vs /webhook-endpoints , or checkout.* vs cart.* event names). 3. Create a checkout session From your backend, create a native Throttle cart, add your line items, then mint a session for that cartId . This two-step native flow is the default — reach for externalCartId only when you’ve connected an external cart provider. The checkout SDK keeps your secret key server-side and returns sessionId , hostedUrl , and embedUrl . 4. Render the React embed Install the checkout SDK for your backend route and the React embed for your checkout page, then mount PaymentEmbed . In a non-production environment the embed shows the Card Simulator's card form. Enter 4111 1111 1111 1111 with any future expiry date and any security code, then submit: the simulator approves it and onSucceeded fires. No real card is charged. Testing covers causing a decline and checking the webhooks the payment produces. 5. Subscribe to webhooks Browser callbacks are immediate UI signals. Webhooks are your durable source of truth for fulfillment, receipts, and order state. Read the webhooks guide to verify signatures and handle retries idempotently."},{"title":"Quotes","route":"/developers/quotes","headings":["Quotes","Status","Core concepts","Create and issue a quote","Request a quote from a cart","Add to Quote on your storefront","Hosted request forms","The buyer link","Product inputs and add-ons","Subscription lines","Catalog lines","SKU-only lines","Generated plan IDs","Missing prices","Changing the currency","Shipping address","Buyer view","Catalog line errors","Quote catalog routes","Accept a quote","Shipping at checkout","Tax on a quote","Which addresses the checkout asks for","Payment terms are enforced, not advisory","Errors","Reopen an accepted quote","Order fees","Emails, expiry, and PDF","Webhooks","The response includes quote.shareToken — the buyer link is","https://checkout.usethrottle.dev/q/{shareToken} (hosted page ships with the","public-link release).`;","The cart itself is unchanged.","No API key: the qrf_ form token is the authority, so this is safe from a browser.","Every line lands on the quote's working revision UNPRICED. targetUnitPrice is","recorded as the buyer's ask and shown to your rep; it never sets what you quote.`;","items[0] to items[2] have no name, so the Product Catalog fills them, priced","in USD for this customer (here a customer in no price group). The unitPrice","on items[1] overrides the catalog price. items[3] is an ordinary line.`;","Without an installed, active Product Catalog: { \"data\": { \"rows\": [], \"available\": false } }`;"],"text":"Guides Quotes B2B sales quotes: a buyer requests pricing, a rep builds and issues a revisioned proposal, and acceptance converts directly into a Throttle order with card, Net-N, or deposit + balance payment terms. Status Build and issue quotes from the dashboard (Quotes in the app sidebar) or the API, and buyers view their quote at https://checkout.usethrottle.dev/q/{shareToken} — toggle optional lines, comment, request changes, decline, or accept. Accepting materializes a checkout session and converting it into a Throttle order happens automatically once payment succeeds. Lifecycle emails, expiry reminders + auto-expiration, a downloadable PDF, deposit-and-balance terms, and hosted RFQ intake forms are all live. Sales quotes are unrelated to shipping/tax quote tokens. Core concepts Quote — the negotiation record. Carries a Q-{seq} number, customer linkage, an optional buyer-supplied reference number ( buyerReference ), and one share token that will be the buyer's permanent link. Revision — an immutable commercial snapshot. Exactly one working revision is editable at a time; issuing freezes it ( issued ) and supersedes the previous offer. Line items support optional upsells and per-line quantity locks ( qtyEditable ). Payment terms — pay_in_full , net_terms (Net-1..365), or deposit_balance (deposit due at acceptance, the balance becomes a receivable). Deposit amounts are computed and frozen at issue time. Lifecycle — draft → requested → under_review → proposed → accepted → converted , with revision_requested , declined , expired (re-issuable), and archived branches. Transitions are service-enforced. A buyer declines an issued quote from the link; a merchant declines a request it will not price with PATCH /api/v1/quotes/ id status: declined , declinedReason , which emails the buyer the reason. An accepted quote the buyer has not paid can be reopened back to proposed . Create and issue a quote Requires an API key with the quotes:write scope (dashboard roles map to application:quotes:* permissions). Prices are integers in minor units. Editing after issue is explicit: POST /api/v1/quotes/{id}/revisions clones the issued revision into a new working revision; PATCH /api/v1/quotes/{id}/revisions/{revId} edits it; issuing again supersedes the prior offer at the same buyer link. Request a quote from a cart Add to Quote on your storefront For buyers who want to browse and collect several products before asking, @usethrottle/quotes ships a quote cart: a persisted list the buyer builds while moving around your site, submitted as one request. It needs no API key — the qrf_ form token is the authority, so it is safe in the browser. Throttle stores no product catalog, so lines come from your own product data, the same way the shopping cart works. Quantities merge when the same SKU is added twice, and the cart survives page navigation. A buyer who already filled a normal cart can ask for a quote on it instead: pass cartId to POST /api/v1/quote-requests and its lines join the request. The cart is resolved inside the form's own application and environment, so an id from anywhere else is simply not found. Cart prices are recorded as the buyer's target, not as the quoted price — a cart is assembled in the browser, and this endpoint authenticates no one but the form. Hosted request forms For inbound RFQs without any integration, create a hosted intake form from the dashboard (Quotes → Request forms) or via POST /api/v1/quote-request-forms . The response reveals a qrf_ form token exactly once (hash-only stored — rotate to mint a new one); the buyer-facing form lives at https://checkout.usethrottle.dev/q/request/{formToken} . Submissions create-or-find the customer by email, open a requested quote (source request_form ) with the buyer's free-text need as the first shared comment, and fire the same quote.requested webhook + rep notifications as every other intake path. A request can carry line items, a written need, or both — at least one of the two. Items land on the quote's working revision unpriced , carrying the name, SKU, quantity, and per-line note the buyer supplied, so your rep prices an itemised sheet instead of transcribing prose. The hosted page renders item rows by default; set fields.lineItems: false for a prose-only form, or fields.targetPrice: true to let buyers name the price they are after. The public form read ( GET /api/v1/quote-request-forms/{token}/public ) carries currency : the currency the quote will be created in, from the form or request, else the store's main currency. The hosted page shows the target-price input with that currency's symbol and decimals, and hides it when the response has no currency . It also carries tracking , the application's public analytics block (IDs and toggles, never secrets, null when it cannot be read), which the hosted page uses to load your GA4 tag and send generate_lead on submit. targetUnitPrice is recorded against the line and shown to your rep while they price it, but it never becomes the quoted price. Everything on this endpoint arrives from a browser holding only a public form token, so treating any of it as pricing would let a buyer set what you charge. Shipping address (optional). Set fields.shippingAddress: true to show an optional address section on the hosted form. The submission takes shippingAddress with addressLine1 , addressLine2 , city , stateProvince , postalCode and countryCode (ISO 3166-1 alpha-2). An all-blank address is ignored; a partly filled one without addressLine1 , city and countryCode is 400 invalid_request , and retired names such as line1 are rejected with the canonical name. The address is stored on the quote as shippingAddress (your team can correct it, see “Shipping address” below) and prefilled into the checkout shipping step when the buyer accepts (they can still change it). It is added to the custome"},{"title":"React Package · @usethrottle/quotes","route":"/developers/quotes/react-package","headings":["React Package · @usethrottle/quotes","Install","The buyer quote page","Errors","RFQ request form","Payment terms"],"text":"Quotes React Package · @usethrottle/quotes Buyer-facing components, hooks, and a same-origin proxy for the hosted quote link and the RFQ request form — so you can serve the buyer experience from your own storefront instead of sending people to Throttle's hosted page. Everything here is authorized by the qtl_ capability token in the buyer's URL — there is no API key, because this runs in the browser. Merchant operations (create, price, issue, revise, record acceptance) need an sk_* key and live in @usethrottle/api-client 's QuotesService , which must stay server-side. Install React 18+ is a peer dependency. The package ships ESM and CJS builds with type declarations, and exposes two entrypoints: the root (browser) and /server (the optional proxy). The buyer quote page Mount QuoteView on a route that receives the token from the buyer's emailed link. It renders line items with optional toggles and editable quantities, live totals, revision history, the comment thread, a PDF link, and the accept / request-changes / decline actions. On acceptance it sends the buyer to Throttle hosted checkout. QuoteItem.recurring carries a line's subscription terms. lineDueAtAcceptance(item, quantity) and computeSelectionTotal count a free-trial line as 0, the rule the server charges by, and QuoteView prints each subscription line's terms and the split totals (Due at acceptance, Recurring after). The default markup is deliberately plain — it is meant to be restyled or replaced. For your own presentation, use the hook directly. useQuote(token, options?) The hook owns the behaviour that is easy to get wrong: Fires the view beacon once per mount, so the merchant sees first viewed telemetry. The API throttles the resulting quote.viewed webhook to one per revision per 6 hours. Seeds selections from the revision, so a re-issue that adds or locks lines resets the buyer to the new offer. Refetches automatically on revision_superseded — the rep re-issued while the buyer was reading. Sends only the selections the rep actually allows: locked lines and non-optional lines are never included in the acceptance payload. total is computed with the same rule the server applies at acceptance , including scaling a line's tax and discount pro-rata when the buyer changes its quantity. Rolling your own sum risks showing the buyer one number and charging another. Errors Everything throws ThrottleQuotesError , which extends the shared ThrottleError and carries the API's own code . code meaning revision_superseded A newer revision was issued. currentRevisionId names it; useQuote auto-refreshes. quote_expired The offer lapsed (410). Prompt the buyer to request updated pricing. invalid_item_selection A locked line's quantity was changed, a required line deselected, an unknown item sent, or (for deposit terms) the selection fell to or below the deposit. accept_in_progress A concurrent acceptance won the race. Retry shortly. not_found Unknown or rotated token, or a draft/archived quote. RFQ request form Bot protection is wired in: the honeypot field and the mount-time anchor that feeds the API's minimum-fill-time check. A honeypot hit returns a success-shaped response and creates nothing — by design, so a bot cannot learn it was caught. Treat submission success as accepted , not created . If the form requires Cloudflare Turnstile, render the widget yourself and pass its token as turnstileToken — this package pulls in no third-party script. A form that requires Turnstile on a store where it is not configured is refused with turnstile_not_configured rather than silently accepted. Same-origin proxy · /server entrypoint Quote links work fine calling Throttle directly — the token is the credential. Proxy through your own origin if you would rather not have a third-party host in the address bar or CSP. The proxy forwards no API key . It allow-lists the public quote paths, so it cannot be pointed at a merchant endpoint; rejects traversal and any method other than GET/POST; passes the PDF 302 straight through instead of buffering the file; and forwards x-forwarded-for so acceptance evidence and per-IP limits attribute to the real buyer. Payment terms A quote carries one of three modes on currentRevision.paymentTerms : pay_in_full — card at checkout. net_terms — invoice due in netN days. deposit_balance — depositAmount charged today by card, the remainder invoiced balanceNetN days out. depositAmount is frozen when the rep issues the quote, so it does not move when the buyer edits quantities. Selections that would drop the total to or below the deposit are rejected with invalid_item_selection ."},{"title":"Cart states","route":"/developers/reference/cart-states","headings":["Cart states","State machine","States","Mutation rules","Abandoned-cart recovery","Where the recovery link points"],"text":"State reference Cart states A cart s status field is the single source of truth for whether it can still accept mutations. Only open carts are writable. State machine States open — initial state. Accepts items, discount apply/remove, shipping select, tax recompute, and checkout conversion. checkout — cart has been converted to a draft order (POST /carts/ id /checkout ). The cart is frozen; further mutations return 409 cart_already_checked_out . converted — the linked draft order was paid and an order row was finalised ( payment.captured fired). Read- only; archived. abandoned — no activity for 24 hours (or past the cart s expiresAt ), OR the linked draft order was cancelled before payment. An hourly background sweep performs the idle transition and emits cart.abandoned . Read-only. See Abandoned-cart recovery below. Mutation rules Every mutation increments sequence on the cart. Webhook payloads include sequence so subscribers can detect out-of-order delivery. POST /carts/ id /checkout transitions open → checkout . Idempotent within the 24h Idempotency-Key window — same key replays the same draft order id. Direct transitions out of checkout / converted / abandoned via the cart API are not allowed. Cancel the linked order to roll the cart back to abandoned . Mutating a non-open cart returns one of: cart_already_checked_out (409), cart_already_converted (409), or cart_abandoned (410). Abandoned-cart recovery An hourly background sweep marks idle carts as abandoned and emits cart.abandoned . A cart is idle when it has had no mutation for 24 hours — every item, shipping, discount, or tax change resets the clock — or when its expiresAt has passed. Empty carts and externally-managed carts are never swept. Webhook (always): every swept cart emits cart.abandoned to your subscribed webhook endpoints, so you can drive recovery from your own systems — including for anonymous carts you track by your own session. The payload carries the line items, totals, customer (a linked customer, or a guest with id: null when only the cart’s customerEmail was captured; null if neither), shippingAddress / billingAddress (if set), and the recoveryUrl . Recovery email: Throttle sends the customer.cart_abandoned email automatically whenever the cart has a known customer email. The email respects customer opt-out / unsubscribe; in non-production environments it carries a [TEST] subject banner. Cart sessions: a backend-less storefront using cart sessions has no server-side customer record to attach an email to. Set customerEmail with PATCH /api/v1/cart-sessions/ id as soon as the buyer gives it — that alone is what makes the guest cart eligible for the sweep above. Where the recovery link points The link in the recovery email resolves through three tiers, first match wins: cartRecoveryUrlTemplate — a URL on your own site containing a cartId placeholder, e.g. https://shop.example.com/cart?c= cartId . Use this when you want the buyer to land on a specific page you control. checkoutLinkBaseUrl — your own host, e.g. https://shop.example.com . Throttle appends /r/<cartSessionToken> , so serve that route yourself with the cart SDK. Throttle-hosted — when neither is set, the link points at Throttle’s own checkout. Nothing to configure. Both settings live on the application, per environment, and are editable from the dashboard’s Abandoned carts page. checkoutLinkBaseUrl also governs where quote links point, so a merchant hosting their own buyer-facing pages sets it once. A recovery link is single-use . Opening it converts the underlying cart session into a checkout session; a second click lands on the expired page rather than reopening a checkout the buyer may already have paid. Throttle can only recover carts it knows about. To get abandoned-cart recovery, create the Throttle cart (POST /carts ) when the buyer first adds an item and mutate it on every change — the mirror pattern . If you only create the cart at checkout, abandonment happens before Throttle ever sees it and there is nothing to recover."},{"title":"Error codes","route":"/developers/reference/errors","headings":["Error codes","Envelope","Common codes","Subscription and recurring-checkout codes","Currency codes","Order builder collect codes","Saved-card charge codes","Resolved cart codes","Product input and add-on codes","Order line-item edit codes","Validation errors","SDK errors","HTTP code conventions"],"text":"Reference Error codes Every 4xx / 5xx response carries a stable error.code . Reach for it (not the prose message ) when branching in your handler — codes are versioned with the wire contract; messages are not. Envelope Common codes The list below covers the ~20 codes you'll see most often when integrating cart, checkout, payments, and embed flows. The full set is generated from the OpenAPI spec at api.usethrottle.dev/openapi.json . [ code: code , http, cause, ]) /> Subscription and recurring-checkout codes Codes returned by the subscription routes and by checkout sessions that carry a plan. See Managing Subscriptions and Starting checkout from an existing cart for the behavior behind them. [ code: code , http, cause]) /> Currency codes Codes returned by the one currency rule on every create path, by per-currency amounts (discounts, shipping, routing thresholds) and by the main-currency lock. See Multi-currency for the rules behind them. [ code: code , http, cause]) /> Order builder collect codes Codes returned when collecting payment for a draft order built in the dashboard: the payment-link and invoice-on-terms routes, and the payment-link checkout page. See Build an order from a cart . [ code: code , http, cause]) /> Saved-card charge codes Codes returned by POST /api/v1/orders/{id}/charge-saved-card . See Charge a saved card . [ code: code , http, cause]) /> Resolved cart codes Codes returned for carts whose lines an installed app prices, and for cart sessions of an environment that only allows prices from installed apps. Each code, its details shape and the SDK error class are on Line Resolvers . [ code: code , http, cause]) /> The two cart pricing settings on PUT /api/v1/embed-config , resolvedLinesOnly and cartCurrencies , answer 403 permission_denied to any caller other than the merchant (an installed app's key, an extension session, an OAuth token). An invalid cartCurrencies answers 400 validation_error with details[].path naming the field or the entry, for example cartCurrencies.1 for a duplicate, the environment's own currency, or a code that cannot be enabled (a fund or test code such as XTS, or one whose processor decimal places are unconfirmed, such as HUF or IDR). Extra cart currencies Product input and add-on codes Codes returned when a line carries inputs or addOns , on orders, carts, cart sessions, quotes and subscriptions. See Product inputs and add-ons . [ code: code , http, cause]) /> Order line-item edit codes Codes returned by PATCH /api/v1/orders/:id/line-items , which adds, updates or removes line items and settles the change on an order with a captured payment: an increase is charged to the customer's saved card, or, with no card to charge, saved and left owing ( data.adjustment.leftOutstanding , and the order reads partially_paid ); a decrease comes off any balance still owed first and the rest is refunded. On an order whose balance is on an outstanding Net-N invoice the invoice takes the change instead — its amount rises or falls, no card is charged — and the response reports it in data.adjustment.invoice . Every code below refuses the edit before anything is written, charged or refunded. [ code: code , http, cause]) /> When the application calculates tax with a provider, the edit re-quotes tax with it. Under the lenient fallback policy a failure the strict policy refuses goes through instead, and the 200 response carries data.warnings: [ code, message ] : provider_fallback (the provider could not answer, so your native tax rules priced the edit), tax_address_missing (no address to tax from, so no tax was charged), or tax_zero_from_provider (the provider returned no tax for the address). The field is absent when there is nothing to report. A refund that fails after the items changed does not error either: it comes back in data.adjustment.refundError , and the refund can be retried from the order. Likewise, a Net-N invoice the edit leaves owing nothing is voided, and a void that fails comes back in data.adjustment.invoice.voidError . Validation errors When a zod body validator fails, the envelope carries code: "validation_error" and a per-field details[] array. Strict-input endpoints return only the canonical camelCase contract. Field-level details identify unrecognized keys and may include a suggestion string when the server can identify the intended field: When in doubt about a field name, send the request, then read error.details[].path . The validator names the canonical key it expected. A malformed id (for example undefined or tmp_123 where a UUID is expected) also answers 400 validation_error , not a 5xx. When the route's path schema declares the UUID format, details[] names the parameter; otherwise the envelope has no details . Treat it as a client bug and do not retry. SDK errors Every Throttle SDK throws the same error class — ThrottleError from @usethrottle/errors , re-exported from each SDK. It carries code , statusCode , message , and optional details . The historical per-SDK names still work and are subclasses, so instanceof ThrottleApiError (cart) and instanceof ThrottleCheckoutError (checkout) keep working — and a single instanceof ThrottleError catches errors from all of them. The cart SDK additionally throws typed subclasses for the two lifecycle failures worth branching on, so you don't have to sniff error.code strings. Both extend ThrottleApiError (and therefore ThrottleError ): CartNotOpenError (409 cart_not_open ) and CartNotFoundError (404). HTTP code conventions 400 — request was malformed (validation, missing required field, invalid value). 401 — authentication missing or invalid (key, signature, JWT). 402 — request requires a paid subscription that isn't active (production entitlement). 403 — authenticated but not authorized for this workspace / application / role. 404 — resource doesn't exist (or exists in a different workspace). 409 — request conflicts with current"},{"title":"Fulfillment states","route":"/developers/reference/fulfillment-states","headings":["Fulfillment states","State machine","States","Type-specific details","When the order is considered shipped or completed"],"text":"State reference Fulfillment states Fulfillment lifecycles are shared across all 5 fulfillment type s (shipment, digital, access, service, in_person). The terminal definition varies by type. State machine States pending — fulfillment row created, no provider activity yet. in_progress — provider has acknowledged the work (label printed, digital file prepared, access pending). Fires fulfillment.shipment.shipped for shipment type — on the first tracking number, whether it arrives with POST /orders/ orderId /fulfillments ( shipment.trackingNumber ) or a later PATCH .../fulfillments/ id /shipment . fulfilled — terminal. Per type: shipment — carrier marks delivered ( fulfillment.delivered ). digital — file generated and a presigned URL was returned at least once. access — access grant row inserted and active. service / in_person — merchant marks complete via API. cancelled — terminal. Reachable from pending or in_progress . For shipment, cancelling after label creation requires merchant void via the carrier. Type-specific details Each fulfillment carries exactly one detail record, decided by its type , and each detail endpoint only accepts a fulfillment of its own type: shipment → PATCH /api/v1/orders/ orderId /fulfillments/ id /shipment digital → …/digital access_grant → …/access service → …/service Pointing one at a fulfillment of another type returns 409 fulfillment_type_mismatch and writes nothing. digital and access_grant line items are fulfilled automatically when the payment captures, so their fulfillment already exists — creating a second one returns 400 over_fulfillment . Patch the existing one instead. When the order is considered shipped or completed The parent order reaches shipped when every shipment line item s quantity is covered by completed fulfillments — not when every fulfillment row happens to be terminal. An order with no shipment line reaches completed instead, once every deliverable line is covered. Line items with nothing to deliver (a donation, a fee) are excluded from the count, so an order made entirely of them is completed as soon as it is paid. A shipped order is marked completed by hand; see Order states . Progress is readable on the order as fulfillmentSummary ."},{"title":"Order states","route":"/developers/reference/order-states","headings":["Order states","Why two fields and not one","What each field owns","Buyer and source fields","State machine","The eight statuses","When it happened","effectiveStatus","Renamed statuses","The compatibility window","The twelve payment statuses","Setting a status by hand","The whole story, not just the status changes","Internal notes","History","Adding your own history entries","Emails sent to the customer","Money moved by hand","How much, not just whether","Where the goods are","Holds","What a hold blocks","What a hold does not block","Placing and releasing","Endpoint per transition","Deleting a draft","What you cannot do","Outbound events","Mapping to other platforms","Shopify import"],"text":"State reference Order states An order has one lifecycle status and one payment status. The lifecycle status answers how far along is this order? ; the payment status answers how much of the money has arrived? . For tools that read a single field, effectiveStatus folds the two into one. The lifecycle now uses the names BigCommerce, ShipStation and most order tools use: awaiting_payment , awaiting_fulfillment , shipped , completed and so on. The old names are still accepted as input for a while. See Renamed statuses for the mapping and the end date. Why two fields and not one Delivery only moves forwards: once an item ships, it has shipped. Money moves both ways — a captured payment can be refunded, and a refund is not a step backwards through the lifecycle, it is a separate fact about the same order. Folding the two into a single field would mean either losing the refund or corrupting the sequence. So status is a single ordered sequence, and paymentStatus sits alongside it. Read them together and you have the whole picture; that combination is exactly what displayStatus gives you. An order used to carry a third field, fulfillmentStatus , alongside status . It was removed: the two encoded one fact, had to be kept in sync by hand, and drifted. Delivery progress now lives in status itself, with per-item counts in fulfillmentSummary . What each field owns status — the lifecycle. Moved automatically by payments and fulfillments, and settable by hand via POST /orders/ id /status . paymentStatus — how much of the money has arrived. Rolled up across every payment on the order. Never set directly. displayStatus — a human-readable label combining the two, e.g. Shipped · Refunded . Derived on every read, never stored, not filterable. Display it; branch on status . effectiveStatus — one machine-readable status for tools that only read one: the lifecycle value, unless the order is cancelled, on hold, refunded or disputed. Derived on every read, never stored, but filterable. See effectiveStatus . fulfillmentSummary — itemsTotal, itemsFulfilled, itemsRemaining . Items with nothing to deliver (a donation, a fee) are excluded from the total. payments[].status — what happened on one transaction. Never a summary of the order. Buyer and source fields Every order read ( GET /orders/ id , the list, and the order every order mutation returns) also carries the stored order row's identity and provenance columns: ipAddress and userAgent — the buyer's IP address and browser user agent recorded at checkout. Null on orders that did not come through a checkout (created by API, imported, or renewals). This is personal data about your buyer: treat it as you would their email address. clientContext — the attribution snapshot copied from the checkout session when the order was created (for example UTM parameters and the referring page). Free-form; null when the checkout recorded none. applicationId , environmentId and cartId — the application and environment the order belongs to, and the cart it was converted from (null when it was not). externalId , externalCustomerId and importId — for an order that arrived by import, the source platform's order and customer ids and the import that created it; null otherwise. Line items on an order read carry their row columns too: orderId , position , cartId , workspaceId , applicationId , createdAt and updatedAt . State machine A failed payment does not move the order. paymentStatus becomes failed ; status stays where it was. The goods side of the order has not changed, and the merchant may retry on another card. PAYMENT_FAILED therefore appears in no row of the automatic-transition table. The eight statuses POST /orders/ id /status or /close ). , ], [ code: cancelled , Cancelled , The order was called off before it completed. , html: POST /orders/ id /cancel , or set by hand. , ], ] /> completed and cancelled are terminal: the engine never moves an order out of them on its own. A cancelled order s authorized payments are voided; captured money is refunded only on explicit opt-in. Physical means the order has at least one line with deliveryMethod: shipment . Awaiting Shipment, Partially Shipped and Shipped are computed from those lines only. A line has shipped once a shipment fulfillment covering it has been handed to the carrier (giving it a tracking number stamps shippedAt ) or marked completed, and was not cancelled; the fulfillment itself stays pending until it is completed or delivered. An order with no shipment line (digital goods, access grants, services) only ever moves automatically to completed . An order rests at shipped until a person or an integration marks it completed . Once an order is shipped, a carrier delivered scan does not move it further: arrival shows as the Delivered qualifier on displayStatus . Marking a shipped fulfillment complete or delivered later does not send a second order.shipped . If your process treats delivery as the end, complete the order from your own tracking integration. Cancelling a shipment fulfillment after it shipped does not move the order back automatically. The order page shows a status notice when the status and the fulfillments disagree, and the merchant sets the status. When it happened shipped , or on reaching completed from any status other than shipped (an order with nothing to ship, or a manual move). Moving shipped to completed keeps it. , ], [ code: closedAt , html: The order was marked completed . , ], [ code: cancelledAt , html: The order was cancelled. , ], ] /> completedAt may be null on a historical completed order. Orders that were closed before the rename often had no handover time recorded, and the migration does not invent one. effectiveStatus Some tools only read one status: a warehouse system, a ShipStation-style order manager, a list pill. effectiveStatus is that one status. It is the eight lifecycle values plus four overrides, checked in this order, first match wins: cancelled — a cancelled order alwa"},{"title":"Payment states","route":"/developers/reference/payment-states","headings":["Payment states","State machine","States","Refunds","Net30 special cases","Disputes & chargebacks"],"text":"State reference Payment states Payment states mirror the underlying provider (card processor, Net30 for invoice). Throttle normalises them so your handler is provider- agnostic. State machine States pending — payment row created, no provider response yet. UI shows a spinner; back-end has the row id but no auth/capture proof. processing — the provider has neither approved nor declined yet: the buyer is mid-3DS challenge, away on a redirect method, or the debit is still settling. Nothing has failed, so there is no error.code — treat this as keep waiting , not as a decline. Fires payment.processing , and a resolution event ( payment.authorized , payment.captured or payment.failed ) always follows. authorized — provider authorised the amount (funds reserved). Most card flows auto-capture so this is brief; manual-capture flows stay here until the merchant explicitly captures. captured — funds moved. Triggers payment.captured outbound event. Order can now transition to paid . Capture may be partial : pass an amount below the authorized total to POST /v1/payments/ id /capture . The captured value is tracked on capturedAmount (the event carries both capturedAmount and authorizedAmount ); the uncaptured remainder is released by the processor, and refunds are capped at the captured amount. failed — provider declined OR a network/timeout error during processing. Carries error.code + error.message . Terminal. A merchant can also declare it by hand with POST /payments/ id /mark-failed — the promised bank transfer that never arrived, the cheque that bounced — which writes error.code: manually_marked_failed and the supplied reason. Only a pending , processing or already- failed payment is failable by hand; anything resolved returns 422 payment_not_failable . voided — authorisation released before capture. Funds never moved. Terminal. expired — the authorization outlived its usable life and was never captured, so the hold has lapsed at the provider. Throttle sweeps these itself because providers do not reliably notify on expiry, and fires payment.expired when it does. To collect this money you must charge again; capture will not work. Terminal. partially_refunded — at least one refund processed but total refunded is less than captured amount. Still accepts further refunds. refunded — total refunded equals captured amount. Terminal. Refunds POST /v1/payments/ id /refund returns money from one payment; omit amount to return everything still refundable on it, including the rest of a payment that was already partly refunded. POST /v1/orders/ id /refund works on the order: when an order was paid more than once — a deposit and a balance, an instalment plan, a retried charge that settled on a second row — the refund is spread across its captured payments, newest capture first, and amount may exceed any single one of them. Omit amount to return everything still refundable on the order. Asking for more than remains returns 400 refund_amount_exceeds_balance , whose message names the amount that is still refundable (formatted in the payment's currency) and whose details carry it as a money value, amount, currency, display , with amount in minor units. The check runs before any money moves, so a refund that cannot be completed in full sends none of it. A refund claims its amount before the provider is called, so a second refund of the same payment arriving at the same moment gets 409 refund_already_in_progress rather than passing a stale balance check and returning the money twice. Wait for the first to resolve, then re-read what is refundable. If the money already went back outside Throttle (a refund issued in the PayPal or processor dashboard, for example), send recordOnly: true with POST /v1/payments/ id /refund . Throttle records the refund and sends nothing to the processor. Every other part of a refund still applies: the balance cap, the payment and order statuses, the payment.refunded / payment.partially_refunded events and the refund email. The refund row in the ledger carries metadata.recordedOnly: true . Record the amount the buyer actually got back: if the provider kept a fee, that is less than the charge, and the payment ends partially_refunded . recordOnly is not accepted on the order refund route. A payment recorded with POST /v1/orders/ id /payments/record (cash, bank transfer, cheque, or external ) never went through a processor, so refunding it only records the refund and no money moves, with or without recordOnly . Return the money where it was taken first, for example in PayPal. That route's receivedAt must fall between 2000-01-01 and today; anything else returns 400 validation_error . POST /v1/payments/ id /refund takes an optional reference (up to 120 characters), such as the PayPal transaction id the money went back under. It is stored as metadata.reference on the refund transaction, which GET /v1/payments/ id /transactions now returns along with metadata.recordedOnly . Net30 special cases Net30 payments go through pending → authorized on invoice issue, then → captured when the buyer pays the invoice (manual mark-paid OR ACH webhook). invoice.overdue fires when an authorized Net30 payment passes its dueDate ; the payment row stays authorized until paid or voided. Disputes & chargebacks Disputes are tracked out-of-band from the status machine, on the disputed boolean plus disputeReason / disputeOpenedAt , and — once a card chargeback is decided — disputeOutcome ( won / lost ) and disputeClosedAt , all exposed on the payment object. A payment keeps its underlying status (usually captured ) throughout. Card chargebacks are ingested automatically from the payment provider: an inbound dispute.* / chargeback.* webhook sets disputed = true and fires payment.disputed . A merchant-favourable resolution (won / reversed) clears the flag, records disputeOutcome: won , and fires payment.dispute_cleared . A loss clears the flag, records disputeOutcome: lost , rolls the order to charged_back , "},{"title":"API Key Scopes Reference","route":"/developers/scopes","headings":["API Key Scopes Reference","Secret vs publishable keys","How scope checks work","Implication","The wildcard","Key types & grantable scopes","The buyer plane: a publishable key is not a permission","Customer PII: redacted, not rejected","Customer directory: names without the record","Scope catalog","{group}","Migration from coarse scopes","Machine-readable catalog"],"text":"Workspace API Key Scopes Reference Every Throttle API route declares a single required scope — a resource:action string such as orders:read or payment_refunds:write . API keys are gated purely by the scopes they hold; dashboard (Clerk) users are gated by role-based permissions instead. The two systems compose — they never replace one another. Secret vs publishable keys API keys come in two prefixes. Secret keys ( sk_ ) are full-power, server-side credentials — keep them on your backend and never expose them. Publishable keys ( pk_ ) are safe to embed in browser or frontend code. Because a publishable key is application-scoped and exposed in the browser, it is restricted to a small, curated set of publishable-allowed scopes — five today: shipping_quotes:write , tax_calculations:write , storefront_scripts:read , storefront_scripts:write , and customer_accounts:write — and can never read carts, orders, customers, payment methods, or PII directly. That last scope is a deliberate exception to "publishable means stateless compute"; see the buyer plane below. (Listing available payment methods needs no key: GET /v1/payment-methods is public.) Create either type from Developers → API keys in the dashboard. How scope checks work On every API-key request Throttle reads the matched route's required scope and checks it against the key's granted scopes using these rules: Implication Exact match grants the scope. resource:write implies resource:read on the same resource — holding a write scope lets you read it too. There is no cross-resource implication : orders:write does not grant order_returns:write or payment_refunds:write . Each financial or destructive action is its own scope. read never implies write . The wildcard * grants full access to every scope. It is only grantable to secret ( sk_ ) keys. Publishable ( pk_ ) keys can never hold * . Prefer the smallest set of explicit scopes; reserve * for trusted server-side keys. A request whose key lacks the route's scope returns 403 with error.code = "insufficient_scopes" and a details.required field naming the missing scope. Key types & grantable scopes Secret keys ( sk_ ) May hold any non–staff-only scope, or the wildcard. Staff-only scopes (the admin:* family) are not grantable to workspace-minted keys — those routes are gated by Throttle Staff org membership in Clerk, never by an API key. Requesting one returns 400 invalid_scope . Publishable keys ( pk_ ) Browser-safe. May hold only the publishable-allowed subset (marked pk_ ok below) — five scopes today: the two stateless compute scopes shipping_quotes:write and tax_calculations:write ; the storefront-script loader s storefront_scripts:read and storefront_scripts:write ; and customer_accounts:write , which gates the buyer-auth plane rather than granting a data-reading permission — see the buyer plane below. A publishable key can never read carts, orders, customers, payment methods, or PII — those scopes are not publishable. (Listing the eligible payment methods for a session needs no key at all: GET /v1/payment-methods is public.) Any non-publishable scope — or the wildcard — returns 400 invalid_scope . The buyer plane: a publishable key is not a permission A publishable key identifies an application. On the buyer plane it is not a permission. Storefront customer-account endpoints are authorised by the shopper's session, not by the key's scopes — the key only selects which application the shopper is signing in to. The one scope that gates that plane is customer_accounts:write : without it, a publishable key cannot reach customer accounts at all. Every other publishable scope ( shipping_quotes:write , tax_calculations:write , storefront_scripts:read , storefront_scripts:write ) authorises a stateless compute or a public read directly off the key itself. customer_accounts:write works differently: holding it only unlocks the /v1/storefront/* route family (see Storefront Customer Auth ). Every action a buyer actually takes there — reading their orders, changing an address, removing a saved card — is authorised by their own Authorization: Bearer session token, never by the key. Two different applications' publishable keys can both hold customer_accounts:write and still never see each other's buyers; the key only decides which application a login or register request lands on. Customer PII: redacted, not rejected customer_pii:read gates personal fields on a customer record — email , phone , firstName , lastName , and the combined name some endpoints return. A credential that can read (or write) customers but lacks this scope does not get a 403 : the request succeeds and those fields come back null , with every other field (id, externalId, company, addresses, order/subscription linkage) intact — the same "redact, not reject" pattern the picker warning on ⚠ sensitive exists to flag. This applies whether the customer came back from a read, or is the record echoed back by a create/update call. Because customer_pii:read is sensitive, an OAuth connection to an AI assistant (the MCP integration flow) can never hold it — see the MCP docs for which tools therefore always return redacted customer data. It is the one sensitive scope an automation connector (Zapier, Make — an OAuth client registered for the REST API) may be granted, and the consent screen names it. A connector without it gets the same redaction, and creating, changing or replaying a webhook endpoint returns 403 oauth_customer_pii_required , because deliveries carry the full record. Customer directory: names without the record customer_directory:read gates GET /api/v1/customer-directory , which finds customers by a name or email prefix, or names up to 50 customer ids, and answers only their id , name and email . It exists so an extension can show customers in a picker without holding customers:read . It is ⚠ sensitive , so no OAuth connection can hold it, and no other scope grants "},{"title":"Your Own Scripts on Hosted Checkout","route":"/developers/scripts","headings":["Your Own Scripts on Hosted Checkout","What this is","What a script can and cannot do","Loading a vendor tag","Event catalog","Consent","External domains","Scripts shipped by an installed app","Declaring them","The two tiers","Automated review gates","What a script declares is frozen once it ships","Consent on upgrade","Your controls over an app's scripts","Authoring from the CLI","Your own storefront","One script tag","Or from npm","React","Events you publish","The manifest, directly","Managing scripts","API","Create a script","List scripts","Update a script","Delete a script","Kill switch","Health","Limits","What is not in this release"],"text":"Analytics Your Own Scripts on Hosted Checkout Add your own JavaScript to Throttle s hosted checkout page — a pixel, a cookie-based attribution stitcher, a custom analytics relay. It runs in an isolated sandbox with no access to the page, the payment form, or anything Throttle does not explicitly hand it. This page documents exactly what ships today: your own scripts, sandbox-tier only, on the hosted checkout page ( /c and /s ), and never in embed mode. See What is not in this release before you build against this. What this is Throttle mounts every enabled script for a surface inside its own <iframe sandbox= allow-scripts > — no allow-same-origin , so the frame s origin is opaque and it cannot reach the parent document under any circumstance. Your script talks to the host only through postMessage , wrapped by the small API surface described below. checkout , html: Hosted checkout — /c/<sessionId> and /s/<sessionId> , Nothing. Mounted for you. , ], [ html: quote , html: The hosted quote page, /q/<token> , html: Nothing. Consent fails closed here — a quote link carries no consent decision, so an environment that requires consent runs essential scripts only. , ], [ html: storefront , Your own pages, on your own domain , html: Install @usethrottle/scripts and allow-list your origin — see Your own storefront . , ], [ html: Embedded checkout ( ?embed=1 ) , html: Runs no scripts of its own. It forwards its events to your page instead. , html: Install the loader on the page doing the embedding. Without it, checkout-surface scripts never run — the dashboard warns when it has never seen your loader call in. , ], ] /> Embedded checkout runs nothing itself on purpose: a sandbox inside that iframe would write cookies like _ga to Throttle s checkout domain, splitting them from the storefront half of the same shop. Forwarding the events to your own loader keeps every cookie first-party on your domain. What a script can and cannot do checkout.started , .step_changed , .shipping_submitted , .payment_submitted , .completed , .failed ) and publish its own events over analytics.subscribe / analytics.publish — see the event catalog below. , html: Touch the checkout page — no document , window , or parent . Reachable identifiers are shadowed to undefined ; the real containment is the iframe s opaque origin. , ], [ html: Read/write cookies (real names — _ga , _fbp , etc. — with a small reserved list blocked) and namespaced local/session storage, all proxied async through the host. A read settles as null when refused; a write rejects , so a refused write cannot read as a successful one. , Read the payment form, card fields, or anything else rendered on the page. , ], [ html: Call fetch / sendBeacon to hostnames it declared in externalDomains . , html: Make a network request ( fetch , sendBeacon , XHR, images) to any other domain — blocked by the sandbox document s CSP connect-src , with no error the script itself can see; Throttle reports it as a blocked outcome with reason: csp . A script can still navigate its own frame (e.g. location.href = ... ) to any URL — that is not a network request CSP governs. Throttle detects this: a navigated frame is torn down and reported as an error outcome, so it is observable in the script health view even though it is not prevented. , ], [ Read the page context it booted with (URL, referrer, title, user agent) once, at load. , See anything about the buyer or the order that was not explicitly included in an event payload — no PII grading is wired yet, so no event carries customer data in this release regardless. , ], ] /> The register() contract Your source is compiled as a function body and run, so plain JavaScript works — top-level statements execute, and a script that never calls register() is perfectly valid. Use it when you want to subscribe to events; skip it when you just want code to run. At the top level you are handed four bindings: register , analytics , browser and settings . There is no api at the top level — api is the single object passed into the register callback, so api.browser.cookie.set(…) outside register() is a ReferenceError . Write browser.cookie.set(…) instead. What actually constrains you is not the convention. document , window , parent , top , opener , localStorage and sessionStorage are undefined inside a sandbox-tier script, and the network is governed by the CSP built from your externalDomains . Use browser.* for storage and browser.loadScript() for vendor tags. Your script s whole body is one call to the global register() function, which Throttle invokes once per load with analytics, browser, init, settings . The shape below — subscribing to a named event and publishing a derived one — is copied from a real, currently-passing test in packages/scripts-runtime/src/sandbox/bootstrap.test.ts , not invented for this page: This actually fires: the hosted checkout page bridges its own checkout lifecycle onto this bus (a script never sees the underlying postMessage events — only the projected checkout.* names below). Loading a vendor tag browser.loadScript(url) pulls a remote script into the sandbox and resolves when it has run. The host must be in your externalDomains , exactly — declaring example.com does not cover cdn.example.com , because the CSP matches hosts rather than parent domains. It rejects with a real error you can catch, rather than leaving you with a CSP refusal the page cannot see. A vendor tag mutates whenever the vendor redeploys — that is the point of one — so subresource integrity cannot pin it and no review can vouch for what runs tomorrow. What contains it is the sandbox: the code lands in an opaque origin with no cookies, no access to the merchant s DOM, no parent, and no network beyond the same declared list. Judge a vendor on whether you are willing to run their code under those limits, not on having read it once. Event catalog throttle_session_id, ecommerce? — ecommerce is a GA4-shaped object (below), pr"},{"title":"Mount Card Fields On Your Own Page","route":"/developers/secure-fields","headings":["Mount Card Fields On Your Own Page","How it works","Mint the session","Content Security Policy","React example","Status","3-D Secure","Analytics","Saved cards","Testing failures","Declines","The rest","Error reference","Field mounting and vaulting (the hook, in the browser)","3-D Secure (the hook)","Fallback codes","Routing -> Decline rules in the dashboard does the same thing.","Remove it again when you are done."],"text":"Checkout surfaces Mount Card Fields On Your Own Page Secure Fields gives you individually mountable, provider-hosted inputs — card number, expiry, security code, postal code — that you place in your own form and style yourself. Raw card data never touches your page or ours; your server never sees it either. Secure Fields has no PayPal, Apple Pay, or Google Pay. It is a card-capture surface, full stop — that is a property of the product, not a v1 gap. A merchant who needs those payment methods keeps using Embedded Checkout or hosted checkout alongside Secure Fields for the card-only case. How it works Four steps, and the only server-to-server call is the mint. Everything after that is either a mount inside the buyer's browser or the same public completion route the Embed and hosted checkout already use. Mint the session Call this from your backend, with your sk_* secret key. Never call it from the browser — there is no publishable-key variant. Field Notes POST /api/v1/checkout-sessions/:id/card-session :id is an existing Throttle checkout session (create one first with the cart/checkout APIs, exactly as you would for the Embed). Auth X-API-Key secret key with the checkout_sessions:write scope. Response sessionId, providerId, environment — pass this object straight into unchanged. Throttle records every card session it mints on the checkout session it was minted for (the newest 20 are kept). /complete authorises only against one of those; a card session minted for another checkout session, or one Throttle did not mint for it, answers 409 transaction_not_for_session before any order or authorisation, with details.retryable: false . Mint a new card session for this checkout session and mount the fields again. A card session minted before 2026-10-05 is refused once in the same way. Content Security Policy The card inputs are iframes served from Throttle's payment provider, not from your own domain. If your checkout sends a Content-Security-Policy header, the fields render as blank boxes until you allow that origin — usually with no error in the page, only a CSP violation in the browser console. frame-src lets the iframes mount; connect-src covers the calls they make. If you also send frame-ancestors elsewhere, it does not apply here — that directive governs who may frame you , not whom you may frame. React example @usethrottle/checkout-react ships a headless provider, a hook, and four unstyled field primitives. Style everything yourself — the whole point of choosing Secure Fields is that you own the pixels around the fields. session.sessionId (from the mint response) is the payment provider's checkout session id. It is what constructs the SecureFields instance and mounts the field iframes. checkoutSessionId (the prop you pass to separately) is Throttle's checkout session id — the same :id you minted against in the step above. It is what pay() uses to call POST /checkout-sessions/:id/complete . Swap them and every payment breaks: the fields will mount and take input fine (they only need the payment provider's id), but complete() will call /checkout-sessions/ provider id /complete , which does not exist on Throttle's side, and every payment 404s at the very last step. Status useSecureCard() exposes an explicit state machine. Render any of it — there is no need to infer state from side effects. Status What it means What to render idle Provider mounted; fields not yet registered. A loading state over the field area. mounting The Secure Fields instance exists; individual fields are registering. Same loading state — fields are not yet interactive. ready All required fields (number, expiry, CVV) are registered. Enable the Pay button. ready is also exposed as its own boolean. vaulting pay() / vault() called; waiting on the payment provider to accept or reject the card. Disable the button: “Saving card…” authorizing The card vaulted; Throttle's /complete call is in flight. Disable the button: “Processing payment…” challenging /complete returned requires_action ; the payment provider's own 3-D Secure iframe is mounted at your registered element and running. Make the registered mount element visible to the buyer: “Confirming with your bank…” complete The order was created. onSuccess already fired. Navigate away, or show a confirmation. error Vaulting, the challenge, or completion failed. Read error.code / error.message (see below) and let the buyer retry. 3-D Secure A payment that needs step-up authentication does not fail — complete() resolves with status: 'requires_action' instead of an order. pay() handles this for you. When that happens, the hook moves to challenging and drives the payment provider's own 3DS iframe (mounted at the element you passed to registerThreeDSecure ) to a result, then re-calls /complete for the authoritative outcome. Register the mount element alongside your card fields — it only actually mounts a challenge when one is needed, so it costs nothing to always include it. If the buyer never resolves the challenge, challengeTimeoutMs (5 minutes by default, overridable via the same-named prop) settles complete() to error.code: 'three_ds_timeout' on its own. Calling cancelChallenge() (also from useSecureCard() ) abandons an in-progress challenge with error.code: 'three_ds_abandoned' . If the challenge resolves but the payment still needs authentication, or if the buyer keeps retrying without ever clearing it, Throttle caps re-entry at 5 attempts and returns 409 three_ds_unresolved . Treat this as terminal: tell the buyer to start a new checkout rather than retrying the same session again. Analytics With GA4 set up, Throttle s server sends purchase and refund for Secure Fields orders. To join the purchase to the buyer s visit, pay() and complete() read your page s _ga cookies, UTMs and click id"},{"title":"Failures with no error","route":"/developers/silent-failures","headings":["Failures with no error","At a glance","Your tenant id is not where you expect","Cancellation fires two different events","A handler for an event you never subscribed to","The gate that never runs","Creation paths without a subscription","Changing a plan through checkout","Cards that save but cannot be charged","Test doubles kinder than production","Start with the delivery log"],"text":"Integration Failures with no error Every trap on this page shares one property: it produces no error. No exception, no 4xx, nothing in your logs. Several of them look actively healthy — a delivery log full of 200 s while nothing at all is happening. This is the single most useful habit for a billing integration. After every step, assert against your own database — not the API response, and not the absence of an exception. Most of what follows was found in production by someone who had green tests. At a glance Your tenant id is not where you expect Subscription and payment payloads carry Throttle s internal customerId — a UUID that means nothing in your system. Your identifier is on the sibling customer object, as externalId . Both appear on the same customer object. externalId is the id you set when you created the customer. externalCustomerId is a per-connection mapping and is null for direct API integrations — so reading it returns nothing, forever, without erroring. The failure mode is total and invisible: every subscription webhook is received, resolves to nothing, and returns 200. Throttle s delivery log shows delivered / 200 for all of them. If your checkout return path also syncs state, the user-present flow keeps working and hides it — until the first renewal, a month later, with no user present. Cancellation fires two different events Handle only subscription.cancelled and a scheduled cancellation is invisible to you: no confirmation email, and your Cancel button stays live because the subscription is still active . The buyer cancels, sees nothing change, and cancels again. A handler for an event you never subscribed to You can write a flawless handler for an event your endpoint does not receive, and nothing will ever tell you. There is an endpoint for exactly this: it reports event types your application emitted that no active endpoint subscribes to. Run it after every integration change — it is cheap enough to put in CI and fail the build on a non-empty unsubscribed array. An endpoint subscribed to * always reports clean. The gate that never runs An entitlement check registered in the wrong place — before tenant context exists, on a router that does not cover your API, behind a condition that is never true — returns early on every request. Both the expiry lockout and all plan gating become dead code, and nothing distinguishes that from no one is over their limit . Reading the code is not evidence. Put a tenant into a blocked state and confirm you get a 403. This is a two-minute test that no amount of code review substitutes for. Creation paths without a subscription Count the ways a tenant can come into existence: signup, invite, admin creation, seed script, import, test fixture. Each one that does not create a subscription row produces an account with permanent free access that never expires and is never asked to pay. Nothing surfaces this. The accounts work perfectly. Enumerate the paths by grepping for your create call and check each one individually. Changing a plan through checkout Checkout always creates a new recurring subscription. Run an existing subscriber through it and they now have two, and are billed for both. Use POST /subscriptions/{id}/change-plan instead, and fall back to checkout only when there is no live subscription to change. Cards that save but cannot be charged Card entry must go through the hosted embed. A card attached by any other route saves successfully, lists successfully, and then fails at charge time with payment_method_not_chargeable — which you discover at the first renewal, not at integration time. Use the embed via @usethrottle/payment-methods or hosted checkout. It is also what keeps card data out of your DOM and your PCI scope. Test doubles kinder than production A mock that returns a friendlier shape than the real API produces passing tests and a broken integration. This is the failure behind more than one bug on this page, on both sides of the boundary. For anything crossing into Throttle, assert against a real captured payload . The delivery log gives you exactly what was sent; replay one as a fixture rather than writing what you think the shape is. Start with the delivery log GET /api/v1/webhook-deliveries?endpointId= shows the exact payload sent and the status your endpoint returned. When something is not happening and nothing is erroring, this is the first place to look — it distinguishes never sent from sent and your handler swallowed it , which are completely different bugs. Next: the build and test checklist turns this page into something you can tick through."},{"title":"Site Forms","route":"/developers/site-forms","headings":["Site Forms","Add a form to your site","What gets stored","Spam and abuse protection","Submission errors","Get submissions by webhook","Manage forms with the API","201","200, newest first","Next page: pass meta.pagination.cursor back as ?cursor=`;"],"text":"Forms Site Forms A site form is a form on your own website (a contact form, a lead form, a get a quote form) that posts straight to Throttle. Throttle keeps every submission and can email it to the addresses you set. Create forms in the dashboard under Forms , or with the API below. Add a form to your site Each form has a publicKey starting with frm_ . Post your form to POST /api/v1/form-submissions/{publicKey} . No API key is needed, and none should ever go in a web page. A plain HTML post is answered with a 303 redirect to the form's redirectUrl , or a simple thank-you page when none is set. To submit from your own code, post JSON instead and you get JSON back. What gets stored Any field names. You don't declare fields in advance; every field posted is saved as sent. Values may be text, numbers, true/false, or a list of those (up to 50 items). Nested objects are refused. Limits: at most 50 fields, field names up to 100 characters, values up to 10,000 characters, and a 64 KB body. Reserved names. Fields starting with _ are never stored. _gotcha is the spam trap. Repeated names in a plain HTML post (for example a group of checkboxes sharing one name) keep only the last value. Give each checkbox its own name, or post JSON with a list. Spam and abuse protection Emails go only to the form's own addresses. They are set on the form and can never come from a submission, so the endpoint cannot be used to send mail to anyone else. Addresses outside your team confirm first. Your workspace members' own addresses are notified straight away. Any other address (a shared sales@ inbox, say) is sent a confirmation email and receives nothing until someone clicks Confirm on the page it links to. One confirmation covers every form in the workspace. Saving the form again re-sends an unconfirmed address its link, at most once a day and three times in all. A workspace can send at most 20 confirmation emails a day ( 429 too_many_confirmations on the create or update that would pass it, before anything is saved). The form's pendingEmails lists the addresses still waiting. Spam trap. A submission with _gotcha filled in gets the normal success answer, but nothing is stored or sent. Rate limit: 10 submissions a minute from one IP address, answered with 429 rate_limit_exceeded . Allowed sites (optional). With allowedOrigins set, a browser post from any other site is refused with 403 origin_not_allowed . This stops other websites using your form; it cannot stop a script, which can claim any origin. Anyone can read the publicKey in your page, and that is expected. Turn a form off ( isActive: false ) to stop it accepting submissions. Submission errors 404 form_not_found : unknown key, or the form is turned off. 403 origin_not_allowed : the post came from a site not on the list. 400 empty_submission : no fields were posted. 400 invalid_submission : a value or the field count broke a limit above, or a filled email field is not an email address (an empty one is accepted). 429 rate_limit_exceeded : too many submissions from one address. A plain HTML post gets these as a short page instead of JSON, with the same status code. Get submissions by webhook Subscribe a webhook endpoint to form.submitted (it needs forms:read ) to receive every submission, alongside or instead of email. It fires for each stored submission; spam-trap hits are not delivered. See webhooks for signing and retries. The event log ( GET /api/v1/events ) records only the ids. Reading a stored delivery back shows submission.data and origin only to a caller holding both forms:read and customer_pii:read . Manage forms with the API These routes take a secret key ( sk_ ) and act in the key's environment. They need forms:write to create or change a form and forms:read to read forms and submissions. Both are marked sensitive, because submissions hold whatever visitors typed. See scopes . POST /api/v1/forms : create a form. GET /api/v1/forms : list the environment's forms. GET /api/v1/forms/{id} : read one form. PATCH /api/v1/forms/{id} : change name , isActive , notifyEmails (up to 10), allowedOrigins (up to 20, each like https://www.example.com ) or redirectUrl or notifyAppOwner ( true also emails the application owner's current Throttle account address, with no confirmation; the address is never returned, and in a submission's emails it shows as app_owner ). GET /api/v1/forms/{id}/submissions : submissions, newest first. limit is 1 to 200 (default 50); page with cursor . A secret key or the dashboard reads it with forms:read . An extension installation's key, an extension session and an OAuth or AI-agent token also need an explicit customer_pii:read ( * does not count; a legacy customers:read key does, because it expands to it), or the answer is 403 insufficient_scopes . Use the metadata route below when no visitor data is needed. GET /api/v1/forms/{id}/submissions/metadata : the same pages without any visitor data, as { totalCount, items: [{ id, submittedAt, subject, status }] } . subject is the visitor-supplied value of the subject field (at most 100 characters, null if it looks like contact details); no other visitor data is returned. emails lists each notification email with its recipient and status, and emailStatus sums them up. A status is one of: queued : waiting to go out. sent : handed to the mail provider, not yet accepted by the recipient's mail server. delivered : accepted by the recipient's mail server. If it isn't in the inbox after that, look in spam, other tabs and any mail filters. bounced : the recipient's mail server refused it. failed : it could not be sent. skipped : nothing was sent (no address on the form is confirmed yet, or notification emails are turned off). emailStatus reports a failure or bounce first; otherwise it shows the recipient that is furthest behind, so one "},{"title":"Storefront Customer Auth","route":"/developers/storefront-auth","headings":["Storefront Customer Auth","Two planes, not two auth options on one plane","Turning it on","Tokens and sessions","Session lifecycle","Step-up: proving the password again for destructive actions","Email verification and the claim cutoff","Endpoint reference","No session required","Session required","Buyer groups on the profile","Cart claim and the retirement of X-Customer-Id","Deprecation timeline","Finding the buyer's cart on another device","Error reference","Webhook events","Carts, claims and reorder","Theming","Checkout interruption","React and react-dom are peer dependencies of this entry point`;"],"text":"Buyer identity Storefront Customer Auth Throttle can authenticate a merchant's end buyers — the shoppers on their storefront — as a plane entirely separate from the merchant API you already use for orders, payments, and webhooks. Buyers register, log in, verify their email, reset passwords, manage addresses and saved cards, view their own orders, invoices and subscriptions, and bind an anonymous cart to their account at checkout. Every application has auth.enabled: false until a merchant turns it on. Guest checkout is completely unaffected either way — a customer with no credentials is a guest by definition, and nothing about existing carts, orders, or subscriptions changes when this feature is off. Two planes, not two auth options on one plane A buyer session is not a weaker version of a merchant API key, and it can never be used as one. The two are isolated structurally, not by convention: , so a page that imports only the provider and guards no longer ships account or sign-in code (the CJS build is one bundle per entry and inlines the modals). Measured on the demo store's /shop : 195,876 B to 184,633 B gzip, 11,243 B lighter. Import paths are unchanged. Drop-in components: @usethrottle/auth/components The hooks above are headless — you build the UI. The ./components entry point is the other option: prebuilt, restylable React components that render inside your own storefront, so a buyer never leaves your site to sign in or read their order history. Same package, same session, same routes underneath. as const, Sign-in card. Also SignUp, ForgotPassword, ResetPassword, VerifyEmail. ], [ code: as const, The five cards with navigation between them — one component for a whole auth surface. ], [ code: as const, A button that opens the auth flow in a modal. Also SignUpButton, SignOutButton. ], [ code: as const, Full-viewport centred shell for a dedicated /sign-in route. Also SignUpPage. ], [ code: as const, Navbar avatar with a menu: identity, account, sign out. ], [ code: as const, Profile, addresses, saved cards, orders, invoices, subscriptions and security, in a sidebar or tab layout. ], [ code: / as const, Render children only in that state. additionally gates on email verification. ], ] /> Every panel is also exported individually ( OrdersPanel , AddressesPanel , …) if you want your own shell around them. Theming Three levels, from least to most invasive: CSS custom properties via appearance.variables , your own classNames on any part via appearance.elements , and whole-component replacement via appearance.components . Every shipped rule is a single-class selector, so a className you pass wins on source order rather than losing to specificity. colorPrimaryForeground is the text drawn on top of colorPrimary . Overriding only the first leaves the theme s own foreground in place, and the pair is not always readable — a terracotta primary on its own measures 3.65:1 against the dark theme s foreground, below the 4.5:1 WCAG asks for button text. Development builds measure the pair and warn once in the console when it falls short. They also warn when your brand colour is too close to the destructive colour to tell apart: Delete and Edit sit side by side in the account panels and a buyer distinguishes them by colour alone, so a warm brand landing on the danger red removes the only signal that one of them is irreversible. Nothing is logged in production builds. appearance.theme accepts light , dark or auto , and defaults to light. It is deliberately not auto : that resolves against prefers-color-scheme , which describes the shopper s machine and has no relationship to your storefront — so a light site would render a dark widget for every shopper with dark mode enabled. Opt into auto explicitly if your own site follows the OS too. Checkout interruption The case these components exist for is a buyer stopped mid-purchase. Render the auth flow inline where they already are, rather than sending them to a separate page — and pair it with cart claim so the cart they built anonymously follows them into the session. An unverified buyer s orders, invoices, subscriptions and saved cards are withheld by the server (see the claim cutoff above). The panels render that as an actionable gate — Verify your email to see your order history , with a resend action — never as a failure. You do not need to special-case it."},{"title":"Subscriptions","route":"/developers/subscriptions","headings":["Subscriptions","What ships in v1","What is intentionally out of v1","How the pieces fit","Order fees on renewals","Tax on renewals","Physical subscriptions","Sequence: auto-subscribe on card capture","Pages in this section"],"text":"Recurring billing Subscriptions Throttle subscriptions turn a one-time embed payment into a recurring billing relationship. The card vaulted during checkout is reused on a 5-minute renewal cron, with built-in dunning and a webhook stream that lets your backend stay in sync. What ships in v1 Recurring on the embed. Pass a recurring block on a checkout session, the embed vaults the card, and (when create: auto is set) Throttle creates the subscription on your behalf. Lifecycle API. Cancel, pause, resume, change plan, list, and fetch subscriptions through @usethrottle/subscriptions/server from your backend, or through the React hooks routed via your backend proxy. Mid-period proration. A plan or seat change sent with effective: now credits the unused portion of the period the buyer already paid for, then charges the net — and skips the charge entirely when the credit covers it. The response carries a proration breakdown ( creditCents , chargedCents , fullAmount ). Send effective: period_end to schedule the change for the next renewal instead, with no charge now. React management package. @usethrottle/subscriptions exposes hooks and primitive components so your buyer-facing portal does not have to re-derive the API plumbing. Any cadence, and installment plans. Send interval for the five named intervals, or intervalUnit + intervalCount for any cadence from 1 hour to 1 year. Add totalPayments (2–60) to make it an installment plan that completes itself after N payments and emits subscription.completed . See Lifecycle and States . Built-in dunning. Retry n waits min(n × cadence, [1, 3, 7][n − 1]) days — weekly and longer cadences always land on the original [1, 3, 7] days; shorter custom cadences retry proportionally faster. The first failed attempt moves the subscription to past_due ; if all three retries also fail it auto-cancels with a dunning_exhausted reason. Trial-fraud protection. Auto-create checks the card fingerprint against prior subscriptions on this merchant; same card already used for a trial → new subscription is created without a trial and a subscription.trial_blocked webhook fires. Pre-flight via POST /api/v1/subscriptions/eligibility-check . See Trial Fraud Protection . Webhook stream. subscription.created , .updated , .activated , .renewed , .past_due , .payment_failed , .paused , .resumed , .cancelled , .completed . What is intentionally out of v1 No-card free trials. Trials always require a vaulted card up front; the embed does not yet support a subscribe now, add card later flow. Trials with a card behave the way you expect — Throttle delays the first charge until trialEnd . Net30 recurring. Renewals charge a stored card via the payment provider. Net30 is supported for one-time orders today; Net30 recurring (invoice every period) is not part of the current subscription package surface. Customer-scoped JWTs. The React package authenticates by proxying through your backend. Direct browser → Throttle calls require a customer token system that is not yet built. See Buyer Portal for the proxy pattern documented for v1. Throttle-sent emails. All notifications flow through your webhook endpoint; you decide which emails to send. Subscribing to subscription.payment_failed is enough to wire the standard your card was declined copy. Recurring discounts. Promotion codes apply to cart-backed checkout totals today. Ongoing subscription-cycle discounts are deferred. Configurable dunning curve. The retry schedule scales down automatically for cadences shorter than a week, but merchants cannot configure their own multipliers or caps. Per-merchant or per-subscription overrides are deferred. Subscriptions touch checkout, customer identity, the renewal cron, and a buyer-facing surface. Start with the Quickstart for the end-to-end flow, then read Customer Identity before you wire your buyer portal. How the pieces fit Subscribe. Your backend creates a checkout session with a recurring block, or puts recurring on cart lines, one subscription per line, up to ten. Buyer pays through <PaymentEmbed /> . Card is vaulted. Throttle auto-creates the subscriptions. onSucceeded returns subscriptionIds . Renew. A cron runs every 5 minutes. For any subscription whose currentPeriodEnd has passed, it charges the stored card with an idempotent chargeStored call and advances the period. On failure it follows the cadence-scaled [1, 3, 7] -day retry curve. Manage. Your buyer portal calls your backend, which proxies to the Throttle API. The React package gives you hooks for the common flows. React. Your webhook handler stays in sync — record renewals, send dunning emails, gate access on past_due . Order fees on renewals A fee that applies to subscriptions is charged on signup and on every renewal. Each subscription stores a snapshot of its fees ( fees on every subscription response); a renewal prices the snapshot, so changing a global fee never changes an existing subscription. Add or remove a fee on one subscription with POST /api/v1/subscriptions/:id/fees and DELETE /api/v1/subscriptions/:id/fees/:feeId (merchant credentials, subscriptions:write ). See Order fees . Tax on renewals A renewal has no cart and no shipping address, so there is nothing for a tax provider to quote against. Throttle solves that by freezing an address on the subscription at signup and reusing it on every renewal. taxAddressSnapshot — the address renewals are quoted against. A subscription created through checkout inherits the address the buyer was taxed on: the billing address when the checkout had no shipping step. Each renewal is quoted with it as both the shipping and the billing address, whichever one your tax trigger reads. The renewal order carries it as its shipping address, and also as its billing address when your trigger is billing_address , so the filed document uses it too. taxAddressSource — checkout when it came from the buyer's session, manual once a merchant has edited it. A later checkout never overwrites a man"},{"title":"Buyer Portal","route":"/developers/subscriptions/buyer-portal","headings":["Buyer Portal","Architecture","Next.js App Router template","Express template","Authorization","Wiring the React provider","What buyers can do","Next"],"text":"Subscriptions Buyer Portal Let buyers manage their own subscriptions. v1 uses a proxy pattern: your backend forwards requests from the browser to Throttle, holding the secret key on your side and enforcing ownership. A proxy keeps your sk_* key off the wire and lets you reuse your existing user authentication. The hook API in @usethrottle/subscriptions is designed around this production path. Architecture Buyer s browser calls /api/throttle/api/v1/subscriptions on your domain. Your backend authenticates the user, verifies they own the resource being mutated, and forwards the call to Throttle with the secret key. @usethrottle/subscriptions s SubscriptionProvider uses a custom fetcher that targets the proxy. Next.js App Router template A single catch-all route handler proxies the relevant subscription endpoints. The helper pins externalCustomerId server-side on every read, rewrites checkout-session creates to the authenticated buyer, resolves payment-method reads from the buyer's customer row, and verifies ownership before reading one subscription or changing it. Since @usethrottle/subscriptions 4.0.0 it also limits what a buyer may send, because it forwards on your secret key: Cancel takes only atPeriodEnd . A refund is refused: a buyer cannot refund themselves. PATCH on a subscription takes only shippingAddress . Plan, cadence and amount need your authorizeUpdate({ request, subscription, body, externalCustomerId }) to return true after checking them against your price list. A direct POST /api/v1/subscriptions is refused unless your authorizeCreate({ request, body, externalCustomerId }) returns true. It names its own price and charges nothing, so prefer a checkout session. Anything else a buyer sends answers 403 field_not_allowed naming the fields; it is never silently dropped. Reading another buyer's subscription answers 404 . Express template Per-route variant. Slightly more code, but easier to reason about route-by-route authorization. Authorization Throttle s API key authorizes your account to act on any subscription you own. It does not know which buyer owns which subscription. That mapping lives in your DB (or you derive it via customer.externalId === user.id ). Without ownership checks on mutations, any logged-in user could cancel any subscription by guessing IDs. Always verify ownership server-side before forwarding a mutating request. Wiring the React provider Every hook in @usethrottle/subscriptions calls through this fetcher. Your proxy is the only thing that talks to Throttle. What buyers can do List their subscriptions and see status, plan, next billing date. Pause an active subscription and resume later. Pause is not offered on a trialing subscription (the API refuses it with 400 invalid_subscription_state ); @usethrottle/auth 0.6.1 and later hide the button there. Cancel at period end (or immediately, if you allow it). Change plan, when your proxy passes authorizeUpdate and it checks the new plan and amount against your own price list (your UI decides which plans are offered, but the browser is not trusted to name the price). Move one subscription to another of the buyer's saved cards: the proxy forwards PATCH /api/v1/subscriptions/:id/payment-method for the buyer's own subscriptions ( setPaymentMethod() on the server client). See Change the card . Change where a physical subscription ships. On the storefront plane that is PATCH /v1/storefront/me/subscriptions/:id/shipping-address (step-up gated), updateSubscriptionShippingAddress() in @usethrottle/auth , and a Change address button in its <SubscriptionsPanel /> . Surface a past_due subscription with an update-card action. The <DunningBanner /> primitive gives you the UI hook; your backend owns the actual card-refresh flow. An installment plan ( totalPayments set) shows its cadence and payment progress — installmentProgress() from @usethrottle/subscriptions gives you paymentsMade , totalPayments , and the remaining amount — but your proxy must hide Cancel, Pause, and Resume for it and refuse to forward those calls. Throttle's subscription API does not itself refuse a pause/resume/cancel called with your merchant secret key. The @usethrottle/subscriptions proxy now refuses every buyer mutation of an installment plan by default ( 403 installment_plan_merchant_only ), except changing its card ( PATCH …/payment-method ), which is not one of the plan's locked terms; if you pass your own authorizeMutation , the default is replaced and your function must check totalPayments != null itself. (Throttle's separate customer-session storefront endpoints, documented under Storefront Auth , enforce this server-side and return 403 installment_plan_merchant_only for a buyer session.) Next React Package — full hook reference."},{"title":"Creating Subscriptions","route":"/developers/subscriptions/creating-subscriptions","headings":["Creating Subscriptions","Pattern A — Server auto-creates (default)","Pattern B — Merchant backend creates explicitly","Pattern C — Webhook-driven creation","Choosing","Direct creation (no embed)","Free and usage-only plans (amount 0)","Linking the order that paid for the first period","Custom cadence and installment plans","Next"],"text":"Subscriptions Creating Subscriptions Three patterns map to three integration trade-offs. Pick the one that fits how much control you want over the create call. currency is optional and defaults to the store's main currency; see Multi-currency for the rule and its error codes. The plan , planName , amount , and interval values you pass on the recurring block come from your application — not from Throttle. We treat planReference as opaque text scoped to your merchant and never validate it against any list. Two workspaces can both have a pro_monthly reference without collision. Most teams keep plans in their own database (a plans table or a static config in the repo). That source-of-truth is what your storefront pulls from to render the plan picker, and what your backend forwards into the recurring block. A managed plan catalog inside Throttle is not part of v1. Pattern A — Server auto-creates (default) Set recurring.create: auto (the default) and Throttle creates the subscription atomically when the card is vaulted. Your onSucceeded callback fires with subscriptionIds (and subscriptionId when exactly one was created). Use this when you want the path of least resistance. The merchant writes zero code on the success path — vault, sub create, and notification all happen on Throttle s side. Throttle treats sub-create-after-vault as a single transactional unit. If the sub create fails, the vault row is still written (the buyer s card is on file), but no subscription exists. Throttle emits subscription.create_failed with a reason code. Listen for it and decide your fallback: retry from your own backend, contact support, or surface the error to the buyer. A checkout creates all of its subscriptions together or none of them. If any create fails, none exist, the order still stands (the money was captured), and one subscription.create_failed fires per subscription line, carrying its lineItemId . Pattern B — Merchant backend creates explicitly Set recurring.create: manual when you want full control. The embed only vaults; you call subscriptions.create yourself. Use this when you need to look up plan details from your own DB, run business logic before subscribing, or attach merchant-specific metadata that the embed cannot know about. Pattern C — Webhook-driven creation Use the payment.vaulted webhook. Survives a buyer closing their tab between vault and create. Recommended when reliability matters more than latency. Combine with create: manual on the embed: auto-mode and webhook-driven creation both racing to call create would double-bill (Throttle de-dupes, but it s still cleaner to pick one). Choosing subscriptions.create with a pre-vaulted payment method ID , ] ] /> Direct creation (no embed) For B2B flows where you ve already collected a card via another mechanism (a sales rep enters it through your admin tool), call subscriptions.create directly. A subscription created this way has no card of its own ( paymentMethodId: null ), so it renews on the customer's default card. Pre-condition: a customerPaymentMethods row already exists with isDefault: true for the customer — otherwise the renewal cron has nothing to charge. Subscriptions Throttle creates from a checkout store the card the buyer paid with instead; see Which card a renewal charges . Free and usage-only plans (amount 0) A subscription at amount: 0 renews every period for nothing, so Throttle treats 0 as a mistake unless you say otherwise. POST /api/v1/subscriptions , PATCH /api/v1/subscriptions/:id and POST /api/v1/subscriptions/:id/change-plan refuse amount: 0 with 400 invalid_amount unless the same request sends allowZeroAmount: true . Send it for a free tier or a plan billed only through usage. The flag applies to that one request and is not stored; subscriptions already at 0 keep renewing. A $0 subscription created without an orderId gets no invoice for its first period, the same as a $0 renewal : GET /api/v1/subscriptions/:id/invoices stays empty until a period costs money. With an orderId the first period keeps its $0 invoice, linked to that order. subscription.created fires either way. Checkout cannot start a $0 subscription. A session recurring.amount is the renewal price and must be above 0 when sent ( 400 invalid_amount ), and so must a cart subscription line's unitPrice ( 400 invalid_line_item ). For a free trial, send the price the plan renews at and set trialDays . Linking the order that paid for the first period When Throttle creates the subscription (Pattern A) it links the signup order itself. When you charge the first period and then create the subscription (Pattern B, Pattern C, or a proxy checkout you completed yourself), nothing connects the two — so that order shows no subscription, and the subscription's Orders tab is missing its own signup charge. Pass orderId to fix it: Throttle writes the link both ways: the order gets a subscriptionId of its own (and keeps carrying the legacy metadata.subscription_id pointer), and the subscription's first invoice records the orderId that collected it. So the order links to the subscription and GET /v1/orders?subscriptionId=... returns it. The order must exist in the same application and environment; if it does not, the call returns 404 and no subscription is created. Renewals need no orderId : the renewal cron creates those orders and stamps them itself. An order Throttle created with several subscriptions lists them in subscriptionIds ; subscriptionId is set only when there is exactly one. Passing such an order as orderId — one whose lines already link other subscriptions — creates the subscription but leaves the order's links unchanged, so the order never appears to have only the new one. Custom cadence and installment plans Every create path above accepts a cadence beyond the five named intervals, and an optional fixed number of payments: interval (named), or intervalUnit + intervalCount for any cadence from 1 hour to 1 year, or both together (they"},{"title":"Custom Cadence","route":"/developers/subscriptions/custom-cadence","headings":["Custom Cadence","Named and custom cadences","Validation","Labels","How renewal dates are computed","Month-end clamping","Hour and day cadences","When the renewal job falls behind","Pause and resume","Trials","Changing the cadence","End to end","Checkout: every 10 days","Direct: every 6 hours","Reading custom cadences","TypeScript SDK","React","Errors","Edge cases","Is "every 4 weeks" the same as monthly?","How is a custom cadence valued for MRR?","What time of day does a plan renew?","My Jan 31 subscription bills on the 3rd. Why?","Does a slow renewal-job run shift an hourly plan?","Can a buyer choose the cadence at checkout?","Next","→ { \"data\": { \"id\": \"c4a8e2f1-7b3d-4e9a-8c1f-0d6e5b4a3c21\", ... }, \"meta\": { ... } }","2. A checkout session that bills 49.00 USD every 10 days.","Then create the session with no \"recurring\" block: the line carries it.`;","it records the period you pass as already paid, and the renewal job bills","every period after it. The customer needs a default vaulted card.","→ data.pendingInterval \"biweekly\", pendingIntervalUnit \"week\", pendingIntervalCount 2,","pendingAmount 9900. subscription.plan_change_scheduled fires.`;"],"text":"Subscriptions Custom Cadence A subscription can bill every N hours, days, weeks, or months — every 6 hours, every 10 days, every 3 weeks, every 2 months — not only on the five named intervals. This page covers what you can send, what Throttle stores, how it labels a cadence, and how it computes each renewal date. Named and custom cadences Every subscription stores its cadence as a unit and a count: intervalUnit ( hour , day , week , or month ) and intervalCount (how many). The interval field names the cadence when it is one of the five named intervals, and is "custom" for everything else. The named intervals are shorthand: You send one of three shapes, and every response carries all three fields: The server reduces what you send to its largest exact unit, then names it when a named interval matches. Hours become days when the count is a multiple of 24, and days become weeks when it is a multiple of 7. Weeks never become months and months never become anything else, because a month is not a fixed length. So every 24 hours is stored as custom / day / 1 , every 14 days as biweekly , and every 4 weeks as custom / week / 4 (28 days — never monthly ). Each cadence has exactly one stored form, so filtering by interval=biweekly also finds a subscription you created as "every 14 days". A cadence is accepted in five places, with the same rules in each: POST /api/v1/subscriptions — required: send a named interval or a unit and count. recurring on POST /api/v1/checkout/sessions — checked when the session is created, so a bad cadence fails for you, not for a buyer at the end of checkout. recurring on a cart line ( POST /api/v1/carts/{id}/items ) or a quote line — checked when the line is added. Each such line becomes its own subscription; see Mixed Carts . POST /api/v1/subscriptions/{id}/change-plan — required, as on create. PATCH /api/v1/subscriptions/{id} — optional; a term-only edit (see Changing the cadence ). Validation The shortest cadence is 1 hour and the longest is one year, measured in the unit you sent: at most 8,760 hours, 365 days, 52 weeks, or 12 months. The bound is checked before the reduction, so 8,784 hours (366 days) is refused even though it would reduce to days. Every message below is the exact error.message . invalid_interval — A cadence can be at most one year: 8760 hours ], [ code: intervalUnit: day , intervalCount: 366 , html: 400 invalid_interval — A cadence can be at most one year: 365 days ], [ code: intervalUnit: week , intervalCount: 53 , html: 400 invalid_interval — A cadence can be at most one year: 52 weeks ], [ code: intervalUnit: month , intervalCount: 13 , html: 400 invalid_interval — A cadence can be at most one year: 12 months ], [ code: intervalCount: 0, -1, or 1.5 , html: 400 invalid_interval — intervalCount must be a whole number of at least 1 ], [ code: intervalUnit: minute or year , html: 400 invalid_interval — intervalUnit must be one of hour, day, week, month ], [ code: interval: daily or fortnightly , html: 400 invalid_interval — Unknown interval "daily" . There is no named daily interval; send day × 1 . ], [ code: intervalUnit without intervalCount, or the reverse , html: 400 invalid_interval — intervalUnit and intervalCount must be sent together ], [ code: interval: custom alone , html: 400 invalid_interval — A custom interval needs intervalUnit and intervalCount ], [ No cadence field at all (create, change-plan) , html: 400 invalid_interval — Send an interval, or intervalUnit and intervalCount ], [ code: interval: monthly , intervalUnit: week , intervalCount: 4 , html: 400 interval_conflict — interval "monthly" does not match every 4 weeks ], [ code: intervalCount: 3 (a string) , html: 400 validation_error — the body schema requires a JSON number ], ] /> Errors use the standard envelope: Labels @usethrottle/subscriptions exports two helpers so every surface words a cadence the same way. cadenceLabel is a standalone label for an Interval column; cadenceNoun is the period that reads correctly after a slash, as in $49.00 / 10 days . The table shows what the server stores for each input and what the helpers return for that stored row. The helpers read the fields as given; they do not reduce them. Called on a Throttle response they always match the table above. Called on raw input, cadenceLabel({ interval: custom , intervalUnit: day , intervalCount: 14 }) returns "Every 14 days", while the server stores and returns that cadence as biweekly . A value the helpers do not recognise is returned unchanged rather than dropped. How renewal dates are computed Renewal dates sit on a grid measured from billingAnchorAt , which every subscription response carries. Each period end is computed from the anchor, never chained from the previous period, so a rounding or clamping step can never compound. Hour, day, and week cadences advance by exact UTC durations: 3,600 s, 86,400 s, or 604,800 s times the count. Every 10 days is always exactly 240 hours. Month cadences land on the anchor's day of month and UTC time of day, in the month anchor month + k × count , with the day clamped to that month's last day. See Month-end clamping . The first period. A subscription created by checkout starts when the buyer pays and its first period is exactly one cadence long. On POST /api/v1/subscriptions you pass currentPeriodStart and currentPeriodEnd ; billingAnchorAt is set to currentPeriodStart (or to trialEnd when there is a trial). currentPeriodEnd must be after currentPeriodStart and in the future, or the create is 400 validation_error . The renewal job picks up a subscription once its currentPeriodEnd has passed and decides which period the charge opens: Billing restarts when a trial converts, when a failed payment is recovered, and when a scheduled change of cadence applies. Everything else is an ordinary renewal. The anchor stays where it is except in these cases: effective: now ) , "},{"title":"Customer Identity","route":"/developers/subscriptions/customer-identity","headings":["Customer Identity","Pattern A — externalCustomerId (recommended)","Pattern B — store Throttle's customerId","Pattern C — email-only","Keeping your DB in sync via webhooks","Looking up a customer by your own ID","What changes in v1","Next"],"text":"Subscriptions Customer Identity Subscriptions are scoped to customers. Throttle gives you three patterns for identifying a customer; the recommended one means you never store Throttle s IDs. Use Pattern A — externalCustomerId . Pass your own user ID everywhere. Throttle resolves it on every call. No new column on your users table. Pattern A — externalCustomerId (recommended) You give Throttle your own user ID at checkout time. Throttle upserts a customer record keyed on (workspaceId, externalId) . Subsequent checkouts and API calls reuse the same record automatically. No schema change in your DB. Idempotent — calling create twice for the same external ID does not duplicate. Your code reads naturally; user.id is the identifier everywhere. Pattern B — store Throttle s customerId Create the Throttle customer explicitly and persist the returned cus_xyz ID in your user table. Slightly faster on hot paths because Throttle skips the upsert lookup, but you own a new column. Best when you call subscription endpoints often and want to skip the resolve step. Adds one column to your DB ( users.throttleCustomerId ). Requires you to handle the user exists in your DB but not yet in Throttle case at signup time. Pattern C — email-only If your storefront accepts guest subscriptions (no merchant-side user account yet), you can pass customer: email alone. Throttle upserts on (workspaceId, email) . Works for the create flow, but management is awkward — you need to look up by email to act on the subscription later, and the buyer cannot easily prove their identity from a self-service portal. Migrate guests to Pattern A as soon as they create an account. Any checkout with a subscription line needs a customer: customer.email , customer.externalCustomerId , customer.customerId or customerEmail on the session, or session creation answers 422 recurring_customer_required . An accepted quote uses the email of the buyer who accepted it. Keeping your DB in sync via webhooks The customer.created event fires whenever a new customer record is created — directly via API, indirectly via checkout resolution, or anywhere else. If you want to mirror Throttle s customer IDs into your DB without explicit creation calls (Pattern A → Pattern B without extra round trips), subscribe to the event. Looking up a customer by your own ID New endpoint: GET /api/v1/customers/by-external/:externalId returns the canonical customer record (or 404). Use this when you need to fetch the Throttle row but only have your own user ID. What changes in v1 GET /api/v1/subscriptions accepts an externalCustomerId query parameter (mutually exclusive with customerId ). GET /api/v1/customers/by-external/:externalId is new. Pass your own ID, get the Throttle record back. The @usethrottle/subscriptions hooks accept either customerId or externalCustomerId as a scope. Next Buyer Portal — how the proxy pattern uses externalCustomerId end-to-end. React Package — hooks accept both ID forms."},{"title":"Installment Plans","route":"/developers/subscriptions/installment-plans","headings":["Installment Plans","How it works","Lifecycle","A 4-payment plan, start to finish","Counting payments","Creating one","Hosted or embedded checkout","A cart with goods and an installment plan","Directly, with the API","Quotes","Custom schedules","Gap units","When each payment is due","Tax, shipping, orders","Discount codes","What is locked","Reading the schedule","Schedule errors","Reading them","What you can change","Merchant API (secret key)","Creation rules","Buyer surfaces","After completion","Failed installments","Cancelling and refunding","Webhooks and emails","SDK and React","Errors","FAQ","Can a buyer pay the rest early?","Can I turn an ongoing subscription into an installment plan, or the reverse?","What if the renewal job was down for several periods?","Is each installment taxed?","Does pausing extend the plan?","Can a custom schedule have a free trial or an equal-payment count?","Can I show "Payment 2 of 4" myself?","What does an older SDK do with a completed plan?","Next","→ { \"data\": { \"id\": \"c4a8e2f1-7b3d-4e9a-8c1f-0d6e5b4a3c21\", ... }, \"meta\": { ... } }"],"text":"Subscriptions Installment Plans An installment plan is a subscription with a fixed number of payments — "4 payments of $100 every 15 days". It bills like any subscription, then stops by itself: the moment the last payment succeeds it becomes completed and is never charged again. How it works Set totalPayments (a whole number from 2 to 60) when you create the subscription. It cannot be added, changed, or removed later. The plan uses any cadence, named or custom — see Custom Cadence . The signup charge is payment 1 of N. paymentsMade counts the payments collected so far. When payment N succeeds the status becomes completed , completedAt is set, no further renewal is scheduled, subscription.completed fires, and the buyer gets a paid-in-full email. completed is terminal. The amount, cadence, quantity, and plan are fixed. There is no trial and no metered usage. Only you can pause, resume, or cancel it. The buyer cannot, from Throttle's buyer portal or its storefront API. If your app grants access while status === active , add completed . A completed plan's currentPeriodEnd is the end of the period the final payment covered; whether access continues after it is your decision. Lifecycle A merchant can cancel from active , paused , or past_due . A past-due installment is recovered by a retry, a buyer card update, or a waive; the fourth failed attempt cancels the plan. A plan created by a session intent on a quote or deposit-split cart starts without payment 1: see Counting payments . Everything else about active , past_due , paused , and cancelled is the same as for an ongoing subscription; see Lifecycle and States . A 4-payment plan, start to finish Four payments of 100.00 USD every 15 days, bought on October 1 at 09:00 UTC: The plan completes on November 15, when payment 4 succeeds — not on November 30, when the period it pays for ends. Nothing is charged on November 30. Counting payments POST /api/v1/subscriptions , html: Starts at 1 — the route books period 1 as paid ], [ Checkout with a session recurring intent on a quote or deposit-split cart, whose charge does not include the plan , Starts at 0; the first renewal is payment 1, so all N payments come from renewals ], [ A renewal charge succeeds (the renewal job, a merchant retry, or the buyer paying a past-due installment) , +1 ], [ A past-due period is waived , +1 — a waived installment counts, and a waived final installment completes the plan ], [ A charge is declined , Unchanged ], [ An installment is refunded , Unchanged ], [ Periods skipped because the renewal job fell behind , Never counted ], [ The plan is paused , Waits — nothing is charged or counted while paused ], ] /> installmentProgress in @usethrottle/subscriptions turns those fields into progress. remainingCents is remainingPayments × amount × quantity on an equal plan. Pass the subscription itself (it carries paymentSchedule ) and on a custom schedule it is the sum of the unpaid payments' net amounts instead. Both are before tax. The buyer sees the schedule before paying. The hosted checkout page reads "Pay 100.00 USD today, then 3 more payments of 100.00 USD every 15 days. Total: 400.00 USD." — with "plus applicable tax" added when the application taxes renewals, and without "Cancel anytime". With a discount code, only the first charge is discounted: "Pay 80.00 USD today, then 3 more payments of 100.00 USD every 15 days. Total: 380.00 USD." When the charge today does not include the plan it reads "Then 4 payments of 100.00 USD every 15 days, starting at the next billing date. Total: 400.00 USD." Creating one Hosted or embedded checkout Put totalPayments on the session's recurring block. With the default create: auto , Throttle charges payment 1 and creates the plan when the buyer pays; the embed's onSucceeded receives subscriptionIds (and subscriptionId , set when exactly one subscription was created). The session is validated when you create it: a bad totalPayments or a trial fails then, not at the end of checkout. With create: manual , checkout takes payment 1 and vaults the card, and your backend creates the plan. Pass the checkout's orderId so the order and the plan point at each other: A cart with goods and an installment plan Put the plan on a cart line: recurring with totalPayments on POST /api/v1/carts/{id}/items , with the installment amount as the line's unitPrice . Leave recurring off the session. The first charge covers the goods plus installment 1 ( paymentsMade: 1 ); renewals charge the installment only. Each such line becomes its own subscription, so one checkout can sell several plans, up to ten. See Mixed Carts for pricing, shipping, and refunds on that shape. The session recurring block still works for a single plan on a cart of goods. It needs amount whenever the cart holds other lines ( 422 recurring_amount_required ), and it cannot be combined with subscription lines on the same cart ( 422 recurring_source_conflict ). A cart or order line item's recurring.count is read-only display data ("· 4 payments"): it mirrors the line's totalPayments , and the cart item endpoints do not accept it on input. On a line, recurring.totalPayments is the installment count. To cap the number of charges, send totalPayments in a cart or quote line's recurring block, on the session's recurring block, or on POST /api/v1/subscriptions . Directly, with the API The route records period 1 as a paid invoice and sets paymentsMade: 1 , on the basis that you already collected it. If you did not, the buyer is charged only N − 1 times. Charge the signup first, pass its orderId when an order records it, and make sure the customer has a default vaulted card — the renewal job charges that card. Quotes A quote line can carry the same recurring block, with totalPayments . Paying the accepted quote takes installment 1 in the same capture as the rest of the q"},{"title":"Lifecycle and States","route":"/developers/subscriptions/lifecycle-and-states","headings":["Lifecycle and States","Billing intervals","Installment plans","States","State diagram","Trial behavior","Renewal","Which card a renewal charges","Dunning","When a renewal can't complete","Renewal reminder","Grace period — your call, not Throttle's","Plan changes","Upgrades — effective: "now"","Downgrades — effective: "period_end"","Cancelling a pending change","Precedence vs. cancel-at-period-end","Credits and refunds","Next"],"text":"Subscriptions Lifecycle and States How a subscription moves through its life. Understand the state machine, the renewal cron, and the dunning policy before you wire your webhook handlers. Billing intervals Throttle bills on any cadence from 1 hour to 1 year, not only the five named intervals ( weekly , biweekly , monthly , quarterly , yearly ). Send a named interval , or intervalUnit ( hour , day , week , or month ) + intervalCount , on the checkout session's recurring block, on a cart or quote line's recurring block, on POST /api/v1/subscriptions , or on change-plan . The server stores one canonical form — every 14 days comes back as biweekly , every 24 hours as custom / day / 1 — and every response carries interval (the name or "custom" ), intervalUnit , and intervalCount . An invalid cadence is 400 invalid_interval ; a named interval that disagrees with the unit and count is 400 interval_conflict . Periods are anchored, not chained. Each period end is computed from billingAnchorAt . Month cadences keep the anchor's day of month, clamped to short months: a Jan-31 monthly subscription renews Feb 28 (29 in a leap year), then Mar 31. Hour, day, and week cadences advance by exact durations. The anchor moves when billing restarts — trial conversion, a recovered payment, an immediate plan change or a scheduled cadence change, or a resume, which shifts it by the time spent paused. biweekly means every 14 days — 26 charges a year, not twice a month. Mixed-interval pricing (e.g., Pro Monthly + Pro Yearly with a 20% discount on yearly) is your job — you store the two plans in your own catalog and pass the right amount / interval to Throttle. We don't model plan tiers; see Creating Subscriptions for why. Plan changes can swap the cadence via POST /api/v1/subscriptions/:id/change-plan (rejected on an installment plan). An outage or a stalled retry can leave a subscription more than one period behind. Throttle charges it once, for whichever grid period contains the moment of the charge — the periods it missed are skipped, never billed back-to-back, and never counted toward an installment plan's totalPayments . Full guide: Custom Cadence → — every validation rule, the label helpers, the renewal-date algorithm, month-end clamping, hour cadences, trials, and cadence changes. Installment plans Set totalPayments (2–60) on the checkout session's recurring block, on a cart or quote line's recurring block, or on POST /api/v1/subscriptions to make a subscription an installment plan — a fixed number of payments that ends itself. The paid signup is payment 1 of N, and the plan becomes completed the moment payment N succeeds, emitting subscription.completed and a paid-in-full email. Merchants who gate access on status = active must treat completed as paid in full. totalPayments is set at creation only ( 400 total_payments_immutable ), an installment plan cannot have a trial ( 400 invalid_combination ), and its amount, cadence, quantity, and plan are fixed ( 409 installment_plan_locked ). Only the merchant can pause, resume, or cancel it; buyer storefront sessions get 403 installment_plan_merchant_only . Payments can also differ: a custom schedule gives each payment its own amount and gap. Its later due dates are estimates: a late payment that succeeds, a pause, or a waive moves them, and nothing is skipped. A manual period renew of a scheduled plan is refused ( 409 installment_plan_locked ). Full guide: Installment Plans → — how payments are counted, the lock and completed-state matrices, failed installments, cancelling and refunding, webhooks, and SDK examples. States trialing — Created with trialEnd in the future. No charge has been attempted. Card is already vaulted. active — Most subscriptions live here. Renews on the period boundary. paused — Manually paused. Skipped by the renewal cron. Can resume back to active. past_due — A renewal charge failed. The subscription moves here on the first failed attempt and stays while Throttle retries (up to three retries; see Dunning below). While it is past due, currentPeriodEnd holds the time of the next scheduled retry, not the date the period was due. The buyer's renewal-failed email carries an Update your card button to a Throttle-hosted page ( checkout.usethrottle.dev/billing/{token} ) where they save a new card and the past-due period is charged on the spot; a successful charge returns the subscription to active and emits subscription.renewed like any other renewal. The link is signed for that customer and subscription and valid for 14 days. See Payment Methods → Subscription self-service for the routes behind it. cancelled — Terminal. Reached via explicit cancel, dunning exhaustion, or merchant action. Renewals stop. completed — Terminal. Reached only from active , when an installment plan's final payment succeeds. Renewals stop; pause, resume, cancel, and plan changes are rejected like cancelled . See Installment plans above. unpaid — Accepted by the status schema and the published SDKs for forward compatibility. The customer-facing renewal engine documented on this page does not transition a subscription to it today. State diagram Trial behavior Trials always require a vaulted card. The embed collects and vaults the card at signup; the cron simply waits until trialEnd passes before attempting the first charge. On trialEnd , the cron flips the row from trialing to active and emits subscription.activated . The first paid period begins immediately after — no second tick is needed. If the buyer cancels during the trial, the subscription transitions directly to cancelled with no charge. Throttle does not yet support trials with no card on file. The card-up-front model is simpler and avoids a second flow to attach a card before trial end. Throttle automatically blocks the same physical card from claiming multiple trials on a single merchant. Checkout checks the card's fingerprint against prior su"},{"title":"Managing Subscriptions","route":"/developers/subscriptions/managing-subscriptions","headings":["Managing Subscriptions","List and filter","Cancel","Immediate cancellation","Cancel at period end","Refund a billing cycle","Pause and resume","Change the card","Product inputs on a subscription","Change where a physical subscription ships","Move or end a trial","Email more people than the customer","Change plan","Immediate change","How the credit is worked out","Scheduled change","Cancelling a pending change","Seats and quantity","From the React package","Audit log","Never change a plan through checkout","Handle the 402","Next"],"text":"Subscriptions Managing Subscriptions Pause, resume, cancel, change plans, and change the card. Same primitives whether you re calling from your backend, the dashboard, or the React package. List and filter GET /api/v1/subscriptions returns cursor-paginated results. Filter by status , interval , customerId , or externalCustomerId . Use q to search subscription ids, customer ids, plan fields, status, interval, or metadata. Cancel Two flavors. Pick based on your buyer experience. The backend examples use @usethrottle/subscriptions/server with your secret key. Immediate cancellation Use when the buyer wants to stop right now. Because this takes away access the buyer may have already paid for, it is the one cancellation that can also move money: refund accepts none (default), prorated , or last_cycle . The refund is issued before the subscription is cancelled, so a payment failure leaves the subscription untouched rather than cancelling it with the money stranded. refund is rejected together with atPeriodEnd: true ( 400 validation_error ): at period end the buyer keeps the period they paid for, so there is nothing to give back. A prorated cancel on a period nothing was paid for (a waived period, say) still cancels, with a refund of 0 . A paused or past-due subscription is refunded the unused paid time from when it was paused (paused) or from now (past due). The refund is always capped at the cash paid for the period; if a period was paid but no unused time is left, the call is 422 invalid_state and nothing is cancelled. Asking for a refund on a subscription that is already cancelled or completed returns 409 invalid_state and refunds nothing. Cancel at period end Common pattern: the buyer keeps access until the end of what they paid for. Throttle sets cancelAtPeriodEnd: true . The renewal cron sees it on the next tick after the period ends and finalizes the cancellation. To restore a subscription that was scheduled to cancel, call POST /api/v1/subscriptions/:id/resume (it clears cancelAtPeriodEnd ; PATCH does not accept that field). (Calling cancel again with atPeriodEnd: false does not undo it — that cancels immediately.) After actual cancellation the subscription is terminal — create a new one. Cancelling, either way, also clears any pending plan or seat change on the subscription. Refund a billing cycle Every subscription charge produces a subscription invoice , and each one can be refunded on its own — the signup cycle, a renewal, or a plan-change charge. Refunding a cycle is a money operation only: it does not stop billing unless you say so. intent is required and has two values: money_only — the money goes back and the subscription keeps running. The next renewal charges as normal. refund_and_cancel — the money goes back and the subscription is cancelled immediately, in that order. Omit amount to refund everything still refundable on the cycle. Partial refunds accumulate: the invoice moves to partially_refunded , then refunded once the whole amount is back. A cycle that is already fully refunded, unpaid, failed, or $0 (waived or free) is rejected with 422 . A refund with money_only leaves an active subscription active — the renewal cron will charge again on schedule. If the buyer is leaving, use refund_and_cancel (or cancel separately). The same is true of refunding the cycle s order from the Orders API: the money goes back and the cycle is marked refunded, but the subscription keeps billing. The same holds for a checkout that created several subscriptions: no refund cancels the order or any of them, and an order refund that names no cycle comes out of the goods and shipping first, then across the cycles in proportion to what each still has refundable. Refunds are placed in the order they happened, each against what was left at that moment. Refunding through either surface reaches the same numbers. The amount refunded on a cycle is derived from the payment s own transaction ledger, so a refund taken on the order that collected the cycle updates the cycle and its invoice too — and the refundable amount the next call is offered already has it subtracted. When the order billed more than the cycle — a one-time setup fee charged alongside the first period — a refund pays down the non-recurring part first, and only what is left over reaches the cycle. Refunding a $40 setup fee on a $65 order that also carried a $25 first period leaves the cycle fully refundable; refunding the remaining $25 then closes it. Refunds carry no line-item attribution, so this is the direction that keeps a one-time refund from locking you out of refunding the subscription itself. Both intents emit subscription.invoice_refunded , whose payload carries the intent so your systems can tell a goodwill refund from a cancellation. refund_and_cancel additionally emits subscription.cancelled . Requires the payment_refunds:write scope. Pause and resume Pausing an active subscription transitions it to paused . The renewal cron skips paused rows entirely — no charge attempt, no dunning. Resuming returns it to active and pushes currentPeriodEnd forward by however long the subscription was paused, so the buyer gets back the days billing was stopped instead of being charged for them. Guards: pause requires status active . Any other status (including trialing , which has nothing billed to pause) is 400 invalid_subscription_state . resume on a paused subscription always unpauses it, whether or not it also has cancelAtPeriodEnd: true — the scheduled cancellation is left exactly as it was. On a subscription that is not paused, resume clears a scheduled cancellation ( cancelAtPeriodEnd: true ) in any non-cancelled status ( active , trialing , past_due ) and leaves the status alone; on an active subscription with nothing scheduled it is a no-op that returns the subscription. For cancelled and completed it is 400 invalid_subscription_state . A paused subscription that also has cancelAtPeriodEnd: true is still cancelled at its stored curren"},{"title":"Mixed Carts","route":"/developers/subscriptions/mixed-carts","headings":["Mixed Carts","Selling one","Starting checkout from an existing cart","What the buyer is charged","What you get back","The same plan twice, and seats","Shipping and the address step","Trials","Discounts","Invoices and emails","Refunds never stop billing","Cancelling","The session intent, for one plan","Errors","Limits","Next","2. Each line with a recurring block becomes ONE subscription.","3. The one-time goods, as usual."],"text":"Subscriptions Mixed Carts One cart can hold any number of one-time lines and up to ten subscriptions — the same plan or different ones, each on its own cadence, installment plan or trial. The buyer pays once, shipping is charged once, and the checkout lands on one order linked to every subscription it created. Selling one Put a recurring block on each cart line that should become a subscription. Leave recurring off the checkout session: the lines carry it. Throttle validates every subscription line when the session is created, so the total on the hosted page, the amount authorized in the embed and the amount settled are the same number. The same recurring block works on the Cart API , the browser cart session (whose hosted cart page shows each line s terms) and quotes . Starting checkout from an existing cart A checkout session can also be created from a cart that already exists — Throttle's hosted cart page ( /cart/<id> ), an abandoned-cart recovery link, or a plain cartId hand-off. These hand-offs carry no recurring block of their own, so Throttle recovers the plan's recurring intent from the cart before anything is charged: It reuses the intent of an earlier session on the same cart for the same plan, keeping the merchant's exact fields and create mode; or, if there is none, it rebuilds the intent from the cart's plan line (its plan reference, cadence, amount, and trial days). If the earlier session's cadence disagrees with the plan line the buyer sees and pays, the plan line wins. The shipping step is kept. The session inherits the earlier session's address collection; with none to inherit, it collects a shipping address whenever the cart holds any line besides the plan line. The cart-based default described in Shipping and the address step does not apply to a hand-off. A recurring session needs a buyer identity. A hand-off that supplies no email inherits the earlier session's. If there is none to inherit and the request names no customer.email , customer.customerId , customer.externalCustomerId , or customerEmail , it is refused with 422 recurring_customer_required ("Recurring checkout sessions require a customer email or customer identifier"). If the terms cannot be determined (the plan line has no plan reference or no valid cadence), the session is refused with 422 subscription_terms_undeterminable before the buyer is charged, so a buyer is never charged for a plan whose subscription would not be created. Fix the cart's plan line, or create the session with an explicit recurring block. This applies to native Throttle carts only, and only to the plan line Throttle writes for a recurring checkout ( type: "subscription" with metadata.subscriptionLineItem: true ). A line that carries its own recurring.plan brings its own terms and needs no session intent. A cart that holds both kinds (a legacy plan line and lines with their own recurring.plan ) is refused with 422 recurring_source_conflict , whatever the line order. What the buyer is charged What you get back subscriptionIds lists every subscription on the order, in line order, and each line s subscriptionId names the one it created. subscriptionId is kept for integrations written before this: it is set when the order has exactly one subscription and is null otherwise, so read subscriptionIds . The completion response, the embed s onSucceeded , and the order and payment webhooks carry the same pair. The ?subscriptionId= filter matches an order through any of its lines. The same plan twice, and seats Every subscription line is its own subscription. Two lines with the same plan make two independent subscriptions, which cancel, refund and renew separately. Nothing is merged, not even when a guest cart is merged into a signed-in buyer s cart. For several seats on one subscription, send one line with a higher quantity : quantity is seats, and each renewal bills unit price × seats. Shipping and the address step Subscription lines are never charged shipping. They are left out of weight, item-count and subtotal rules, so a free-shipping threshold is measured on the goods alone, and requiresShipping: true on a subscription line is rejected. A subscription line ships only when it says so with deliveryMethod: shipment : a physical subscription that ships a box every cycle, still with no shipping charge. A type: subscription line with no recurring never becomes a subscription, so it ships by the usual rules. Omit collect and Throttle decides from the cart: on a checkout with subscriptions, the address step is on when the cart holds at least one shippable one-time line or a physical subscription line, and off otherwise; any other checkout keeps asking. A physical subscription line refuses an explicit collect.shippingAddress: false with 400 shipping_address_required . A collect object that leaves out shippingAddress sets it to true . An explicit value always wins. A checkout with no shipping step still needs an address to tax when your application uses a tax provider on the strict fallback policy. In that case an omitted collect.billingAddress defaults to true , and tax is calculated from the billing address. See collection flags . Trials A free-trial line is charged nothing today. Throttle stores it at a unit price of 0 and keeps your price on recurring.amount for the renewals, the same way it stores the plan line for a trial on the session intent. A free-trial line cannot carry taxAmount or discountAmount . Trial eligibility is checked once per checkout, against the card s history before this checkout, and the answer applies to every trial line in it. When it is blocked, the whole checkout is refused with 409 trial_not_available before any order exists: no subscription gets a free first period, nothing is charged, and one subscription.trial_blocked fires with subscriptionId: null . The buyer can pay with another card, or you can offer the plan without a trial. Discounts A discount "},{"title":"Subscribe a Buyer in Five Minutes","route":"/developers/subscriptions/quickstart","headings":["Subscribe a Buyer in Five Minutes","Flow","1. Backend route — create the session","2. Frontend — render the embed","3. Webhook handler — react to lifecycle events","Next"],"text":"Subscriptions · Quickstart Subscribe a Buyer in Five Minutes End-to-end recurring billing with the Throttle embed. Three files: backend session route, frontend embed, webhook handler. You have a Throttle workspace, a secret key for your backend, a configured application, and an allowed checkout origin. If you don't, run through the payment quickstart first. Flow 1. Backend route — create the session The recurring block is the only difference from a one-time payment session. Throttle stores it on the session metadata and uses it to create the subscription when the embed reports a successful vault. 2. Frontend — render the embed The recurring prop on the embed is optional; when omitted, the session s recurring metadata still drives the backend. Pass it explicitly only if you want type-safe disambiguation in your client code. 3. Webhook handler — react to lifecycle events Webhooks are the source of truth for state. The embed callback is convenient but not durable — a buyer who closes their tab still triggers webhooks. Set recurring.create: manual if you d rather call subscriptions.create from your own backend after vault success. See Creating Subscriptions for the three patterns. recurring.interval: monthly above is the common case. Send intervalUnit + intervalCount instead (or as well) for any cadence from 1 hour to 1 year, and totalPayments (2–60) to make it an installment plan that ends itself after N payments — no trial allowed together with it. See Lifecycle and States for the bounds and Creating Subscriptions for the installment rules. Next Customer Identity — why externalCustomerId beats storing Throttle s customer ID. Lifecycle and States — what happens between renewals and what dunning looks like. Buyer Portal — give buyers a way to cancel without emailing support."},{"title":"React Package · @usethrottle/subscriptions","route":"/developers/subscriptions/react-package","headings":["{sub.planName}","React Package · @usethrottle/subscriptions","Install","Backend proxy","Provider","Server-side client","Hooks · queries","useSubscriptions(filters)","useSubscription(id)","useCustomerPaymentMethods(customerId)","Hooks · mutations","useCancelSubscription()","usePauseSubscription() / useResumeSubscription()","useChangePlan()","useCreateCheckoutSession()","useTrialEligibility()","Custom cadence and installment plans","Primitive components","Boundaries"],"text":"Subscriptions React Package · @usethrottle/subscriptions Production React hooks, server proxy helpers, and primitive components for managing Throttle subscriptions end-to-end from your buyer portal. Browser code should use the provider and hooks through your backend proxy. Backend code can import createSubscriptionsClient from the server entrypoint and use it with your secret key. The package never requires putting an sk_* key in browser code. Install Backend proxy The package ships a Next.js-compatible proxy helper at @usethrottle/subscriptions/server . It allowlists the subscription, customer-by-external, trial eligibility, and checkout-session paths, pins subscription reads, customer lookups, direct subscription creates, and checkout-session creates to the authenticated buyer's externalCustomerId , and verifies ownership before forwarding subscription mutations. Provider Mount a SubscriptionProvider high in your tree. The fetcher prop is the contract with your backend proxy — every hook routes through it. Server-side client Backend routes can use the server entrypoint as a typed subscription client without bundling React provider code. Use this for admin tooling, webhook handlers, or custom business logic that should run server-side. Subscription confirmation pages and account portals can also fetch vaulted payment-method summaries without reaching around the package. Hooks · queries useSubscriptions(filters) Lists subscriptions for a customer. Filters: customerId or externalCustomerId (one is required), plus optional status (now including unpaid and completed ), interval ( custom matches every non-named cadence), installment ( true for installment plans only, false for ongoing subscriptions only), cursor , limit . useSubscription(id) Fetches a single subscription. useCustomerPaymentMethods(customerId) Fetches saved payment-method summaries. When routed through the backend proxy, payment method reads are pinned to the authenticated buyer's customer row. Hooks · mutations All mutation hooks return a mutate, mutateAsync, isPending, error, data shape. On success they invalidate the relevant useSubscription / useSubscriptions caches. useCancelSubscription() usePauseSubscription() / useResumeSubscription() useChangePlan() A real plan change — prorated and charged immediately when effective: now , or scheduled for period end with no charge today. For a term-only edit with no proration and no charge (rename a plan, correct the amount on the row), call the client s update(id, input) instead. useCreateCheckoutSession() Bridge from the management package to @usethrottle/checkout-react s <PaymentEmbed /> . Wraps the /api/v1/checkout/sessions POST with recurring metadata. recurring is optional: omit it when the cart s lines carry recurring . useTrialEligibility() Calls POST /api/v1/subscriptions/eligibility-check through your proxy. Use it when your UI needs to decide whether to offer a trial after a payment method has already been vaulted. Custom cadence and installment plans Subscription carries the fields a custom cadence and an installment plan need: intervalUnit ( hour | day | week | month ) and intervalCount alongside interval (which now also accepts "custom" ), plus totalPayments , paymentsMade , and completedAt for installment plans (on an ongoing subscription totalPayments and completedAt are null and paymentsMade is 0 ). SubscriptionStatus adds unpaid and completed . Three helpers turn those fields into copy instead of every app re-deriving its own label map — the exact bug custom cadences were built to retire: cadenceNoun(sub) — the period noun after a slash: "10 days" , "2 weeks" , "month" . cadenceLabel(sub) — a standalone label: "Monthly" , "Every 10 days" . installmentProgress(sub) — null for an ongoing subscription, or paymentsMade, totalPayments, remainingPayments, remainingCents for an installment plan. create() and useCreateSubscription() accept intervalUnit + intervalCount alongside interval , and totalPayments (2–60) to create an installment plan. Full guide: Custom Cadence → — bounds, the label table, and renewal dates. Full guide: Installment Plans → — counting, locks, completion, and a progress component. Primitive components Three presentational components. They take a subscription (or a single field) as a prop and render appropriately. No secret-key API calls. <SubscriptionStatusBadge status= status /> — chip with state-specific colour. Accepts className . <TrialCountdown endDate= date /> — Trial ends in N days . Pass the trial end date. <DunningBanner subscription= sub onUpdateCard= fn /> — shown when status is past_due . Includes an action that calls your update-card flow. Boundaries Payment collection stays in @usethrottle/checkout-react . This package creates recurring sessions and manages the subscription lifecycle around the embed. Direct browser auth via customer-scoped tokens is not exposed yet. Use the proxy helper so your backend owns authorization and secret-key storage. Composite portal layouts are application code. Components here are primitives and accept className / style for your design system."},{"title":"Testing","route":"/developers/subscriptions/testing","headings":["Testing","Sandbox checklist","Manual smoke test","Trial-abuse replay","Webhook assertions","Automated test boundaries","Common gotchas","Prove webhooks before go-live","Next"],"text":"Subscriptions Testing Verify subscription integrations against Throttle's hosted sandbox surfaces and your own staging storefront. Treat Throttle as an external API: configure keys, origins, webhooks, and assertions the same way you will in production. Keep secret keys on your backend, use a non-production workspace/application for test runs, and never put a secret key in browser code. Browser code should only receive session identifiers and embed data returned by your backend. Sandbox checklist Before exercising a subscription flow, confirm the environment pieces below. The exact values come from your Throttle dashboard or onboarding handoff. Testing and test cards . , ] ] /> Manual smoke test A passing smoke test proves that your backend can create the session, the browser can mount the hosted payment surface, and your webhook endpoint can process durable subscription events. Open your staging pricing or subscribe page. Select a plan that creates a recurring checkout session. Confirm your backend creates the session with a recurring block. Mount the Throttle payment or checkout embed from the returned session. Complete the payment with sandbox payment details for your account. Confirm your storefront receives the success callback and renders the subscription confirmation state. Confirm your webhook endpoint receives subscription.created and any payment events needed by your ledger. Trial-abuse replay To validate trial-abuse protection, repeat the subscription flow with the same physical card fingerprint and a different customer identity. The expected result is a subscription without the requested trial and a subscription.trial_blocked webhook. subscription.trial_blocked with a reason such as card_already_used_for_trial . , ], [ Customer experience , Your storefront should explain that the buyer is subscribed without a new trial. , ] ] /> Webhook assertions Subscription state is durable only after your webhook handler processes signed events idempotently. Store event ids before applying side effects and treat delivery as at-least-once. subscription.created plus the payment event your ledger expects. , ], [ Trial ends , code: subscription.activated , ], [ Renewal succeeds , code: subscription.renewed , ], [ Renewal fails , html: subscription.payment_failed and, on the first failed attempt, subscription.past_due . , ], [ Cancellation , html: subscription.cancelled with the expected data.reason . , ] ] /> Automated test boundaries Automated browser tests should validate your application's behavior around the embed: session creation, iframe mounting, event listeners, success routing, and webhook-driven state updates. They should not reach into the hosted payment iframe or depend on private Throttle implementation details. Common gotchas Origin not allowlisted. The iframe refuses to render until the parent storefront origin is configured for the merchant. Webhook signature mismatch. Verify against the webhook secret for the same merchant environment that sent the event. Duplicate webhook side effects. Throttle retries delivery; store event ids and make every handler idempotent. Expired checkout session. Create a fresh session for every buyer attempt instead of reusing old session ids. Testing inside the iframe. The payment surface is hosted and isolated. Assert the events it emits and the state your app persists. Prove webhooks before go-live A broken tenant lookup returns 200 on every delivery. Throttle s log shows delivered / 200 , your endpoint reports no errors, and nothing happens. If your checkout return path also syncs state, the user-present flow keeps working and hides it — until the first renewal, with nobody watching. Do not wait for a real customer to find out. Use a dedicated test tenant: Give it a subscription row and record the baseline. Create a Throttle customer whose externalId is that tenant s real id. Create or modify a subscription through the API. Assert your own database changed. Restore the tenant. Everything except a renewal can be driven headlessly this way — a browser is only needed for card entry. Renewal is the one path you cannot trigger on demand, so diarise the first one for about a month after cutover. Next Quickstart — create the first recurring checkout session. Subscription Webhooks — understand event payloads and delivery behavior. Trial Fraud Protection — see how trial eligibility is evaluated."},{"title":"Trial Fraud Protection","route":"/developers/subscriptions/trial-fraud-protection","headings":["Trial Fraud Protection","How it works","Scope is per-merchant","Pre-flight API","POST /api/v1/subscriptions/eligibility-check","Using it from your backend","The trial_blocked webhook","What this does NOT protect against","Disabling the check","Next"],"text":"Subscriptions Trial Fraud Protection Throttle ships a card-fingerprint check that detects the same physical card being reused across fresh customer accounts. The check runs automatically inside the auto-create flow and is also exposed as a pre-flight API endpoint for explicit gating. How it works Every payment vault writes the processor's stable payment_method.fingerprint onto the customer_payment_methods row. When a checkout grants a trial, Throttle reads the card's fingerprint from the payment before any order exists and checks whether a customer on this merchant with the same fingerprint already had a subscription with trialEnd set. The check runs once per checkout, and its answer covers every trial line. If a match exists, the checkout is refused with 409 trial_not_available ( details.reason: "card_already_used_for_trial" ). No order, no subscription and no saved card are created, and nothing is charged. The hosted checkout says "This card has already been used for a free trial." and shows the card form again, since another card may be eligible; your storefront can offer a plan without a trial. A subscription.trial_blocked event still fires, with subscriptionId: null . On the server-authorize rail (Secure Fields) the check runs after the authorisation and before capture; a non-zero authorisation is voided, and the pending order that rail creates first is reused if the buyer retries. A refused trial never gives a free first period. Before 2026-10-05 a blocked trial created the subscription active with its first period unpaid. If two checkouts with the same card race past the first check, the check after payment catches it: the subscription is created trialing with trialEnd set to now, the renewal job charges the first period on its next run (with tax, invoice, emails and dunning as for any trial conversion), and subscription.trial_blocked fires with the subscription id. For those few minutes subscription.created reports status: trialing . If the engine can't check (no fingerprint on the row, or the card was vaulted before the v1 schema migration), the trial is allowed . We surface this in the eligibility-check response as reason: 'no_fingerprint_available' so you can layer your own checks on top. Failing-closed would be catastrophic during the rollout — many legitimate cards in your existing customer base have no fingerprint yet. Scope is per-merchant A fingerprint that's been on Merchant A's trial does not block the same card from getting a trial on Merchant B. Different businesses, different fraud surfaces. Throttle deliberately scopes the check to (workspaceId, fingerprint) so we don't leak fraud signals across workspaces. Pre-flight API POST /api/v1/subscriptions/eligibility-check Server-to-server endpoint, secured with your API key. Useful when you want to render different UI before subscribing (e.g., hide the "Start free trial" button when the buyer is ineligible). Response: Using it from your backend The trial_blocked webhook When checkout refuses a trial (without you calling the eligibility endpoint), Throttle still emits a webhook so you have a hook point to react. On a refusal no subscription exists, so subscriptionId is null and the event carries the checkout instead: cartId , checkoutSessionId and planReference . Only the race backstop above sends it with a subscription id, in addition to subscription.created . @usethrottle/webhook-types 6.3.0 types subscriptionId and paymentMethodId as nullable. What this does NOT protect against Different cards from the same buyer. The fingerprint changes when the card changes. A buyer with three different cards can claim three trials. Disposable email signups. Block disposable email domains in your signup flow if your business cares; Throttle doesn't. IP / device velocity. Throttle doesn't see the buyer's IP. Add rate-limiting or a CAPTCHA at your edge if needed. Stolen cards. That's a payment-processor concern (provider auth-decline rules) — not a subscription concern. Disabling the check The check runs automatically when customerPaymentMethods schema is wired into the subscription service (default in production). There's no per-merchant toggle in v1 — if your business model wants unlimited trials per card, contact support and we'll discuss the right primitive. Next Lifecycle and States — trial timing semantics + dunning curve. Subscription Webhooks — full event reference (now includes subscription.trial_blocked )."},{"title":"Usage Reporting","route":"/developers/subscriptions/usage-reporting","headings":["Usage Reporting","How it works","Required scopes","Report usage","List usage","Multiple usage kinds","Billing at renewal","Next"],"text":"Subscriptions Usage Reporting Report metered usage against a subscription's current billing period. Usage items are billed on top of the base subscription amount at the next renewal. How it works Each usage item is identified by a kind string (e.g. api_calls , storage_gb ). There is exactly one row per (subscription, current period, kind) combination. Reporting the same kind twice replaces the previous value — it is an absolute upsert, not an increment. The engine computes totalCents = unitCount × unitPriceCents and stores it on the row. At renewal the cron sums all usage rows for the period and adds them to the base subscription charge. The base amount and total usage overage appear as separate line items in the renewal invoice. An immediate plan or seat change ( effective: "now" ) resets the current period to the moment of the change, so any usage already reported for the period it closes out moves forward to the new period start and is billed at the next renewal instead. A waived period forgives everything due for it, usage included — that usage is never billed later. See Lifecycle & states for both. Required scopes subscription_usage:write — report (upsert) a usage item. subscription_usage:read — list usage items. subscription_usage:write also grants read access. Report usage POST /api/v1/subscriptions/{id}/usage Body fields: kind (string, 1–64 chars, required) — usage category identifier. Use a stable, lowercase slug you control. unitCount (integer ≥ 0, required) — the absolute number of units consumed this period. unitPriceCents (integer ≥ 0, required) — per-unit price in the smallest currency unit (cents for USD). Set unitCount to the total consumed so far this period, not the delta. If you called this endpoint earlier with unitCount: 1000 and 500 more units were used, report unitCount: 1500 — not 500 . Usage can't be recorded on an installment plan (a subscription with totalPayments ): it has a fixed total, so the call returns 400 invalid_state and stores nothing. Usage is likewise refused on a cancelled or completed subscription ( 422 invalid_state ), and an unknown or cross-environment subscription id is 404 not_found . List usage GET /api/v1/subscriptions/{id}/usage Returns all usage items recorded for the subscription's current billing period. Response shape per item: id — UUID of the usage row. subscriptionId — parent subscription UUID. kind — usage category string. unitCount — units reported. unitPriceCents — per-unit price. totalCents — computed unitCount × unitPriceCents . periodStart / periodEnd — ISO 8601 timestamps bounding the current billing period. createdAt — when the row was first written or last upserted. Multiple usage kinds A subscription can carry any number of independently tracked usage kinds within a period. At renewal every kind's totalCents is summed and added to the renewal charge. Billing at renewal At renewal the subscription is charged its base amount plus the sum of all usage totalCents for the ending period, and each usage kind appears as its own line item on the renewal order and invoice. No prorations are applied — the full usage overage is billed in the renewal cycle it was accrued in. After a successful renewal all usage rows for that period are finalized; new usage accumulates against the next period. Each usage line item is written with type: "usage" . It needs no fulfilment ( deliveryMethod: "none" ), and its presence does not change the renewal order's own type — the order stays recurring , same as a renewal with no usage on it. usage is written by the renewal job only: it appears in order responses, never as a line item type you can send — POST /api/v1/carts/{id}/items , quotes, and manual order line-item edits all reject it. Usage recorded after the renewal cron runs for a period is attributed to the next period. Send your final tally before the periodEnd timestamp on the subscription. Next Managing Subscriptions — pause, resume, cancel, and change plan. Subscription Webhooks — event types fired at renewal and state changes. Scopes reference — subscription_usage:read / subscription_usage:write scope details."},{"title":"Subscription Webhooks","route":"/developers/subscriptions/webhooks","headings":["Subscription Webhooks","Event types","Example payload","Plan change scheduled (downgrade deferred)","Plan changed (upgrade applied or downgrade finalized)","Completed (installment plan paid in full)","Installment plans: paymentIndex and the schedule fields","The card and the payment","Reference handler","Delivery semantics","Common pitfalls"],"text":"Subscriptions Subscription Webhooks Webhooks are the source of truth for subscription state. Your DB stays in sync without polling, and you decide which events translate to buyer emails or in-app notifications. Throttle sends transactional emails to buyers automatically for the events that matter most — welcome, renewal receipt, renewal reminder, trial ending, payment-failed, cancellation, plan-changed, and paid-in-full — so you don't need to build these from webhooks. See Lifecycle and States for the full list. Webhooks are still how you drive anything beyond that: your own additional buyer-facing message, delivered by your own provider (Resend, Postmark, SES), or an in-app surface like the <DunningBanner /> component. Event types trialing subscription converts, or on the first hourly run after signup when the trial is shorter. Carries data.trialEnd (ISO 8601, when it converts and takes its first payment). Throttle emails the buyer a trial-ending notice at the same time, so you only need this webhook for your own message or app state. Sent once per trial end: moving the trial with PATCH trialEnd sends a fresh one. A cancelled or converted trial gets none. , Warn the buyer before the first charge. Remind the merchant that a trial is about to convert. , ], [ code: subscription.activated , html: A trialing subscription flips to active at trialEnd : this is the trial conversion. It fires before the first charge, so a declined card follows it with subscription.payment_failed . , Optional your trial ended, you are now subscribed email. , ], [ code: subscription.renewed , html: A renewal charge succeeded and the period advanced. Carries data.payment (the public payment ) and data.order when a charge was made. A period that cost nothing carries data.freeRenewal: true and no payment or order : none is created (see Renewal ). , Ledger entry. Receipt email (optional). , ], [ code: subscription.backup_pm_used , html: The card the renewal tried first was declined and another of the buyer's cards paid. data.backupPaymentMethod is cardBrand, cardLastFour of the card that paid. data.repinned: true when the subscription's own card hard-declined (expired, an invalid card number, lost or stolen): the subscription now renews on the card that paid, and data.subscription.paymentMethodId is that card. No separate subscription.updated is sent for that move. , Tell the buyer which card was charged; on repinned, that it is now the card for this subscription. , ], [ code: subscription.invoice_refunded , html: One billing cycle was refunded. data.intent is money_only (the subscription keeps billing) or refund_and_cancel (it was cancelled too). data.amountRefunded is what this refund moved, data.totalRefunded is the cycle s running total, and data.fullyRefunded says whether the cycle is now whole. The same event is recorded in the event feed ( GET /api/v1/events ) with entityType: "subscription" and entityId set to the subscription id, so ?entityType=subscription&entityId=<id> finds it. It is emitted for both refund routes: the dedicated cycle refund and cancel with a refund . , html: Ledger entry and refund receipt. Do not revoke access on money_only — wait for subscription.cancelled . , ], [ code: subscription.payment_failed , html: Each of the first three failed renewal attempts (the fourth cancels instead). Includes attempt , nextRetryAt , cancelsAt (when it is cancelled if every remaining retry fails), and lastError in the payload. , Payment-failed email. First failure is the most important. , ], [ code: subscription.past_due , html: The subscription moved to past_due : fires once, on the first failed renewal attempt. , Mark the account past due and show an update-card prompt. , ], [ code: subscription.updated , html: Plan, amount, interval, or metadata changed via PATCH, or the product inputs were replaced via PATCH /api/v1/subscriptions/:id/inputs ( data.subscription.inputs is the new snapshot, [{ key, label, type, value, displayValue }] , and the subscription object now carries inputs on every event: null when the plan had none), or a pending plan change was cleared via DELETE …/pending-change . Also fires when the card a subscription renews on changes: the merchant picks a card for it ( PATCH /api/v1/subscriptions/:id/payment-method , or Change card in the dashboard), the buyer does ( PATCH /v1/storefront/me/subscriptions/:id/payment-method , or PATCH /api/v1/me/subscriptions/:id/payment-method from the billing link), or a new default card moves the subscriptions that were on the previous default. Picking a card for one subscription fires once, for that subscription only; through the merchant or storefront route, picking the card it already has fires nothing. data.subscription.paymentMethodId is the new card. Deleting a card a subscription uses does not fire it: the subscription silently falls back to the default card. An immediate seat change ( POST …/change-quantity with effective: "now" ) also fires it, with data.proration shaped as on subscription.plan_changed . , Confirmation email if buyer-initiated. , ], [ code: subscription.plan_change_scheduled , html: A plan change was deferred to the next renewal via POST …/change-plan with effective: "period_end" . The data.pending object contains the new plan details, and data.effectiveAt is the period-end ISO timestamp. , html: Notify the buyer: "your plan change to X takes effect on [date from effectiveAt ]". Show the pending change in your billing UI. If the change is later cancelled via DELETE …/pending-change , subscription.updated fires. , ], [ code: subscription.plan_changed , html: A plan change was applied. Fires in two situations: (1) an immediate upgrade ( effective: "now" ) charged and applied right away, or (2) a scheduled downgrade applied by the renewal cron at period end. In both cases, the data.subscription payload reflects the new plan fields and all pe"},{"title":"Team Management","route":"/developers/team-management","headings":["Team Management","Workspaces vs applications","Workspace concepts","Application concepts","Roles","Workspace roles","Application roles","Who can invite","Environment grants","Invite lifecycle","Token properties","Invite states","Accept flow","Member management","Workspace-level actions","Application-level actions"],"text":"Workspace Team Management Throttle organises access around workspaces and applications . A workspace is the billing and membership boundary; each workspace can contain multiple applications and multiple workspace environments. Role assignments exist at the workspace and application levels, while environment grants decide which production or non-production environments a member can see. Workspaces vs applications A workspace is the top-level container. It holds subscription and billing state, and every member with a workspace-level role can act across all applications inside it. An application maps to one storefront or integration surface. A workspace environment is the isolation layer shared across applications: production is immutable, and custom environments such as test, UAT, QA, and staging are non-production sandbox-provider environments. Workspace concepts One owner — the Clerk user who created the workspace. Unlimited workspace admins — implicit admin on all applications. Members with per-application roles. Shared billing across all applications. Environment grants for production, all non-production, or selected environments. Application concepts Scoped API keys, webhooks, and checkout sessions. Per-member roles: admin , developer , finance , viewer . Reads and writes are filtered by the active workspace environment. Roles Throttle checks two role axes for every request: the caller's workspace role and, for application-scoped actions, the caller's application role on the specific application being accessed. A permission is granted if either axis satisfies the rule — see the Permissions reference for the full matrix. Workspace roles owner — assigned to the workspace creator; one per workspace; cannot be transferred via the API (use the transfer ownership flow). Holds every permission, including workspace deletion and billing management. workspace_admin — full administrative access across all applications. Can invite members, edit member roles, and manage application settings. Cannot delete the workspace or access billing. Application roles admin — manage application settings, API keys, webhooks, and all member roles within the application. Can invite new members to the workspace with an application-scoped role. developer — access API keys, webhooks, customers, and orders (read and write). Cannot change application settings or member roles. finance — read customers, orders, payments; issue refunds. No write access to orders or customers. viewer — read-only access to customers, orders, and payments. Who can invite Invite rights depend on the inviter's own role. You can never grant a role higher than your own. Inviter role Can invite as Application scope owner Any role (including workspace_admin) Any application in the workspace workspace_admin Member with any application role Any application in the workspace admin (application member) Member with developer , finance , or viewer Only the applications they are admin on Only the owner can grant the workspace_admin role. This maps to the workspace:invite-admin permission. Environment grants Environment grants are workspace-wide. They sit beside roles: a member must have the right role for the action and access to the active environment. Owners and workspace admins can set grants on invites and member edits; application admins can invite members only into their current application and those invites default to all non-production environments. grantType Meaning all All active environments, including production and future custom environments. all_non_production Every active non-production sandbox-provider environment. production_only Only the immutable production environment. selected Only the listed environment UUIDs. A dashboard or Clerk-authenticated API request for an environment outside the member's grant returns 403 member_env_forbidden . Invite lifecycle Invitations are short-lived signed tokens. The flow from creation to membership is: Create — POST to /api/v1/workspaces/ workspaceId /invites with the invitee email and target role(s). Throttle mints a 7-day JWT and emails the invite link. Email sent — the invitee receives a link to /accept-invite?token=... from Throttle. The email address on the invite must match the Clerk account used to accept. Resend — POST to /api/v1/workspaces/ workspaceId /invites/ id /resend . Throttle rotates the token (old token is immediately invalidated) and sends a fresh email with a new 7-day window. Revoke — POST to /api/v1/workspaces/ workspaceId /invites/ id /revoke . The token is killed immediately and the invitation can no longer be accepted. Accept — see the accept flow section below. Token properties Signed JWT — tamper-proof and server-verified on accept. 7-day TTL from creation or last resend. Single-use — accepting invalidates the token. Strict email match — the signing email must equal the Clerk account email. Invite states pending — awaiting acceptance, token valid. accepted — member joined, token consumed. revoked — cancelled by an admin; token dead. expired — TTL elapsed before acceptance. Accept flow Accepting an invitation binds a Clerk user to the workspace membership record. The invitee clicks the link in the email and lands on /accept-invite?token=... . If not already signed in, the invitee authenticates via Clerk. The Clerk email must exactly match the address the invite was sent to — mismatches are rejected with invite_email_mismatch . The browser POSTs the token to POST /api/v1/invites/accept with the Clerk session JWT in the Authorization header. On success the member record is created, role assignments are applied, and the invitee is redirected to the workspace dashboard. If the accepting user is already a member of the workspace, the API returns 409 already_member . Existing roles are not modified. Member management After a member joins, their roles and access can be adjusted at any time by users with sufficient permissions. Workspace-level actions List member"},{"title":"Test Your Integration","route":"/developers/testing","headings":["Test Your Integration","Fastest check: Run test checkout","Environments","The Card Simulator","What to enter at the payment step","Causing a decline","What the simulator does not reproduce","Testing against a processor sandbox","Testing webhooks","Testing other areas","Before you launch","Remove it again when you are done.","A specific event type the endpoint is subscribed to"],"text":"Testing Test Your Integration Everything on this page happens in a non-production environment, where no real card is charged. Start with the dashboard test checkout to confirm your configuration, then run the same payment from your own storefront and check the webhooks it produces. Fastest check: Run test checkout The dashboard can mint a session and show you the result without any code of your own. Use it first: if this works and your integration does not, the difference is in your code or your origin, not in the application's setup. Select a non-production environment in the top bar. The test session is created in whichever environment is selected. Open App in the left nav, then the Checkout tab. The tab is shown to team members who can manage API keys. In the Try it card, click Run test checkout , then Mint test session . Pay in the embed that appears, as described under the Card Simulator below. The session is for one unit of the application's main currency (1.00 USD on a USD application). The dialog shows three things side by side: The embed — the same payment surface your storefront mounts. postMessage events — each event the embed posts to its parent page, with its type and time, such as throttle.ready and throttle.completed . These are the events your page receives; see the embedded checkout event reference . Webhook deliveries — the event type and delivery status of webhooks sent to your endpoints, refreshed every three seconds. The list stays empty until the selected environment has a webhook endpoint. The embed only renders on an allowed origin, so minting a test session adds the dashboard's own origin to the selected environment's Allowed origins if it is not already there. Your storefront origin still has to be added separately. Environments Every workspace has one production environment and any number of non-production environments. Keys, allowed origins, payment connections, webhook endpoints, orders and customers all belong to one environment, so nothing you create while testing appears in production. A key's prefix names its environment: sk_live_* for production, the environment's slug otherwise ( sk_test_* , sk_uat_* ). See Workspace environments . The Card Simulator When an application is created, Throttle turns on a Card Simulator and a PayPal Simulator in each of the workspace's non-production environments. They are listed on the Payment methods tab under App . A simulator stands in for a processor: the payment runs through the same session, order, payment and webhook path as a real one, but no processor is contacted and no money moves. If a non-production environment shows no active payment service, add the Card Simulator there with Add payment method . What to enter at the payment step The embed shows a card form. The simulator approves the charge whatever card number you give it, so there is no list of test numbers to learn. Use: Submit the form. Your onSucceeded callback fires with the orderId and paymentId , and the order appears under Orders in the same environment. Very small amounts (under about 0.50) have left the simulator's form spinning with no event fired. Test with a session total of 1.00 or more. Causing a decline Because the simulator approves every card number and amount, no “bad” card number produces a decline. Cause one with a decline rule instead, which is the same mechanism you would use in production to refuse traffic you do not want. Rules can match amount, currency, country, card scheme, card type or metadata. Set them with a secret key that holds connectors:write , or in the Routing section of the Payment methods tab. Rules are saved per environment, so a rule set with a non-production key does not affect production. Remove it when you are finished so later tests are not declined by surprise. What the simulator does not reproduce Issuer behaviour. There are no card numbers for insufficient funds, expired cards or other specific refusals. A decline rule is the only way to get a decline. 3-D Secure by card number. A challenge is not raised by the card number alone, including the numbers other processors treat as 3-D Secure test cards. It has to be configured; see Secure Fields , which also lists the other failures worth driving (double submit, an already-paid session, a saved card on a guest checkout). A real processor's responses. Fees, settlement timing, disputes and processor-specific error detail only exist once a processor is connected. Testing against a processor sandbox Each environment has its own payment connections and credentials. Non-production environments take a processor's sandbox credentials and production takes live ones, so you can connect a processor's sandbox account to a non-production environment and test against it before you go live. Once a sandbox processor handles the payment, the card numbers, test accounts and outcomes are that processor's, not the simulator's. Use the test values from the processor's own documentation. Connection steps are in Payment connectors . Testing webhooks Webhook endpoints belong to one environment and only receive that environment's events. Create the endpoint in the environment you are testing in, then use these tools rather than waiting for a checkout to produce each event. With no body, the test event is a payment.captured sample. An endpoint subscribed to specific event types only accepts a test for one of those types; anything else is 400 validation_error , and the message lists the types it will accept. To exercise your own handler logic, send eventType with a data object. It is delivered as the event's data in place of the built-in sample. A replay sends the same payload again with a new signature, so it also proves your handler is idempotent: the second delivery of an event must not repeat its side effects. The same tools are in the dashboard under Developers → Webhooks"},{"title":"Use Webhooks as Your Source of Truth","route":"/developers/webhooks","headings":["Use Webhooks as Your Source of Truth","Create an endpoint","Verify signatures","Rotate the signing secret","Process idempotently","Recommended fields","Event families","Abandoned carts & cart lifecycle","Payload envelope","Event payload reference","{group.label}","Payments and saved cards in payloads","No longer sent","Every read surface uses the same shape","Event scope reference","Retries","Manage endpoints","Inspect deliveries","Send a test event"],"text":"Event delivery Use Webhooks as Your Source of Truth postMessage events make the browser feel instant. Signed webhooks tell your backend what actually happened, even if the buyer closes the tab. Create an endpoint Register an HTTPS endpoint and choose the events your backend can process. Store the returned signingSecret securely; it is shown once. enabledEvents must be exact event-type strings from the catalog — Throttle uses payment.captured and subscription.cancelled , not Stripe-style payment.succeeded or subscription.expired . Fetch the full list from GET /api/v1/event-types . An unknown name is rejected with 400 ; the error’s details[].allowedValues enumerates every accepted event type. /api/v1/webhook-endpoints is the canonical, signed outbound webhook system documented on this page ( enabledEvents , a whsec_ signing secret, X-Throttle-Signature , plus /deliveries , /replay , and /test ). The older /api/v1/webhooks family ( events , no signed delivery) is deprecated and no longer delivers events — its delivery worker has been decommissioned. Responses carry Deprecation + Sunset: 2026-10-11 headers; the routes will be removed after 2026-10-11 . Migrate any integration still pointing at it to /api/v1/webhook-endpoints . Verify signatures Each delivery includes X-Throttle-Signature (format t=<unix_seconds>,v1=<hex> ). Compute HMAC-SHA256 over <timestamp>.<raw body> . The verifier below also rejects deliveries whose timestamp falls outside a tolerance window (default 300s) so a captured delivery cannot be replayed indefinitely, and guards against a malformed v1 so a bad header returns false instead of throwing in your handler. Signature checks fail if your framework parses and reserializes JSON before verification. Capture the raw request body first, then parse JSON after the signature passes. Verify the signature, then parse the envelope, and report the two failures with different status codes. If a strict schema rejects a field it has not seen and your handler answers with the same 401 it uses for a bad signature, a routine additive change looks like a rotated secret from the outside. That is exactly how an extension lost every delivery for hours on 2026-09-08 when environmentKind shipped. Throttle retries a 401 on the normal ladder; a 4xx that names a schema problem is far easier to find in the delivery log. Rotate the signing secret POST /api/v1/webhook-endpoints/:id/rotate-secret mints a new whsec_ and returns it once. For graceSeconds (default 86400, max 604800) every delivery is signed with both secrets — the header reads t=…,v1=<outgoing>,v1=<new> — so you can swap the secret in your config on your own schedule without a failed delivery. Send graceSeconds : 0 to revoke the old secret immediately when it has leaked. The response carries previousSecretExpiresAt . The verifier above accepts the header if any digest matches your secret, which is what makes the window seamless. A verifier that keeps only the last v1 still works — it verifies from the moment you deploy the new secret, and rejects until then, exactly as before the window existed. Process idempotently Webhook delivery is at-least-once. Store each event id before applying side effects so retries do not double-fulfill, double-email, or double-book revenue. Deduping on event id covers retries . It does not cover a genuine repeat: order.created fires exactly once per order, but every other order lifecycle event is at-least-once by design, and a repeat carries a new event id. Moving an order backwards is a supported merchant action, so shipped → awaiting_fulfillment → shipped sends order.shipped twice. That is deliberate — a merchant who rewinds and re-ships has usually re-shipped, and suppressing the second event would be the one case where a shipping notification must not go missing. Make handlers that must not act twice idempotent on the entity and target state, not on the event id alone. If a paid order has line items marked fulfillmentType: 'digital' or fulfillmentType: 'access_grant' , Throttle creates and completes those fulfillment rows after the order enters awaiting_fulfillment . Listen for fulfillment.completed and order.completed (an order with nothing to ship completes on its own) or order.shipped (an order with something to ship) in addition to payment events when you need to mirror delivery state. fulfillment.shipment.delivered now fires when the arrival is recorded — a call to POST /fulfillments/ id /delivered — and no longer when the shipment fulfillment is completed. Completing a fulfillment is carrier handoff, so the old timing announced a delivery while the parcel was still moving. Merchants who complete a fulfillment and never call the new endpoint will not see this event at all; listen for fulfillment.completed if what you want is handover. The payload gained the shipment object, so data.shipment.actualDelivery carries the arrival timestamp. The buyer-facing customer-order-delivered email follows this event, and so moved with it. Recommended fields event_id unique identifier from the delivery envelope. event_type for routing and debugging. event_version from the delivery envelope for payload migrations. environment_id from the delivery envelope for environment-scoped processing. processed_at timestamp after side effects finish. payload raw JSON for audit and replay. Event families OUTBOUND_EVENT_GROUPS.map((group) => ( group.label ( group.events.length events) )) Abandoned carts & cart lifecycle Carts are authoritative in Throttle. When your storefront creates a native cart ( POST /api/v1/carts ), Throttle tracks its whole lifecycle and detects abandonment server-side — you don't build your own timer. cart.abandoned — a nightly sweep marks an open cart abandoned once it sits idle past the application's configured threshold (or you can react immediately on delivery). A cart built from an accepted quote, or in the dashboard order "},{"title":"Zapier","route":"/developers/zapier","headings":["Zapier","Connecting your account","Triggers","What a trigger hands the next step","Searches","Actions","When something goes wrong"],"text":"Tools Zapier The Throttle Zapier integration puts your orders, payments, subscriptions, quotes and invoices in front of every other app Zapier connects to. It authenticates with OAuth — no API key to copy, and no key to rotate when someone leaves. Zapier speaks REST and webhooks, not the Model Context Protocol. This is a separate integration over the same public API, and it needs no MCP setup. If you want Throttle inside Claude, Cursor or another AI assistant, use the MCP server instead — the two are independent and can both be connected at once. Connecting your account Add Throttle as a step in any Zap and choose Connect a new account . You'll be sent to Throttle to sign in, pick the workspace, application and environment the connection should use, and approve the permissions it asks for. A connection is pinned to the workspace, application and environment you picked at approval time, and nothing inside a Zap can move it. Connect a sandbox environment first and verify the Zap end to end there; to run the same automation against production, add a second Throttle account in Zapier. The account picker labels each one Workspace · Application · environment so the two are never confused. The permissions requested cover exactly the triggers and actions listed below — read access to orders, customers, subscriptions, quotes, invoices, payments, carts and the event log, write access to customers, quotes and carts, and permission to manage the webhook endpoints your triggers create. It also asks to read customers' personal data (names, emails, phone numbers and addresses, customer_pii:read ): that is what most Zaps move, and every trigger needs it, because a webhook delivery carries the full record. Throttle's AI-assistant connections can never be granted it; Zapier can because it is registered as an automation connector. Refunds, payment capture and other money-moving verbs are not requestable over OAuth and are deliberately absent from this integration. Triggers Every trigger is a real-time webhook, not a poll — a Zap fires within seconds of the event, and there is no polling interval to wait out. Turning a Zap on creates a webhook endpoint in your workspace subscribed to that one event type; turning it off deletes it. New order — order.created Payment captured — payment.captured Payment failed — payment.failed New subscription — subscription.created Subscription cancelled — subscription.cancelled Quote accepted — quote.accepted Cart abandoned — cart.abandoned Invoice past due — invoice.past_due You'll see these endpoints in your dashboard alongside any you made by hand. They're marked as owned by Zapier — delete the Zap rather than the endpoint, or the Zap will go quiet with no error. What a trigger hands the next step Throttle delivers this envelope: Zapier flattens it so the entity's own fields are available directly in the field mapper: id is the event id, because that is what Zapier deduplicates on and what stays stable when a delivery is retried. The order, payment or subscription's own id is resourceId — map that one when the next step needs to look the record up. Searches Search customers — by name, email or your own external id. Search orders — newest first, with status and payment-status filters. Search quotes — filter by status, e.g. to chase quotes about to expire. List invoices — issued invoices, filterable by status. Receivables aging — outstanding receivables bucketed by age. List subscriptions — filterable by customer and status. Actions Create a customer — email and external ID are each unique per application, so a buyer who already exists makes the step fail with customer_already_exists . Run Search customers first when the buyer may already exist. Update a customer — only the fields you fill in are touched; everything else is left alone. Create a quote — drafts a quote with line items and terms. It is not sent to the buyer. Create a checkout link — builds a cart from line items and returns a hosted checkout URL. Every amount is an integer in the smallest currency unit: 2500 is 25.00 in a two-decimal currency, and 25 is 0.25. A checkout link created on a production connection is buyer-facing and takes real payment. Actions carry an idempotency key derived from the Zap step and its inputs, so a retried run lands on the record the first attempt created rather than making a second one. When something goes wrong “Reconnect your Throttle account and approve this permission” — the connection was approved without a permission the step needs. A connection's permissions are fixed at approval time, so reconnecting is the only fix. “Allow access to customers' personal data” ( oauth_customer_pii_required ) — turning on a trigger creates a webhook endpoint, and deliveries include customer details, so the connection must hold that permission. Reconnect and approve it. An environment mismatch — the step is reaching for data in an environment this connection isn't pinned to. Connect the other environment as a second Throttle account. A Zap goes quiet — check whether its webhook endpoint still exists in your dashboard under Webhooks . Turning the Zap off and on again recreates it."},{"title":"Internal Support Module","route":"/internal/support","headings":["Internal Support Module","Routes","Auth","Workspace identity model","Webhook payload contract","See also"],"text":"Internal Internal Support Module Powers the in-dashboard support feature backed by dispatchtickets.com . These endpoints are not part of the public API surface for merchant integrations — only the Throttle dashboard consumes them. This page is intentionally excluded from the docs sidebar and the search index. Merchant API keys cannot call these routes and they are subject to change without a developer changelog entry. Routes All routes are mounted under /api/v1/workspaces/:wsId/support/* and require a Clerk JWT that resolves to a member of :wsId . Method Path Permission Notes GET /tickets support:read List tickets for the workspace. GET /tickets/:id support:read Ticket detail + comments. POST /tickets support:write File a ticket. Audit-logged. Idempotent. POST /tickets/:id/comments support:write Reply to a ticket. Audit-logged. Idempotent. POST /tickets/:id/read support:read Mark ticket read for the current user. GET /unread-count support:read Badge count for the current user. POST /attachments/presign support:write Issue a presigned upload URL. POST /attachments/:attachmentId/confirm support:write Finalise an upload once the PUT completes. Plus the public webhook receiver POST /api/v1/support/dispatch-webhook , which has no Clerk auth and is gated solely by the signed X-Dispatch-Signature header. Auth The workspace-scoped routes accept Clerk JWTs only . API-key callers receive 403 application_key_workspace_route because these endpoints sit under a workspace-scoped router rather than the application-scoped one. POST /tickets and POST /tickets/:id/comments require an Idempotency-Key header (UUID v4 recommended). The server falls back to a body-hash synthetic key if the header is missing, but stable client-supplied keys are required to make retries safe across browser refreshes and React strict-mode double-effects. Workspace identity model Each Throttle workspace maps to exactly one Dispatch customer record. The synthetic customer email follows the pattern workspace-<workspaceId>@support.throttle.internal . The real human filer identity is captured separately so support staff can reply to a person rather than the workspace: Ticket body footer line: Filed by: … Each comment carries authorName and authorId for the Clerk user that posted it. Ticket customFields include filer_user_id , filer_email , type , and browser_info . Webhook payload contract Dispatch posts events to /api/v1/support/dispatch-webhook with an HMAC signature header: X-Dispatch-Signature: t= ,v1= The signed payload is $ unixSeconds .$ rawBody . The server enforces a 5-minute replay window. Event types handled: comment.created — when authorType === 'STAFF' , the corresponding ticket row is marked unread for all workspace members. ticket.created — no-op locally; the filer already saw the ticket they just filed. ticket.updated / ticket.closed — propagated to the dashboard via the next list/detail read; no local caching layer needs invalidation. Other event types return 200 as a no-op. A bad signature returns 401 invalid_signature . For properly signed events, downstream errors are logged and swallowed with a 200 response to avoid Dispatch retry storms. See also Design spec: docs/superpowers/specs/2026-05-17-dispatch-support-feature-design.md Implementation plan: docs/superpowers/plans/2026-05-17-dispatch-support-feature-plan.md Runbook: docs/superpowers/runbooks/2026-05-17-support-module.md"},{"title":"Product Catalog storefront","route":"/product-catalog","headings":["Product Catalog storefront","The API","The SDK","How carts reach checkout","Pushing products in","Versioning","New in 1.2","Guides","{page.label}"],"text":"Product Catalog Product Catalog storefront The Product Catalog extension keeps a store's products in Throttle. Its storefront API serves them to the store's own website: product lists with filters and facets, product pages, categories, collections, search, prices per currency and per customer, reviews, and carts that end in Throttle's checkout. The @usethrottle/catalog SDK is a typed client for all of it, with React hooks, Next.js helpers and URL helpers for shop pages. The API Every storefront route lives under one base URL and takes a publishable key in the X-Catalog-Key header: Answers are JSON. Prices are integers in minor units (cents for USD). Only public products are ever answered: a product is public when it is active, not a draft, and has at least one active variant. No parameter widens that. The OpenAPI 3.1 document of the API is at catalog.usethrottle.dev/v1/storefront/openapi.json , and the API reference renders it. The SDK It runs on Node.js 20 or later and in evergreen browsers. Its only runtime dependency is @usethrottle/errors ; React 18.2 or 19 is an optional peer, needed only for the React entry. It has five entry points: How carts reach checkout The storefront never sends a price. Your page sends SKUs and quantities to carts.create ; the catalog prices every line itself, creates the cart in Throttle and answers cartUrl , Throttle's hosted cart page. The shopper reviews the cart there and pays on Throttle's checkout. When a line is added or changed, when the cart is refreshed and again at checkout, Throttle asks the catalog to price the lines (the line resolver ), so a cart always charges the catalog's price. To build your own cart page instead, keep the cart session the create answers and change it with carts.session(id) or React's useCart , then hand the shopper to checkout with checkout() . Optional return URLs bring the shopper back to your store after paying. Cart and checkout has the details. Publishable keys are public: they ship in your page's code and anyone can read them. A key's allowed websites protect browsers only; a script can send any Origin . Carts are protected by server-side resolution: the catalog prices every line on its side, so nothing a key holder sends can change a price. See Keys and channels . Pushing products in The storefront API reads the catalog. To write to it from a server, use the Catalog Push API : staged jobs for merchants and vendors. Start with the first feed guide , or point an AI agent at the agent reference . Versioning From 1.0.0 the package follows semantic versioning: a breaking change to an exported name, a type, an error class or code, or a hook's behaviour comes only in a major version. New answer keys, new error codes in (string & ) positions and new optional options are minor. Deprecated names keep working for at least one major. The reference store at throttle-demo-store.vercel.app runs @usethrottle/catalog 1.0.0. New in 1.2 useTags, useCollections and useReviewEligibility in @usethrottle/catalog/react/extras , and useCustomerKey in /react . keepPreviousData with dataFor and isPreviousData , and refresh errors with isStale and automatic retries of network, timeout and 5xx failures. The customer's cart on any device ( customerCart , with @usethrottle/auth 0.12.0 or later and a known currency). keyInQuery : browser reads send ?key= and need no preflight. A server key in a URL is refused with 403 KEY_NOT_ALLOWED_IN_URL . Suggestions never send the customer token , so they always show list prices, in every mode. A store that showed group prices in suggestions now shows list prices there. Product, related, suggestion, collection, category and review answers include a 640 px image size for every image at least 640 px wide; the legacy search, vehicles and lite product answers keep 400, 800 and 2048. Until that copy is stored it is served from the next larger stored copy. Guides pages.map((page) => ( page.label page.description Open guide ))"},{"title":"Storefront API Reference","route":"/product-catalog/api-reference","headings":["Storefront API Reference","Sending the key","{group.name}","Error codes"],"text":"Product Catalog Storefront API Reference Every operation of the storefront API at https://catalog.usethrottle.dev , rendered from its OpenAPI document. Every route except the document itself takes a publishable key in X-Catalog-Key . Sending the key A GET may send the key as ?key= instead of the header, so a browser read needs no preflight. A browser, app or legacy key is accepted this way, never together with the header (that is a 400 INVALID_REQUEST ): a server key in a URL answers 403 KEY_NOT_ALLOWED_IN_URL , and a POST always uses X-Catalog-Key . The customer token is never accepted in a URL; it travels in X-Customer-Token . The SDK's suggest never sends it, so suggestions from the SDK are list prices. See Keys and channels . Download the OpenAPI document groups.map((group) => ( group.name group.description group.endpoints.map((item) => ( )) )) Error codes Every error answers the same envelope, with a stable error.code . These are all the codes the API returns, with their HTTP statuses and whether a retry can succeed."},{"title":"Volume pricing","route":"/product-catalog/bulk-pricing","headings":["Volume pricing","The model","Who gets which table","The price rule","Rounding","Worked examples","Push a table","Percent","Amount off","Fixed price","All buyers, and clearing","CSV and XLSX","Blank cells and clearing","In the cart","On the product page","In the dashboard","Errors"],"text":"Product Catalog Volume pricing Volume pricing gives a buyer a lower unit price when they buy more. A tier table belongs to a customer group's price list. A buyer in that group gets the table. A table for all buyers covers everyone else. Every unit takes the tier price, not just the units above the threshold. The model A tier table belongs to one product and one target. The target is a Throttle customer group , or * for all buyers. A product has at most one table per target, and at most 50 group tables, plus the all-buyers table. A table holds up to 10 tiers . Each tier has a minQuantity (a whole number from 2 to 1,000,000), an optional maxQuantity (at least minQuantity , at most 1,000,000), and one effect. A tier with no maxQuantity ends one unit before the next tier starts. The last tier is open. Tiers may leave gaps. They may not overlap. The quantity is counted per product . Every variant of the product in the cart adds to it. Both group kinds may have tables: a fixed group and a percent group. Groups live in Throttle. The catalog stores the table under the group's id. You may name a group by name (any case) or by id when you write a table. The three tier types are the same for every target. percentBps , 1 to 9999 (100 = 1%), so a tier is always below 100%. One value for the product, used in every currency. , ], [ code: amountOff , An amount off each unit. , html: amounts[sku][CUR] , in minor units, at least 1. One value per variant and currency. , ], [ code: fixedPrice , A fixed unit price. , html: prices[sku][CUR] , in minor units, at least 1. One value per variant and currency. , ], ] /> One table may mix types. A variant or currency with no entry gets no price from that tier. The catalog never converts a currency: an amountOff or fixedPrice value works only in its own currency. A percent tier works in every currency. There are no free tiers. A fixedPrice of 0 and a percent of 100 are refused with BULK_TIERS_INVALID . A percent or amount-off tier never prices below 1 minor unit, so an amount off at or above the price gives 1, not 0. Tables saved before this rule keep working as stored. Who gets which table The catalog first works out the buyer's group, with the same proof that group prices need (see Customer prices ). Then it picks one table. * ), if any. , The list price. ], [ In an enabled group, identity proven, and the group has a table for the product , The group’s table. , The buyer’s group price. ], [ In an enabled group, identity proven, and the group has no table for the product , The all-buyers table, if any. , The list price. The tier counts only if it beats the group price. ], [ In a group, identity not proven (a publishable key with no customer token) , The all-buyers table, if any. , The list price. ], [ In a disabled group , The all-buyers table, if any. , The list price. ], [ Any buyer, when the install has no group grant (see below) , The all-buyers table, if any. , The list price. ], ] /> A buyer never gets two tables. A group table beats the all-buyers table. The legacy catalog /v1/checkout names no customer, so it applies only the all-buyers table. Throttle sends a buyer's group only to installs whose pinned version holds customer_groups:read (or :write ) explicitly. A * scope does not count. Group prices need the same grant. Without it, every buyer prices as a guest: no group price and no group tier. The all-buyers table still works. The price rule The catalog works out one unit price in four steps. List price. The variant's price in the cart's currency. A sale price is already applied. Group price. A fixed group uses its entry for the variant. A percent group takes its percent off the list price. With no group, or no entry, the price stays the list price. Tier. Add up the quantity of the product's lines. Find the tier whose range holds it. Take its effect off the group price (the list price for the all-buyers table). Guard. Use the tier price only if it is below the price from step 2. A tier never raises a price. This matters for fixedPrice tiers. When a tier applies, the compare-at price is the list price (if the tier price is below it), and the line shows the tier's minQuantity . Discount codes apply after this. Tax and multi-currency use the unit price as it comes out. Rounding Each step rounds once , to the currency's minor unit, half up. The group price is a price the buyer sees, so it rounds first. Percents never combine in basis points. A percent group with a percent tier is two steps and two roundings. The percent text turns into basis points with whole-number math. 29.75 becomes 2975 exactly. A percent may have at most two decimals. Worked examples All amounts are USD. The SKUs are made up. List price is $100.00 and the Dealer (fixed) group price is $88.00, unless the row says otherwise. Push a table Send bulkTiers on a push row. It is keyed like groupPrices : by group name (any case), by group id, or * for all buyers. The value is that target's whole table for the product. See the push reference for the merge and clear rules. Percent Amount off The values are per SKU. Each row carries its own SKU's amounts. Rows of one product combine into one table, so every row must send the same ranges and types. Fixed price All buyers, and clearing null or [] clears that target's table for the product. A key you leave out changes nothing. A key must name a group Throttle still lists, or the whole row is refused with GROUP_NOT_FOUND . Tables of deleted groups are removed by a daily sweep. CSV and XLSX The standard columns are bulk_tier:<group>:<n>:<part> . The group is a name or id, or * for all buyers. n is the tier, 1 to 10. The group may contain colons, because the column is read from the right. percent , amountOff , fixedPrice or none . Also read: fixed as fixedPrice , and price as amountOff . none on tier 1 clears the table. ], [ code: percent , html: A percent, such as 15 , 12.5 or"},{"title":"Cart and checkout","route":"/product-catalog/cart-and-checkout","headings":["Cart and checkout","Resolved carts","Volume prices on cart lines","Create a cart: carts.create","Return URLs: back to your store","Your own cart page: carts.session","In React: useCart","Signing in with a cart","Switching currency makes a new cart","“Only allow prices from installed apps”","Cart errors"],"text":"Product Catalog Cart and checkout A storefront sends SKUs and quantities; the catalog creates a Throttle cart, prices every line itself and answers the link to Throttle's hosted cart page. The shopper pays on Throttle's checkout, and the order lands in Throttle like any other. Resolved carts A cart the catalog creates is a resolved cart : Throttle asks the catalog for the name, price, image and limits of each line when it is added, when its quantity changes, when a shopper signs in and again at checkout (see Line resolvers ). Lines carry catalog prices only, including a signed-in shopper's customer prices . Publishable keys are public, and allowed websites protect browsers only. Carts are protected by server-side resolution : nothing a browser sends can set a line's price, name or image. Throttle refuses a price on a catalog line ( 400 price_locked ) and prices it again from the catalog before every checkout. Volume prices on cart lines A line the catalog prices at a volume tier carries resolution.bulk , an object { minQuantity } with the start of the tier the line is at. It is absent on a line with no tier. It is for display only: the price is the line's unit price. See Volume pricing . The tier depends on the quantity of the whole product, so adding a line or changing a quantity can change the price of the product's other lines. Throttle sends every catalog line of the cart to the catalog on each change, and the cart shows the new prices. Two changes to one cart at the same moment can answer 409 cart_changed . Nothing is written. Retry. Subscription lines count toward the quantity. They keep their signup price. <BulkPriceBadge> shows “Bulk price: 10+” on such a line, and the cart drawer and cart lines components draw it for you. See Storefront components . Create a cart: carts.create carts.create takes 1 to 50 lines with unique SKUs, an optional currency (else the client's currency option, else the store's default currency) and an optional locale for the line names. It answers 201 with cartUrl (Throttle's hosted cart page), sessionId , expiresAt and the priced lines with their subtotal in minor units. Send the shopper to cartUrl : the hosted cart page shows the lines, lets them change quantities and has the checkout button. Pass an idempotencyKey in the call options to make a retry safe: the same key answers the same cart. A line with product inputs shows what the shopper entered under its name, and its add-ons sit indented under it, on the hosted cart, the checkout summary and the quote page. Removing an add-on removes only that add-on; removing the line it belongs to removes its add-ons too. If a required input was added after the line went in, checkout is refused with 422 invalid_line_inputs and the hosted cart asks for the missing value on that line; the shopper fills it in and checks out again. Quote lines are read-only, and unticking an optional line also leaves out its add-ons. Return URLs: back to your store Three optional URLs bring the shopper back to your store. The catalog stores them on the hosted cart session, and Throttle's cart and checkout pages use them: /complete on Throttle's checkout). , ], [ code: cancelUrl , The cancel link on Throttle’s checkout page. , Back to the hosted cart page, which stays open. , ], [ code: storefrontUrl , The “Continue shopping” link on the hosted cart page. , No “Continue shopping” link. ], ] /> Each must be an absolute https: URL of at most 2,048 characters, with no spaces or control characters (otherwise 400 INVALID_REQUEST ). Before it sends a request, carts.create refuses a URL that is not absolute https with INVALID_REQUEST , naming the field. Its website must be on the store's Checkout settings › Allowed return websites (in the Product Catalog dashboard, Settings › General , the Allowed return origins list): an exact origin, https, with no user name or password. Otherwise the answer is 422 RETURN_URL_NOT_ALLOWED , with one issue per refused field, and no cart is created. An empty list refuses every URL. The answer then carries returnUrlApplied : true when Throttle stored all of them, false when it did not (the cart works, and the shopper ends on Throttle's pages). Without any URL the field is absent. The URLs are stored once per session; a create with other URLs gets its own hosted cart session. Throttle's abandoned-cart email links to a new hosted cart session that does not carry your return URLs. A shopper who comes back through that email and pays ends on Throttle's /complete page, not on your store. Your own cart page: carts.session To keep the cart on your site, drive Throttle's cart session yourself. catalog.carts.session(sessionId) answers get , add , update , remove , refresh and checkout . They call Throttle's cart-session routes directly, with the session id as the only credential, so your website must also be on Throttle's allowed origins (see Keys and channels ). checkout( returnUrl, cancelUrl ) needs both URLs, each absolute http or https (unlike carts.create , it accepts http ). It answers checkoutUrl and never navigates. Throttle prices every line again first; if a price changed it answers cart_prices_changed with the repriced cart, and the next checkout goes through. In React: useCart Give CatalogProvider a cartUrls prop with the same three URLs. useCart sends them on every cart it creates, and checkout() uses its returnUrl and cancelUrl unless you pass others; with either missing it rejects with INVALID_REQUEST before any request. Because cartUrls go on every cart create, they must be absolute https URLs on an allowed return website, or every add fails. On http://localhost , say, leave cartUrls out and pass the URLs to checkout(input) . A provider holds one cart. The first add creates it; changes run one at a time, in call order. A session Throttle ended is recreated once from its lines; a purchased cart is nev"},{"title":"Collections, categories, tags and featured","route":"/product-catalog/collections-categories-tags","headings":["Collections, categories, tags and featured","Categories","Collections","Renamed handles redirect","Tags","Featured products","Related products"],"text":"Product Catalog Collections, categories, tags and featured The ways a store groups its products, and the calls that render them. Each of these pages shows its products through products.list , so filters, facets, sorting and paging work the same everywhere (see Products, filters and sorting ). Every count is a count of public products, and a category, tag or collection with none is not listed. Categories categories.tree( depth ) answers the category tree, 1 to 10 levels deep (default 10). Each node has id , handle , name , description , seoTitle , productCount (products in the category or below it) and children . categories.get(handle) answers one category with its breadcrumbs (from the top of the tree down to it) and its children . Its products come from products.list( category ) , which includes the products of every subcategory. A product page carries breadcrumbs too: the path of the product's first category. An unknown handle answers 404 NOT_FOUND . Collections The merchant builds collections in Storefront › Collections . A manual collection is a hand-ordered list of up to 5,000 products; a rule collection holds whatever matches its conditions (brand, type, tag, category, attribute, option, price, featured, availability, how recently created), checked at the time of each request. Each has its own handle, title, description, image, SEO fields and default sort, and only published collections are answered. collections.list( limit, cursor ) pages through the published collections (50 a page by default, up to 100) with their kind , image and productCount . collections.get(handle) answers the collection page: title , description , descriptionHtml (sanitised by the catalog), image , seo , kind and defaultSort . products.list( collection ) answers its products. Without a sort they come in the collection's default sort; manual is a manual collection's own order. An unpublished or unknown collection answers 404 NOT_FOUND . A published collection with no products still answers its page, with an empty product list. Renamed handles redirect When the merchant renames a product or a collection, the old handle keeps working. Asking for it answers redirectTo with the new handle instead of the product or collection. It is a normal answer, not an error: check for it, and send the shopper (and search engines) to the new URL with a permanent redirect. TypeScript makes you handle it, because the answer type is a union: products.get , collections.get and reviews.list all answer either their content or redirectTo . Tags tags.list( q, limit ) answers tags with their product counts, most used first: all of them, or those starting with q (case-insensitive). The default is 50 tags and the most is 200. products.list( tags ) answers products carrying any of the tags. Featured products The merchant marks products as featured on the product page, or in bulk from the Products list. products.list( featured: true ) is the home page block, and featured is also a sort that puts them first (the default sort of a plain list). Related products products.related(handle, limit ) answers products to show beside a product (8 by default, up to 24) in the lite projection. The merchant can pick up to 24 related products per product, in order, and chooses how the list is filled in Storefront › Settings ; config().relatedMode tells you which: Similar products are ranked by what they share with the product: category most, then brand, product type, tags and filterable attribute values. The product itself and anything not public are never included, unavailable products come last, and the order is the same on every request."},{"title":"Customer prices","route":"/product-catalog/customer-prices","headings":["Customer prices","Customer groups","Volume pricing for a group","Send the customer token","A verified email is required","priceContext: which prices an answer carries","A refused token","In React"],"text":"Product Catalog Customer prices A merchant can give some customers their own prices: trade accounts, wholesale buyers, members. The shopper signs in with their Throttle customer account, the storefront sends their token with each request, and the catalog answers their prices. Customer groups Customer groups live in Throttle. The merchant creates them, and adds customers to them, in Throttle › Customers › Groups (or with the Customer groups API ). The catalog stores only fixed prices per variant and currency for a group. A fixed group uses those prices; a percent group takes its percent off the regular price. Each customer is in at most one group. Shoppers who are signed out, in no group, or in a disabled group, get the regular prices. In the group dialog, the Pricing field offers Percent off first, which is the default, then Fixed prices set in the catalog ; you set those per product on the catalog’s Prices card. Without Product Catalog installed in the environment, Pricing is disabled with the note “Group prices need Product Catalog. Without it, groups control who can use group-only discount codes.” and an Install link, and the Groups pages show a banner saying the same. Saving the group still works. How fresh: a change to a group's rule or members shows on the storefront within about 10 seconds at the 95th percentile (webhook latency plus one request), and within 60 seconds at most if a webhook is lost. Carts, checkout, quotes and New order read the group exactly. When a group price is below the regular price, the compare-at price carries the regular price ( compareAtMinMinor in a list's price range, compareAtPriceMinor on a variant), so you can show it struck through. Price sorts, price filters and price facet ranges use the regular price; only the prices shown change. Answers never name the group. Carts are priced the same way: the price a signed-in shopper sees on a product page is the price their cart charges. Volume pricing for a group A group can also have volume tiers : a lower unit price when the shopper buys more. The tiers are taken off the group's price , so a dealer who pays $88.00 and buys 10 at 15% off pays $74.80 each. A tier never raises a price. A fixedPrice tier that is above the group price is ignored, and the shopper keeps the group price. A shopper gets the table of their group, when their identity is proven and the group has a table for the product. Everyone else (guests, shoppers in no group, shoppers whose group has no table) gets the product's all-buyers table, if there is one. It is taken off the list price. Product answers carry bulkTiers for the table that prices this shopper. A group table needs the same proof as a group price, so it comes with the customer token. The all-buyers table needs no token. The rule, rounding and examples are on Volume pricing . Send the customer token Shoppers sign in with Throttle's customer accounts, through @usethrottle/auth (see Storefront customer auth ). Give the catalog client a customerToken function that returns the shopper's current access token. With @usethrottle/auth 0.10.1 or later, that is auth.getAccessToken() : it refreshes the token first when it is about to expire, and answers null when the shopper is signed out. The client calls the function on every request that can use the token, so a refreshed token is used at once. It sends the token only in the X-Customer-Token header, never in a URL, never stores it on the client and never logs it. getAccessToken() can throw when a refresh fails for a moment (a network error, a 5xx). The client treats a throw, or anything that is not a string, as signed out for that request: it answers regular prices instead of failing the page. The token read and the request each get the full timeoutMs (10 seconds by default), so a call that waits on a slow refresh can take up to about twice that. A token function that never answers ends in TimeoutError . Sign shoppers in in the browser. A Throttle pk_ is a browser key: Throttle checks the page's origin against your allowed origins, so a sign-in from server code is refused with origin_not_allowed . On the server, take the shopper's access token from the request (a header or cookie your app sets) and return it from customerToken . The token goes with product lists, product pages, related products, suggestions, carts.check , carts.create , review eligibility and review submission. Categories, collections, tags, filter values, review lists and config answer the same for everyone and never send it. A verified email is required Group prices need a verified email address. A signed-in shopper whose email is not verified gets the regular prices, on product pages and in the cart, until they verify it. Knowing a trade customer's email address is not enough to buy at trade prices. priceContext: which prices an answer carries An answer to a request that carried a token has priceContext . Use it to tell the shopper why they see the prices they see: A refused token A token the catalog refuses (expired, revoked, or for another store) answers 401 CUSTOMER_TOKEN_INVALID . The client then asks your function for the token once more, and retries with it if it changed. If it did not, a read (or carts.check ) is retried once without the token and answers the regular prices, with no priceContext : the page still renders. A call that cannot fall back to regular prices ( reviews.eligibility , reviews.submit , and carts.create with a token) throws CustomerTokenInvalidError instead. A call makes at most three requests. In React Keep one catalog client for the life of the app and pass customerToken as a function, as above; do not make a new client when the shopper signs in. Give CatalogProvider a customerKey : the signed-in customer's id, or null . The hooks' cache is partitioned by it, so a change empties the cache and every mounted hook fetches again, and one shopper never sees answers fetched for another. Ch"},{"title":"Mapping an ERP or IMS export","route":"/product-catalog/erp-mapping","headings":["Mapping an ERP or IMS export","Field by field","Convert units first","Send all rows of a product in one batch","One variant, every price kind","A price-list file"],"text":"Product Catalog Mapping an ERP or IMS export Your ERP or inventory system has its own names for prices and sizes. This page shows where each one goes in a push row and in a CSV file. Throttle sets the standard fields. You map your columns to them once. Field by field variant.priceMinor and variant.currency , html: variant.priceMinor , variant.currency , Push: whole minor units (cents). CSV: a decimal in major units, such as 24.99. ], [ Sale price , code: variant.salePriceMinor , code: variant.salePriceMinor , Same unit as the base price. A sale beats the regular price while it is set. ], [ Compare-at (was) price , code: variant.compareAtPriceMinor , code: variant.compareAtPriceMinor , Same unit as the base price. ], [ A price in another currency , code: prices. .priceMinor , html: price:<CUR> , sale_price:<CUR> , compare_at_price:<CUR> , Only for a currency that is not the variant’s base currency. The catalog never converts. ], [ A dealer or wholesale price , code: groupPrices. . , code: group_price: : , Only for a fixed group. A percent group has no price column. Use the group’s name or id. ], [ Volume tiers , code: bulkTiers. , code: bulk_tier: : : , html: See Volume pricing . ], [ Weight , code: variant.weightGrams , code: variant.weightGrams , A whole number of grams, 1 to 10,000,000. ], [ Length, width, height , html: variant.lengthMm , variant.widthMm , variant.heightMm , html: The same names. , Whole millimetres, 1 to 100,000. Throttle uses them only when all three are present. ], ] /> Weight and dimensions drive live shipping rates. See Weight and dimensions . Convert units first Minor units. A push sends money as a whole number of minor units: 24.99 USD is 2499 , 3200 JPY is 3200 , and 1.250 KWD is 1250 . A CSV takes the decimal and reads it with the currency's own number of decimals. A cell with too many decimals is refused. Basis points. A push sends a percent as percentBps : percent × 100. 15% is 1500 . 22.5% is 2250 . A CSV may send the percent as it is ( 22.5 ). Grams. Multiply kilograms by 1,000 and pounds by 453.592. Round to a whole number. Millimetres. Multiply centimetres by 10 and inches by 25.4. Round to a whole number. Send all rows of a product in one batch Rows of one product in a batch combine into one volume table. That is how a table gets one value per SKU, and how the catalog checks that every row agrees on the ranges and types. The combined table replaces the stored one. If you split a product over two batches, the later batch replaces the earlier table, and the first batch's SKU values are lost. Keep a product's rows together in one batch. See jobs and batches . One variant, every price kind A bolt that costs $100.00, is on sale at $90.00 (was $120.00), costs 92.00 EUR (84.00 on sale), costs a Dealer $88.00, and weighs 310 g in a 45 × 45 × 20 mm box. For volume tiers on the same variant, see the examples for each tier type . A price-list file Some systems export one customer group's whole price list: a price for each SKU and tier columns beside it. You can import that file as it is. The mapper turns it into the standard columns. You map it once and save the profile. : ], [ Tier minimum, N , code: bulk_tier: :N:min ], [ Tier maximum, N (if any) , code: bulk_tier: :N:max ], [ Tier type, N , code: bulk_tier: :N:type ], [ Tier value, N , code: bulk_tier: :N:value: ], [ List ids, product names, variant ids, sale price, retail price, minimum advertised price , Ignore ], ] /> One price list per file. A check column is compared with the one group or currency the mapped columns write to, ignoring case ( usd matches USD ). A row that names another list or currency is refused with PRICE_LIST_MISMATCH . A mapping that writes to two groups or currencies and also has a check column is refused when you save it. The type cell. It reads percent , amountOff , fixedPrice and none . It also reads fixed as a fixed price and price as an amount off. The preview shows the type each row ends with. Existing SKUs only. A price list never creates a product. A SKU the catalog does not hold is refused with UNKNOWN_SKU . A row with no SKU is refused with MISSING_SKU . The other rows apply. Import the products first. No product columns. A price list sets prices and tiers on existing variants. The file has no product handle, so a product column such as a title or a description is refused when you save the mapping. Blank tier cells do not clear. A row with blank tier cells changes nothing. To clear a table, use none as the tier 1 type. Retail and sale prices are not mapped. The public price comes from your catalog. Throttle has no group sale price. Check the name. The group name in the mapping must match a Throttle group. When a saved profile names a different group than the file's price list name, the map step warns you. The importer recognises a BigCommerce price-list export from its headers and fills in this mapping for you. You can still edit it before you import."},{"title":"Errors and rate limits","route":"/product-catalog/errors-and-rate-limits","headings":["Errors and rate limits","The error envelope","The SDK's errors","Codes the SDK makes","Every storefront error code","Rate limits","While the catalog is indexing"],"text":"Product Catalog Errors and rate limits Every storefront error answers one envelope with a stable code, and the SDK turns each into a typed error. This page lists them all, with the rate limits and what the client and the hooks do about them. The error envelope error.code is stable; branch on it, never on the message. error.requestId identifies the request when you ask for help. error.issues (at most 20) names the fields at fault, as path, message . CART_REJECTED adds error.throttleCode , and CART_ITEMS_INVALID adds a top-level items list of refused lines. Throttle's cart-session routes answer their own envelope, error: code, message, details? , with lowercase codes. The SDK's errors Everything the SDK throws is a CatalogError (which extends ThrottleError from @usethrottle/errors ), with code , message , statusCode (0 when nothing answered), source ( catalog , throttle for Throttle's cart session, or client when the SDK made it), retryable , retryAfterSeconds , issues , details and requestId . 429 . retryAfterSeconds is always set: from Retry-After , or 60 when that is missing or unusable. , ], [ code: OriginNotAllowedError , html: ORIGIN_NOT_ALLOWED , SERVER_KEY_IN_BROWSER , KEY_NOT_ALLOWED_IN_URL and Throttle's origin_not_allowed . , ], [ code: CustomerTokenInvalidError , A refused customer token on a call that cannot fall back to regular prices. ], [ code: CartLineError , html: CART_ITEMS_INVALID and Throttle's quantity_unavailable and line_not_purchasable , with lines: sku, code, maxQuantity? [] . , ], [ code: TimeoutError , html: TIMEOUT : no answer within timeoutMs . ], [ code: NetworkError , html: NETWORK_ERROR : the request never got an answer (DNS, a CORS refusal, a dropped connection). ], [ code: FeatureUnavailableError , html: FEATURE_UNAVAILABLE : the catalog does not have this route yet (below). , ], [ code: CatalogError , Everything else. ], ] /> FeatureUnavailableError. A 404 that carries the header X-Catalog-Route: unmatched means the catalog has no such route: an older catalog than the SDK. A 404 from a route that never answers a missing resource ( config , the category tree, tags , the collections list, suggest , carts/check and carts ) means the same. Any other 404 is NOT_FOUND . Your own abort rethrows your AbortSignal 's reason, never wrapped in a CatalogError . isCatalogError also recognises an error from another copy of the SDK, such as the CommonJS build in an app that loads both; instanceof on a class holds within one build only. Codes the SDK makes createCatalogClient for a key that is not pc_pk_… . The key is never in the message. ], [ code: CLIENT_ERROR , html: A cartStorage adapter (or another of your functions) threw inside a hook action. ], ] /> Timeouts. timeoutMs (10 seconds by default, per client or per call) covers one request. Reading the customer token gets its own full timeoutMs first, so a call that waits on a slow token refresh can take up to about twice as long. Every storefront error code Every code a /v1/storefront route answers, from the OpenAPI document , with the class the SDK throws for it. Retryable means the same request may succeed later. Throttle's cart-session codes ( quantity_unavailable , cart_prices_changed , cart_session_expired and the others) reach you with source: throttle ; they are listed on Cart and checkout . Throttle's cart_session_expired passes details.storefrontUrl through as it was stored, unvalidated. Never render it as a link or navigate to it without your own check: http or https only, on an origin you trust. Rate limits Review submission adds 5 attempts a minute per customer and 10 accepted reviews an hour per IP address (server keys skip the IP cap). Over a limit the answer is 429 RATE_LIMITED with Retry-After in seconds. Wait that long; the SDK exposes it as RateLimitedError.retryAfterSeconds . The client never retries a 429 itself , so a burst never turns into a retry storm. The per-visitor count is kept per Cloudflare location and is approximate: a fast burst can pass somewhat more than the limit before it is refused. The per-key limit still caps a key. In the hooks. A catalog 429 RATE_LIMITED that a read hook or a useCart change meets pauses every read of its CatalogProvider until retryAfterSeconds : The hook that met it keeps its data and shows the RateLimitedError . A hook mounted during the pause makes no request. With nothing cached for its query, it shows a RateLimitedError with the seconds left, not a loading state; with a cached answer, it shows that. useCart and useSubmitReview actions reject at once with that error, with no request. When the pause ends, each mounted query fetches once. Every other 429 goes to the caller only and pauses nothing: a 429 from Throttle's cart session, and every 429 from a review submit ( RATE_LIMITED from the per-customer limit or the per-IP review cap, and REVIEW_QUEUE_FULL ). While the catalog is indexing When a store first turns on the storefront, the catalog builds its storefront index. Until it is done, plain product browsing answers 200 with indexing: true (no filters, and a null total), and requests that need the index answer 503 STOREFRONT_INDEXING with Retry-After: 30 . See the first backfill . The client retries a read once after Retry-After when that is 30 seconds or less ( indexingRetry: maxWaitSeconds changes it, false turns it off); otherwise it throws with retryAfterSeconds . The hooks never wait inside a call. They show the 503 and fetch once more at Retry-After ; a list answered with indexing: true is fetched once more after 30 seconds."},{"title":"Keys and channels","route":"/product-catalog/keys-and-channels","headings":["Keys and channels","Publishable keys are public","Key types","Allowed websites","Server rendering and static builds use a server key","Sending the key in the URL: keyInQuery","Secret keys never reach a storefront","Carts need the same websites in Throttle","Rate limits by key type"],"text":"Product Catalog Keys and channels Every storefront call carries a publishable key ( pc_pk_… ) in X-Catalog-Key . A key has a type, its channel, that decides where it may be used. Create and revoke keys in the Product Catalog dashboard under Storefront › Keys . Publishable keys are public Publishable keys are public. A browser key ships in your page's JavaScript, and anyone can copy it. It reads only what every shopper already sees: public products, categories, collections and published reviews. Allowed websites protect browsers only. They stop another website from using your key in its visitors' browsers. They do not stop a script or a server, which can send any Origin header, or none. Carts are protected by server-side resolution. A storefront sends SKUs and quantities, never prices. The catalog prices every line on its side, when the cart is created and each time Throttle asks again, so nothing sent with a publishable key can change what a shopper pays. Key types Choose the type when you create the key. The catalog enforces it on every storefront route: 403 ORIGIN_NOT_ALLOWED , html: 403 ORIGIN_NOT_ALLOWED , Your website’s browser code. , ], [ App , html: Must be on the key's allowed websites (refused when the list is empty) , Allowed , A native app or another client that is not a web page. , ], [ Server , html: Always refused: 403 SERVER_KEY_IN_BROWSER , Allowed , Server rendering, static builds and scripts. , ], [ Legacy , Any website , Allowed , Keys made before key types existed, shown as “Legacy (any website)”. , ], ] /> A legacy key keeps working from any website until you give it a type in Storefront › Keys; the key itself does not change. A store can have up to 20 active publishable keys. Revoking a key deletes it, and the next request with it answers 401 AUTHENTICATION_FAILED . Allowed websites Browser and app keys carry a list of up to 20 allowed websites. Each is an exact origin: https, a host and an optional port, with no path, such as https://shop.example.com or https://shop.example.com:8443 . A subdomain or another port is a different origin and needs its own line. http: origins, including http://localhost , cannot be listed; during development, call the catalog from your dev server with a server key, or serve the site over https. Server rendering and static builds use a server key Pages rendered on a server (Next.js, Remix, Astro and the like), static site builds, sitemap jobs and scripts call the catalog without an Origin . Give them a server key. It is refused on any request that carries an Origin , so it cannot be lifted into a browser page, and it has the higher per-key limit with no per-visitor bucket: server traffic arrives from a few hosting addresses, which a per-visitor limit would throttle. Use the browser key in the client-side part of the same app. A server key is still a publishable key and reads only public data. Keep it in a server environment variable anyway, so its higher limit stays yours. The Next.js page shows the full setup. Sending the key in the URL: keyInQuery By default every request sends the key in the X-Catalog-Key header, which makes a browser preflight each new URL. Set keyInQuery: true (1.2.0 and later) on a browser client and a read (a GET ) sends ?key= instead, with no custom header, so a plain read needs no preflight. Reads only. A POST always sends the header. createServerCatalogClient ignores the option. A revalidation with If-None-Match , or any client headers , still preflights. Never a server key in a URL. The catalog refuses it with 403 KEY_NOT_ALLOWED_IN_URL (an OriginNotAllowedError in the SDK). Use keyInQuery with browser and app keys only. A URL is recorded wherever full URLs are kept (CDN and zone logs, analytics, browser history), so rotate any server key that was ever sent in a URL, even though it was refused. The customer token is never put in a URL , in any mode. It travels only in X-Customer-Token , so a read that carries a token still preflights. Suggestions never send the customer token and, with keyInQuery on, send no custom header at all: see Search and suggestions . Secret keys never reach a storefront The catalog also has secret keys ( pc_sk_… ) for writing products from your own systems. A secret key is never for a storefront: storefront routes refuse it with 401 AUTHENTICATION_FAILED , and the SDK refuses it before any request. createCatalogClient throws CatalogError INVALID_PUBLISHABLE_KEY for anything that is not a pc_pk_ key, and for a pc_sk_ key the message says so: “Secret keys (pc_sk_) must never be used in a storefront. Use a publishable key (pc_pk_).” The key itself is never part of an error message. Carts need the same websites in Throttle Creating a cart goes through the catalog, but changing it from the browser (adding lines, the useCart hook, the checkout hand-off) talks to Throttle's cart-session routes directly, and Throttle checks the Origin against its own list. Add the same websites to Throttle's allowed origins in your application's settings (see Cart sessions ), or cart calls from them are refused with Throttle's origin_not_allowed . Rate limits by key type Over a limit the answer is 429 RATE_LIMITED with Retry-After . Errors and rate limits covers what the SDK does with it."},{"title":"Line resolvers","route":"/product-catalog/line-resolvers","headings":["Line resolvers","When Throttle calls it","The request","The signature","The answer","Weight and dimensions on the answer","The reserved metadata namespace","Refusals and failing closed"],"text":"Product Catalog Line resolvers For extension builders. The Product Catalog is a line resolver: the catalog carts a storefront creates are resolved carts , and Throttle calls the catalog to price their lines. This page describes the catalog's resolver, POST /throttle/line-resolver , as an example of the contract. Throttle's Line resolvers page is the full contract for building your own. When Throttle calls it Throttle never takes a price from the browser for a line the catalog owns. It calls the resolver with an intent : A line's price can depend on the other lines of the same product (see Volume pricing ), so every change sends all the catalog lines together. Only a refusal of the line being added or changed fails the call. A server-side conversion ( finalize , checkout or orders/from-cart ) sends the checkout intent once before the order is made. Throttle waits at most 3 seconds and does not retry an add or update (the shopper is waiting); it retries a checkout once. The request type is always cart.lines.resolve , never a webhook event type; id is Throttle's request id. installationId , applicationId and environmentId only say which installation to look up. The signature decides: the catalog checks that the signed body names the same application and environment as that installation. customerId is the cart's customer, or null ; locale picks the language of the line names. customerGroup ( { id, kind, percentBps, version } or null ) and identityQualified are sent to installations whose pinned version holds an explicit customer_groups:read or customer_groups:write scope. Group prices apply only when identityQualified is true (a resolver reads customerEmailVerified only when that field is absent). customerEmailVerified keeps its meaning: a live verified credential exists. Throttle sends customerGroup as null unless identity qualifies. A group's volume tiers need the same field. Without it, a buyer gets only the all-buyers table. A Worker that creates or changes carts with an extension-install key must forward the buyer's storefront token in the x-customer-token header, with the token's subject equal to the customer being attached. Without it the cart has no proven identity, so list prices apply and group codes are refused. See Customer groups . 1 to 50 lines , each lineId, referenceId, quantity . referenceId is the variant SKU, matched exactly; the body is at most 64 KB. The signature Throttle signs every call with the installation's webhook signing secret, in the header X-Throttle-Resolver-Signature: t=<unix seconds>,v1=<hex> . The signed string is throttle.line-resolver.v1.<t>.<raw body> , HMAC-SHA256. The purpose label throttle.line-resolver.v1 keeps resolver and webhook signatures apart, though they share a secret: neither can be replayed as the other. The catalog verifies the raw body before it parses it as JSON, with a constant-time compare. t must be within 5 minutes; during a secret rotation the header carries one v1 per secret, and any match passes. Every verification failure is the same 401 , whatever the reason. The answer 200 , no-store , with one line per requested line, in order. A priced line carries ok: true and the name, unit price in minor units, currency, image, quantity limits, shipping flag and, when the variant has them, its shipping measures ; a refused line carries ok: false and a code . A line priced at a volume tier also carries bulk , { minQuantity } , for display only. It is left out when no tier applies. The answer has one other field, internal to Throttle's stock handling. maxQuantity is the most that can be ordered now, and can be 0. ], [ code: BELOW_MIN , Under the variant’s minimum order quantity. ], [ code: ABOVE_MAX , Over the variant’s maximum order quantity. ], [ code: NO_PRICE_IN_CURRENCY , No price in the cart’s currency. ], [ code: PRICE_SOURCE_MISMATCH , The source that set the price does not hold the cart’s currency. ], ] /> The price always comes from the catalog, never from the request. Stock quantities are never answered: maxQuantity on a priced line is the order limit, and on a refused line only what a refused quantity needs. Weight and dimensions on the answer A priced line for a shippable variant carries an optional shipping object with the variant's weightGrams , lengthMm , widthMm and heightMm . A measure the variant does not have is left out: omitted means unknown, never 0. Throttle converts them to kilograms and centimetres on the cart line ( weight and length , width , height , with their units), where live carrier rates read them. The dimensions are written only when all three are present. See Shipping measures in the contract. A variant with no weight keeps today's behaviour: the line carries no weight key and the rate is worked out as before. The reserved metadata namespace A priced line's metadata is stored on the Throttle line, and a browser can never write it. The catalog fills it with catalogInstallationId , catalogPriceMinor , sku and variantId . It is at most 2 KB of JSON; an answer over that is never sent. The catalog never trusts line metadata alone on an order: a line counts as a catalog line only when its SKU is one of the catalog's variants and its unit price is a price the catalog would have answered. Refusals and failing closed Throttle fails closed . When the resolver times out, refuses the call or answers anything malformed (a missing line, an invalid line), the cart change is refused with 503 line_resolver_unavailable and nothing on the cart changes. Throttle never falls back to a browser price or a stale one. The catalog does the same on its side: if it cannot read the catalog, or would build an answer Throttle would refuse, it answers 503 rather than guess. Storefronts never call this route; they see its results as cart errors ."},{"title":"Next.js SSR and caching","route":"/product-catalog/nextjs","headings":["Next.js SSR and caching","A server key on the server, a browser key in the client","How the server client caches","App Router","Refresh when the catalog changes: syncCatalogGeneration","A sitemap","Pages Router"],"text":"Product Catalog Next.js SSR and caching A Next.js store uses two keys: a server key for everything rendered on the server, and a browser key for the hooks in the browser. @usethrottle/catalog/server adds Next.js cache options to every catalog read, without importing Next.js. The examples target Next.js 15. A server key on the server, a browser key in the client Server Components, route handlers, getServerSideProps , static builds and sitemaps call the catalog without an Origin , from a few hosting addresses. Give them a server key: it has the higher per-key limit and no per-visitor limit, and the catalog refuses it on any request from a browser page ( 403 SERVER_KEY_IN_BROWSER ). Keep it in a variable without the NEXT_PUBLIC_ prefix. See Keys and channels . In the browser, the CatalogProvider gets a browser key, which is public, with your site's origins as its allowed websites: For customer prices, give that browser client the customer token as shown on React . Render public prices on the server and let the hooks show the signed-in shopper's prices. How the server client caches createServerCatalogClient takes the options of createCatalogClient plus next : During the catalog's first index build, a read that meets 503 STOREFRONT_INDEXING waits its Retry-After (30 seconds at most by default; indexingRetry: maxWaitSeconds changes the limit) and asks once more. Pass indexingRetry: false to fail fast inside a page render or route handler instead. Every catalog read's fetch carries next: revalidate, tags . revalidate defaults to 60 seconds; next.tags on the client are added to each route's own tags. A call can pass its own next , which replaces the derived one for that call: include the route's tags yourself, with catalogTags . Everything else is sent cache: no-store with no next : cart calls, Throttle's cart session, review eligibility, and any request that carries a customer token. A personal answer never enters Next.js's cache. , html: Every read of one route: config , products , filters , product , related , categories , category , tags , collections , collection , suggest , reviews . , ], [ code: throttle-catalog: : , A read for one handle: a product, its related products or reviews, a category or a collection. , ], ] /> catalogTags(route, handle?) builds them, for revalidateTag or a per-call next . Two catalog installations in one Next.js app share these tags, so revalidating one also refreshes the other. App Router A product page that renders each product on its first visit and caches it. It has no generateStaticParams on purpose: every prerendered page is written to the ISR cache again on every deploy. To prerender a few, return staticProductParams(catalog, limit ) , which answers up to limit (1,000 by default) public product handles, handle each, most recently updated first, and keep limit small. Refresh when the catalog changes: syncCatalogGeneration Every change to what a storefront can see moves the catalog's generation , a number config() answers. syncCatalogGeneration reads it without the cache and, when it differs from the one you saw last, awaits onChange , where you call revalidateTag . Call it from a cron job, every minute for example. On a serverless host (Vercel and the like) a cron call often lands on a fresh instance, where a module variable starts empty: that call only records the generation, and a change made since the last call is never revalidated. Store previous in KV, a database row or an edge config instead. If a change is missed anyway, the pages' time-based revalidate still bounds how stale they get. Generations are compared, never clocks. The first call only records the generation; an error (an indexing 503 included) is thrown and onChange is not called. revalidateTag( throttle-catalog ) refreshes every catalog read; a narrower tag from catalogTags refreshes less. A sitemap The paging helpers walk every public handle, following cursors, and always end: handle [] for generateStaticParams . ], ] /> Pages Router Fetch on the server with the server key, and hand the answer to the hook as initialData . The browser then refreshes it through the provider in pages/_app.tsx , with the browser key. Next.js keeps fetch answers in its data cache only in the App Router; in the Pages Router the next options change nothing. To cache pages there, use getStaticProps with revalidate , and staticProductParams for getStaticPaths , with each handle mapped to params: handle ."},{"title":"Prices, currencies and languages","route":"/product-catalog/prices-currencies-languages","headings":["Prices, currencies and languages","Price lists, one per currency","The currency option","Languages","In the SDK"],"text":"Product Catalog Prices, currencies and languages A store can sell in several currencies and answer in several languages. Both are options on the client or on a single call, and config() says which ones the store offers. Price lists, one per currency Every variant has a base price in its own currency. To sell in another currency, the merchant enables it in Storefront › Prices , which creates a price list, and enters prices in it (by hand, by import or through the API). A variant's price in a currency is: its entry in that currency's price list, when there is one; else its base price, when its base currency is that currency; else none: the variant has no price in that currency. The catalog never converts a price. A product the merchant has not priced in euros has no euro price, and is treated as not sold in euros. Each price-list entry has its own price, sale price and compare-at price. An amountOff or fixedPrice tier value applies only in its own currency. A variant with no value in the cart's currency gets no price from that tier. A percent tier applies in every currency. See Volume pricing . config() answers currencies (every base currency in use plus every enabled price list) and defaultCurrency (the catalog's default, used when a cart is created without a currency). The currency option Without currency , each variant is priced in its own base currency and a list answer's currency is null . With it: Every price in the answer is in that currency: price ranges, variants, sorts and price filters. Product lists, search, suggestions and facet counts leave out products with no public variant priced in that currency. A product page still answers such a product, with availableInCurrency: false , priceRange: null , and every variant unpriced and purchasable: false . It cannot be added to a cart in that currency: the cart refuses the line ( NO_PRICE_IN_CURRENCY ). A currency the store has not enabled answers 400 CURRENCY_NOT_ENABLED . A cart has one currency. Switching currency makes a new cart with the same lines; see Cart and checkout . Languages The merchant sets a default language and up to 19 more in Storefront › Languages , and translates products, categories, collections, options, attribute labels, filter labels and filter value labels. Ask for a language with the locale option, a BCP 47 tag such as fr or fr-CA . The locale used. The catalog tries the tag, then its language ( fr-CA → fr ), and takes the first one the store has enabled. A locale the store does not have is not an error: the answer comes in the default language. The answer's locale names the one used. Field by field. A field without a translation in that locale falls back the same way, to the language and then to the default text, so a half-translated product still shows every field. What is not translated: variant fields, and reviews, which are shown as written. Search with a locale also matches the locale's translated titles and descriptions. In the SDK Set currency and locale on createCatalogClient as defaults, and override them on any call. Each call sends only what its route takes: Prices for a signed-in shopper (customer groups, managed in Throttle › Customers › Groups; the catalog stores only their fixed prices) are on Customer prices ."},{"title":"Products, filters and sorting","route":"/product-catalog/products-filters-sorting","headings":["Products, filters and sorting","Parameters","Filters","Facets and filter values","Sorting","Paging","Fields and include","Keep the shop page in its URL","While the catalog builds its index"],"text":"Product Catalog Products, filters and sorting products.list ( GET /v1/storefront/products ) answers one page of public products for a selection, with the filters a shop page shows beside them. Shop, category, collection, search and home pages are all this one call. Parameters products.list(query, options) takes the selection first and the per-call options ( signal , timeoutMs , currency , locale ) second. (repeated) , Selected filter values, keyed by the filter key. A range is one a..b value. ], [ code: handles / skus , code: handles / skus (repeated) , A batch of up to 100 products by handle or SKU, in the order asked. ], [ code: vehicle , code: year, make, model, submodel, engine , Parts that fit a vehicle; make and model are required. ], [ code: sort , code: sort , The order. See Sorting. ], [ code: limit , code: limit , Products per page, 1 to 100. Default 24. ], [ code: page / cursor , code: page / cursor , A page number, or the previous page’s nextCursor. Not both. ], [ code: facets , code: facets , true for every filter, or a list of filter keys. ], [ code: fields , code: fields , lite (the default), full, or a list of product keys. ], [ code: include , code: include , Heavy parts to add: fitment, oemNumbers, supersessions, jsonLd, descriptionHtml. ], ] /> An unknown parameter, or a value it does not accept, answers 400 INVALID_REQUEST with an issue naming it. A category or collection that does not exist answers 404 NOT_FOUND . Batch lookups silently leave out anything that is not public: a draft, an archived product and an unknown SKU look the same. Filters The merchant sets up filters in Storefront › Filters : each has a key, a label, a source (brand, product type, tag, category, price, availability, rating, an attribute or a product option) and a display (checkbox, swatch, range, boolean or dropdown). The examples here assume filters keyed brand , color and price . Values within a filter are OR, filters are AND. brand: [ Bosch , Brembo ] with color: [ Red ] is Bosch or Brembo products that are also red. Ranges are one a..b value : 5000..12000 , or open-ended 5000.. and ..12000 . A price range is in minor units, like every price. A malformed range answers 400 . Variant filters match one variant. Filters on variant values, such as options and price, must all hold for the same variant: “red” with “under $50” finds products with a red variant under $50, not a product whose red variant costs more and whose blue one is cheaper. An unknown filter key answers 400 INVALID_REQUEST . A filter the merchant disabled, or whose source is no longer public, is skipped and named in the answer's applied.ignored . On the wire, each value is its own filter.<key> parameter; commas and .. are literal: Facets and filter values With facets , the answer carries filters : one entry per filter with its key , label , display , its values (each value , label , count , selected and an optional swatch ), a range for range filters, and more . A value's count is the number of products that match every other selected filter plus that value, so the numbers next to a checkbox are what the shopper gets by ticking it. Values with no products are left out, unless selected: a selected value that matches nothing comes back with count: 0 , so the shopper can clear it. A list answer carries up to 50 values per filter; more: true means there are others. filters.values(key, query) ( GET /v1/storefront/filters/:key/values ) answers every value of one filter, up to 1,000, counted for the same selection. Sorting Without a sort , the list uses relevance with q (or a handles / skus batch), a collection's own default sort with collection , and featured otherwise. The answer's sort names the one used, and config().sorts lists the ones the store offers. An unknown sort, or best_rated while ratings on lists are off, answers 400 INVALID_REQUEST . Ties break by product, so pages never overlap. Paging Every list answer carries page : number , limit , total (the exact count of matching products), pageCount and nextCursor . Page by number with page , or follow nextCursor with cursor for infinite scroll; sending both answers 400 . Offsets are capped. A page number, and a cursor for relevance or manual , can reach 10,000 products deep (1,000 for relevance ). Past that the page is empty and page.capped is true . Cursors on a sort with a stable key are not capped. For featured , title, price, newest , updated and best_rated , the cursor is keyset based: it walks the whole list and stays exact while products change. A cursor is opaque. Send it back as it came, with the same selection and sort. Fields and include Lists answer the lite projection by default, sized for a product grid (a 24-product page is at most about 30 KB): handle , title , brand , productType , images (the first two, with sizes), priceRange , availability , lowStock , featured , badges (sale and new), variantCount , optionSwatches , seo.title and, while ratings show on lists, rating . fields: full answers the whole product, as a product page gets it: variants with their option values, options, breadcrumbs, descriptions, purchasable and the rest. Each variant in the full product carries four nullable measures: weightGrams , lengthMm , widthMm and heightMm . null means the merchant never entered it. The Specifications section of a product page shows them, and live carrier rates use them. fields: [...keys] answers only those top-level keys ( handle is always kept). An unknown key answers 400 INVALID_REQUEST naming it. include adds the heavy parts no projection carries by default: fitment , oemNumbers , supersessions , jsonLd and descriptionHtml . products.get(handle) always answers the full product and takes include . A renamed product answers redirectTo with its new handle; see Collections, categories and tags . Keep the shop page in its URL @usethrottle/catalog/url turns a shop page's query string into a selection and ba"},{"title":"Catalog Push API","route":"/product-catalog/push","headings":["Catalog Push API","What it is","How a push works","Tax codes and quotes","In this section","Known limits"],"text":"Product Catalog · Push API Catalog Push API The push API is how a vendor's own system, or the merchant's, puts products into the Product Catalog: create, update, rename and archive them by the vendor's own product id, at any size, with a result for every row. It lives next to the storefront API, on the same host. Push keys are secret. Never put a pc_sk_ or pc_vk_ key in a browser, a mobile app or a repository. The storefront API takes publishable keys; this one does not. What it is Every route takes the key as a bearer token ( Authorization: Bearer pc_… ). Answers are JSON, and every error answers the same envelope (see Errors ). The OpenAPI document is public at GET /v1/catalog/openapi.json . Callers address a product by their own product id , externalId , which is unique per vendor. The URL handle is an ordinary field you can change. Vendors and keys covers who owns what. How a push works Pushing is async only . A push answers 202 with a job or run id and is applied in the background, so a feed of a hundred thousand products does not hold a request open. The one synchronous route is PATCH /v1/catalog/inventory , for live stock. A job is staged : nothing applies until it is closed. A job that is not closed within 24 hours expires , its staged batches are discarded and never applied, and it ends as failed ( JOB_EXPIRED ). Send the feed again in a new job. In TypeScript, jobs.run does all five steps for you ( admin SDK ): Tax codes and quotes A row's product.taxCode sets the product's tax code, such as Avalara's PF050101 . There is one per product, shared by all its variants. It must be upper case and match ^[A-Z0-9]{1,25}$ (file imports trim and upper-case it for you), and a sent null removes it. Vendor pushes and product reads carry it too. Storefront answers, feeds and JSON-LD never include it. Pushed products are what Throttle's quotes look up. When a rep picks a product for a quote line, or an API caller sends a line with only its SKU, Throttle asks the catalog through a signed, server-to-server quote lookup. The lookup answers the variant's name, description, image, price in the quote's currency (the customer's price-group price when there is one; Throttle sends the customer's group in the signed request), tax code, stock status and quantity limits. Out-of-stock variants are still returned; draft and archived products are not. No push key, publishable key or browser can call the lookup. See Catalog lines in the quotes guide. In this section First vendor feed in 10 minutes , Start here: a working feed, step by step, with expected answers. ], [ html: Concepts , Keys, the job lifecycle, merge and replace, fair turns, ownership and holds. ], [ html: Limits and throughput , Every limit, and two measured production runs. ], [ html: Troubleshooting , Symptom, cause, fix. ], [ html: Reference for AI agents , How an agent runs a full sync; links the OpenAPI document. ], [ html: Vendors and keys , Ownership, key reach, SKU clashes, adoption, holds, the vendor winning, vendor on orders. ], [ html: Jobs, batches and runs , Merge and replace, staged jobs, limits, full sync, fair turns, reports. ], [ html: Products , Read, archive, restore, rename, the 30-day purge, categories. ], [ html: Stock , Set and adjust, idempotency, per-row results, stock in a job. ], [ html: Webhooks , Completion events, signatures and the retry schedule. ], [ html: Errors , The envelope and every error code. ], [ html: Admin SDK , The experimental @usethrottle/catalog/admin entry. ], [ html: API reference , Every operation, rendered from the OpenAPI document. ], ] /> Known limits None of these is a bug; plan around them. Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer. Stock in a job applies at close. Use PATCH /v1/catalog/inventory for live stock ( Stock ). The legacy checkout records no vendor on an order line. With the Vendor on orders setting on, only carts priced by the catalog's line resolver record metadata.lineResolver.vendorId ( Vendor on orders ). Vendor batches are canonical rows. A mapping profile cannot set externalId . Job CSV reports above 900 parts answer 409 REPORT_TOO_LARGE . The admin SDK entry is experimental. A breaking change to it ships as a minor release. Categories now go up to 10 levels deep everywhere the tree is used; the storefront's categories.tree takes a depth of 1 to 10."},{"title":"Catalog Push API: reference for AI agents","route":"/product-catalog/push/agents","headings":["Catalog Push API: reference for AI agents","Base URL and auth","Endpoints","Complete call sequence with exact JSON","Required call order for a full sync","Idempotency rules","Retry decision table","Stop conditions","The loop in pseudo-code","Error handling","Never"],"text":"Product Catalog · Push API Catalog Push API: reference for AI agents Follow this page literally to run a full sync of a vendor's catalog. Machine-readable contract: https://catalog.usethrottle.dev/v1/catalog/openapi.json (public, no key). Base URL and auth Base URL: https://catalog.usethrottle.dev/v1/catalog Header on every call: Authorization: Bearer <key> , with a vendor key pc_vk_… or a store key pc_sk_… . Never send either from a browser, and never print or log it. Bodies are JSON ( Content-Type: application/json ), at most 5 MiB and 1,000 rows per batch; PATCH /inventory at most 1 MiB and 1,000 rows. Archive, restore and assign take at most 100 refs per call; GET /products takes limit 1 to 100 (default 50); externalId is at most 255 characters. An Idempotency-Key is remembered 24 hours. Endpoints Complete call sequence with exact JSON Every request and response of a full sync, in order. Replace <key> , <jobId> and <batchIndex> . Bodies are real answers from production (ids replaced); the base URL is https://catalog.usethrottle.dev/v1/catalog . Required call order for a full sync Open a job with mode: "replace", fullSync: true (or merge, if you only upsert). Keep the jobId . Send batches : split the feed into batches of at most 1,000 rows and under 5 MiB. Keep all rows of one product adjacent in the same batch (replace refuses scattered rows). Every row of a vendor needs externalId , productHandle and sku . Send at most 2,000 batches per job; keep at most 3 jobs open. Check each batch answer : if rowsRefused > 0 , read issues . A refused row counts in rowsFailed for the whole job and skips the archive pass, even if you resend a fixed row. To get the archive, open a new full-sync job with the whole corrected feed. Close the job exactly once. Nothing is applied before this. Wait : poll GET /jobs/{jobId} every 5 to 10 seconds, or use a webhook, until finishedAt is set. Do not hold requests open. Judge the result : success is failureCode === null and rowsFailed === 0 . Otherwise download errors.csv and report it. Measured on 2026-11-01 in two single runs on one store (Workers e844ed62 and e2f3c98a): 120,000 products (372,242 rows) took 55 and 62 minutes end to end, an apply rate of 7,538 and 6,713 rows per minute (end-to-end rates: about 6,700 and 6,045). Plan on about 1 hour per 120,000 products with images. Image copies run alongside the job at about 200 to 285 per minute at peak, and leftovers drain at about 20 per minute afterwards; the storefront serves the vendor's image URL until a copy lands. Updates with no image changes run faster. Split very large catalogs across jobs. Details: Limits and throughput . Idempotency rules Send Idempotency-Key (1 to 200 characters) on every batch. Use a stable key such as jobId : batchIndex . A retry must repeat the same body with the same key ; the replayed answer carries Idempotent-Replayed . A different body with a used key is 409 IDEMPOTENCY_CONFLICT . An adjust stock row requires a key ( 400 IDEMPOTENCY_KEY_REQUIRED ). One key per delivery event, not per attempt. Retry decision table 0) , Resend only the fixed rows (merge); with fullSync the archive is already skipped, so run a new full-sync job with the whole corrected feed , None , A NEW key (the body changed) , The fixed rows ], [ 409 JOB_CLOSED, JOB_FULL , No, in this job , None , New job, new keys , Continue in a new job ], [ 400, 413, 422, 404, 401, 403 , No , None , None , Fix the request first ], ] /> Stop conditions Stop and report to the user (do not retry) when: The response is 401 or 403 (key invalid, vendor paused, route not allowed). Five consecutive retries of one request have failed. A batch answers 413 or 400 after you cut it to the limits. The job finished with failureCode set, or rowsFailed > 0 : report the code and the first lines of errors.csv . You have waited more than 3 hours without finishedAt for a feed under 120,000 products (see the time guidance below), or the job state is expired . The feed would archive far more products than usual: stop before close and ask the user (a full sync archives everything the job did not send). The loop in pseudo-code Error handling Every error is { error : { code , message , requestId , issues ? } } . Branch on code , never on the message. All codes: Errors . Symptoms and fixes: Troubleshooting . Never Never set fullSync unless the feed is the vendor's complete catalog: it archives everything the job did not send. Never split a product's rows across batches in replace mode. Never put a key in a browser, URL, log or repository. Never assume stock in a job is live: it applies at close. Use PATCH /inventory for live stock. Background: Concepts , first feed guide , API reference ."},{"title":"Push API Reference","route":"/product-catalog/push/api-reference","headings":["Push API Reference","{group.name}","Error codes"],"text":"Product Catalog · Push API Push API Reference Every operation of the push API at https://catalog.usethrottle.dev/v1/catalog , rendered from its OpenAPI document. Every route except the document itself takes a secret key as a bearer token: a store key ( pc_sk_ ), or a vendor key ( pc_vk_ ) on the operations that list it. Download the OpenAPI document groups.map((group) => ( group.name group.description group.endpoints.map((item) => ( )) )) Error codes Every error answers the same envelope, with a stable error.code . These are all the codes the API returns, with their HTTP statuses and whether a retry can succeed."},{"title":"Concepts","route":"/product-catalog/push/concepts","headings":["Concepts","Store key and vendor key","The staged job lifecycle","Which calls work in which state","Merge and replace","Fair turns","Ownership, adoption and holds","A SKU clash, walked through","API archive and the 30-day purge"],"text":"Product Catalog · Push API Concepts Seven ideas explain the whole push API. Each section is short and links to the page with the details. Store key and vendor key Example. The same header name, a different reach and a different way to name a product: Both are secret and server-side only. Details: Vendors and keys . The staged job lifecycle A job is a staged, all-or-nothing push. Batches are checked on arrival and stored; nothing changes in the catalog until the job closes. open closed completed failed expired close 24 h, never closed Which calls work in which state The job view has the states open , closed and expired ; completed and failed are read from finishedAt and failureCode . A completed job can carry FULL_SYNC_ARCHIVE_SKIPPED , so consumers must check failureCode (webhook: data.failureCode ) on a catalog.run.completed event. Webhooks say catalog.run.completed or catalog.run.failed . Merge and replace Merge (default) changes only what you send. Replace treats the job as the full truth for your own data: values you did not send are dropped, and variants you supplied earlier and did not send are archived. Replace needs a product's rows together in one batch. Full sync is a separate switch: after applying, it archives your products that the whole job never mentioned, and only if the job was clean. See Merge and replace . Example, run on production. A product has two variants, a brand and a stock of 5. The replace job sends only the 250 g variant, with a title and a price. Afterwards the brand is gone (the value you no longer send), the stock you did not resend is dropped to 0, and the 1 kg variant you stopped sending is archived . A merge job with the same row would have changed only the price. Fair turns Each vendor, and the store key, has its own lane. Closed jobs take turns across lanes, so a small update is not stuck behind another vendor's huge feed. An idle open job holds no turn. Within a lane, work goes oldest close first. Ownership, adoption and holds Ownership. A product has one owner: a vendor or the merchant. A vendor key never changes ownership, and a SKU clash with another owner fails with SKU_CONFLICT . Adoption. Products already in the catalog stay the merchant's until the merchant assigns them to a vendor; the vendor's first push then links each one by SKU and records its externalId . A push never claims an unassigned product. The vendor wins. On a vendor-owned product, what the vendor sends outranks the merchant's dashboard edit. Holds. If the merchant archives or drafts a vendor product in the dashboard, the vendor can still update its data but cannot republish or restore it until the merchant lifts the hold ( held in the answer). A SKU clash, walked through Vendor A owns DEMO-GUJI-250 . Vendor B pushes a different product with the same SKU. The batch is accepted (a SKU clash is found when the row is applied), the row fails with SKU_CONFLICT in the error report, and nothing of vendor A's product changes. Vendor B cannot see A's product to find out why: it answers 404 , and a store-only route answers 403 VENDOR_KEY_NOT_ALLOWED . Resolve it by choosing a SKU of your own, or ask the merchant to assign the product to the right vendor. Holds in detail . API archive and the 30-day purge Deleting through the API archives : the product leaves the storefront and can be restored. An API archive is purged 30 days later (the whole product, unless another source still supplies it). A merchant's dashboard archive never purges. An archived product stays archived when later pushes resend it, until an explicit restore or a row that sends status: "active" . The storefront edge cache holds an answer for at most 60 seconds, so an archived product can still appear for up to a minute. It is gone on the next uncached read. The purge in practice: The purge in detail ."},{"title":"Errors","route":"/product-catalog/push/errors","headings":["Errors","The envelope","Codes","Row issues","Job failure codes and other codes","In the SDK"],"text":"Product Catalog · Push API Errors Every failed request answers the same envelope with a stable error.code . A failed row is not a failed request: it is reported in the batch answer and the job's error report. The envelope issues appears on validation errors and names every problem. Quote requestId when you ask for help. A 429 and some 409 s carry Retry-After . Codes Retryable means the same request can succeed later without a change. Always resend with the same Idempotency-Key . Row issues A failed row is not a failed request. A batch answer lists refused rows in issues as { index, code } (the position in the batch, 0 based; no message) and counts them in rowsRefused . The job's errors.csv adds the row number (job-wide, from 1), SKU, field , severity, message and externalId. Rows refused or failed count in rowsFailed ; warnings leave the row applied and count in rowsWarned . Every code a push can report: [ code: r.code , r.title, r.fix]) /> Warnings are MERCHANT_HOLD , INVALID_GTIN_DROPPED , CATEGORY_TOO_DEEP , DUPLICATE_SKU_REPLACED and SCATTERED_PRODUCT_ROWS in merge mode (in replace mode it refuses the product). A currency the store has no price list for, or a locale it has not enabled, refuses a vendor row: for a currency the error is FIELD_NOT_ALLOWED with "The store has no price list in this currency."; for a locale it is LOCALE_NOT_ENABLED . Stock rows in PATCH /inventory report invalid with the stock codes above. Job failure codes and other codes The same codes, with the exact response and a corrected request, are on Troubleshooting . In the SDK The admin client throws the same classes as the rest of @usethrottle/catalog : a CatalogError with the server's code , and a RateLimitedError (with retryAfterSeconds ) for every 429 . See Errors and rate limits for the storefront side."},{"title":"Your first vendor feed in 10 minutes","route":"/product-catalog/push/guide","headings":["Your first vendor feed in 10 minutes","1. Create a key","2. Open a job","3. Send a batch","A row-level error","4. Close the job","5. Poll until completed (or use a webhook)","The webhook alternative","6. Read a product back","7. Verify on the storefront","All seven steps in one script","What to do next"],"text":"Product Catalog · Push API Your first vendor feed in 10 minutes Seven steps take two products from your system to the live storefront. Every step has the request as curl and as SDK code, and the answer you should get. All of it was run against production before publication; ids are real examples and your ids differ. Replace the demo- and DEMO- ids with your own. A vendor key from the merchant, Node 20+ (or just curl ), and npm install @usethrottle/catalog for the SDK form. The HTTP answers are the contract; the SDK returns the inner object (for example the job without the job wrapper). 1. Create a key Keys are created by the merchant, in the Product Catalog dashboard: Storefront › Vendors , open your vendor, Create key . A vendor key starts with pc_vk_ and is shown once ; copy it into your server's secret store. If you are the merchant, use a store key ( pc_sk_ ) instead. Export it, then prove it works with any read: export CATALOG_VENDOR_KEY=pc_vk_… Check before moving on: 200 with a products list means the key is valid. 401 AUTHENTICATION_FAILED means the key is wrong or revoked; 403 VENDOR_PAUSED means the merchant paused you. A vendor that already has products sees them here (the SDK returns the same object). 2. Open a job A job is a staged push: nothing changes in the catalog until you close it. Open one and keep its id. Check before moving on: 201 , state: "open" , failureCode: null and an expiresAt 24 hours away. Export the id: export JOB_ID=<jobId> . The SDK's job.get() returns the object inside job . 3. Send a batch A batch is up to 1,000 rows and 5 MiB. All rows of one product go in the same batch. Send an Idempotency-Key so that a retry never stages the batch twice. Check before moving on: 202 , rowsAccepted equals the rows you sent, rowsRefused: 0 and an empty issues . Nothing is applied yet. A row-level error One bad row does not fail the batch. Here the second row has no sku : the batch still answers 202 , the bad row is listed in issues by its position ( index , 0 based), and the good row is accepted. The error report (after the job finishes) names the field and counts rows from 1 across the whole job. This example runs in a scratch job, so the main feed stays clean. Fix: correct the row and send it in the same job as a new batch with a new Idempotency-Key (the body changed). Rows already accepted stay staged. 4. Close the job Closing tells the catalog the feed is complete; it applies the staged batches in the order they arrived, in the background. Check before moving on: 202 , state: "closed" , finishedAt: null . Closing twice is harmless (the second call answers 200 with the job). Any batch sent now answers 409 JOB_CLOSED . 5. Poll until completed (or use a webhook) Poll the job every 5 to 10 seconds until finishedAt is set. A small job took about 10 seconds; a 120,000-product feed took about an hour. Check before moving on: finishedAt is set, failureCode is null and rowsFailed is 0. If not, download GET /v1/catalog/jobs/{jobId}/errors.csv . On a repeat run of the same feed the counts read unchanged instead of created . The webhook alternative Instead of polling, the merchant sets a webhook URL for your vendor (Storefront › Vendors › webhook) and you get a signed catalog.run.completed or catalog.run.failed event. Verify the signature on the raw body, then act. Dedupe on id , because an event can arrive twice or late. Check: your receiver answers 2xx within 3 seconds, and data.runId equals your job id. See Webhooks . 6. Read a product back Address the product by your own id. This is the push API's view: status, hold, archive and purge state, variants. Check before moving on: status: "active" , held: false , the price and quantity you sent. 404 means the id is not yours or the job has not finished. 7. Verify on the storefront Shoppers see the product through the storefront API with a publishable key ( pc_pk_ , type server; ask the merchant). This is the final proof. Check before moving on: the title and priceRange match what you sent. A few seconds can pass between finishedAt and the product appearing; a 404 for longer means the product is a draft (send status: "active" ), held, or archived. All seven steps in one script What to do next Concepts : merge and replace, the job lifecycle, ownership and holds. Full sync : archive what your feed no longer lists. Stock : live stock with PATCH /inventory . Limits and throughput : plan a large feed. Troubleshooting : every error code with a fix. Reference for AI agents ."},{"title":"Stock: set and adjust","route":"/product-catalog/push/inventory","headings":["Stock: set and adjust","PATCH /v1/catalog/inventory","Adjust rules","Results per row"],"text":"Product Catalog · Push API Stock: set and adjust Every stock write chooses, per row, between set (the quantity becomes the sent value) and adjust (the sent value is a signed delta added to the quantity on hand). Set is the default, so an existing caller is unchanged. A stock set or adjust inside a sync job is staged with the job and applies at close, not on arrival ; a staged set re-bases on-hand stock at that moment. PATCH /v1/catalog/inventory is synchronous: the quantity changes before it answers. PATCH /v1/catalog/inventory The body is { rows: [...] } , 1 to 1,000 rows, at most 1 MiB. A row names a sku and can carry quantity (an integer), quantityMode ( set or adjust ), priceMinor , salePriceMinor ( null clears it), currency and availability . Adjust rules Atomic. Two adjusts that arrive together both apply (5 + 3 + 2 = 10); the last writer never wins. An Idempotency-Key is required. A request, a job batch or a vendor single batch with an adjust row needs an Idempotency-Key of 1 to 200 characters, or the answer is 400 IDEMPOTENCY_KEY_REQUIRED before anything is written. A repeated key answers the first answer again and never applies the delta twice. Choose one key per delivery event, not per attempt. Reusing a key with a different body is 409 IDEMPOTENCY_CONFLICT . The SDK generates a key when you pass none. On-hand only. An adjust changes the stored quantity. Stock reserved by open carts is not touched, and availability keeps being computed from reservations as before. Below zero. An adjust may take the quantity below zero only when the variant's backorders setting is allow . Otherwise the row fails with QUANTITY_BELOW_ZERO and the quantity stays. The check uses the backorders value stored before the row writes : a row that also turns backorders on is still judged against the old value. Nothing is silently clamped to zero. One mode and one row per SKU per request. The same SKU twice, or set and adjusted together, fails every row involved ( DUPLICATE_SKU_IN_BATCH , STOCK_MODE_CONFLICT ). Results per row The answer is { results: [...] } , one entry per row, in order: updated , unchanged , not_found (an unknown SKU, or one outside a vendor key’s reach, never SKU_CONFLICT ) or invalid . ], [ code: quantity , The quantity the row left on hand. Reconcile against this, not your own arithmetic. ], [ code: code , html: Why a row is invalid : QUANTITY_BELOW_ZERO , QUANTITY_OUT_OF_RANGE , QUANTITY_MODE_WITHOUT_QUANTITY , STOCK_MODE_CONFLICT or DUPLICATE_SKU_IN_BATCH . ], [ code: sourceWins , false when the caller’s value does not win the quantity (the store key under a value the merchant set by hand). ], ] /> A failed row never fails the others. In a job or a vendor single batch, the quantity each stock-writing row left is recorded and paged from GET …/stock (see reports )."},{"title":"Limits and throughput","route":"/product-catalog/push/limits","headings":["Limits and throughput","Limits","Throughput: two measured runs","What to do about it","Images","How fresh is the storefront?"],"text":"Product Catalog · Push API Limits and throughput Every number you can hit, what happens when you hit it, and how long a large feed really takes. Limits 400 INVALID_REQUEST ], [ Bytes per batch , 5 MiB (5,242,880 bytes) , html: 413 REQUEST_BODY_TOO_LARGE ], [ Inventory request , 1,000 rows, 1 MiB , html: 413 REQUEST_BODY_TOO_LARGE ], [ Batches per job , About 2,000 (roughly 2 million rows) , html: 409 JOB_FULL ], [ Open jobs per caller , 3 , html: 409 TOO_MANY_OPEN_JOBS ], [ Waiting batches per caller , 2,000 received, not yet applied , html: 429 PUSH_QUEUE_FULL , Retry-After: 60 ], [ Job lifetime while open , 24 hours , html: Expires: JOB_EXPIRED ], [ Request rate , 600 per 60 s per key (approximate) , html: 429 RATE_LIMITED with Retry-After ], [ Idempotency-Key , 1 to 200 characters , html: 400 INVALID_REQUEST ], [ Job CSV report , Up to 900 parts , html: 409 REPORT_TOO_LARGE ], [ Report retention , 30 days after the run finishes , html: 410 REPORT_EXPIRED ], [ Refs per archive, restore or assign call , 100 , html: 400 INVALID_REQUEST ], [ GET /products page size , 1 to 100, default 50 , html: 400 INVALID_REQUEST ], [ externalId length , 255 characters , html: 400 INVALID_REQUEST or a refused row ], [ Idempotency-Key memory , 24 hours , After that the same key is treated as new ], [ Stock adjust de-duplication (job rows) , 7 days , A repeated adjust row of the same delivery is not applied twice ], [ Vendors per store / keys per vendor , 200 / 2 active , Creation is refused ], ] /> The rate limiter is approximate : it is not an exact meter, so a burst can slip a little past 600 or be refused a little early. Treat 600 per minute as a design target, not an exact meter, and always honor Retry-After . A vendor key is limited on every route; the store key on jobs and products routes only. Throughput: two measured runs These are two measurements made on 2026-11-01 on one production store, each run once. They are not a guarantee, a benchmark of your feed, or a target. The feed was 120,000 products (372,242 rows) in 373 batches, mode merge, four parallel senders, with images on 10% of the products. Expect about 1 hour per 120,000 products with images , roughly 6.7k to 7.5k rows per minute on average, and plan on a feed with many new image URLs taking that long or longer. The apply rate falls during a run (about 12k to 13k rows per minute at the start, about 3.5k in the middle) and recovers once the image copies drain. The fix between the runs cut database reads by half and made them independent of catalog size, but did not make the run faster. Updates to existing products with no image changes run faster: a price update of about 150,000 rows on the same store applied at about 46,000 rows per minute (a single run on 2026-11-01, 195 s, Worker e844ed62). The same 120,000-product feed ran in about 4 minutes on a local test stack. Do not read that as a production figure. What to do about it Split very large catalogs across jobs (for example by category or by 20,000 products), and keep at most 3 open at once. Poll the job every few seconds, or use the webhook, rather than holding a connection open. Closing returns at once. Send updates without images as a separate, small job so they are not queued behind a big image feed (lanes take turns, but a lane applies its own work in order). Images Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer. A completion event means rows are written, not that images are copied. See known limits . How fresh is the storefront? Rows are visible a few seconds after finishedAt (8.6 s and 39 s were measured on the two large runs). An archived product can still be served for up to 60 seconds from the edge cache."},{"title":"Products: read, archive, restore, rename","route":"/product-catalog/push/products","headings":["Products: read, archive, restore, rename","Read","Weight and dimensions drive live rates","Volume tiers: bulkTiers","Naming products","Archive and restore","The 30-day purge","Rename","Categories"],"text":"Product Catalog · Push API Products: read, archive, restore, rename Writing a product is a push ( jobs and batches ). These routes read what you pushed and change its state. They are synchronous, and a vendor key reaches only its own products. Read GET /v1/catalog/products answers one product when you pass exactly one of externalId , sku or handle , and otherwise a page of the caller's products with a nextCursor ( null at the end; limit 1 to 100, default 50). A product that is not the caller's answers 404 , so a vendor cannot tell it exists. Weight and dimensions drive live rates A variant you push can carry weightGrams , lengthMm , widthMm and heightMm (grams and millimetres, each a number or null ). They now drive live shipping rates: when a buyer adds the variant to a cart, Throttle copies them onto the cart line (kilograms and centimetres), and a connected carrier or rate aggregator quotes with the item's real weight and box. Reading a product back returns the same four fields. Empty means unknown. Send null to clear a value. A value of 0 is refused, never stored as a weightless item. Whole numbers in range. weightGrams is a whole number from 1 to 10,000,000 (10 t); each size is a whole number of millimetres from 1 to 100,000 (100 m). A value outside that, or a fraction, refuses the row with INVALID_ROW and the field path in the report, for example variant.weightGrams . Values already stored are not changed. Dimensions are a set. Throttle uses length, width and height only when all three are present. No weight keeps today's behaviour. A variant with no weight puts no weight on the cart line, and the rate is worked out as it was before. The merchant sees the same numbers in the storefront's Specifications and in the shipping docs for UPS and FedEx . Volume tiers: bulkTiers A push row can carry bulkTiers : volume tables keyed by customer group. The keys work like groupPrices : a group name (any case), a group id, or * for all buyers. Each value is that target's whole table for the product. The model, the price rule and examples are on Volume pricing . null or [] , Clears that target’s table for the product. Other targets keep theirs. ], [ Rows of one product in one batch , html: They combine per target. The first row sets the ranges and types. Values per SKU are merged. A later row with other ranges or types, or a second value for one SKU and currency, is refused with BULK_TIERS_CONFLICT . ], [ Replace mode (full sync) , Behaves like groupPrices. It replaces the tables of the targets you name. It never deletes the table of a group your batch did not name. ], [ A vendor key , html: Refused with FIELD_NOT_ALLOWED . Only the store key may send bulkTiers. ], [ A key that names no group , html: GROUP_NOT_FOUND on the key. The row writes nothing. A percent group is accepted. ], [ A tier that names a SKU of another product , html: BULK_TIER_SKU_UNKNOWN . A SKU created by another row of the same call is known. ], [ A table that breaks a rule , html: BULK_TIERS_INVALID , with the tier and the rule in the field, such as bulkTiers.Dealer[1].minQuantity . ], ] /> Last writer wins. There is no source precedence. A later write replaces the table, whoever sent it, as it does for group prices. Reading it back. GET /v1/catalog/products returns bulkTiers keyed by group id (lowercase UUID), or * for the all-buyers table, never by name, and only when a table exists. A vendor key's read never carries it. Tables of groups Throttle no longer lists are left out. Every maxQuantity is explicit. If the read needs group names and Throttle cannot supply them, it answers 409 EXTENSION_UPGRADE_REQUIRED (the install has no group grant) or 503 CUSTOMER_GROUPS_UNAVAILABLE (retry). It never answers with some tables missing. Read, then write back. A store key that reads a product and pushes the same rows back writes the tables it read as its own. With no source precedence this changes nothing the buyer sees. Naming products The archive, restore and rename routes name a product with a ref : an object with exactly one of externalId , sku or handle . results: [ index, status ] , status archived , unchanged , held or not_found . ], [ code: POST /v1/catalog/products/restore , code: products : [ref, …] , html: The same shape, status restored , unchanged , held or not_found . ], [ code: POST /v1/catalog/products/rename , code: product : ref, handle : new-handle , html: The renamed product. 409 HANDLE_TAKEN when the handle is in use. ], [ code: PUT /v1/catalog/products/vendor , html: Store key only. vendorId : string | null, products : [ref, …] , at most 100 refs; a null vendorId unassigns. , html: Per product: assigned , unchanged or not_found . ], ] /> Each result carries the index of the product in your request, so one missing product does not fail the rest. Archive and restore Deleting through the API archives . The product leaves the storefront at once (it answers 404 ) and can be restored for 30 days. An archived product stays archived when later pushes resend it, until an explicit restore or a row that sends status: "active" for it. Only the key that may write the product can archive or restore it. A vendor cannot archive the merchant's products. Holds stick. If the merchant archived or drafted the product in the dashboard, the vendor's restore answers held and changes nothing until the merchant lifts the hold (see Vendors and keys ). A push to an archived product keeps updating its data; it just does not bring it back. The 30-day purge A product archived through the API is purged 30 days after the archive. Merchant dashboard archives never purge. What a purge removes: The whole product (its variants, images, reviews as the existing product delete rules do, and its data) when no other non-manual source still supplies one of its variants and it has no archive or draft hold. Otherwise only the archiving source's own values, and the product stays archived. Past orde"},{"title":"Jobs, batches and runs","route":"/product-catalog/push/runs","headings":["Jobs, batches and runs","Rows","Merge and replace","Sync jobs","Limits and guardrails","Idempotency","Full sync","Fair turns","Single batches","Runs and progress","Error reports and stock results"],"text":"Product Catalog · Push API Jobs, batches and runs A row describes one variant (a SKU) and the product it belongs to. Rows travel in batches ; many batches make a sync job ; every job and every single batch is applied as a run that you can follow. Rows A row is keyed by sku and grouped into a product by productHandle . A vendor row also carries externalId , the vendor's own product id, which is how the product is found again after a rename. Optional parts: product (title, description, brand, images, categories, tags, options, draft, taxCode ), variant (price, currency, stock, GTIN, dimensions), status ( draft or active ), attributes , prices (other currencies), translations and quantityMode ( set or adjust ). The API reference lists every field and its limits. Images are public URLs; the catalog copies them through its media pipeline (see the image limit ). Categories can be an id or a path, up to 10 levels deep; missing levels are created. Merge and replace Replace needs a product's rows together. All of a product's rows must sit next to each other in one batch . Rows of a product that an earlier batch of the job already claimed, or rows of it that are not adjacent, are refused with SCATTERED_PRODUCT_ROWS , and nothing of that product in the batch applies. The SDK never splits a product across a batch boundary. A row that is refused still counts as sent for the whole job, so its variant is never archived and its values are never withdrawn by a replace. A sent null blanks a field in either mode. A mode is chosen per job (or per single batch), never per row. Sync jobs Open a job with POST /v1/catalog/jobs ( mode , and optionally fullSync ), send batches to POST /v1/catalog/jobs/{jobId}/batches , then close it with POST /v1/catalog/jobs/{jobId}/close . Nothing applies until close. A batch is validated when it arrives (the answer lists refused rows in issues ) and stored. At close the batches apply in the order received, then a full sync runs if requested. The job is all-or-nothing in this sense: until the close, the catalog has not changed. Open for 24 hours at most. A job not closed within 24 hours expires. Its staged batches are discarded, never applied, and the job ends as failed with JOB_EXPIRED (the webhook and the progress view say so). Resend the feed in a new job. States. open (batches accepted), closed (applying or finished; read finishedAt and failureCode ) and expired . Each batch is staged , applied or discarded . Stock in a job applies at close, not on arrival. A staged set re-bases on-hand stock when the job closes. For live stock, use PATCH /v1/catalog/inventory ( Stock ). Limits and guardrails 400 INVALID_REQUEST ], [ Bytes per batch , 5 MiB , html: 413 REQUEST_BODY_TOO_LARGE ], [ Batches per job , About 2,000 (roughly 2 million rows) , html: 409 JOB_FULL ], [ Job lifetime , 24 hours open , html: The job expires and is discarded ( JOB_EXPIRED ). ], [ Open jobs per caller , 3 , html: 409 TOO_MANY_OPEN_JOBS (retryable once one closes or expires). ], [ Waiting batches per caller , 2,000 received but not yet applied, across open and running jobs , html: 429 PUSH_QUEUE_FULL with Retry-After: 60 . , ], [ Request rate , 600 requests per 60 seconds per key , html: 429 RATE_LIMITED with Retry-After . A vendor key is limited on every route; the store key on jobs and products routes only. , ], [ Idempotency-Key , 1 to 200 characters , html: 400 INVALID_REQUEST ], ] /> The store key is one caller: its jobs share one set of caps, and one lane. Send the next batch after a 429 only once Retry-After seconds have passed, with the same Idempotency-Key . Idempotency Send an Idempotency-Key (1 to 200 characters) with every batch. A retry with the same key answers the first answer again instead of staging the batch twice (the replay carries an Idempotent-Replayed header); the same key with a different body is 409 IDEMPOTENCY_CONFLICT . A job batch, a vendor single batch or an inventory request that contains an adjust row must carry one, or the answer is 400 IDEMPOTENCY_KEY_REQUIRED before anything is stored. The SDK makes a key for you when you pass none. Full sync fullSync: true (off by default, never implied) archives the caller's products that are missing from the whole job , once, at close. It never runs per batch. The archive pass is skipped, and the job ends with FULL_SYNC_ARCHIVE_SKIPPED , when any row in the job was refused or failed, or when nothing was seen (an empty job). Nothing is archived on a job that is not clean. A job that expires unclosed is different: it ends failed with JOB_EXPIRED . While a full-sync job is open, it refuses its own source's other writes : another job or a single batch from the same key (and for a vendor, any of that vendor's keys) answers 409 RUN_IN_PROGRESS . Other vendors are not affected. Fair turns Applying takes turns. Every vendor, and the store key, has its own lane, and within one store the lanes take turns, so a small update from one vendor is not stuck behind another vendor's multi-hundred-batch feed. Only a closed job takes a turn. An idle open job never blocks anyone: its staged batches sit in storage, take no turn and apply nothing. Within a lane, work applies one item at a time, oldest close first, so a vendor's single batch waits behind that same vendor's earlier-closed job. A job finishes in the turn that applies its last batch. Single batches For a small update, POST /v1/catalog/variants sends one batch (up to 1,000 rows and 5 MiB) without a job and answers 202 with a run to follow. With a vendor key it has the full push behaviour ( externalId , status, replace, adjust, and a mode in the body). With the store key it is today's endpoint, unchanged: no externalId , status, replace or adjust; use a job for those. A vendor single batch counts toward the same waiting-batch cap as job batches. Runs and progress GET /v1/catalog/runs/{runId} and GET /v1/catalog/jobs/"},{"title":"Admin SDK","route":"/product-catalog/push/sdk-admin","headings":["Admin SDK","Install and create the client","Methods","What the SDK does for you","Images"],"text":"Product Catalog · Push API Admin SDK @usethrottle/catalog/admin wraps the push API: it opens jobs, cuts a feed into batches, waits out a full queue, makes the idempotency keys and follows the run to the end. The admin entry is outside the package's 1.x freeze: a breaking change to it ships as a minor release, named in the changelog, until it is frozen. Every export carries a TSDoc @experimental tag. The HTTP API itself is the stable surface. Install and create the client The admin entry ships in @usethrottle/catalog 1.1.0 and later. createCatalogAdmin({ key }) takes a store key ( pc_sk_ ) or a vendor key ( pc_vk_ ). It is server-only : in a browser environment it throws CatalogError SERVER_ONLY , and it throws INVALID_ADMIN_KEY for any other key (a publishable key gets its own message). The key is never part of an error message. Options: baseUrl , timeoutMs (default 60 seconds) and fetch . Methods What the SDK does for you Idempotency keys. It makes a UUID for every job batch, vendor batch and adjust call that has none, and one retry after a network error reuses it, so a delta is never applied twice. A key you pass is 1 to 200 characters. A full queue. A 429 PUSH_QUEUE_FULL waits retryAfterSeconds , then sends the same batch again with the same key, at most 3 times; after that the RateLimitedError is thrown. wait(). job.wait() and runs.wait() poll every 5 seconds for up to 24 hours ( intervalMs , timeoutMs , signal ). They resolve even when the job failed: read failureCode (or status ). A job that failed client-side is left open and expires after 24 hours; its staged batches are discarded, never applied. A vendor run answer has pushMode beside mode . Stock in a job still applies at close; use inventory.set or inventory.adjust for live stock ( Stock ). Reports: job row numbers are job-wide, and a job whose CSV is above 900 parts answers 409 REPORT_TOO_LARGE ; page stockResults() for stock, and split a very large feed into smaller jobs for error reports. Images Image copies run in two phases. While a job applies, they run alongside it: about 200 to 285 copies per minute at peak in one production run (2026-11-01, Worker e2f3c98a, a single run on one store). Copies still waiting when the job ends are picked up by a sweep that runs every 5 minutes and publishes up to 100 jobs per run, about 20 copies per minute (in the first run, 1,607 leftover copies took about 40 minutes). Until a copy lands, the storefront serves the vendor's own image URL, so keep those URLs public and stable. A catalog also has a budget of 20,000 image resizes per calendar month (roughly 6,700 images), so a feed with more images than that stays partly on vendor URLs for longer."},{"title":"Troubleshooting","route":"/product-catalog/push/troubleshooting","headings":["Troubleshooting","Find your problem","{item.title}"],"text":"Product Catalog · Push API Troubleshooting One section per problem: the exact response, the cause, the fix with a corrected request, and how to confirm it is fixed. Bodies come from real production answers (ids shortened) except where marked as the envelope only. Quote requestId when you ask for help. The full code list is on Errors . Find your problem items.map((item) => ( item.title ( where(item.status) ) )) items.map((item) => ( item.title Where you see it: where(item.status) . item.response !== && ( ) Cause. item.cause Fix. item.fix requests[item.id] !== undefined && Confirm. item.confirm ))"},{"title":"Vendors and keys","route":"/product-catalog/push/vendors","headings":["Vendors and keys","Vendors","What a vendor key can reach","Ownership, ids and clashes","The vendor's push wins","Holds: what the vendor cannot undo","Vendor on orders"],"text":"Product Catalog · Push API Vendors and keys A vendor is a supplier whose products the merchant sells. The merchant creates the vendor and its keys; the vendor never logs in to anything and talks to the catalog only through the API. Vendors The merchant adds a vendor under Storefront › Vendors in the Product Catalog dashboard: a name (creating takes a name only), and a status of active or paused . The webhook URL is set separately, under Storefront › Vendors › webhook. A store holds at most 200 vendors. A vendor cannot be deleted; revoking its keys and archiving its products covers it. Each vendor has at most 2 active keys ( pc_vk_ ), so a key can rotate. A key is shown once when created; only a hash is kept. Revoking or pausing applies on the next request. A paused vendor's keys answer 403 VENDOR_PAUSED before the body is read. Its products stay exactly as they are. What a vendor key can reach A vendor key reads and writes its own products only : products and variants, status (draft or active), handle, archive and restore, stock, prices in the store's currencies, images by public URL, attribute values, translations and categories (a path such as Coffee > Single origin creates missing levels). It also reads its own products, jobs, runs and reports. It cannot touch another vendor's or the merchant's products, set customer-group (trade) prices, create new attribute types, or change collections, filters, price lists, locales, settings, keys, checkout or reviews. Anything outside its reach answers 404 (a resource that is not its own) or 403 VENDOR_KEY_NOT_ALLOWED (a route a vendor key may not call). The store key works on every push route and may act on any product, including assigning a product to a vendor. Ownership, ids and clashes Every product has one owner: a vendor, or none (the merchant). Ownership never changes through a vendor key. externalId is the vendor's own product id, unique per vendor. Two vendors may use the same id for two different products. The store key's own products have a separate id space. A row that creates a vendor's product needs one ( EXTERNAL_ID_REQUIRED ). SKUs stay unique per store. A row whose SKU belongs to another vendor's or the merchant's product fails with SKU_CONFLICT and never takes the SKU over. Adopting existing products. Products already in the catalog (CSV, dashboard) stay merchant-owned until the merchant assigns them to a vendor, one or in bulk. The vendor's first push then links each assigned product by SKU and records its externalId . A push never claims an unassigned product. A new product with no status is created as a draft . Send active to publish it; the vendor decides whether a product shows. Vendor batches are canonical rows . A mapping profile cannot set externalId , so a vendor batch that needs one must not use a profile. A full sync with the store key archives the store's products that its job did not send. A product the merchant has just assigned to a vendor still has the store as its only supplier until the vendor's first push, so that full sync may archive it. Once the vendor supplies the product, a store-key full sync no longer touches it. Assign products after the store's full sync, or let the vendor push first. The vendor's push wins On a vendor-owned product, a field the vendor sends ranks above the merchant's dashboard edit and above every other source. That includes a rename : the vendor's handle replaces the merchant's. A sent null blanks the field. Store-key pushes keep today's precedence: a merchant's dashboard edit still wins over them. Replace mode drops only the caller's own values for fields it did not send, so another source's value (the merchant's) shows instead, and archives only variants the caller supplied. Nothing the merchant added by hand is touched. A replace needs all of a product's rows together, adjacent in one batch (see Merge and replace ). Holds: what the vendor cannot undo If the merchant archives or drafts a vendor product in the dashboard, that is a hold. The vendor's pushes keep updating the product's data, but cannot republish or restore it until the merchant lifts the hold. This lets a merchant stop selling one vendor product without pausing the whole vendor. An archive made through the API is different: it is the vendor's own and is lifted by a restore, or by a row that sends status: "active" (see Products ). The result of a held product is held in an archive or restore answer. Vendor on orders The merchant can switch Vendor on orders on in the dashboard (it is off by default). Then each Throttle order line created from a catalog cart for a vendor-owned product carries the vendor under the reserved metadata.lineResolver key, which merchant order reads and merchant order webhooks return (for drop-ship routing, for example): Only resolver carts record a vendor, the carts the catalog prices through the line resolver . The legacy checkout records no vendor on an order line, and cannot, because it cannot write that reserved key. The vendor is never part of a buyer's view of the cart or order."},{"title":"Webhooks","route":"/product-catalog/push/webhooks","headings":["Webhooks","Set one up","Events","Verify the signature","Retries"],"text":"Product Catalog · Push API Webhooks Instead of polling a job, give the catalog a URL and it tells you when the work is done. One event per finished job or batch, signed, and retried if your server is down. Set one up The merchant sets a webhook URL per vendor, and one for the store key, in the Product Catalog dashboard ( Storefront › Vendors ). Creating an endpoint shows its signing secret ( pc_whsec_… ) once; store it with your other secrets. The URL must be https , with no explicit port, credentials or fragment, no IP literal, no single-label host and no special-use host ( localhost , .local , .internal , .test , .example , .invalid ), and at most 2,048 characters; otherwise it is refused with 422 WEBHOOK_URL_INVALID . Redirects are not followed, and each delivery times out after 3 seconds. Events fire only for sync jobs and vendor single batches . Upload runs and the store key's single batch send none. Events data.runId is the job id for a job. The counts are the same as the progress view and the error report is at …/errors.csv until reportExpiresAt . An event can be delivered more than once: dedupe on its id . The event says the rows are written, not that images are copied. Copies continue afterwards; until a copy lands the storefront serves the vendor's own image URL, so keep those URLs public (see known limits ). Verify the signature Every delivery carries X-Catalog-Signature: t=<seconds>,v1=<hex> , where v1 is the HMAC-SHA256, with your secret, of <t>.<rawBody> . The header can hold up to eight v1 digests (any match passes, so a secret can rotate). Reject a timestamp more than 300 seconds old. Check the raw body text, before any JSON parsing. verifyCatalogWebhook uses WebCrypto only and returns true or false ; it never throws. Answer any 2xx quickly and do the work afterwards. Retries A delivery your server does not accept with a 2xx is tried again. The retry schedule is a list of gaps after the previous attempt , in seconds, not offsets from the first: [ String(index + 1), index === 0 ? None: at once : gap >= 3600 ? $ gap / 3600 h : $ gap / 60 min , String(gap), ]) /> That is GAPS.length attempts over about TOTAL_HOURS hours in all. A receiver that is down longer than that misses the event. The run is still there to poll ( GET /v1/catalog/runs/{runId} or GET /v1/catalog/jobs/{jobId} ), so reconcile from the API after an outage."},{"title":"Product Catalog Quickstart","route":"/product-catalog/quickstart","headings":["Product Catalog Quickstart","1. Install the SDK","2. Create keys","3. Run your first query","From your website","With curl","Next steps"],"text":"Product Catalog Product Catalog Quickstart From nothing to a list of your products in three steps. You need a Throttle application with the Product Catalog extension installed and some products in it. 1. Install the SDK Node.js 20 or later, or any evergreen browser. In TypeScript, moduleResolution must be node16 , nodenext or bundler : the package has only an exports map, which the older node setting cannot read. 2. Create keys Storefront calls use publishable keys ( pc_pk_… ). Create them in the catalog dashboard: Open the Product Catalog extension in your Throttle dashboard and go to Storefront › Keys . For your website, create a key with type Browser and put your site's origin under Allowed websites , one per line, such as https://shop.example.com . Origins are matched exactly and must be https. For Node.js, a server or curl , create a second key with type Server . It has no websites: it refuses any request that comes from a browser. Copy each key when it is shown. Store the server key in an environment variable. A browser key cannot list http://localhost : allowed websites are https only. While you develop, call the catalog from your dev server with the server key, or serve your site over https (for example https://localhost:8443 ) and list that origin. Keys and channels explains the three key types and what each one protects. 3. Run your first query This script lists five products with their lowest price. A script sends no Origin , so it uses the server key. It prints one line per product: its handle, its title and its lowest price in minor units ( 4999 is $49.99). The client talks to https://catalog.usethrottle.dev by default and gives up on a call after 10 seconds. From your website The same call in a page, with the browser key. It works only from an origin on the key's allowed websites. With curl The API is plain HTTP. Send the key in X-Catalog-Key . Use the server key here too: a browser key refuses a request without an allowed Origin ( 403 ORIGIN_NOT_ALLOWED ). Next steps Products, filters and sorting : build a shop page with filters, facets and paging. Cart and checkout : send the shopper to Throttle's checkout. React and Next.js SSR and caching : hooks, a cart and server rendering. Pushing products in : the Catalog Push API puts a merchant's or vendor's products into the catalog; start with the first feed guide."},{"title":"React","route":"/product-catalog/react","headings":["React","CatalogProvider","The read hooks","useTags, useCollections and useReviewEligibility","Keeping previous data","Refresh errors","The cache","initialData: hand over a server answer","useCart","Customer carts","useSubmitReview"],"text":"Product Catalog React @usethrottle/catalog/react wraps the catalog client in a provider and hooks, with a small cache, a session-backed cart and review submission. It works with React 18.2 and 19 (an optional peer dependency), is marked use client , and needs no other library. CatalogProvider createCatalogClient . Required. ], [ code: customerKey , html: The signed-in customer's id, or null . It partitions the cache and the cart by customer. Required whenever customerToken can return a token. , ], [ code: cartStorage , html: Where useCart keeps the cart session id: get, set, remove , each sync or async. The default keeps it in memory only. , ], [ code: cartUrls , html: returnUrl?, cancelUrl?, storefrontUrl? , sent on every cart useCart creates, so each must be an absolute https URL on an allowed return website (otherwise leave them out and pass URLs to checkout(input) ), and used by its checkout() . See return URLs . , ], [ code: throttleBaseUrl , html: Throttle's API, for the cart session. Default https://api.usethrottle.dev . , ], [ code: throttleCheckoutUrl , html: Throttle's hosted pages, for a cart link the hook builds itself. Default https://checkout.usethrottle.dev . , ], ] /> Keep one client per currency and language , memoised on both; on a currency switch run useCart().switchCurrency() first and swap the client once it resolves. Pass customerToken as a function. With @usethrottle/auth 0.10.1 or later that is () => auth.getAccessToken() , read on every request. A new client per customer would start a new cart. Change customerKey in the same update as the token. Reading the customer from useAuth() , as above, does that. A change starts an empty cache, so every mounted hook fetches again and one shopper never sees prices fetched for another. It is required whenever customerToken can return a token: the hook drops the cart on a sign-out or a customer change only by watching it, so without it one customer's cart stays for the next shopper. In the browser, set keyInQuery: true on the client so reads need no preflight; see Keys and channels . useCatalog() answers the provider's client, for a call no hook covers. The read hooks product , or redirectTo for a renamed handle. , ], [ code: useRelated(handle, limit? ) , code: products.related , html: products ], [ code: useFilterValues(key, query?, options?) , code: filters.values , Every value of one filter for a selection. ], [ code: useCategories( depth? ) , code: categories.tree , The category tree. ], [ code: useCollection(handle) , code: collections.get , html: The collection page, or redirectTo . , ], [ code: useSuggest(q, debounceMs?, limit? ) , code: suggest , Suggestions. No request under 2 characters; one per pause in typing (200 ms by default). , ], [ code: useReviews(handle, sort?, rating?, limit?, cursor? ) , code: reviews.list , html: Reviews and their summary, or redirectTo . , ], [ code: useConfig(options?) , code: config , Currencies, locales, sorts, the review settings and the generation. ], ] /> Every read hook (and the three in the extras entry ) answers data, dataFor, error, isLoading, isPreviousData, isStale, isValidating, refetch : data : the answer, typed as the client's call answers it, or undefined . error : the CatalogError of the last attempt, or undefined . A failed refresh keeps the last data . isLoading : no data and no error yet. isValidating : a request for this key is in flight, first load or refresh. refetch() : fetch again now. It never rejects. They take enabled ( false makes no request), initialData and staleTimeMs . A null handle or key makes no request either, which is how one hook waits for another. Each hook also answers dataFor (the query the shown data answers), isPreviousData and isStale , and takes keepPreviousData ; see Keeping previous data and Refresh errors . useTags, useCollections and useReviewEligibility These three hooks (1.2.0 and later) live in @usethrottle/catalog/react/extras , which keeps the /react entry small. They use the provider and the cache of /react : import CatalogProvider from /react and these from /react/extras . tags ], [ code: useCollections( limit?, cursor? ) , code: collections.list , html: collections ], [ code: useReviewEligibility(handle) , code: reviews.eligibility , html: Whether the signed-in shopper may review the product ( canReview ). No request while signed out or while handle is null ; asked again on every mount and kept per customer. , ], ] /> useCustomerKey() , from /react , answers the provider's customerKey . The ReviewEligibility type, the answer of reviews.eligibility , is exported from either entry. Keeping previous data keepPreviousData: true keeps a hook's last settled answer on screen while the next key loads, so a filter change or a typed query does not flash empty. isPreviousData is true while data is the old answer. isLoading stays false meanwhile. dataFor is the params object the shown data answers: for useSuggest the query echo is dataFor.q . While data is undefined (a first load, or a new key without keepPreviousData ) it is the params just asked for, so check data before treating dataFor as its params. If the new key fails, error is set and the old data stays, with isPreviousData still true . isStale is for revalidation failures of the data's own key. Data is never kept across a customerKey change: one customer's answer is not shown to the next. Refresh errors isStale is true while the shown data was not confirmed by the latest attempt: a revalidation failed, or an initialData seed under a customerKey is still being revalidated. A failed revalidation keeps the data and sets error . A success clears both. Retries. The hook retries by itself only when the failure is retryable: a NetworkError , a TimeoutError or a 5xx. The retries come 2 seconds after the failure and again 10 seconds after that, so two retries. Other 4xx answers are not retried, and a 429 keeps its pause with no extra retry"},{"title":"Product reviews","route":"/product-catalog/reviews","headings":["Product reviews","The settings","List reviews: reviews.list","May this shopper review? reviews.eligibility","Submit a review: reviews.submit","Review errors","Show review text safely"],"text":"Product Catalog Product reviews Shoppers signed in with their Throttle customer account can review the products they bought. The storefront lists published reviews and their summary, checks whether the shopper may write one, and submits it. The settings The merchant turns reviews on in the Product Catalog dashboard, on the Reviews screen: pending ) until the merchant approves them. ], [ Ratings on product lists , html: List answers carry rating: average, count , and the best_rated sort and rating filters become available. , ], [ Show imported reviews , Reviews imported from a file are shown and counted. They are never marked verified. ], ] /> The first time reviews are turned on, “Verified buyers only” and “Hold new reviews for approval” come on with it, and the catalog looks through the last 365 days of orders for buyers. A full product carries rating while reviews are on; config() answers reviews: enabled, onLists . List reviews: reviews.list reviews.list(handle, options) answers the product's published reviews, a summary and nextCursor : sort : newest (the default), highest or lowest . rating : 1 to 5, an exact match (4 means four-star reviews, not “4 and up”). limit 1 to 50 (default 10), and cursor for the next page. summary is average, count, histogram : the average rating ( null with no reviews), the number of reviews, and the number per star from 1 to 5. Each review has rating , title , body , displayName , verified (a verified buyer), imported , createdAt and the merchant's reply (or null ). A renamed product answers redirectTo . An unknown product, or reviews turned off, is 404 NOT_FOUND . Review lists are public and cached like the rest of the catalog. In React, useReviews(handle, sort, rating, limit, cursor ) reads them. May this shopper review? reviews.eligibility reviews.eligibility(handle) needs the shopper's customer token (the client's customerToken , see Customer prices ) and answers canReview, reason? . The reasons, checked in this order: Eligibility is a quick check. It does not read the order again, so a purchase refunded since can still answer canReview: true ; the submit then refuses it. Submit a review: reviews.submit reviews.submit(handle, rating, title?, body, displayName ) needs the customer token too. rating is 1 to 5; title is at most 120 characters, body 1 to 5,000 and displayName 1 to 60. It answers 201 review: id, status : A verified email is always required , even with “Verified buyers only” off. With Verified buyers only on, the shopper needs a paid order for the product, and the catalog reads that order from Throttle again before it accepts the review. One review per customer and product. A rejected review keeps the slot; only the merchant deleting it frees it. With Hold new reviews for approval on, the review is pending and appears only once approved; otherwise it is approved and shows at once. Send an idempotencyKey and reuse it when you retry the same submission: a replay answers the first review instead of making a second. useSubmitReview does this for you (see React ). A refused token throws CustomerTokenInvalidError : there is no signed-out fallback for a review. Review errors Retry-After: 900 ; the SDK throws it as RateLimitedError ; it never pauses the React provider's reads. , ], [ code: RATE_LIMITED , 429 , More than 5 submissions a minute from one customer, or 10 accepted reviews an hour from one IP address. Retry-After says when. , ], [ code: REVIEW_VERIFICATION_UNAVAILABLE , 503 , The catalog could not read the order from Throttle to confirm the purchase. Nothing was saved; retry (Retry-After: 10). , ], [ code: EXTENSION_UPGRADE_REQUIRED , 409 , The store has not accepted the Product Catalog extension version that reads customer accounts. , ], [ code: CUSTOMER_TOKEN_INVALID , 401 , No customer token, or one the catalog refuses. ], [ code: NOT_FOUND , 404 , No such product, or reviews are off. ], ] /> Show review text safely A review's title, body, display name and reply are plain text written by a shopper or the merchant, stored as given. The API never turns them into HTML and never cleans them: your storefront must escape them when it renders them. React escapes text in JSX for you; never pass review text to dangerouslySetInnerHTML or innerHTML ."},{"title":"Search and suggestions","route":"/product-catalog/search-and-suggestions","headings":["Search and suggestions","Search results","Suggestions","Search as you type in React"],"text":"Product Catalog Search and suggestions Two calls cover search: products.list with q for a results page, and suggest for the dropdown under a search box. Search results A search results page is a product list with q (up to 200 characters). It matches product titles, brands, product types, Google categories, public attribute values and descriptions, plus SKUs, GTINs and MPNs. With a locale , it also matches the locale's translated titles and descriptions. Everything else on products.list combines with it: filters and facets (with counts for the search), a category or collection, paging and fields. Without a sort , results come by relevance . Any other sort works too. Relevance pages stop at 1,000 products deep: past that the page is empty and page.capped is true . Shoppers rarely go that far; offer filters instead. The answer's applied.q echoes the search. Keep the search in the page URL with the URL helpers ; q is part of the shop query they read and write. Suggestions suggest(q, limit ) ( GET /v1/storefront/suggest ) answers what matches the start of what the shopper typed. q must be 2 to 100 characters; anything else answers 400 INVALID_REQUEST . limit : 6 by default, at most 8 , ], [ code: categories , handle, name and productCount , Up to 5 ], [ code: brands , name and productCount , Up to 5 ], [ code: tags , tag and productCount , Up to 5 ], [ code: collections , handle, title and productCount , Up to 5 ], ] /> Categories, brands, tags and collections match by case-insensitive prefix and come most products first. Every name comes from public products only, so a draft title, a hidden attribute or an archived brand never shows up. Suggestions take the client's currency and locale . They always show list prices: a suggestion request never carries the customer token, so a signed-in shopper's group prices (see Customer prices ) appear on product pages and cards, not here. One request per keystroke pause. Without keyInQuery the answer is cached under the guest partition. With keyInQuery: true (1.2.0 and later), suggest bypasses the SDK's ETag cache and sends no If-None-Match : the request carries only accept plus any client headers you set, so it needs no preflight (a client with custom headers preflights again). See Keys and channels . Link each kind where it belongs: a product to its page, a category or collection to its page, a tag to products.list( tags: [tag] ) , and a brand to a shop page filtered by your brand filter (its key is whatever the merchant named it in Storefront › Filters). Search as you type in React useSuggest(q, debounceMs, limit ) from @usethrottle/catalog/react sends no request while the trimmed text is shorter than 2 characters, and one request per pause in typing: debounceMs , 200 ms by default. Answers are cached in the provider, so typing back to an earlier text shows its suggestions at once. Like every hook, it answers data, dataFor, error, isLoading, isPreviousData, isStale, isValidating, refetch ; with keepPreviousData: true the last suggestions stay while the next ones load, and dataFor.q is the text they answer. Suggestions have their own rate limit for browser, app and legacy keys: 600 requests a minute per visitor, twice the limit of the other routes, so a fast typist is not cut off. The React page covers the provider and the cache."},{"title":"Stock and availability","route":"/product-catalog/stock-and-availability","headings":["Stock and availability","What the API tells you","A quantity the store cannot fill","Reserve stock at checkout","Oversold orders"],"text":"Product Catalog Stock and availability The storefront API never answers a stock quantity. It tells you whether a product or variant can be bought and whether stock is running low, and the cart refuses a quantity it cannot fill. What the API tells you in_stock , out_of_stock , preorder , backorder or null (not set). , ], [ code: lowStock , Products and variants , A tracked variant at or below the store’s low-stock threshold. A product whose stock is all held in checkouts answers false (it is out of stock instead). , ], [ code: purchasable , Full products and variants , Public, priced in the answer’s currency, and available or backorderable. , ], ] /> That is all: no counts, ever. A storefront can show “In stock”, “Only a few left” or “Sold out”, never “3 left”. The one number the API answers is maxQuantity , and only when a requested quantity is refused (below). Stock is counted only for variants that track inventory, and a tracked variant that allows backorders is never refused for stock. A quantity the store cannot fill carts.check , carts.create and every change to a resolved cart judge each line against the stock available right now. A tracked line that wants more than that is refused with QUANTITY_UNAVAILABLE and maxQuantity , the most that can be ordered now (also capped by the variant's maximum order quantity). A line with none on hand is OUT_OF_STOCK . On carts.check the refusal is a line of the answer ( ok: false ). On carts.create it is 422 CART_ITEMS_INVALID , and on a cart session Throttle's 409 quantity_unavailable ; the SDK throws both as CartLineError , whose lines carry maxQuantity . maxQuantity can be 0 while units are still on hand: with reservations on, other shoppers' checkouts can hold the last units (the variant then reads out_of_stock until a hold lapses). Say so (“In other shoppers' checkouts right now”) rather than “Sold out”: a hold that is not paid for lapses within minutes. Reserve stock at checkout Reserve stock at checkout is a per-store setting in the Product Catalog dashboard, under Storefront › Settings › Stock . It is off by default ; with it off, stock is the quantity you import or enter, and nothing below happens. With it on, the catalog keeps its own count: Holds at checkout. When a shopper starts checkout from a catalog cart, the catalog holds the cart's tracked lines for 15 minutes , only if every line fits; otherwise it holds nothing and refuses the lines that do not fit. Starting checkout again replaces the cart's holds. A cart's own holds never count against it. Holds lapse on their own. An unpaid hold simply expires; nothing has to release it. An abandoned cart releases its holds earlier when Throttle reports it. Sales. An order takes its catalog lines off stock and releases its cart's holds. Cancels and returns. A cancelled order puts its lines back, and so does a return once it is received with restocking on. A refund of money alone changes no stock. Counting starts from the quantities you have when you turn it on; earlier orders never move stock. A new quantity from an import or the API becomes the new starting point. Turning it on needs the Product Catalog extension version that reads carts and returns; the dashboard says so if the store has not accepted it yet. Oversold orders The order is the truth. A paid order is never refused or changed because of stock: its sale is always recorded, even when that takes a variant below zero. This can happen because Throttle's checkout session lasts 30 minutes, longer than the 15-minute hold, so a shopper who pays late can buy units another checkout has since taken. The product's Inventory card and the Products list show Oversold by N for a variant that sold N more units than it has. The merchant fixes it by restocking, with “Adjust stock”, or by cancelling an order, which puts its units back. See Cart and checkout for every cart error, and Line resolvers for how Throttle asks the catalog to check stock."},{"title":"Storefront components","route":"/product-catalog/storefront-components","headings":["Storefront components","Start","Install","Two catalog keys: browser and server","Quick start","StorefrontProvider","One cart","What wins when sources disagree","Presets","Styling and the layer order","URL state","SEO","Analytics","Right to left","Keyboard and accessibility","Account page","Shell state","Next"],"text":"Product Catalog Storefront components @usethrottle/storefront-react is a set of React components for a Throttle product catalog: the shop and collection listing, the product page, search, the cart drawer, the account page and the page frame around them. They read their filters, sorts and listing layout from your catalog's storefront settings. The card style and toggles, the badges, the product page options and the catalog wording come from props ( card , badges , product , strings ), from a Throttle Builder, or from the package defaults. The catalog's /config no longer feeds those four. Start A new Next.js store: run npx @usethrottle/create-store my-store . See create-store . An existing app: install the package, wrap the app in StorefrontProvider and render a component. See below. Next.js specifics: route helpers, caching and the hosting-cost rules are on Next.js and caching . Read the cost section before you deploy. Install The package needs @usethrottle/catalog ^1.4.1 , @usethrottle/money ^1.1.0 , and React 18 or newer. Next.js >=15 , @usethrottle/scripts and @usethrottle/auth are optional peers (auth is read only by the ./account entry). Your app and the package must resolve one copy of @usethrottle/catalog and of react ; two copies are two React contexts, and each reads a different cart. Check with pnpm why @usethrottle/catalog . StorefrontNextProvider , the provider wired to Next's router and links. ], [ code: @usethrottle/storefront-react/account , html: AccountPage and StoreShellProvider . Needs @usethrottle/auth . ], [ code: @usethrottle/storefront-react/styles.css , The same stylesheet as a file, for a cached, flash-free server render (with injectStyles false). ], ] /> Two catalog keys: browser and server A catalog has two kinds of key, and a store uses both. They are not interchangeable. 403 ORIGIN_NOT_ALLOWED ). It also works for local development. , ], ] /> A NEXT_PUBLIC_ variable is written into the JavaScript your visitors download. The catalog refuses a server key on a browser request ( 403 SERVER_KEY_IN_BROWSER ), but the key is still exposed. Keep it in a plain variable on your host, and never use a secret ( pc_sk_ ) key in a storefront. See Keys and channels . Quick start A client-only app (Vite, for example) needs a provider and a component. The provider reads your catalog's settings in the browser, and the history router is its default. For Next.js, give the provider the settings the server already loaded ( loadSettings ) so the first paint needs no request, and use StorefrontNextProvider . The route files are three lines each; see Next.js and caching . StorefrontProvider One provider holds everything the components share: the catalog client and its settings, the resolved site design (theme, brand, menus), the router, the link component, analytics, the cart drawer and your text overrides. client . ], [ code: client , A ready catalog client (a server-built one, or a fixture in tests). ], [ code: settings , html: The settings answered on the server ( loadSettings ). The first render uses them with no request. ], [ code: preset, theme, scheme , html: The look. See Theming . ], [ code: locale, currency, dir , html: Language and currency for the reads. dir defaults from the locale (right to left for Arabic, Hebrew and the like). ], [ code: appearance , html: parts (class names per part), variables and darkVariables (token overrides, the last word). ], [ code: localization , Text overrides for any string, in any language. ], [ code: card, badges, product, strings , html: Site-wide display options: the card (style, rating, swatches, brand, compare-at, badges, second image, quick add), the badges (sale, new, low stock, custom), the product page (layout, sections, related) and the catalog wording by key. Each is a partial group, filled field by field. A component's own prop beats these, and a Throttle Builder's value beats both. Site keys such as footer.copyright still come from /config ; catalog keys do not, so pass strings or localization for locale-specific wording. ], [ code: builderOverrides , The non-null display values a Throttle Builder set (same shape as the four props above). Set by the Builder renderer; a null value defers to the props. ], [ code: analytics , html: Where GA4-shaped events go. See Analytics . ], [ code: router, linkComponent , html: How the URL is read and links are drawn. StorefrontNextProvider sets both. ], [ code: customerKey, customerCart, cartStorage, cartUrls , html: Cart wiring. See One cart . ], [ code: generationWatch , html: The open tab's check for a catalog change. Default on, every 60 s at the least; false turns it off. ], [ code: injectStyles , html: Default true: the provider renders the stylesheet in its own markup, so it is in the HTML the server sends and the first paint is styled (the client adopts it, no second copy). Set false and import styles.css yourself to ship it as a cached file instead. ], [ code: imageOrigin , html: Where catalog media is requested. Every image URL whose path starts with /media/ (cards and the gallery) is requested at <imageOrigin>/media/... ; '' is your own origin, so a rewrite of /media/:path* to the catalog saves the phone a second connection. Default: the catalog's URLs. ], ] /> One cart StorefrontProvider creates the one CatalogProvider of your app. The add-to-cart buttons, the cart button and the drawer read the same cart as your own useCart() from @usethrottle/catalog/react . Hand the cart wiring to the storefront provider and it forwards it unchanged: cartStorage : where the cart session id is kept ( get , set , remove ). The default is memory only, so a reload starts a new cart. customerKey and customerCart : whose cart this is, and resuming a signed-in customer's cart on any device. cartUrls : returnUrl , cancelUrl and storefrontUrl , sent on every cart and used by checkout() . Each is an absolute https URL on an allowed return web"},{"title":"Components","route":"/product-catalog/storefront-components/components","headings":["Components","Money is always formatted for you","Pieces","Shop","Product page","Volume pricing","Frame","Merchandising","Shopper tools","Pages","Slots","Hooks and helpers"],"text":"Product Catalog / Storefront components Components Every public export has a JSDoc comment, so your editor shows what each prop does on hover; this page is the map of what exists. All of them take classNames (class names per part key ), className (the root) and unstyled , and read their defaults from your catalog settings (a prop wins over the setting, the setting over the package default). The card, badge, product page and wording options are the exception: they no longer come from the catalog's /config . ProductCard ( card , badges , strings ), ProductGrid , ShopAll , ProductCarousel , RecentlyViewed and ProductPage (all four, with product ) take them as props; the order is a Throttle Builder's value, then the component's prop, then StorefrontProvider 's, then the package default. Where a component has a single-purpose prop for the same option ( variant or quickAdd on a card, layout or sectionsStyle on a product page), that prop wins over the group prop ( card.style , product.layout ). The server loaders take the same values as an optional display input so the server's requests match the client's. Money is always formatted for you Components show every amount with formatMoney from @usethrottle/money , in the record's own currency. A slot that draws a price receives minor (the amount in the currency's minor units) and currency , never a pre-formatted string, and must call formatMoney(minor, currency) . Do not divide by 100, call toFixed(2) , use Intl currency styles, hard-code a symbol or default to USD. Catalog answers also carry ready-made display strings where a read gives them. Pieces product , generatedAt (required, ISO: the new badge ages against it, never the browser clock), variant (standard, minimal, overlay, row), meta (brand or category), position , listName , slots , onSelect ], [ code: Price , One price with its labels. , html: minor , currency , compareAtMinor , priceContext (anonymous, customer, email_unverified, anonymous_fallback) ], [ code: Money , An amount drawn by formatMoney. , html: minor , currency , compareAtMinor ], [ code: StarRating , A rating as five stars, one image to a screen reader. , html: value , count , size ], [ code: Badge, Swatch , A label; a colour or texture dot. , html: kind , tone ; value , hex , image , selected , disabled ], [ code: Image , A picture that reserves its space. , html: src , alt , aspectRatio (required), sizes , srcSet , priority , eager ], [ code: RichText , Catalog HTML through an allow-list: no script, style, event handler or javascript: URL. , code: html ], [ code: Link , A link through the store link component (a plain anchor, or next/link). , html: href , prefetch , any anchor attribute ], ] /> Reserved for a later release, rendering nothing today so a slot can already name them: WishlistButton , BackInStock , FrequentlyBoughtTogether , ReviewPhotos , ReviewVotes , QuestionsAndAnswers . Shop ShopAll is the listing page for the shop, a collection, a category, a tag or a search: heading, controls, filters, grid and pagination, laid out by your settings. Give it initialData from loadShopAll and it renders at once and fetches nothing until the shopper changes the selection. With children it is ShopAll.Root around them, so you lay the pieces out. { kind: 'all' } , or collection , category , tag with a handle , or search . ], [ code: initialData , The server answer (loadShopAll). No request on mount. ], [ code: filterLayout , sidebar, topbar or drawer. The markup carries the sidebar and the Filters button; CSS shows the right one by width, so the server paint is already right. ], [ code: pagination , numbered, load_more or infinite. ], [ code: columns , html: { desktop, mobile } ], [ code: priorityCount , How many cards, from the first, load their picture at once. The first is the page's largest paint (high priority, preloaded in the HTML), the rest of the row load at once at low priority, so they do not compete with it, later cards are lazy. Default: the desktop row size; 0 leaves all lazy. ], [ code: cardVariant, cardMeta , How the cards are drawn; the line above each title (brand or category). ], [ code: card, badges, product, strings , Display options for this list (partial groups). They beat the provider\\ s and lose to a Throttle Builder\\ s value. The card toggles and badges reach every card in it. ], [ code: baseUrl, jsonLd , Absolute URLs for the JSON-LD; turn the JSON-LD off if you render it yourself. ], [ code: view , grid (default) or list. list draws one card per row, through data-view= list on each product grid. ], ] /> ShopAllContext and ListingTemplateShell are for Builder listing templates: read the state with useShopAll() in your own code. The pieces on ShopAll : Root , Heading , Breadcrumbs , FilterSidebar , FilterBar , FilterDrawer , ActiveFilters , SortSelect , ResultCount , ProductGrid , Pagination , SlotAbove , SlotBelow . FacetGroup draws one filter (checkboxes, colour swatches, a dropdown, a yes or no choice, or a numeric range; values OR within a filter and AND across filters). useShopAll() answers the state and actions (see Recipes ). Product page ProductPage is the whole page: breadcrumbs, the gallery and buy box in the layout ( classic , stacked or editorial ), the sections (tabs, accordions or a stack), related products, reviews and the sticky add bar. Give it initialData from loadProduct . With children it is ProductPage.Root ; the pieces are JsonLd , Breadcrumbs , SlotAbove , Gallery , BuyBox , VariantPicker , Price , StockStatus , QuantityInput , AddToCart , StickyAddToCart , ProductSections , ShippingSection , TagList , CategoryList , RelatedProducts , Reviews , ReviewForm , SlotBelow . useProductPage() answers the product, the chosen variant and options, stock, the quantity and add() . In a Server Component, use the named exports ProductPageRoot , ProductJsonLd and the other pieces (such as StickyAddToCart ) instead of Pro"},{"title":"create-store","route":"/product-catalog/storefront-components/create-store","headings":["create-store","Usage","The two key prompts","Options","What you get","--builder-mode build"],"text":"Product Catalog / Storefront components create-store @usethrottle/create-store writes a complete Next.js store on @usethrottle/storefront-react : the shop, collections, categories, tags, product, search and account pages, the cart drawer, and the cache-safe webhook and sync routes. Usage pnpm create @usethrottle/store my-store does the same. The folder must be empty or missing (default my-store ). The command asks for your keys, writes .env.local , and installs dependencies with the package manager that ran it. The two key prompts A catalog has a browser key and a server key , and a store needs both (see the two catalog keys ). The command asks for them in this order: "Catalog publishable key (pc_pk_...)" : the browser key. It goes to NEXT_PUBLIC_THROTTLE_CATALOG_KEY . "Catalog server key, for your store's server (pc_pk_..., press enter to skip)" : the server key. It goes to THROTTLE_CATALOG_SERVER_KEY . You can skip it, and the command warns that your server cannot read with only a browser key; add it to .env.local before you run the store. Both start with pc_pk_ , so the command asks the catalog which is which (a read with and without a website origin) and never trusts the order you typed them in. If you give a server key first, it asks for the browser key next. If you give them the wrong way round with flags and the catalog confirms it, it swaps them. If the catalog cannot place a key (offline, or no answer), it asks for both and takes the roles on your word, with a note. The one rule the command enforces last, whatever path it took: a key the catalog says is a server key is never placed in NEXT_PUBLIC_THROTTLE_CATALOG_KEY , because that variable is published to every visitor. A secret key ( pc_sk_ ) is refused outright; a storefront never uses one. Options , The catalog browser key. A server key given here is detected. ], [ code: --server-key , The catalog server key, for reads made by your store server. Asked for after the browser key when missing. ], [ code: --yes, -y , Ask nothing. Needs --catalog-key. A server key given alone needs the browser key too, and keys the catalog cannot tell apart need both flags. ], [ code: --builder-mode , html: Default live (nothing added). build adds a Throttle Builder site generated at build time from a frozen release, with no Builder reads while the store runs. See Builder delivery modes . ], [ code: --pm , The package manager (default: the one running the command). ], [ code: --skip-install , Write the files and stop before installing. ], [ code: --offline , Do not call the catalog to tell the keys apart. Then pass both --catalog-key and --server-key. ], ] /> What you get The store renders its pages per request from catalog data kept until the catalog changes, so it writes no ISR. Its README.md lists the cost rules; the reasons are on Keeping ISR costs down . Set THROTTLE_WEBHOOK_SECRET and point the catalog's storefront.changed webhook at /api/throttle/revalidate before you go live. --builder-mode build The store gains app/(store)/[[...path]]/page.tsx (the one route, made by createBuilderRoute , with every page of the release in generateStaticParams and dynamicParams = false ; / is the Builder home, with the shop there until you publish one, so the store has no app/page.tsx ), app/not-found.tsx (the Builder not-found template), app/robots.txt/route.ts , app/sitemap.ts , lib/builder.ts (the build client), lib/packs.ts , and a layout, provider and next.config.ts that read the site from the release. Set THROTTLE_BUILDER_KEY (the build key, server and build only) and THROTTLE_MEDIA_ORIGIN ; BUILDER_RELEASE_ID builds an older release. The build reads the release once into .builder/release.json and the running store never calls the Builder. Its README says one full build per release, zero Builder-driven ISR writes. Without the option the store is exactly as before."},{"title":"Next.js and caching","route":"/product-catalog/storefront-components/nextjs","headings":["Next.js and caching","Setup","Route helpers","Keeping ISR costs down","1. The cache policy: kept until the catalog changes","2. Search is no-store and dynamic","3. One coarse tag, cleared at most once a minute","4. The signed revalidate handler and the sync handler","5. staticParams defaults to 0","6. primaryCache: 'no-store' and its trade-offs","7. Deploys, preview and the layout","8. Bots and deep pagination","Checklist"],"text":"Product Catalog / Storefront components Next.js and caching The /next entry gives a Next.js App Router store one helper per route, a provider wired to Next's router, and the two handlers that clear the cache when your catalog changes. The defaults are set so a store does not write to the ISR cache on every change, every visit or every deploy. Read Keeping ISR costs down before you go live. Setup Next.js 15 or newer. Both keys are needed: the server reads with the server key, the browser with the browser key (see the overview ). In app/providers.tsx use StorefrontNextProvider from /next/client . It is StorefrontProvider with Next's useRouter , usePathname and useSearchParams and next/link , and with the open-tab check wired to the sync route ( syncPath , below). Pass settings from loadSettings in the layout so the first paint needs no request, and import @usethrottle/storefront-react/styles.css in the layout, before your own CSS, with injectStyles={false} : the sheet then ships as a cached file, with the layer order first, instead of inside every page's HTML. To serve images from your own origin, add a /media/:path* rewrite to the catalog and pass imageOrigin="" . Route helpers searchParams , so it renders per request. A missing handle is a 404, a renamed one a 308. ], [ code: createProductPage( ...store, staticParams ) , A product, by handle. , html: staticParams defaults to 0. See the cost section. ], [ code: createSearchPage(store) , Search results, query in ?q=. , Dynamic, never cached, noindex. ], [ code: createAccountPage(store) , The account page (needs @usethrottle/auth). , Never indexed. ], ] /> Each helper returns { Page, generateMetadata } (and generateStaticParams for products), built on loadShopAll , loadProduct , loadSearch and the metadata builders from /server . Use those directly if you want your own page around the components. Shared options: getPreviewToken ). It reads cookies, so the route renders per request: preview deployments only. ], [ code: site , A function returning the site design, for the title template and the share image (a Builder store passes its own). ], [ code: primaryCache , html: 'default' or 'no-store' . See the cost section. ], ] /> Keeping ISR costs down On Vercel every page regenerated into the ISR cache, and every cached read written to the data cache, is a billed write. A store that regenerates often, or writes a page per URL a crawler tries, pays for each one. A deploy also starts with an empty cache, so every prerendered page is written again. The defaults below are chosen so a store pays close to nothing for caching. Each rule says what to keep and what it costs to break it. 1. The cache policy: kept until the catalog changes createStorefrontServerClient reads on STOREFRONT_CACHE_POLICY : every kind of read (settings, navigation, pages, product, listings, facets, related, reviews) is 'until-changed' . A read is kept, with the catalog SDK's one-hour safety limit as the longest it can go without a check, and cleared sooner when the catalog changes. Nothing revalidates in under one hour. Next regenerates a page on its lowest revalidate time, so one short time on one read would regenerate every shop, collection and product page, per filter, sort and page, that often. Override one kind with cachePolicy: { listings: '120m' } if you must. Keep any override at an hour or more. Never set revalidate under 3600 on a route, in next: { revalidate } on a fetch, or in route segment config. A request with a customer token, a cart or a preview token is never cached, whatever the policy says. 2. Search is no-store and dynamic STOREFRONT_CACHE_POLICY.search is 'no-store' , and loadSearch (and any listing carrying a q ) reads with cache: 'no-store' . Every query is a new URL; caching them is what makes a hosting bill grow. createSearchPage reads searchParams , so Next renders it per request. If you write your own search route, read searchParams or export dynamic = 'force-dynamic' . 3. One coarse tag, cleared at most once a minute Every read carries a single tag, throttle-catalog ( CATALOG_TAG ). A change clears that tag, not one tag per product or per route, and the clearing is coalesced: at most once a minute per server instance ( REVALIDATE_WINDOW_MS , a floor you cannot lower), however many notices arrive. A burst of merchant edits is one regeneration, not one per product. A change that arrives inside the window is left pending and applied by the first call after it; there is no timer, because Next applies a tag clearing when the request that called it ends. With several instances each has its own window. Never use revalidatePath . It regenerates a named page whatever changed, and a loop over paths is a write per path. The package never calls it, and a store should not either. 4. The signed revalidate handler and the sync handler Two route files, both short: storefront.changed webhook. The primary path. , html: Checks the signature first: an unsigned or wrongly signed request is a 401 and clears nothing. A verified notice clears the one tag, at most once a minute. A test event clears nothing. secret accepts a list, for rotating it. , ], [ code: createGenerationSyncHandler( client ) , html: An open tab that saw the catalog's generation move (the provider's generationWatch ), before it refreshes. , html: Reads the live generation (at most once per minIntervalMs , default 5 s), and only if it differs from the one the cache holds clears the tag, at most once a minute. Answers 200 { changed, throttled? } , or 502 { changed: false } when the catalog cannot be read. A change found inside the window carries retryAfterMs ; the tab asks again then. It needs no auth because it cannot empty the cache unless the generation really moved. , ], ] /> Set the webhook up. Add THROTTLE_WEBHOOK_SECRET and point t"},{"title":"Recipes","route":"/product-catalog/storefront-components/recipes","headings":["Recipes","Restyle with Tailwind","Swap the Price slot","Rearrange ShopAll sections","Headless filters with useShopAll","Add GA4","A Vite (client-only) store","Add an account page","Pick a preset in code","A collection shelf and a product carousel","Arrange the product page","Keep an open tab fresh without webhooks","Widget packs for the Throttle Builder"],"text":"Product Catalog / Storefront components Recipes Each recipe is a real file that is typechecked against the package, so the code you copy is the code that compiled. Every amount a recipe draws goes through formatMoney or a component that uses it; none divides by 100 or writes a currency symbol. Restyle with Tailwind Pass utility classes per part key in classNames . They are added after the package's classes and win because the package's CSS lives in @layer throttle , below Tailwind's components and utilities layers. The one requirement is the layer order, declared first in your CSS. Part keys are listed in STOREFRONT_PART_KEYS , and every element shows its own in data-throttle-part in the browser inspector. Swap the Price slot A slot gets the props its default takes. The price slot gets minor , currency , compareAtMinor and priceContext ; draw them with formatMoney(minor, currency) . Rearrange ShopAll sections Give ShopAll.Root children and place the pieces yourself. Put filters in the top bar or a drawer with filterLayout , and choose pagination and columns ; each defaults to your catalog's setting. Headless filters with useShopAll useShopAll() answers the facets, the selection ( query ) and the actions ( toggleValue , setValues , setRange , setSort , setPage , clear ). The selection is the URL, so your markup stays shareable and the back button works. Wrap in <Unstyled> to drop the package's classes for what you draw. Add GA4 Pass gaAnalytics() as analytics . Your page loads gtag.js or Google Tag Manager; the storefront pushes the ecommerce events ( view_item_list , select_item , view_item , add_to_cart , remove_from_cart , view_cart , begin_checkout ). To send them through Throttle's own scripts instead, use throttleScriptsAnalytics(scripts) with @usethrottle/scripts . To send your own events, useTrack() . A Vite (client-only) store No server is needed: the provider reads the catalog's settings in the browser with a browser key, and its history router is the default. Add your site's origin to the key's allowed websites. Persist the cart session with cartStorage , or a reload starts a new cart. Add an account page Install @usethrottle/auth , add the account publishable key to your catalog's brand settings, and render AccountPage . In Next.js, createAccountPage(store) does it in three lines. Pick a preset in code Without a Throttle Builder your props decide the theme; with one, the Builder does and a development warning names the prop it shadowed. appearance.variables always has the last word. See Theming . A collection shelf and a product carousel Both read their products in the browser unless you give them initialData from loadMerchProducts , which lets a server component send the first render with the products already in it. Arrange the product page Keep an open tab fresh without webhooks The signed webhook is the primary way a change reaches your store. If you cannot set it up, the open-tab check still works: the provider's generationWatch (every 60 s at the least) sees the catalog's generation move and POSTs to syncPath before it refreshes the page, and createGenerationSyncHandler clears the cache only when the generation really moved, at most once a minute. A visitor with a tab open sees a change within about a minute; a store with no open tabs updates through the one-hour safety limit. Do not lower generationWatch below 60 s, and do not clear the cache with revalidatePath or a short revalidate : those are the settings that turn a catalog edit into hundreds of ISR writes. The reasons and the checklist are on Keeping ISR costs down . Widget packs for the Throttle Builder @usethrottle/storefront-react/builder exports catalogPack() and commercePack() for @usethrottle/builder-react . They wrap the components on this page (the product grid, collection shelf, featured product, product carousel, category list, reviews list, search box, language and currency switches, cart button, account button) as Builder widgets, and add the data sources that feed them. The entry needs @usethrottle/builder-react and @usethrottle/builder-schema (both optional peers of this package); the core package never imports them. To use a page s or menu item s Show when rules (signed in, cart, buyer groups), give <BuilderProvider> a viewer . useStoreViewer() builds it from the buyer session; it runs in the browser only. Upgrade @usethrottle/builder-react and @usethrottle/builder together: a store on an older renderer has group-rule content hidden by the Builder until it upgrades. See Storefront auth and Layout . Data sources. catalog.products , catalog.product , catalog.collection , catalog.categories and catalog.reviews resolve on the server; context.product and context.listing are what a slot hands over (the product page s product, the listing page s listing), not a read; catalog.cart and throttle.customer are per shopper and resolve in the browser only. A page makes one lookup request for all the catalog ids it stores (so a renamed collection still renders) and one list request per widget, never one per product. Money. A money field is amount, currency, display , with amount in minor units and display from formatMoney . A template prints only display or currency . Slots. product.above and product.below know product ; shop.above and shop.below know listing . Manifest. @usethrottle/storefront-react/builder-pack.json is the data-only part of both packs (widget definitions, data sources, slot points), generated at build time. The Builder s server validates documents with it and never imports React. Cost. The packs read through the catalog client s until-changed policy (an hour at most, cleared by the catalog s cache tags). They never call revalidatePath and never revalidate on a shorter time."},{"title":"Theming","route":"/product-catalog/storefront-components/theming","headings":["Theming","Two kinds of setting","Site design precedence","Presets","Tokens, dark mode and appearance","Text and languages","Slot outlets"],"text":"Product Catalog / Storefront components Theming A storefront's look comes from several places that can disagree: a Throttle Builder, your own props, your catalog settings and the package's presets. This page says which one wins, field by field, and how to override the result. Two kinds of setting Catalog display is how the shop works: the listing, the card, the badges, stock text, the product page and its sections, filters, sorts, routes and catalog strings. It is read from your catalog settings. A prop on a component wins over the setting, and the setting over the package default. Site design is how the site looks and speaks: the theme, the brand (store name, logo), the menus, the announcement, SEO defaults, the site strings ( footer.copyright , nav.menu , nav.account ), the page route and the account key. It is resolved from the sources below. Site design precedence The provider resolves the site design once, in resolveSiteDesign (also exported from /server ). preset , theme and scheme props. 3. The preset's defaults ( clean and auto ). , ], [ Every other site field: brand, menus, announcement, SEO defaults, site strings, page route , html: 1. The Builder (or the site prop). 2. The package defaults. Decided field by field. The catalog no longer supplies any of these. , ], [ The account publishable key , html: The throttlePublishableKey prop, then the Builder's connections, then none. ], [ Token overrides , html: appearance.variables and appearance.darkVariables , applied last, always. They beat every row above. ], ] /> A null from a source is a value (it clears the field); undefined falls through to the next source. With no Builder, the tokens are the preset's, then your theme prop, merged deeply. With a Builder, its values go on top. A Builder whose theme is not customized contributes only its preset and colour scheme. When a Builder's theme shadows a preset , theme or scheme prop, one development warning names the prop. Remove the prop or change it in the Builder. The Product Catalog no longer holds site design (brand, theme, menus, home page, announcement, SEO defaults, site wording) or content pages, and catalogSiteDesign is removed. Manage them in the Throttle Builder, or provide your own site design with the site prop, or set the theme in code. The catalog keeps how catalog pages display: product cards, badges and the product page. Presets Preset tokens (colours for light and dark, fonts, radius, spacing scale) are plain data in @usethrottle/ui/presets ( PRESET_NAMES , PRESET_TOKENS ). That entry has no React and no directive, so it is safe in a server component, and the Throttle Builder reads the same data. The storefront root carries data-throttle-preset="<name>" ; each package keeps its own per-preset CSS for its own components, keyed by that attribute (storefront CSS never reads the tokens from anywhere else). Tokens, dark mode and appearance scheme is light , dark or auto (the visitor's system setting). With auto , the dark palette moves into a scoped rule so it beats the stylesheet's own dark rule. theme overrides preset tokens ( radius , spacingScale , fonts , and the light and dark palettes). appearance.variables (and darkVariables , used in dark and in auto ) set the CSS custom properties directly: colorPrimary , colorBackground , borderRadius , fontFamily and so on. This is the developer's token layer and always has the last word. appearance.parts adds class names per part key, the same as classNames on a component but for the whole tree. A Throttle Builder site can set the same map in Theme, Advanced, Package part classes ( partClasses ); it is laid under appearance.parts , so the prop wins for a key both set. Values that carry { , } , ; , url( or @import are dropped from generated CSS, because the CSS can be built from data a site owner typed. Text and languages Every string resolves in this order, first match wins: the Builder's strings; your localization prop; for a catalog string, the catalog settings' strings ; the package's English ( SF_STRINGS_EN , or the SDK's defaults for catalog strings). localization is a nested object, for example { cart: { title: 'Basket' } } , so any language is a data change. Strings take {name} placeholders. Set locale (and dir when the locale is not enough) on the provider; prices and dates follow it. Slot outlets A SlotOutlet is a place where a host may add content: product.above , product.below , shop.above and shop.below . The storefront core never imports the Throttle Builder; it talks to one through two hooks in @usethrottle/ui : useSiteDesign() (the site design a host provides) and useSlotOutlet(name) (the renderer a host registered for a slot). A product outlet's renderer receives { context } with the product and the chosen variant SKU; a listing outlet's receives the source, the total, the filters, the sort and the page. With no host, or no renderer for a name, the outlet renders nothing, not even its wrapper, so a store without a Builder is unchanged. SiteDesignProvider and SlotOutletProvider from @usethrottle/ui let a host (or a test) provide them without the Builder package. For the components that take a replacement directly, see Slots ."}]}
|