Admin API and Bulk Operations in Shopify CLI

In Shopify CLI 3.90.1, we released two new Shopify CLI commands that improve your experience exploring and automating the GraphQL Admin API: shopify app execute, for running queries and mutations, and shopify app bulk execute, for running bulk queries and bulk mutations. These come on the heels of the release of improved performance and expanded mutation support for bulk operations, which make it possible to handle larger data sets for a wider variety of data types. With this Shopify CLI release, it’s now easy for app developers to script and automate both bulk operations and standard GraphQL operations with the Admin API, right in your terminal.

I’ve been exploring some use cases for these commands in a sample application that I’m sharing with the community. It’s no surprise that pairing these commands with agentic tools like Claude Code and the Shopify Dev MCP server is extremely powerful. You can quickly create scripts that interact with store data in a variety of ways. Command line utilities like jq can be used directly against the output of these commands to extract, manipulate, and combine data for customized output, or for piping into another command.

Let’s take a look at the examples found within.

Hello, world!

Start simple. Sometimes you just want to get a piece of data, like the ID of the current shop.

shopify app execute --query '{ shop { id } }'

Coding agents with access to the Shopify Dev MCP server can craft accurate GraphQL queries for use with shopify app execute as well. Try prompts like:

  • Query the current app ID
  • How many products do I have in the current store?
  • What’s the current active theme on this store?

Example:

Setting up test discounts for function development

When developing Shopify Functions, there is usually a required step to activate and configure the function before it will trigger on your store. If you’ve yet to create an admin UI for your function, you might use GraphiQL to activate it with the Admin API. By scripting this instead, you can automate the setup and teardown of various function configurations, so that you can quickly verify them on your store.

Examples:

Even if you don’t need a persistent script for this, shopify app execute can be used by your coding agent to activate your function. Try prompts like:

  • Use Shopify CLI to create a discount for the vip-discount.
  • Use Shopify CLI to create a validation for New York and Massachusetts.

Opening a cart in checkout

Looking to test that function with a large cart, or a specific type of product? You can script the creation of a cart permalink with dynamic data from your store, and open it in your browser.

Example:

Exporting data to CSV

You know it, you love it: the CSV data dump. Sometimes they are still the only way to get data into legacy systems, and are definitely still useful for exploring data in spreadsheets. Bulk operations queries make it possible to export massive amounts of data without worrying about pagination or rate limits. By scripting them with shopify app bulk execute, you can pipe that data into tools like jq in order to obtain your desired format, like the flattened product/variant data in the example below.

Example:

Setting up a new development store

What if you could automate the setup of your entire store? Whether you are bringing a new teammate online, starting development of a new feature, or creating a testing environment – the ability to set up a clean, consistent store is invaluable. The new app dev command only reinforces this, since it encourages teams to use dev stores as the unit of isolation for team development.

There’s a lot that goes into store setup: creating and publishing products, setting inventory, uploading images, and more. However by combining bulk operations mutations with other GraphQL queries, you can go a long way in automating this for your team.

Examples:

Usage limitations

Keep in mind the following constraints on these commands:

  • They authenticate as your app using client credentials, so they only have access to stores in your organization, and only to the access scopes that have been granted to your app.
  • To prevent accidental damage to production data, especially when working with coding agents, Shopify CLI will only execute mutations against dev stores. You can still query non-dev stores in your organization, or write your own code with mutations against any authenticated store.

What else is possible?

We can’t wait to hear about how you plan to use these commands to automate your store environments and other routine development tasks. Please share your use cases in the comments, along with any other feedback you have on these new commands!

9 Likes

Oh very cool!

I’ve been using my own CLI commands for this for some time. Nice to see this built into the main CLI.

2 Likes

This is awesome, Nick! I’ve been building on top of this and created a quick plugin for Claude Code to make it easier to use.

I wrapped the commands (plus a few workflow automations) into a Claude Code plugin called storefront-cli-plugin.

A few examples of what it looks like in practice:

/shopify-cli-admin:shopify-query list all products with prices
Running query against Admin API…
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Title β”‚ Price β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Classic Tee β”‚ $29.00 β”‚
β”‚ Everyday Hoodie β”‚ $65.00 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

/shopify-cli-admin:shopify-bulk-export products to CSV
βœ“ Exported 1,247 products β†’ products_export.csv

/shopify-cli-admin:shopify-dev-store-init
βœ“ Created 50 products with images and inventory

It ships five slash commands that map directly to the use cases in your post:

  • shopify-query β€” ad-hoc GraphQL against the Admin API (wraps shopify app execute)
  • shopify-bulk-export β€” large dataset export to CSV (wraps shopify app bulk execute)
  • shopify-dev-store-init β€” automated dev store setup with products, inventory, and images
  • shopify-function-test β€” activate and test Shopify Functions without a UI
  • shopify-cart-test β€” create test carts with specific products

All the same safety rails apply, mutations are dev-store-only, destructive ops require confirmation, and auth goes through the CLI (no hardcoded tokens).

Install in Claude Code:
/plugin marketplace add alecramos-sudo/storefront-cli-plugin
/plugin install shopify-cli-admin@alecramos-sudo-storefront-cli-plugin

Would love feedback from anyone who tries it.

The plugin is MIT licensed and the source is all on GitHub.

2 Likes

@NickWesselman - do the performance improvements on bulk ops mean faster imports? When importing large catalogs ( > 1m SKUs), we’ve found that we got much better throughput by just hitting productCreate and the bulkadjust… endpoints than with the bulk ops.

Hi @Chris_Marshall! It depends on the number of products. Bulk ops do have some overhead. Something like 10-15k products with 5 concurrent bulk ops (the new limit) should be faster than running it yourself synchronously.

Bulk ops also give you the benefit of start-and-forget, without the need to manage your own infra or manage rate limits.

@Chris_Marshall bulk ops - utilizing five concurrent operations - should be faster imports when compared against base rate limits for plus plans. Please let us know if your benchmarks show anything contrary to that.

Useful addition to the CLI :clap:

One thing I noticed is that there seems to be a limitation where the store has to belong to the same org as the app. It would be great if custom apps that have distribution set to a specific org could execute queries on stores that belong to that org.