Loading...
Loading...
Use when calling the Spree 6 Admin API from the command line or driving it programmatically as an agent — exploring endpoints, reading or mutating store data, and especially DEBUGGING (inspecting an order/product/customer, checking why a request failed, reproducing a 403/422). The `spree api` command group in `@spree/cli` is a `gh api`-style generic HTTP client: `spree api get|post|patch|delete <path>` plus offline discovery (`spree api endpoints`, `spree api schema`). Common phrasings include "spree api", "spree CLI", "call the admin API from the terminal", "spree api get", "inspect this order", "why is this Spree request failing", "list admin endpoints", "spree auth". Also covers the project-side dev commands agents reach for while debugging (`spree shell`, `spree test`, `spree console`, `spree add`, `spree plugin new`). For SDK/TypeScript integration use spree-typescript-sdk; for raw API protocol details use spree-api-v3.
npx skill4agent add spree/agent-skills spree-cli@spree/clispree apigh apispree api/api/v3/admincurlor_xjq@spree/admin-sdkspree-typescript-sdk@spree/clispreespree --version # or: pnpm exec spree --versionnpm i -g @spree/clipnpm exec spreenpx @spree/cli--api-key sk_xxx--profile prodSPREE_API_KEYhttp://localhost:3000SPREE_BASE_URLSPREE_API_KEYSPREE_API_KEY=sk_xxx spree api get /products # → localhost:3000
SPREE_BASE_URL=https://store.example.com SPREE_API_KEY=sk_xxx spree api get /ordersdocker-compose.ymlserver/backend/spree api.spree/credentials.jsonspree auth loginspree auth login --profile prod --base-url https://store.example.com
spree api get /orders --profile prod # or omit --profile once it's the defaultspree api statusread_allspree api-key create --type secret --scopes read_orders,write_productsread_<resource>write_<resource>write_*read_*read_allwrite_allspree api endpoints# Read — Ransack filters as repeatable -q, plus sort/page/limit/expand/fields
spree api get /products -q status_eq=active -q name_cont=shirt --sort -created_at --limit 10
spree api get /orders/or_x8k2J9aQ --expand items,payments,fulfillments
spree api get /products --fields name,slug,status # id is always returned
# Write — JSON body inline, from @file, or '-' for stdin
spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}'
spree api patch /orders/or_x8k2J9aQ/cancel
spree api post /orders/or_x8k2J9aQ/refunds -d @refund.json
cat prices.json | spree api post /prices/bulk_upsert -d -
spree api delete /products/prod_86Rf07xd/api/v3/adminjq--format tableIdempotency-Keyspree api endpoints --resource orders # every orders endpoint + required scope
spree api endpoints --search "gift card" # fuzzy search across method/path/summary
spree api schema "POST /orders" # full request/response schema for one opendpointsschemaeval "$(spree completion zsh)" # bash and fish also supportedstatus_eq=name_cont=# 1. Reproduce the read and see the actual state
spree api get /orders/or_x8k2J9aQ --expand payments,fulfillments | jq '.status, .payment_status, .fulfillment_status'
# 2. If a write failed, find the endpoint's contract
spree api schema "PATCH /orders/{id}/cancel"
# 3. Re-run the write and read the error envelope verbatim
spree api patch /orders/or_x8k2J9aQ/cancel01{error: {code, message, details}}2403code: access_denieddetails.required_scope--api-keySPREE_API_KEYaccess_denied: API key lacks scope: write_products
{ "details": { "required_scope": "write_products" } }
Hint: this key lacks `write_products`. Create one that has it and use it:
spree api-key create --type secret --scopes write_products
then pass it via --api-key <sk_...> or export SPREE_API_KEY=<sk_...>422code: validation_errordetailsspree api schemaspree api statusspree apibin/rails consolebundle exec rspecspree console # Rails console: Spree::Cart.find_by_prefix_id!('cart_…')
spree shell # interactive bash in the web container (alias: spree bash)
spree test spec/models/spree/brand_spec.rb:15 # RSpec with RAILS_ENV=test; args pass straight through
spree logs # web logs (spree logs worker for jobs)
spree db:console # psql against the dev database
spree add dashboard # scaffold apps/dashboard (or: spree add seller-dashboard)
spree plugin new brands # scaffold a dashboard plugin repo (the Rails engine half is a separate spree_extension gem)
spree encryption init [--print] # add Active Record encryption keys to .env (never overwrites; --print only prints a set)
spree add mcp # add the Admin MCP server gem (spree_mcp) — see spree-mcp
spree add paypal # add spree_paypal_checkout at the project's Spree version (6.0.3+)
spree task openapi:generate # write server/openapi/admin.yaml from the app's rswag specs — see spree-resource
spree filters types # TypeScript typings for your app's custom list filters, into each app under apps/spree sdk generate"spree": { "extension": "../my_extension" }package.jsonrake spree:openapi:generate spree:sdk:serializer_typessrc/generated/<api>/client.tsparams/filters.tstypes/spree.tsspree sdk generate # regenerate after an endpoint or serializer change
spree sdk generate --no-backend # from the committed openapi/*.yaml only
spree sdk generate --check # CI: fail when generated files are stalespree-typescript-sdkspree shellspree testcompose runspree api/orders/order_groupsspree consolecurlpk_spree apispree api/api/v3/admin/mcpsk_spree-mcpendpointsschemaspree api statusendpoints--api-keySPREE_API_KEYspree api-key revoke <id>--store-id <store_…>X-Spree-Store-Idspree dev