CLI tool for the Shopify Admin GraphQL API. Provides structured commands for common operations (orders, products, customers, inventory) plus a raw GraphQL escape hatch and an interactive REPL.
pip install git+https://github.com/hatlabs/shopify-gql-cli.gitSet two environment variables:
export SHOPIFY_STORE_URL="your-store.myshopify.com"
export SHOPIFY_ACCESS_TOKEN="shpat_..."Or pass them as CLI flags: --store and --token.
Add --json before any subcommand to get machine-readable JSON output:
shopify-gql-cli --json shop infoshopify-gql-cli shop info
shopify-gql-cli shop locationsshopify-gql-cli orders list --first 20
shopify-gql-cli orders list --query "financial_status:paid"
shopify-gql-cli orders get 12345
shopify-gql-cli orders cancel 12345 --reason CUSTOMER
shopify-gql-cli orders close 12345Orders default to status:any (all orders). Pass an explicit status: filter to restrict (e.g. status:open).
shopify-gql-cli products list --query "title:Widget*"
shopify-gql-cli products get 12345
shopify-gql-cli products create "New Product" --type "Hardware" --status DRAFT
shopify-gql-cli products update 12345 --title "Updated Title"
shopify-gql-cli products delete 12345shopify-gql-cli customers list --first 20
shopify-gql-cli customers get 12345shopify-gql-cli inventory levels --query "sku:WIDGET-001"
shopify-gql-cli inventory levels --item-id 123
shopify-gql-cli inventory adjust --item-id 123 --location-id 456 --delta 5
shopify-gql-cli inventory set --item-id 123 --location-id 456 --quantity 10shopify-gql-cli graphql execute '{ shop { name currencyCode } }'
shopify-gql-cli graphql execute \
'query($id: ID!) { product(id: $id) { title } }' \
-v '{"id": "gid://shopify/Product/12345"}'Run without a subcommand to enter the REPL:
shopify-gql-cliThe REPL supports command history, auto-suggest, and all the same commands as the CLI.
python -m shopify_gql_cli --json shop infoAll commands accept both plain numeric IDs (12345) and full Shopify GIDs (gid://shopify/Product/12345).
List commands support --first N (1–250) and --after CURSOR for pagination. When more results are available, the cursor is shown in the output.
The client automatically retries once on HTTP 429 responses, respecting the Retry-After header.
This project was initially generated by CLI-Anything (MIT), a tool that auto-generates structured CLI harnesses from software APIs. The generated scaffolding, REPL interface, and test suite provided the foundation for this tool.