How to let Claude Code manage your Shopify store safely
You want your AI assistant to check orders, update prices, or sync inventory. The usual way is to paste your Shopify Admin API token into a chat window — and that's the problem. That token has write access to your whole store, and once it's in a chat log, you can't take it back.
Here's the safer way, in three steps.
What you need
- A Shopify store with TokenPort installed (listing)
- Claude Code (or any AI assistant that can run shell commands)
- Python 3
- The TokenPort Skill: download
tokenport-skill.zipfrom https://tokenport.breeze.computer/tokenport-skill.zip and extract it into your assistant's skill directory
Step 1: Setup — connect your store
In your terminal, run the skill's setup command, replacing <skill-dir> with the absolute path where you extracted the skill:
python3 <skill-dir>/scripts/shopify_api.py setup It asks for two things:
- Your store's original
xxx.myshopify.comdomain - Your TokenPort API Key — the shop-bound key (it starts with
tp_) you copy from TokenPort inside Shopify Admin. If your store doesn't have one yet, select Create API key in the app.
You can also add a Storefront API token here (public or private) if you want your assistant to build buyer-facing features. For this tutorial, the Admin key is enough.
Setup saves a config file at ~/.config/tokenport/<shop-domain>.json with strict permissions (700 on the directory, 600 on the file). Each store gets its own file, and your credentials are never printed to chat. Keep the config path handy — you'll pass it to every command.
Step 2: Check — verify before you trust it
Saving a config file doesn't prove anything. Run the check:
python3 <skill-dir>/scripts/shopify_api.py check --config ~/.config/tokenport/<shop-domain>.json Check runs a minimal read-only query against each configured API and reports success only for the APIs that passed and returned your store. If it fails, don't guess — the error tells you what to fix:
-
402 subscription_required— the store needs an active trial or paid plan. Open TokenPort in Shopify Admin and choose a plan. -
503 billing_unavailable— Shopify couldn't be reached to verify billing. Wait and retry; it's temporary. - A 403 can mean a missing scope or an IP allowlist problem. Ask the store owner to check the connection in TokenPort.
Step 3: Your first Admin query
Write one GraphQL operation in a file, for example products.graphql:
query { products(first: 5) { edges { node { id title } } } } Then run it through the skill:
python3 <skill-dir>/scripts/shopify_api.py admin products.graphql --config ~/.config/tokenport/<shop-domain>.json That's it. Your assistant just read your store through TokenPort — and the raw Shopify token never left the server. The TokenPort key it used is revocable in one click: if it ever leaks, revoke it in Shopify Admin and the old key dies everywhere at once.
What happens behind the scenes
- TokenPort's Cloudflare Worker sends your Admin GraphQL request to Shopify and keeps the Shopify credentials encrypted (AES-256-GCM) and auto-renewed on the server. Your tools only ever hold the
tp_key. - Each store has exactly one active TokenPort API Key. Rotating or revoking it disables the previous key across all connected tools.
- If Shopify rejects the stored token, a read-only check lets TokenPort try renewing it. If the owner needs to reconnect, the existing TokenPort key keeps working after reconnection.
A few rules that will save you later
- One operation per file, JSON variables for anything dynamic. The script handles transport, not authorization — check the scopes each operation needs.
- Query before you edit. Read the product, variant, or inventory record first; use real IDs and SKUs.
- Verify after every write. Check HTTP status, top-level GraphQL
errors, and mutationuserErrors. HTTP 200 alone isn't enough. - Never put credentials in chat, code, or logs. Not the TokenPort key, not the Storefront token. The setup command hides credential input for a reason.
Try it
TokenPort is free to start, and Pro is $1/month with a 30-day trial.