CRITICAL — before anything else, use Read on ../shoplazza-common/SKILL.md.
It owns every cross-cutting mechanic: the three access tiers, the output envelope (.data),
--dry-run, --jq (incl. "don't pass -r"), --fields, schema, api rest, auth /
profiles, and the safety protocol. This file covers only the shop domain and never repeats them.
Overview
The shop module is the store-level config & content domain: shop info/settings,
sales & traffic analytics, the media library (files), metafields (all three families),
blogs & articles, custom pages, navigation menus, URL redirects, markets, store languages,
and real-time shipping-rate carrier services. Broad and shallow — this file is the router; per-sub-area
depth lives in references/.
The only shortcut is +upload-file — everything else is a spec leaf
(--params / --data). All three access tiers apply (tier rule in shoplazza-common).
Command map
Intent → command, highest-fit tier first. Authoritative flags/params live in
shoplazza shop <cmd> --help and shoplazza schema shop.<cmd>, not this table.
| User intent | Command |
|---|---|
| Store info — check shop info / domain / currency / plan | shop info get (optional --params '{"fields":["id","domain"]}') |
| change customer-service email / change customer-service email (the ONLY editable field) | shop info get --jq '.data.id' → shop info update --params '{"shop_id":"<id>"}' --data '{"shop":{"customer_email":"…"}}' |
| Analytics — sales/order count report for a date range | shop analytics overview --data '{"begin_time":"<unix-str>","end_time":"<unix-str>","indicator":["sales","orders"]}' → references/analytics.md |
| SKU sales ranking / best-selling SKU | shop analytics by-sku --data '{…,"sort_by":"sales_total","sort_direction":"desc"}' |
| SPU / landing-page / UTM breakdown | shop analytics by-spu (extra required type) / by-land-page (required dimensions) / by-utm |
| search term analysis / terms with no results / on-site search keywords | shop analytics search-keyword --data '{…,"sort_by":"count","sort_direction":"desc"}' (has_result is a string "0"/"1") |
| traffic channels / traffic sources / traffic by channel | shop analytics traffic-channel (required dimensions + metrics); valid channel names: shop analytics traffic-channel-options |
| Media library — upload a file to the media library (public URL only) | shop +upload-file --source-url <url> [--source-url <url> …] [--folder <name>] |
| Check an upload task / upload progress | shop files task --params '{"task_id":"<id>"}' (the shortcut already fetches it once) |
| Browse the media library / view the media library | shop files list (folder defaults to all_upload; page_size ≤ 300) |
| File detail / delete a file | shop files {get,delete} --params '{"file_uri":"<uri>"}' |
| Metafields — store-level metafield | shop metafields-shop create --data '{"namespace":"…","key":"…","type":"string","value":"…"}' → references/metafields.md |
| Metafield ON a product/order/customer… (add a field to a product) | shop metafields-resource create --params '{"owner_resource":"product","owner_id":"<id>"}' --data '{"definition_id":"…","namespace":"…","key":"…","type":"…","value":…}' |
| Define a metafield schema (metafield definition) | shop metafields-definition create --params '{"owner_resource":"…"}' --data '{"name":"…","namespace":"…","key":"…","type":"…"}' |
| Blog content — publish a blog post / new blog post | shop articles create --data '{"article":{"title":"…","content":"…","blog_ids":["…"]}}' → references/blogs-articles.md |
| Manage blogs (containers of articles) | shop blogs list / shop blogs create --data '{"blog":{"Title":"…"}}' (title key is capital Title) |
| Custom pages — custom page / About Us / About Us | shop pages create --data '{"page":{"title":"…","content":"…"}}' → references/pages-redirects.md |
| Navigation menus — view navigation menus / list menus & items | shop menu list (built-ins have ids header / footer; one menu: --params '{"ids":["header"]}') |
| create a new menu / create a custom menu | shop menu create --data '{"title":"…","children":[…]}' (custom menus only) |
| rename a menu / edit menu items / edit a menu | shop menu update --params '{"id":"<menu-id>"}' --data '{"title":"…"}' — sending children replaces the whole item tree (see Gotchas) |
| delete a menu / delete a custom menu | shop menu delete --params '{"id":"<menu-id>"}' (built-in header / footer can't be deleted) |
| URL redirect — 301 / redirect | shop redirects create --data '{"redirect":{"from_url":"…","redirect_url":"…","status":"…"}}' (status required — see Gotchas) |
| Markets — create a market / publish to a country | shop markets create --data '{"name":"…","countries":["JP"]}' → references/markets.md |
| Languages — enable a language / multilingual | shop languages supported → add → enable → publish → references/languages.md |
| Carrier services — register a real-time shipping rate carrier | shop carrier-services create --data '{"carrier_service":{"name":"…","callback_url":"…","carrier_code":"…"}}' → references/carrier-services.md |
Write discipline
Config domain — no full ask-matrix, but these writes have required no-default fields.
Missing or ambiguous → ask with AskUserQuestion (one batch), never fabricate. Never ask
about defaulted/optional fields.
| Operation | Must ASK if missing | Default silently / never ask |
|---|---|---|
+upload-file |
a public URL (local file → degrade: explain the API only fetches public URLs, ask for a link or a host) | --folder (default all_upload) |
pages create |
title |
url, meta_*, independent_seo — omit; never fabricate SEO fields |
redirects create |
from_url, redirect_url; status value if the wording doesn't settle it (enum not in schema — see Gotchas) |
— |
metafields-shop create |
namespace, key, type, value |
description, definition_id (optional here) |
metafields-resource create |
owner_resource+owner_id, definition_id, namespace, key, value |
description; type — resolve from the definition (metafields-definition get) before asking |
markets create |
name, countries |
confirm — never silently pass true (it deletes occupied markets) |
carrier-services create |
name, callback_url (the user's own endpoint — never invent), carrier_code |
active, logo, short_desc |
languages add |
the language(s); resolve IETF codes via languages supported |
— |
info update |
the new customer_email |
shop_id — resolve it yourself via info get, don't ask |
menu create |
title; each item's title + link target (resolve ids yourself) |
category (always custom 3), target, disabled |
menu update |
which menu (resolve the id via menu list), the change |
title / category — omit to keep them |
Destructive leaves (pages batch-delete, markets delete — irreversible, files delete,
redirects delete, metafields-* delete, menu delete, menu update with children) →
--dry-run first + restate, per shoplazza-common → Safety protocol.
Boundaries
Reads like another domain (or another domain reads like shop):
| Sounds like | Actually belongs to | Command |
|---|---|---|
| add a metafield to a product/order / metafield on a product | HERE — all metafields live in shop, even product-owned ones | shop metafields-resource create --params '{"owner_resource":"product",…}' |
| product image / main image / image attached to a product | shoplazza-products |
products images create |
| upload a file / media library / media library asset | HERE | shop +upload-file / shop files … |
| sales/traffic/conversion report / sales & traffic analytics | HERE | shop analytics … |
| order count statistics / search orders / order count & search | orders domain | orders +count / orders +search |
| real-time shipping rate carrier / rate-quoting carrier at checkout | HERE | shop carrier-services … |
| carrier lookup / tracking / fulfillment tracking carriers, shipping zones | orders domain | orders tracking-carriers / orders shipping-schemas |
| custom page / About Us / brand-story page | HERE (content, not theming) | shop pages create |
| navigation menu / menu items / add a link to the main menu | HERE (menu content) | shop menu list → shop menu update |
| which menu shows in the header / bind a menu to the header card | shoplazza-themes |
themes +edit (the card's link_list setting) |
| edit template / design / theme & template editing, layout of a custom page | shoplazza-themes |
themes +page / themes +edit / themes template … |
| blog/articles blog & articles | HERE (not product reviews) | shop blogs / shop articles |
| customer reviews / product reviews | shoplazza-products |
products comments … |
| discount code / discount / discount codes | shoplazza-discounts |
discounts +* |
Permissions · Scope
Authorization is by domain (the unit of --domain), not per command. Authorization flow
is in shoplazza-common → Authentication.
| Operation | Needs | Grant |
|---|---|---|
read (info get, analytics *, files list/get/task, * list/get/count) |
shop read scope |
auth login --domain shop |
write (+upload-file, * create/update/delete, languages enable/publish, …) |
shop write scope |
auth login --domain shop |
Look up exact scope literals with shoplazza auth scopes; --domain shop expands into them.
Gotchas
Domain-specific pitfalls only (generic ones — .data prefix, --jq without -r — are in
shoplazza-common).
| Symptom | Cause | Fix |
|---|---|---|
| Analytics call rejected / empty | Every analytics report is POST (only traffic-channel-options is a GET): filters go in --data, not --params; begin_time/end_time are unix-second timestamps passed as STRINGS ("1782864000") |
Compute the timestamps, quote them as strings, send via --data |
traffic-channel 400 cannot unmarshal object … filters of type string |
Its filters is a JSON object encoded as a string; search-keyword's has_result is also a string |
"filters":"{\"last_referrer_first_show\":{\"operator\":\"in\",\"value\":[\"Social\"]}}"; "has_result":"0" — see references/analytics.md |
Menu items lost after menu update |
children replaces the whole item tree: items left out are deleted, [] clears the menu |
Read the menu first, edit the full tree, send all of it back (keep each existing item's id); omit children to change only the title |
| Nested menu items came back flat / nesting lost | menu list returns items flat — a sub-item points at its parent via pid; writes take nesting only as nested children (no pid field) |
Rebuild the tree from pid before sending children |
Unsure what to put in a menu item's url_obj |
The link type values are not enumerated in the schema |
Copy url_obj from an existing item of the same kind in menu list (type + source_id + url); never invent a type or source_id |
| Tried to update shop name/address | info update exposes one editable field: shop.customer_email |
Anything else is not updatable via this endpoint; say so |
info update needs a shop_id the user can't know |
shop_id is a required path param |
Resolve first: shop info get --jq '.data.id' |
| Asked to upload a local file | +upload-file takes public URLs, NOT local files (verbatim in its help); the API fetches the URL |
Degrade: no write; ask for a public link or suggest hosting it first |
| Upload "done" but file missing | Upload is an async task — POST returns a task_id; the shortcut auto-fetches the task once |
Re-check with shop files task --params '{"task_id":"…"}' until status/success_list settle |
blogs create title ignored / rejected |
Blog title key is capital Title (required, 1–100), not lowercase title |
shop blogs create --data '{"blog":{"Title":"…"}}' — confirm fields via schema shop.blogs.create |
What values can redirects status take? |
status is required but the schema documents no enum — do not invent one |
Check schema shop.redirects.create, inspect existing rules (shop redirects list --jq '.data.redirects[].status') or the OpenAPI docs; ask the user if still ambiguous |
metafields-resource create rejected, metafields-shop create fine |
Asymmetry: resource-level requires definition_id; shop-level doesn't (optional). Type enums differ too (shop: JSON/string; resource: single_line_text_field, integer, …) |
See references/metafields.md |
| Language published but market relations vanished | languages publish is a full replacement — market_ids: [] removes ALL relations |
Always send the complete target list |
| Added a language, storefront unchanged | Newly added languages are disabled by default; unsupported codes are silently dropped | languages enable after add; verify codes via languages supported |
markets create/update with confirm: true deleted other markets |
A country may belong to only ONE market; confirm: true auto-deletes the occupied markets |
Preview with markets preview, --dry-run, restate what gets deleted, get explicit consent |
metafields-definition get 404s with id in path |
Its id is a query param, not a path segment |
shop metafields-definition get --params '{"id":123456}' |
Recipes
# 1. Store's primary domain and currency
shop info get --jq '{domain: .data.domain, currency: .data.currency}'
# 2. Change the customer-service email (only editable field; two steps)
SHOP_ID=$(shop info get --jq '.data.id')
shop info update --params "{\"shop_id\":\"$SHOP_ID\"}" --data '{"shop":{"customer_email":"support@brand.com"}}'
# 3. Sales + order count, 2026-07-01 .. 2026-07-15 (unix seconds as STRINGS)
shop analytics overview --data '{"begin_time":"1782864000","end_time":"1784159999","indicator":["sales","orders"]}'
# 4. Best-selling SKU over a window (sort desc by sales metric)
shop analytics by-sku --data '{"begin_time":"1782864000","end_time":"1784159999","sort_by":"sales_total","sort_direction":"desc","page_size":10}'
# 5. Upload a public image to the media library (async task; folder defaults to all_upload)
shop +upload-file --source-url https://example.com/banner.png
# 6. Create an "About Us" custom page
shop pages create --data '{"page":{"title":"关于我们","content":"我们是一家来自杭州的 DTC 品牌"}}'
# 7. Permanent URL redirect (status REQUIRED — pin the value via schema/existing rules first)
shop redirects list --jq '.data.redirects[].status' # see what values live rules use
shop redirects create --data '{"redirect":{"from_url":"/old-sale","redirect_url":"/new-sale","status":"<verified-value>"}}'
# 8. Shop-level metafield (no definition_id needed at shop level)
shop metafields-shop create --data '{"namespace":"global","key":"support_phone","type":"string","value":"400-800-1234"}'
# 9. Product-level metafield (owner in --params, definition_id REQUIRED in --data)
shop metafields-resource create --params '{"owner_resource":"product","owner_id":"66880"}' \
--data '{"definition_id":"D8899","namespace":"specs","key":"material","type":"single_line_text_field","value":"cotton"}'
# 10. Launch Japanese and publish it to the Japan market
shop languages supported --jq '.data.languages' # find the exact IETF code
shop languages add --data '{"codes":["ja-JP"]}'
shop languages enable --params '{"language_code":"ja-JP"}'
MARKET_ID=$(shop markets list --jq '.data.markets[] | select(.name=="Japan") | .id')
shop languages publish --params '{"language_code":"ja-JP"}' --data "{\"market_ids\":[\"$MARKET_ID\"]}"
# 11. Rename a custom menu without touching its items (no children = items kept)
shop menu list --jq '[.data.menus[] | {id, title, category}]' # category 3 = custom
shop menu update --params '{"id":"<menu-id>"}' --data '{"title":"Footer links"}'
References
- references/analytics.md — 7 POST reports + the channel-options lookup, indicators/dimensions, sort enums, timestamp rules
- references/metafields.md — definitions vs resource vs shop metafields, owner_resource enum, type enums
- references/blogs-articles.md — blogs (containers) vs articles (posts); blog title key is capital
Title - references/pages-redirects.md — custom pages CRUD/batch, redirects & the undocumented status enum
- references/markets.md — market lifecycle, country occupation/confirm, price/tax/domain/language
- references/languages.md — add → enable → publish flow, full-replacement semantics
- references/carrier-services.md — rate-quoting carrier registration
- Per-command flags:
shoplazza shop <cmd> --help - Spec-leaf params / body / response:
shoplazza schema shop.<cmd>(nested:schema shop.metafields-resource.create) - Cross-cutting mechanics (auth / tiers / envelope /
--dry-run/--jq/ safety):../shoplazza-common/SKILL.md