87 Fixed Bundles in 30 Minutes: Bulk Creating Shopify Bundles with Claude and the Flex Bundles API
TLDR
- An agency used Claude and the Flex Bundles Admin API to put 87 fixed bundles live on a client's store in 30 minutes, work that would have taken hours by hand
- It works because the API covers everything the bundle editor does, a fixed bundle is one small request, and the docs are published as plain Markdown an AI assistant can read
- To do it yourself: generate an API key, prepare a list of parent variants and their components, point Claude at the docs, and have it write a script that creates the bundles one at a time
- Create one bundle first and check it in the app, keep the API key out of the chat, and send requests sequentially
Last week, an agency needed to build 87 fixed bundles for a client, and they needed them that night.
They opened Claude, pointed it at the Flex Bundles API, and all 87 bundles were live on the store within 30 minutes. Building them one at a time in a bundle editor would have been hours of work.
I wasn't involved. I heard about it afterwards, which is my favourite part of the story: nobody had to ask us for anything.
This post covers why that works and how to set up the same thing yourself.
Why 87 bundles is a 30 minute job
Three things have to be true for an AI assistant to do this well, and none of them are about the AI.
The API does everything the editor does. The Bundles Admin API creates, updates, and deletes bundles, and a bundle created through it behaves exactly like one built in the app. There is no "API version" of a bundle with missing features.
A fixed bundle is one small request. A fixed bundle is a parent variant plus a list of component variants and quantities. That is the whole payload:
curl -X POST https://api.flexbundles.com/v1/fixed-bundles \
-H "Authorization: Bearer fxb_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"product_id": "10313045967149",
"variant_id": "52212525334829",
"components": [
{ "product_id": "10309675221293", "variant_id": "52199500808493", "quantity": 2 },
{ "product_id": "10309675286829", "variant_id": "52199500972333", "quantity": 1 }
]
}'
Once it is saved, adding the parent variant to the cart brings the components with it, and our Cart Transform Function expands the bundle into real line items at checkout. There is no theme code to write for a fixed bundle, so "created" and "live" are the same moment.
The docs are written to be read by machines too. Every docs page is available as plain Markdown
by adding .md to its URL, and the full set is at /llms.txt. An assistant that has
read the page knows the endpoints, the fields, and the error codes without guessing.
Put those together and 87 bundles is a loop over a list. The slow part is no longer the clicking. It is deciding what goes in each bundle, which is the part that should take the thought anyway.
How to do it yourself
I don't know the exact prompts the agency used. This is how I would set it up.
1. Generate an API key
Open the Flex Bundles app, go to Settings, and generate an API key. It is shown once, so copy it somewhere safe, then put it in an environment variable on the machine that will run the script:
export FLEX_BUNDLES_API_KEY=fxb_your_api_key
Keep the key out of the chat. The key grants full bundle management for the store. Have the script read it from the environment variable, and don't paste it into a prompt. If a key does end up somewhere it shouldn't, regenerate it in Settings and the old one stops working immediately.
2. Prepare the list of bundles
The assistant needs to know what the 87 bundles are. A spreadsheet or CSV with one row per component works well:
| parent_product_id | parent_variant_id | component_product_id | component_variant_id | quantity |
|---|---|---|---|---|
| 10313045967149 | 52212525334829 | 10309675221293 | 52199500808493 | 2 |
| 10313045967149 | 52212525334829 | 10309675286829 | 52199500972333 | 1 |
The API takes numeric Shopify product and variant IDs, without the gid:// prefix. If your list is
in SKUs, you need a way to turn them into variant IDs first, such as a lookup through the Shopify
Admin API. That lookup is a good job for the assistant as well.
The parent variants have to exist in Shopify before the bundles are created. The API attaches a bundle to a variant. It does not create products.
3. Point Claude at the docs
Give it the Markdown version of the API reference:
https://flexbundles.com/docs/admin-api.md
4. Ask for a script, and start with one bundle
A prompt along these lines is enough:
Read https://flexbundles.com/docs/admin-api.md.
bundles.csv has one row per component of a fixed bundle. Group the rows by
parent_variant_id and write a Node.js script that creates one fixed bundle per
group with POST /v1/fixed-bundles.
- Read the API key from the FLEX_BUNDLES_API_KEY environment variable.
- Send the requests one at a time, not in parallel.
- Log the parent variant and the result of every request.
- On an error, log the status and message and carry on with the next bundle.
- Add a --limit flag so I can run it for the first bundle only.
Run it with --limit 1, open the bundle in the Flex Bundles app, and add the parent variant to a
cart on the store. When that one is right, run the rest.
5. Check the results
Bundles created through the API appear in the app immediately. Read the script's log for anything that failed, fix those rows, and run the script again for just those bundles.
Things to know before you run it
- One request at a time. Send writes sequentially. Parallel writes can race with each other, and 87 sequential requests are quick enough that there is nothing to gain.
- One fixed bundle per variant. If a parent variant already has a fixed bundle, the API returns
a
409. Update the existing bundle withPATCHor delete it first. - Bundles are active by default. Send
"active": falseif you want to review the batch before it goes live. - The parent's inventory is managed for you. Saving a fixed bundle turns off inventory tracking on the parent variant when every component is in stock, and sets the parent out of stock when a component is out, so the bundle can't be oversold.
- A bundle's parent can't be changed. To move a bundle to a different variant, delete it and create a new one.
- Errors say what went wrong. A
422means a product or variant doesn't exist, or the variant doesn't belong to the product. The message names the problem, and an assistant can usually fix the row and retry on its own.
Why this matters for agencies
Bundle setup has usually been billed and scheduled as manual work: someone clicks through an editor once per bundle. When the bundles live behind a documented API, a catalog of 87 becomes a list and a script, and the same script handles the next 87 when the client's range changes.
It also changes what you can say yes to. A client who needs a seasonal range bundled by tomorrow, or a migration of every bundle from another setup, is a same-day job.
The Bundles Admin API reference has every endpoint and field. If you don't have Flex Bundles on the store yet, install it from the Shopify App Store and generate a key from Settings.
Frequently Asked Questions
Do I have to use Claude?
No. The work is done by the Bundles Admin API, which is a plain JSON API with a bearer token. Any AI assistant that can read the docs and write a script will do, and so will a script you write yourself. Claude is what the agency in this story used.
Can I bulk create flex (build-your-own) bundles the same way?
Yes. The API has the same create, update, and delete operations for flex bundles at /v1/flex-bundles. A flex bundle attaches to a product and carries more settings, such as its pricing mode and rules, so the list you prepare has a few more columns.
Are the bundles live as soon as they are created?
Yes, by default. A bundle created through the API is active unless you send "active": false. If you want to review a batch before it goes live, create the bundles inactive and switch them on afterwards with an update request or in the app.
Does the API create the products too?
No. A fixed bundle attaches to a parent variant that already exists in Shopify, and its components are existing variants too. The API returns an error if a product or variant doesn't exist. Create the products in Shopify first, then create the bundles.
Do bundles created through the API show up in the app?
Yes, immediately. Bundles created through the API and bundles built in the editor are the same records, so you can create 87 with a script and then open any one of them in the app to check or change it.